ソースを参照

Merge branch 'server-165' of http://47.111.81.118:3000/uskycloud/usky-modules into server-165

fuyuchuan 1 ヶ月 前
コミット
4ccb3bba33
31 ファイル変更1062 行追加370 行削除
  1. 11 0
      service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java
  2. 15 0
      service-eg/service-eg-biz/src/main/java/com/usky/eg/domain/EgDevice.java
  3. 2 0
      service-eg/service-eg-biz/src/main/java/com/usky/eg/service/EgDeviceService.java
  4. 26 4
      service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgDeviceServiceImpl.java
  5. 3 0
      service-eg/service-eg-biz/src/main/resources/mapper/eg/EgDeviceMapper.xml
  6. 43 32
      service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpDeviceInfoController.java
  7. 1 1
      service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/PmWorkContentController.java
  8. 21 2
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/DmpDeviceInfoService.java
  9. 34 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/enums/TopicInfo.java
  10. 2 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseBuildFacilityServiceImpl.java
  11. 436 239
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpDeviceInfoServiceImpl.java
  12. 8 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpProductInfoServiceImpl.java
  13. 0 2
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkContentServiceImpl.java
  14. 17 9
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java
  15. 23 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpHttpAlarmResponseVO.java
  16. 79 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpTopicRequestVO.java
  17. 49 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpTopicResponseVO.java
  18. 10 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/FacilityDeviceResultVO.java
  19. 8 0
      service-oa/service-oa-biz/pom.xml
  20. 5 0
      service-oa/service-oa-biz/src/main/java/com/usky/oa/controller/web/OaApprovalController.java
  21. 9 1
      service-oa/service-oa-biz/src/main/java/com/usky/oa/controller/web/OaDocumentController.java
  22. 5 0
      service-oa/service-oa-biz/src/main/java/com/usky/oa/domain/OaApproval.java
  23. 15 0
      service-oa/service-oa-biz/src/main/java/com/usky/oa/mapper/SysUserMapper.java
  24. 2 0
      service-oa/service-oa-biz/src/main/java/com/usky/oa/service/OaApprovalService.java
  25. 63 22
      service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaApprovalServiceImpl.java
  26. 16 15
      service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaDocumentServiceImpl.java
  27. 39 12
      service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaJbdDocumentServiceImpl.java
  28. 20 6
      service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaQjdDocumentServiceImpl.java
  29. 53 0
      service-oa/service-oa-biz/src/main/java/com/usky/oa/service/utils/OaProcessAnalysis.java
  30. 46 25
      service-oa/service-oa-biz/src/main/java/com/usky/oa/service/utils/OaSendMessageCenter.java
  31. 1 0
      service-oa/service-oa-biz/src/main/resources/mapper/oa/OaApprovalMapper.xml

+ 11 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java

@@ -59,6 +59,17 @@ public class EgDeviceController {
         return ApiResult.success();
     }
 
+    /**
+     * 附加功能更新
+     * @param egDevice
+     * @return
+     */
+    @PutMapping("attachUpdate")
+    public ApiResult<Void> attachUpdate(@RequestBody EgDevice egDevice){
+        egDeviceService.attachUpdate(egDevice);
+        return ApiResult.success();
+    }
+
     /**
      * 删除
      * @param id

+ 15 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/domain/EgDevice.java

@@ -108,6 +108,21 @@ public class EgDevice implements Serializable {
      */
     private Integer tenantId;
 
+    /**
+     * 屏保
+     */
+    private String imgPath;
+
+    /**
+     * 标识语
+     */
+    private String remark;
+
+    /**
+     * 开门方式
+     */
+    private String openMode;
+
     /**
      * 用户人脸信息记录
      */

+ 2 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/EgDeviceService.java

@@ -25,6 +25,8 @@ public interface EgDeviceService extends CrudService<EgDevice> {
 
     void update(EgDevice egDevice);
 
+    void attachUpdate(EgDevice egDevice);
+
     void remove(Integer id);
 
     boolean checkNameUnique(EgDevice egDevice);

+ 26 - 4
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgDeviceServiceImpl.java

@@ -72,15 +72,25 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
                 .orderByDesc(EgDevice::getId);
         page = this.page(page,queryWrapper);
         if(page.getRecords().size() > 0){
+
+            LambdaQueryWrapper<MeetingFace> meetingFaceQuery = Wrappers.lambdaQuery();
+            meetingFaceQuery.eq(MeetingFace::getTenantId,tenantId);
+            List<MeetingFace> meetingAllFaceList = meetingFaceMapper.selectList(meetingFaceQuery);
+
             for (int i = 0; i < page.getRecords().size(); i++) {
                 if(Objects.nonNull(page.getRecords().get(i).getBindFace()) ||StringUtils.isNotBlank(page.getRecords().get(i).getBindFace())){
                     String[] fidListStr = page.getRecords().get(i).getBindFace().split(",");
                     Integer[] fidList = Arrays.stream(fidListStr).map(Integer::parseInt).toArray(Integer[]::new);
 
-                    LambdaQueryWrapper<MeetingFace> meetingFaceQuery = Wrappers.lambdaQuery();
-                    meetingFaceQuery.in(MeetingFace::getFid,Arrays.asList(fidList));
-                    List<MeetingFace> meetingFaceList = meetingFaceMapper.selectList(meetingFaceQuery);
-
+                    List<MeetingFace> meetingFaceList = new ArrayList<>();
+                    for (int j = 0; j < fidList.length; j++) {
+                        for (int k = 0; k < meetingAllFaceList.size(); k++) {
+                            if(fidList[j] == meetingAllFaceList.get(k).getFid()){
+                                meetingFaceList.add(meetingAllFaceList.get(k));
+                                break;
+                            }
+                        }
+                    }
                     page.getRecords().get(i).setMeetingFaceList(meetingFaceList);
                 }
 
@@ -166,6 +176,18 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
         }
     }
 
+    @Override
+    public void attachUpdate(EgDevice egDevice){
+        if(checkNameUnique(egDevice)){
+            throw new BusinessException("更新门禁设备附加功能'"+egDevice.getDeviceId()+"'失败,设备已存在");
+        }
+
+        egDevice.setUpdateBy(SecurityUtils.getUsername());
+        egDevice.setUpdateTime(LocalDateTime.now());
+
+        this.updateById(egDevice);
+    }
+
     @Override
     public void remove(Integer id){
         EgDevice egDevice = this.getById(id);

+ 3 - 0
service-eg/service-eg-biz/src/main/resources/mapper/eg/EgDeviceMapper.xml

@@ -20,6 +20,9 @@
         <result column="update_time" property="updateTime" />
         <result column="dept_id" property="deptId" />
         <result column="tenant_id" property="tenantId" />
+        <result column="img_path" property="imgPath" />
+        <result column="remark" property="remark" />
+        <result column="open_mode" property="openMode" />
     </resultMap>
     <insert id="insertMeetingFaceDevice" parameterType="integer">
         insert into meeting_face_device (face_id,device_id) value (#{fid}, #{egDeviceId});

+ 43 - 32
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpDeviceInfoController.java

@@ -1,27 +1,19 @@
 package com.usky.iot.controller.web;
 
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.backend.domain.*;
 import com.usky.common.core.bean.ApiResult;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.core.utils.poi.ExcelUtil;
-import com.usky.iot.domain.BaseFacilityDevice;
 import com.usky.iot.domain.DmpDeviceInfo;
 import com.usky.iot.service.DmpDeviceInfoService;
-import com.usky.iot.service.vo.BaseFacilityDeviceVO;
-import com.usky.iot.service.vo.DmpDeviceInfoRequest;
+import com.usky.iot.service.vo.*;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
-import javax.validation.constraints.NotNull;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -44,7 +36,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping
-    public ApiResult<Void> add(@RequestBody DmpDeviceInfo dmpDeviceInfo){
+    public ApiResult<Void> add(@RequestBody DmpDeviceInfo dmpDeviceInfo) {
         dmpDeviceInfoService.add(dmpDeviceInfo);
         return ApiResult.success();
     }
@@ -55,7 +47,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PutMapping
-    public ApiResult<Void> edit(@RequestBody DmpDeviceInfo dmpDeviceInfo){
+    public ApiResult<Void> edit(@RequestBody DmpDeviceInfo dmpDeviceInfo) {
         dmpDeviceInfoService.update(dmpDeviceInfo);
         return ApiResult.success();
     }
@@ -67,8 +59,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/page")
-    public ApiResult<CommonPage<DmpDeviceInfo>> page(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest)
-    {
+    public ApiResult<CommonPage<DmpDeviceInfo>> page(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest) {
         return ApiResult.success(dmpDeviceInfoService.page(dmpDeviceInfoRequest));
     }
 
@@ -79,8 +70,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/pageWhite")
-    public ApiResult<CommonPage<DmpDeviceInfo>> pageWhite(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest)
-    {
+    public ApiResult<CommonPage<DmpDeviceInfo>> pageWhite(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest) {
         return ApiResult.success(dmpDeviceInfoService.pageWhite(dmpDeviceInfoRequest));
     }
 
@@ -88,8 +78,7 @@ public class DmpDeviceInfoController {
      * 删除记录
      */
     @DeleteMapping("/{id}")
-    public ApiResult<Void> remove(@PathVariable("id") Integer id)
-    {
+    public ApiResult<Void> remove(@PathVariable("id") Integer id) {
         dmpDeviceInfoService.remove(id);
         return ApiResult.success();
     }
@@ -100,7 +89,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/addByFile")
-    public ApiResult<Void> addByFile(@RequestParam(value = "file") MultipartFile multipartFiles){
+    public ApiResult<Void> addByFile(@RequestParam(value = "file") MultipartFile multipartFiles) {
         dmpDeviceInfoService.addByFile(multipartFiles);
         return ApiResult.success();
     }
@@ -112,7 +101,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/importDeviceInfo")
-    public ApiResult<Void> importDeviceInfo(@RequestBody List<DmpDeviceInfo> list){
+    public ApiResult<Void> importDeviceInfo(@RequestBody List<DmpDeviceInfo> list) {
         dmpDeviceInfoService.importDeviceInfo(list);
         return ApiResult.success();
     }
@@ -124,8 +113,8 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("/export")
-    public void export(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest, HttpServletResponse response){
-        dmpDeviceInfoService.export(dmpDeviceInfoRequest,response);
+    public void export(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest, HttpServletResponse response) {
+        dmpDeviceInfoService.export(dmpDeviceInfoRequest, response);
     }
 
     /**
@@ -139,12 +128,12 @@ public class DmpDeviceInfoController {
      * @return
      */
     @GetMapping("deviceCurrentDataList")
-    public ApiResult<CommonPage<Object>> deviceCurrentDataList(@RequestParam(value = "deviceName",required = false) String deviceName,
-                                                               @RequestParam(value = "installAddress",required = false) String installAddress,
-                                                               @RequestParam(value = "productCode",required = false) String productCode,
+    public ApiResult<CommonPage<Object>> deviceCurrentDataList(@RequestParam(value = "deviceName", required = false) String deviceName,
+                                                               @RequestParam(value = "installAddress", required = false) String installAddress,
+                                                               @RequestParam(value = "productCode", required = false) String productCode,
                                                                @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
-                                                               @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize){
-        return ApiResult.success(dmpDeviceInfoService.deviceCurrentDataList(deviceName,installAddress,productCode,pageNum,pageSize));
+                                                               @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
+        return ApiResult.success(dmpDeviceInfoService.deviceCurrentDataList(deviceName, installAddress, productCode, pageNum, pageSize));
     }
 
     /**
@@ -154,7 +143,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("dataTVList")
-    public ApiResult<CommonPage<DataTVResponseVO>> dataTVList(@RequestBody DataTVRequestVO requestVO){
+    public ApiResult<CommonPage<DataTVResponseVO>> dataTVList(@RequestBody DataTVRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.dataTVList(requestVO));
     }
 
@@ -165,7 +154,7 @@ public class DmpDeviceInfoController {
      * @return
      */
     @PostMapping("dataTVStatistic")
-    public ApiResult<List<DataTVStatisticResponseVO>> dataTVStatistic(@RequestBody DataTVRequestVO requestVO){
+    public ApiResult<List<DataTVStatisticResponseVO>> dataTVStatistic(@RequestBody DataTVRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.dataTVStatistic(requestVO));
     }
 
@@ -176,7 +165,7 @@ public class DmpDeviceInfoController {
      */
     @PostMapping("deviceDataTotal")
     @ApiOperation("获取设备某个时间端内的汇总值")
-    public ApiResult<List<Map<String,Object>>> deviceDataTotal(@RequestBody DataTotalRequestVO requestVO){
+    public ApiResult<List<Map<String, Object>>> deviceDataTotal(@RequestBody DataTotalRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.deviceDataTotal(requestVO));
     }
 
@@ -187,7 +176,7 @@ public class DmpDeviceInfoController {
      */
     @PostMapping("deviceDataAverage")
     @ApiOperation("获取设备日平均、月平均、年平均值")
-    public ApiResult<List<DataAverageResponseVO>> deviceDataAverage(@RequestBody DataAverageRequestVO requestVO){
+    public ApiResult<List<DataAverageResponseVO>> deviceDataAverage(@RequestBody DataAverageRequestVO requestVO) {
         return ApiResult.success(dmpDeviceInfoService.deviceDataAverage(requestVO));
     }
 
@@ -198,10 +187,32 @@ public class DmpDeviceInfoController {
      * @throws IOException
      */
     @PostMapping("deviceDataAverageExport")
-    public void export(@RequestBody DataAverageRequestVO requestVO, HttpServletResponse response) throws IOException{
+    public void export(@RequestBody DataAverageRequestVO requestVO, HttpServletResponse response) throws IOException {
         List<DataAverageExportVO> list = dmpDeviceInfoService.DataAverageExport(requestVO);
         ExcelUtil<DataAverageExportVO> util = new ExcelUtil<DataAverageExportVO>(DataAverageExportVO.class);
-        util.exportExcel(response,list,requestVO.getSheetName(),requestVO.getTitleName());
+        util.exportExcel(response, list, requestVO.getSheetName(), requestVO.getTitleName());
+    }
+
+    /**
+     * 获取设备topic列表
+     * @param requestVO
+     * @return
+     */
+    @PostMapping("topic")
+    public ApiResult<CommonPage<DmpTopicResponseVO>> topic(@RequestBody DmpTopicRequestVO requestVO) {
+        return ApiResult.success(dmpDeviceInfoService.topic(requestVO));
+    }
+
+    /**
+     * 获取设备告警请求信息
+     * @param deviceId 设备id
+     * @param productCode 产品编码
+     * @return
+     */
+    @GetMapping("alarmResponse")
+    public ApiResult<DmpHttpAlarmResponseVO> alarmResponse(@RequestParam(value = "deviceId") String deviceId,
+                                                           @RequestParam(value = "productCode") String productCode){
+        return ApiResult.success(dmpDeviceInfoService.alarmResponse(deviceId, productCode));
     }
 }
 

+ 1 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/PmWorkContentController.java

@@ -112,7 +112,7 @@ public class PmWorkContentController {
     @GetMapping("/slide")
     public ApiResult<PmWorkReportSlideVO> slide(@RequestParam(value = "upOrDown", required = false) Integer upOrDown,
                                                 @RequestParam(value = "slideSum", required = false) Integer slideSum,
-                                                @RequestParam(value = "submitDate", required = true) LocalDateTime submitDate){
+                                                @RequestParam(value = "submitDate") LocalDateTime submitDate){
         return ApiResult.success(pmWorkContentService.slide(upOrDown, slideSum, submitDate));
     }
 

+ 21 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/DmpDeviceInfoService.java

@@ -4,8 +4,7 @@ import com.usky.backend.domain.*;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.mybatis.core.CrudService;
 import com.usky.iot.domain.DmpDeviceInfo;
-import com.usky.iot.service.vo.BaseFacilityDeviceVO;
-import com.usky.iot.service.vo.DmpDeviceInfoRequest;
+import com.usky.iot.service.vo.*;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
@@ -73,4 +72,24 @@ public interface DmpDeviceInfoService extends CrudService<DmpDeviceInfo> {
     List<DataAverageExportVO> DataAverageExport(DataAverageRequestVO requestVO);
 
     Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName);
+
+    /**
+     * @description: 获取设备topic列表
+     * @author: fyc
+     * @email yuchuan.fu@chinausky.com
+     * @date: 2025/2/7 17:49
+     * @param: [pageNum, pageSize]
+     * @return: java.util.List<com.usky.iot.service.vo.DmpTopicResponseVO>
+     **/
+    CommonPage<DmpTopicResponseVO> topic(DmpTopicRequestVO requestVO);
+
+    /**
+     * @description: 获取设备告警请求信息
+     * @author: fyc
+     * @email yuchuan.fu@chinausky.com
+     * @date: 2025/2/7 17:49
+     * @param: [deviceId, productCode]
+     * @return: com.usky.iot.service.vo.DmpHttpAlarmResponseVO
+     **/
+    DmpHttpAlarmResponseVO alarmResponse(String deviceId, String productCode);
 }

+ 34 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/enums/TopicInfo.java

@@ -0,0 +1,34 @@
+package com.usky.iot.service.enums;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/2/7
+ */
+public enum TopicInfo {
+
+    GATEWAY_DEVICE("网关设备","gatewayDevice"),
+    IOT_PLATFORM("物联网平台","IoTPlatform"),
+    ADD_REMARKS("网关设备添加子设备","add"),
+    INFO_REMARKS("网关设备指标数据上报","info"),
+    CONTROL_REMARKS("网关设备命令下发","control"),
+    CONTROL_RESPONSE_REMARKS("网关设备命令响应","controlResponse");
+
+    private String value;
+    private String letter;
+
+    TopicInfo(String value, String letter){
+        this.value = value;
+        this.letter = letter;
+    }
+
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getLetter(){
+        return letter;
+    }
+}

+ 2 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseBuildFacilityServiceImpl.java

@@ -328,6 +328,8 @@ public class BaseBuildFacilityServiceImpl extends AbstractCrudService<BaseBuildF
                             if(list2.get(i).getDeviceId().equals(deviceInfoList.get(j).getDeviceId())){
                                 resultVO.setDeviceName(deviceInfoList.get(j).getDeviceName());
                                 resultVO.setDeviceAddress(deviceInfoList.get(j).getInstallAddress());
+                                resultVO.setDeviceId(deviceInfoList.get(j).getDeviceId());
+                                resultVO.setProductCode(deviceInfoList.get(j).getProductCode());
                             }
                         }
                     }

ファイルの差分が大きいため隠しています
+ 436 - 239
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpDeviceInfoServiceImpl.java


+ 8 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpProductInfoServiceImpl.java

@@ -68,6 +68,14 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
         if (StringUtils.isBlank(dd) || dd.length() == 0){
             throw new BusinessException("新增产品信息'" + dmpProductInfo.getProductCode() + "'失败,设备类型缺少属性");
         }
+
+        QueryWrapper<DmpProductInfo> query = Wrappers.query();
+        query.select("max(id) as id");
+        DmpProductInfo info1 = this.getOne(query);
+        int id = info1.getId()+1;
+        String productCode = String.format("%03d",deviceType)+"_"+String.format("%04d",id);
+        dmpProductInfo.setProductCode(productCode);
+
         dmpProductInfo.setCreatedBy(SecurityUtils.getUsername());
         dmpProductInfo.setCreatedTime(new Date());
         dmpProductInfo.setDeleteFlag(0);

+ 0 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkContentServiceImpl.java

@@ -820,8 +820,6 @@ public class PmWorkContentServiceImpl extends AbstractCrudService<PmWorkContentM
         if (!userId.isEmpty()) {
             userNameQuery.eq(SysUser::getDelFlag, 0).eq(SysUser::getStatus, 0).in(SysUser::getUserId, userId);
             return sysUserMapper.selectList(userNameQuery);
-        } else if (workerOrProject == 2) {
-            userNameQuery.apply(Objects.nonNull(DataScopeContextHolder.getDataScopeSql()), DataScopeContextHolder.getDataScopeSql());
         } else {
             userNameQuery.eq(SysUser::getUserId, SecurityUtils.getUserId());
         }

+ 17 - 9
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java

@@ -219,13 +219,13 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
 
         List<PmWorkContent> workContents = pmWorkReport.getWorkContents();
         if (workContents == null) {
-            throw new BusinessException("报告内容不能为空,请检查!");
+            throw new BusinessException("报告内容不能为空,请检查后提交!");
         } else {
             for (PmWorkContent workContent : workContents) {
                 BigDecimal workTime = workContent.getWorkTime();
                 // 单个工时大于零
                 if (workTime == null) {
-                    throw new BusinessException("工时不能为空,请检查!");
+                    throw new BusinessException("工时不能为空,请检查后提交!");
                 } else if (workTime.compareTo(BigDecimal.ZERO) <= 0) {
                     throw new BusinessException("工时必须大于零!");
                 } else if (workTime.scale() > 1) {
@@ -237,14 +237,14 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                 String workContent1 = workContent.getWorkContent();
                 // 工作内容不允许为空或空字符串
                 if (StringUtils.isBlank(workContent1)) {
-                    throw new BusinessException("工作内容不能为空,请检查!");
+                    throw new BusinessException("工作内容不能为空,请检查后提交!");
                 }
             }
         }
         Set<Integer> projectIds2 = new HashSet<>();
         for (PmWorkContent workContent : pmWorkReport.getWorkContents()) {
             if (!projectIds2.add(workContent.getProjectId())) {
-                throw new BusinessException("存在重复项目,请检查!");
+                throw new BusinessException("存在重复项目,请检查后提交!");
             }
         }
         for (PmWorkContent a : pmWorkReport.getWorkContents()) {
@@ -253,11 +253,20 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
         // 判断总工时是否超过24h
         BigDecimal maxWorkTimePerDay = BigDecimal.valueOf(24);
         if (totalWorkTime.compareTo(maxWorkTimePerDay) >= 0) {
-            throw new BusinessException("一天24小时都不够你用,请检查当日总工时!");
+            throw new BusinessException("总工时超过24小时,请检查后提交!");
         }
 
         // 判断是否携带reportId,不写带则为新增报告,携带则为编辑(更新)报告
         if (rid == null) {
+            // 判断是否今天已提交过
+            LambdaQueryWrapper<PmWorkReport> wrapper = Wrappers.lambdaQuery();
+            wrapper.eq(PmWorkReport::getReportDate, pmWorkReport.getReportDate())
+                    .eq(PmWorkReport::getSubmitterId, userId)
+                    .eq(PmWorkReport::getTenantId, tenantId);
+            if (!pmWorkReportMapper.selectList(wrapper).isEmpty()) {
+                throw new BusinessException("今天已提交工作报告,请勿重复提交!");
+            }
+
             PmWorkReport newReport = new PmWorkReport();
             newReport.setReportDate(pmWorkReport.getReportDate());
             newReport.setSubmitterId(userId);
@@ -280,15 +289,14 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                     newReport.setTimingTime(timingTime);
                     newReport.setReportStatus(0);
                 } else {
-                    throw new BusinessException("定时发送支持选中5分钟后的时间,请重新选择时间");
+                    throw new BusinessException("定时发送支持选中5分钟后的时间,请重新选择时间");
                 }
             }
             try {
                 pmWorkReportMapper.insert(newReport);
 
             } catch (Exception e) {
-                e.printStackTrace();
-                throw new BusinessException("已存在重复数据,一人一天一篇报告!");
+                throw new BusinessException("新增报告异常!请联系管理员" + e);
             }
 
             // 获取报告中所有项目id
@@ -541,7 +549,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
             LocalDate firstMondayOfYear = firstDayOfYear.with(TemporalAdjusters.nextOrSame(DayOfWeek.MONDAY));
 
             DayOfWeek dayOfWeek = firstDayOfYear.getDayOfWeek();
-            if (dayOfWeek != DayOfWeek.MONDAY){
+            if (dayOfWeek != DayOfWeek.MONDAY) {
                 dateNum -= 1;
             }
 

+ 23 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpHttpAlarmResponseVO.java

@@ -0,0 +1,23 @@
+package com.usky.iot.service.vo;
+
+import lombok.Data;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/2/10
+ */
+@Data
+public class DmpHttpAlarmResponseVO {
+
+    /**
+     * 报警事件数据上报http地址
+     **/
+    private String alarmHttpUrl;
+
+    /**
+     * 报警事件数据上报参数body
+     **/
+    private String alarmPayload;
+}

+ 79 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpTopicRequestVO.java

@@ -0,0 +1,79 @@
+package com.usky.iot.service.vo;
+
+import lombok.Data;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/2/10
+ */
+@Data
+public class DmpTopicRequestVO {
+
+    /**
+     * topic类型
+     **/
+    private String topicType;
+
+    /**
+     * 产品编码
+     **/
+    private String productCode;
+
+    /**
+     * 产品id
+     **/
+    private Integer productId;
+
+    /**
+     * 设备id
+     **/
+    private String deviceId;
+
+    /**
+     * 设备唯一标识
+     **/
+    private String deviceUuid;
+
+    /**
+     * 设备名称
+     **/
+    private String deviceName;
+
+    /**
+     * sim卡号
+     **/
+    private String simCode;
+
+    /**
+     * 安装位置
+     **/
+    private String installAddress;
+
+    /**
+     * 时间戳
+     **/
+    private Long timestamp;
+
+    /**
+     * 属性值集合
+     **/
+    private String metrics;
+
+    /**
+     * 标签值集合
+     **/
+    private String tags;
+
+    /**
+     * 页码
+     **/
+    private Integer pageNum;
+
+    /**
+     * 每页条数
+     **/
+    private Integer pageSize;
+
+}

+ 49 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpTopicResponseVO.java

@@ -0,0 +1,49 @@
+package com.usky.iot.service.vo;
+
+import lombok.Data;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/2/7
+ */
+@Data
+public class DmpTopicResponseVO {
+
+    /**
+     * topic
+     **/
+    private String topic;
+
+    /**
+     * 发布者
+     **/
+    private String publisher;
+
+    /**
+     * 订阅者
+     **/
+    private String subscriber;
+
+    /**
+     * 备注
+     **/
+    private String remarks;
+
+    /**
+     * mqtt数据上报数据
+     **/
+    private String topicPayload;
+
+    /**
+     * http报警数据上报地址
+     **/
+    private String alarm;
+
+    /**
+     * http报警数据上报数据
+     **/
+    private String alarmPayload;
+
+}

+ 10 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/FacilityDeviceResultVO.java

@@ -41,6 +41,16 @@ public class FacilityDeviceResultVO {
      */
     private String deviceAddress;
 
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+    /**
+     * 设备id
+     */
+    private String deviceId;
+
     /**
      * 设备属性
      */

+ 8 - 0
service-oa/service-oa-biz/pom.xml

@@ -49,6 +49,14 @@
             <version>4.1.0</version>
         </dependency>
 
+        <!-- 流程XML解析 -->
+        <!-- https://mvnrepository.com/artifact/org.dom4j/dom4j -->
+        <dependency>
+            <groupId>org.dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 5 - 0
service-oa/service-oa-biz/src/main/java/com/usky/oa/controller/web/OaApprovalController.java

@@ -76,5 +76,10 @@ public class OaApprovalController {
         oaApprovalService.approve(id, approvalStatus, opinion);
     }
 
+    @GetMapping("/analysisTest")
+    public void analysisTest(@RequestParam(value = "id") Integer id) {
+        oaApprovalService.analysisTest(id);
+    }
+
 }
 

+ 9 - 1
service-oa/service-oa-biz/src/main/java/com/usky/oa/controller/web/OaDocumentController.java

@@ -72,7 +72,15 @@ public class OaDocumentController {
         return oaDocumentService.documentDetails(docNo);
     }
 
-    // 更新单据
+
+    /**
+     * @description: 更新单据
+     * @author: fyc
+     * @email yuchuan.fu@chinausky.com
+     * @date: 2025/1/20 15:47
+     * @param: [jsonDocument]
+     * @return: void
+     **/
     @Log(title = "更新单据", businessType = BusinessType.UPDATE)
     @PostMapping("/update")
     public void approvalCount(@RequestBody JSONObject jsonDocument) {

+ 5 - 0
service-oa/service-oa-biz/src/main/java/com/usky/oa/domain/OaApproval.java

@@ -39,6 +39,11 @@ public class OaApproval implements Serializable {
      */
     private Long approvalUid;
 
+    /**
+     * 申请人id
+     */
+    private Integer proposer;
+
     /**
      * 审批类型(0:审批,1:知会)
      */

+ 15 - 0
service-oa/service-oa-biz/src/main/java/com/usky/oa/mapper/SysUserMapper.java

@@ -0,0 +1,15 @@
+package com.usky.oa.mapper;
+
+import com.usky.common.mybatis.core.CrudMapper;
+import com.usky.system.domain.SysUser;
+import org.springframework.stereotype.Repository;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/1/21
+ */
+@Repository
+public interface SysUserMapper extends CrudMapper<SysUser> {
+}

+ 2 - 0
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/OaApprovalService.java

@@ -45,4 +45,6 @@ public interface OaApprovalService extends CrudService<OaApproval> {
      * @param approvalStatus 审批状态(1:审批中,2:审批通过,3:审批不通过)
      */
     void approve(Integer id, Integer approvalStatus, String opinion);
+
+    void analysisTest(Integer id);
 }

+ 63 - 22
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaApprovalServiceImpl.java

@@ -10,12 +10,18 @@ import com.usky.common.core.exception.BusinessException;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.oa.domain.OaApproval;
 import com.usky.oa.domain.OaDocument;
+import com.usky.oa.domain.OaFormDefinition;
 import com.usky.oa.mapper.OaApprovalMapper;
 import com.usky.oa.mapper.OaDocumentMapper;
+import com.usky.oa.mapper.OaFormDefinitionMapper;
 import com.usky.oa.service.OaApprovalService;
 import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.oa.service.utils.OaProcessAnalysis;
+import com.usky.oa.service.utils.OaSendMessageCenter;
 import com.usky.oa.service.vo.OaApprovalCountVO;
+import com.usky.system.domain.SysUser;
 import org.apache.commons.lang3.StringUtils;
+import org.hibernate.validator.internal.constraintvalidators.bv.time.futureorpresent.FutureOrPresentValidatorForReadableInstant;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -24,6 +30,7 @@ import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -44,22 +51,36 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
     @Autowired
     private OaDocumentMapper oaDocumentMapper;
 
-    // 我的申请-待处理、已处理、我发起、我收到-统计
+    @Autowired
+    private OaSendMessageCenter oaSendMessageCenter;
+
+    @Autowired
+    private OaProcessAnalysis oaProcessAnalysis;
+
+    @Autowired
+    private OaFormDefinitionMapper oaFormDefinitionMapper;
+
+
+    // 我的申请-待处理、已处理、我发起、我收到-统计(暂时统计近一年数据)
     @Override
     public OaApprovalCountVO approvalCount() {
         Long userId = SecurityUtils.getUserId();
         String username = SecurityUtils.getUsername();
         Integer tenantId = SecurityUtils.getTenantId();
 
+        LocalDateTime now = LocalDateTime.now();
+        // 一年前时间
+        LocalDateTime oneYearAgo = now.minusYears(1);
+
         OaApprovalCountVO oaApprovalCountVO = new OaApprovalCountVO();
         // 待处理
-        oaApprovalCountVO.setPendingSum(getPendingSum(tenantId, userId).size());
+        oaApprovalCountVO.setPendingSum(getPendingSum(tenantId, userId, oneYearAgo, now).size());
         // 已处理
-        oaApprovalCountVO.setAlreadySum(getAlreadySum(tenantId, userId).size());
+        oaApprovalCountVO.setAlreadySum(getAlreadySum(tenantId, userId, oneYearAgo, now).size());
         // 我发起
-        oaApprovalCountVO.setMyInitiated(getMyInitiated(tenantId, username).size());
+        oaApprovalCountVO.setMyInitiated(getMyInitiated(tenantId, username, oneYearAgo, now).size());
         // 我收到
-        oaApprovalCountVO.setMyReceived(getMyReceived(tenantId, userId).size());
+        oaApprovalCountVO.setMyReceived(getMyReceived(tenantId, userId, oneYearAgo, now).size());
 
         return oaApprovalCountVO;
     }
@@ -71,16 +92,11 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
         Integer tenantId = SecurityUtils.getTenantId();
         IPage<OaApproval> page = new Page<>(pageNum, pageSize);
 
-        LocalDateTime now = LocalDateTime.now();
-        // 一年前时间
-        LocalDateTime oneYearAgo = now.minusYears(1);
-
         List<Integer> processed = Stream.of(2, 3).collect(Collectors.toList());
 
         LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(OaApproval::getTenantId, tenantId)
-                .eq(OaApproval::getApprovalUid, userId)
-                .between(OaApproval::getCreateTime, oneYearAgo, now);
+                .eq(OaApproval::getApprovalUid, userId).orderByDesc(OaApproval::getApprovalDate);
 
         switch (queryType) {
             case 1:
@@ -127,33 +143,55 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
             throw new BusinessException("审批类型错误,请重试!");
         }
 
+        String username = SecurityUtils.getUsername();
+
+        LocalDateTime now = LocalDateTime.now();
+
         oaApproval.setApprovalStatus(approvalStatus);
         oaApproval.setOpinion(opinion);
-        oaApproval.setApprovalDate(LocalDateTime.now());
-        oaApproval.setUpdateBy(SecurityUtils.getUsername());
-        oaApproval.setUpdateTime(LocalDateTime.now());
+        oaApproval.setApprovalDate(now);
+        oaApproval.setUpdateBy(username);
+        oaApproval.setUpdateTime(now);
         oaApprovalMapper.updateById(oaApproval);
+
+        int isPass = 1;
+        if (approvalStatus == 3) {
+            isPass = 0;
+        }
+
+        List<Long> receivers = Collections.singletonList(Long.valueOf(oaApproval.getProposer()));
+        oaSendMessageCenter.sendAsyncMessage(oaApproval.getCreateBy(), Long.valueOf(oaApproval.getProposer()), oaApproval.getId(), receivers, isPass);
+    }
+
+    @Override
+    public void analysisTest(Integer id) {
+        LambdaQueryWrapper<OaFormDefinition> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(OaFormDefinition::getId, id);
+        String flowInfo = oaFormDefinitionMapper.selectOne(queryWrapper).getFlowInfo();
+        oaProcessAnalysis.processAnalysis(flowInfo);
     }
 
     // 待处理
-    private List<OaApproval> getPendingSum(Integer tenantId, Long userId) {
+    private List<OaApproval> getPendingSum(Integer tenantId, Long userId, LocalDateTime oneYearAgo, LocalDateTime now) {
         LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(OaApproval::getTenantId, tenantId)
                 .eq(OaApproval::getApprovalUid, userId)
-                .eq(OaApproval::getApprovalStatus, 1);
+                .eq(OaApproval::getApprovalStatus, 1)
+                .between(OaApproval::getSubmitDate, oneYearAgo, now);
         List<OaApproval> oaApprovals = oaApprovalMapper.selectList(queryWrapper);
         return oaApprovals == null ? Collections.emptyList() : oaApprovals;
     }
 
     // 已处理
-    private List<OaApproval> getAlreadySum(Integer tenantId, Long userId) {
+    private List<OaApproval> getAlreadySum(Integer tenantId, Long userId, LocalDateTime oneYearAgo, LocalDateTime now) {
         LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(OaApproval::getTenantId, tenantId)
                 .eq(OaApproval::getApprovalUid, userId)
                 .and(wrapper -> wrapper
                         .eq(OaApproval::getApprovalStatus, 2)
                         .or()
-                        .eq(OaApproval::getApprovalStatus, 3));
+                        .eq(OaApproval::getApprovalStatus, 3))
+                .between(OaApproval::getSubmitDate, oneYearAgo, now);
         List<OaApproval> oaApprovals = oaApprovalMapper.selectList(queryWrapper);
         return oaApprovals == null ? Collections.emptyList() : oaApprovals;
     }
@@ -174,20 +212,23 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
     }*/
 
     // 我发起
-    private List<OaDocument> getMyInitiated(Integer tenantId, String username) {
+    private List<OaDocument> getMyInitiated(Integer tenantId, String username, LocalDateTime oneYearAgo, LocalDateTime now) {
         List<OaDocument> oaDocuments = oaDocumentMapper.selectList(new QueryWrapper<OaDocument>().lambda()
                 .select(OaDocument::getDocNo)
                 .eq(OaDocument::getTenantId, tenantId)
-                .eq(OaDocument::getCreateBy, username));
+                .eq(OaDocument::getCreateBy, username)
+                .in(OaDocument::getDocStatus, 1, 2, 3)
+                .between(OaDocument::getCreateTime, oneYearAgo, now));
         return oaDocuments == null ? Collections.emptyList() : oaDocuments;
     }
 
     // 我收到
-    private List<OaApproval> getMyReceived(Integer tenantId, Long userId) {
+    private List<OaApproval> getMyReceived(Integer tenantId, Long userId, LocalDateTime oneYearAgo, LocalDateTime now) {
         LambdaQueryWrapper<OaApproval> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(OaApproval::getTenantId, tenantId)
                 .eq(OaApproval::getApprovalUid, userId)
-                .eq(OaApproval::getType, 1);
+                .eq(OaApproval::getType, 1)
+                .between(OaApproval::getSubmitDate, oneYearAgo, now);
         List<OaApproval> oaApprovals = oaApprovalMapper.selectList(queryWrapper);
         return oaApprovals == null ? Collections.emptyList() : oaApprovals;
     }

+ 16 - 15
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaDocumentServiceImpl.java

@@ -14,6 +14,8 @@ import com.usky.oa.service.OaDocumentService;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.oa.service.OaJbdDocumentService;
 import com.usky.oa.service.OaQjdDocumentService;
+import com.usky.oa.service.utils.OaSendMessageCenter;
+import org.apache.commons.lang3.RandomUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -21,7 +23,9 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -59,6 +63,9 @@ public class OaDocumentServiceImpl extends AbstractCrudService<OaDocumentMapper,
     @Autowired
     private OaApprovalMapper oaApprovalMapper;
 
+    @Autowired
+    private OaSendMessageCenter oaSendMessageCenter;
+
     private static final String TABLE_HEAD = "oa_";
     private static final String TABLE_SUFFIX = "_document";
 
@@ -149,7 +156,6 @@ public class OaDocumentServiceImpl extends AbstractCrudService<OaDocumentMapper,
     }
 
     // 提交单据
-    @Transactional
     @Override
     public void submit(String docNo, Integer docStatus) {
         if (docStatus != 1) {
@@ -166,6 +172,7 @@ public class OaDocumentServiceImpl extends AbstractCrudService<OaDocumentMapper,
         Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
         Integer tenantId = SecurityUtils.getTenantId();
         String username = SecurityUtils.getUsername();
+        Long userId = SecurityUtils.getUserId();
         LocalDateTime now = LocalDateTime.now();
 
         String formSign = getFormSign(docNo);
@@ -192,12 +199,15 @@ public class OaDocumentServiceImpl extends AbstractCrudService<OaDocumentMapper,
                 .set(OaDocument::getUpdateTime, now)
                 .eq(OaDocument::getDocNo, docNo));
 
-        // 生成两条审批记录数据
+        // 生成审批记录
         OaApproval oaApproval = new OaApproval();
         oaApproval.setDocNo(docNo);
         oaApproval.setType(0);
         oaApproval.setApprovalStatus(1);
-        oaApproval.setApprovalUid(226L);
+        // 随机选择一个审批人(涛、哲)
+        long approvalUid = RandomUtils.nextBoolean() ? 101 : 105;
+        oaApproval.setApprovalUid(approvalUid);
+        oaApproval.setProposer(Math.toIntExact(userId));
         oaApproval.setCreateBy(username);
         oaApproval.setCreateTime(now);
         oaApproval.setSubmitDate(now);
@@ -205,18 +215,9 @@ public class OaDocumentServiceImpl extends AbstractCrudService<OaDocumentMapper,
         oaApproval.setTenantId(tenantId);
         oaApprovalMapper.insert(oaApproval);
 
-        OaApproval oaApproval1 = new OaApproval();
-        oaApproval1.setDocNo(docNo);
-        oaApproval1.setType(1);
-        oaApproval1.setApprovalStatus(1);
-        oaApproval1.setApprovalUid(157L);
-        oaApproval1.setCreateBy(username);
-        oaApproval1.setCreateTime(now);
-        oaApproval1.setSubmitDate(now);
-        oaApproval1.setDeptId(deptId);
-        oaApproval1.setTenantId(tenantId);
-        oaApprovalMapper.insert(oaApproval1);
-
+        // 发送审批消息
+        List<Long> receivers = Collections.singletonList(oaApproval.getApprovalUid());
+        oaSendMessageCenter.sendAsyncMessage(oaApproval.getCreateBy(), userId, oaApproval.getId(), receivers,3);
     }
 
     // 获取单据类型

+ 39 - 12
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaJbdDocumentServiceImpl.java

@@ -13,6 +13,7 @@ import com.usky.oa.mapper.OaJbdDocumentMapper;
 import com.usky.oa.service.OaJbdDocumentService;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.oa.service.enums.OaBuiltInDocument;
+import com.usky.oa.service.utils.OaSendMessageCenter;
 import org.apache.commons.lang3.RandomUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +22,8 @@ import org.springframework.stereotype.Service;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * <p>
@@ -42,6 +45,9 @@ public class OaJbdDocumentServiceImpl extends AbstractCrudService<OaJbdDocumentM
     @Autowired
     private OaApprovalMapper oaApprovalMapper;
 
+    @Autowired
+    private OaSendMessageCenter oaSendMessageCenter;
+
     @Override
     public void add(OaJbdDocument oaJbdDocument) {
         Long userId = SecurityUtils.getUserId();
@@ -86,14 +92,18 @@ public class OaJbdDocumentServiceImpl extends AbstractCrudService<OaJbdDocumentM
             oaApproval.setDocNo(oaJbdDocument.getDocNo());
             oaApproval.setType(0);
             oaApproval.setApprovalStatus(1);
-            long approvalUid = RandomUtils.nextBoolean() ? 226L : 157L;
-            oaApproval.setApprovalUid(approvalUid);
+            oaApproval.setApprovalUid(105L);
+            oaApproval.setProposer(Math.toIntExact(userId));
             oaApproval.setCreateBy(oaJbdDocument.getCreateBy());
             oaApproval.setCreateTime(now);
             oaApproval.setSubmitDate(now);
             oaApproval.setDeptId(oaJbdDocument.getDeptId());
             oaApproval.setTenantId(oaJbdDocument.getTenantId());
             oaApprovalMapper.insert(oaApproval);
+
+            // 发送审批消息
+            List<Long> receivers = Collections.singletonList(oaApproval.getApprovalUid());
+            oaSendMessageCenter.sendAsyncMessage(oaApproval.getCreateBy(), userId, oaApproval.getId(), receivers, 3);
         }
     }
 
@@ -102,16 +112,42 @@ public class OaJbdDocumentServiceImpl extends AbstractCrudService<OaJbdDocumentM
         if (StringUtils.isBlank(oaJbdDocument.getDocNo())) {
             throw new BusinessException("更新单据编号传参异常!");
         }
+
+        LocalDateTime now = LocalDateTime.now();
+        Long userId = SecurityUtils.getUserId();
+
         validateOaJbDocument(oaJbdDocument);
         oaJbdDocument.setUpdateBy(SecurityUtils.getUsername());
         oaJbdDocument.setUpdateTime(LocalDateTime.now());
         oaJbdDocumentMapper.updateById(oaJbdDocument);
 
         oaDocumentMapper.update(null, Wrappers.lambdaUpdate(OaDocument.class)
+                .eq(OaDocument::getDocNo, oaJbdDocument.getDocNo())
                 .set(OaDocument::getDocStatus, oaJbdDocument.getDocStatus())
                 .set(OaDocument::getUpdateBy, oaJbdDocument.getCreateBy())
                 .set(OaDocument::getUpdateTime, oaJbdDocument.getUpdateTime())
         );
+
+        Integer docStatus = oaJbdDocument.getDocStatus();
+        if (docStatus.equals(1)) {
+            // 生成一条审批记录数据
+            OaApproval oaApproval = new OaApproval();
+            oaApproval.setDocNo(oaJbdDocument.getDocNo());
+            oaApproval.setType(0);
+            oaApproval.setApprovalStatus(1);
+            oaApproval.setApprovalUid(105L);
+            oaApproval.setProposer(Math.toIntExact(userId));
+            oaApproval.setCreateBy(oaJbdDocument.getCreateBy());
+            oaApproval.setCreateTime(now);
+            oaApproval.setSubmitDate(now);
+            oaApproval.setDeptId(oaJbdDocument.getDeptId());
+            oaApproval.setTenantId(oaJbdDocument.getTenantId());
+            oaApprovalMapper.insert(oaApproval);
+
+            // 发送审批消息
+            List<Long> receivers = Collections.singletonList(oaApproval.getApprovalUid());
+            oaSendMessageCenter.sendAsyncMessage(oaApproval.getCreateBy(), userId, oaApproval.getId(), receivers, 3);
+        }
     }
 
     /**
@@ -136,19 +172,10 @@ public class OaJbdDocumentServiceImpl extends AbstractCrudService<OaJbdDocumentM
             throw new BusinessException("加班开始时间或结束时间输入异常!请确保开始时间不晚于结束时间");
         }
 
-        if (oaJbdDocument.getDuration() == null || oaJbdDocument.getDuration() <= 0) {
+        if (duration == null || duration <= 0) {
             throw new BusinessException("加班时长必须大于0!");
         }
 
-        long hours = ChronoUnit.HOURS.between(startTime, endTime);
-        long days = ChronoUnit.DAYS.between(startTime, endTime);
-        if (days > 0) {
-            hours -= days * 16;
-        }
-        if (hours != duration) {
-            throw new BusinessException("加班时长与实际时长不一致,请重试!");
-        }
-
         if (StringUtils.isBlank(oaJbdDocument.getReason())) {
             throw new BusinessException("加班原因不能为空!");
         } else if (oaJbdDocument.getReason().length() > 255) {

+ 20 - 6
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaQjdDocumentServiceImpl.java

@@ -16,6 +16,7 @@ import com.usky.oa.mapper.OaQjdDocumentMapper;
 import com.usky.oa.service.OaQjdDocumentService;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.oa.service.enums.OaBuiltInDocument;
+import com.usky.oa.service.utils.OaSendMessageCenter;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.RandomUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -25,6 +26,8 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * <p>
@@ -50,6 +53,9 @@ public class OaQjdDocumentServiceImpl extends AbstractCrudService<OaQjdDocumentM
     @Autowired
     private OaApprovalMapper oaApprovalMapper;
 
+    @Autowired
+    private OaSendMessageCenter oaSendMessageCenter;
+
     @Override
     public void addQjDocument(OaQjdDocument oaQjdDocument) {
 
@@ -99,15 +105,18 @@ public class OaQjdDocumentServiceImpl extends AbstractCrudService<OaQjdDocumentM
             oaApproval.setDocNo(docNo);
             oaApproval.setType(0);
             oaApproval.setApprovalStatus(1);
-            // 随机选择一个审批人
-            long approvalUid = RandomUtils.nextBoolean() ? 226L : 157L;
-            oaApproval.setApprovalUid(approvalUid);
+            oaApproval.setApprovalUid(101L);
+            oaApproval.setProposer(Math.toIntExact(userId));
             oaApproval.setCreateBy(username);
             oaApproval.setCreateTime(now);
             oaApproval.setSubmitDate(now);
             oaApproval.setDeptId(deptId);
             oaApproval.setTenantId(tenantId);
             oaApprovalMapper.insert(oaApproval);
+
+            // 发送审批消息
+            List<Long> receivers = Collections.singletonList(oaApproval.getApprovalUid());
+            oaSendMessageCenter.sendAsyncMessage(oaApproval.getCreateBy(), userId, oaApproval.getId(), receivers, 3);
         }
     }
 
@@ -123,12 +132,14 @@ public class OaQjdDocumentServiceImpl extends AbstractCrudService<OaQjdDocumentM
         LocalDateTime now = LocalDateTime.now();
         Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
         Integer tenantId = SecurityUtils.getTenantId();
+        Long userId = SecurityUtils.getUserId();
 
         oaQjdDocument.setUpdateBy(username);
         oaQjdDocument.setUpdateTime(now);
         oaQjdDocumentMapper.updateById(oaQjdDocument);
 
         oaDocumentMapper.update(null, Wrappers.lambdaUpdate(OaDocument.class)
+                .eq(OaDocument::getDocNo, oaQjdDocument.getDocNo())
                 .set(OaDocument::getDocStatus, oaQjdDocument.getDocStatus())
                 .set(OaDocument::getUpdateBy, username)
                 .set(OaDocument::getUpdateTime, oaQjdDocument.getUpdateTime())
@@ -140,15 +151,18 @@ public class OaQjdDocumentServiceImpl extends AbstractCrudService<OaQjdDocumentM
             oaApproval.setDocNo(oaQjdDocument.getDocNo());
             oaApproval.setType(0);
             oaApproval.setApprovalStatus(1);
-            // 随机选择一个审批人
-            long approvalUid = RandomUtils.nextBoolean() ? 226L : 157L;
-            oaApproval.setApprovalUid(approvalUid);
+            oaApproval.setApprovalUid(101L);
+            oaApproval.setProposer(Math.toIntExact(userId));
             oaApproval.setCreateBy(username);
             oaApproval.setCreateTime(now);
             oaApproval.setSubmitDate(now);
             oaApproval.setDeptId(deptId);
             oaApproval.setTenantId(tenantId);
             oaApprovalMapper.insert(oaApproval);
+
+            // 发送审批消息
+            List<Long> receivers = Collections.singletonList(oaApproval.getApprovalUid());
+            oaSendMessageCenter.sendAsyncMessage(oaApproval.getCreateBy(), userId, oaApproval.getId(), receivers, 3);
         }
     }
 

+ 53 - 0
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/utils/OaProcessAnalysis.java

@@ -0,0 +1,53 @@
+package com.usky.oa.service.utils;
+
+import com.usky.common.core.exception.BusinessException;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+import java.io.StringReader;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ *
+ * @author fyc
+ * @email yuchuan.fu@chinausky.com
+ * @date 2025/1/23
+ */
+@Slf4j
+@Configuration
+public class OaProcessAnalysis {
+    public void processAnalysis(String xmlString) {
+        try {
+            // 创建 SAXReader 对象
+            SAXReader reader = new SAXReader();
+            // 将 XML 字符串解析为 Document 对象
+            Document document = reader.read(new StringReader(xmlString));
+
+            // 获取根元素
+            Element root = document.getRootElement();
+
+            // 遍历根元素的子元素
+            parseElement(root);
+        } catch (DocumentException e) {
+            throw new BusinessException("解析流程xml文件失败" + e);
+        }
+    }
+
+    private void parseElement(Element element) {
+        // 输出元素名称
+        System.out.println("元素名称: " + element.getName());
+        // 处理元素的属性
+        element.attributes().forEach(attribute -> {
+            System.out.println("元素属性: " + attribute.getName() + ", 元素值: " + attribute.getValue());
+        });
+        // 遍历子元素
+        element.elements().forEach(subElement -> {
+            // 递归处理子元素
+            parseElement((Element) subElement);
+        });
+    }
+}

+ 46 - 25
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/utils/OaSendMessageCenter.java

@@ -5,9 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.bean.ApiResult;
 import com.usky.common.core.exception.BusinessException;
+import com.usky.oa.mapper.SysUserMapper;
+import com.usky.system.RemoteMceService;
 import com.usky.system.domain.SysUser;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.Async;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -22,51 +26,68 @@ import java.util.stream.Collectors;
 @Configuration
 public class OaSendMessageCenter {
 
+    @Autowired
+    private RemoteMceService remoteMceService;
+
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
     private static final String INFO_TITLE = "审批提醒";
     private static final String INFO_CONTENT = "的申请";
-    private static final int INFO_TYPE = 6;
+    private static final String INFO_APPROVE_FAIL = "审核不通过";
+    private static final String INFO_APPROVE_SUCCESS = "审核通过";
+    private static final int INFO_TYPE = 3;
+
+    /**
+     * 异步发送消息
+     *
+     * @param username 提交人账号名
+     * @param submitterId 提交人id
+     * @param id 数据id
+     * @param receivers 接收人userId集合
+     * @param isPass 是否通过(0:不通过,1:通过)
+     */
+    @Async
+    public void sendAsyncMessage(String username, Long submitterId, Integer id, List<Long> receivers, Integer isPass) {
 
-    /*public void sendAsyncMessage(PmWorkReport newReport) {
-        String username = newReport.getCreateBy();
-        Long submitterId = newReport.getSubmitterId();
         log.info(username + "的申请开始发送消息中心-----------------------------------");
-        List<Long> userId = new ArrayList<>();
-        if (!newReport.getCcTo().isEmpty()) {
-            userId = Optional.of(newReport.getCcTo())
-                    .map(ccTo -> Arrays.stream(ccTo.split(","))
-                            .map(Long::parseLong)
-                            .collect(Collectors.toList()))
-                    .orElse(Collections.emptyList());
-        } else {
-            throw new BusinessException( newReport.getCreateBy() + "的报告:" + newReport.getId() + ",抄送人为空,无需发送消息中心");
-        }
+
         LambdaQueryWrapper<SysUser> nickNameQuery = Wrappers.lambdaQuery();
         nickNameQuery.select(SysUser::getNickName)
                 .eq(SysUser::getUserId, submitterId);
         SysUser nickName = sysUserMapper.selectOne(nickNameQuery);
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("infoTitle", INFO_TITLE);
-        jsonObject.put("infoContent", nickName.getNickName() + INFO_CONTENT);
+
+        switch (isPass) {
+            case 0:
+                jsonObject.put("infoContent", nickName.getNickName() + INFO_APPROVE_FAIL);
+                break;
+            case 1:
+                jsonObject.put("infoContent", nickName.getNickName() + INFO_APPROVE_SUCCESS);
+                break;
+            default:
+                jsonObject.put("infoContent", nickName.getNickName() + INFO_CONTENT);
+        }
+
         jsonObject.put("infoType", INFO_TYPE);
-        jsonObject.put("id", newReport.getId());
+        jsonObject.put("id", id);
         jsonObject.put("infoTypeName", INFO_TITLE);
-        jsonObject.put("userName", newReport.getCreateBy());
-        if (!userId.isEmpty()) {
-            jsonObject.put("userIds", userId);
-        }
+        jsonObject.put("userName", username);
+        jsonObject.put("userIds", receivers);
         try {
             // 推送消息中心
             ApiResult<Void> voidApiResult = remoteMceService.addMce(jsonObject.toString());
 
             if (voidApiResult.isSuccess()) {
-                log.info("报告消息发送成功!");
+                log.info("申请消息发送成功!");
             } else {
-                log.error("报告消息发送失败!");
+                log.error("申请消息发送失败!");
             }
         } catch (Exception e) {
-            log.error("报告发送消息时发生异常", e);
+            log.error("申请发送消息时发生异常", e);
         }
-        log.info(username + "的工作报告发送消息中心完成-----------------------------------");
-    }*/
+        log.info(username + "的申请发送消息中心完成-----------------------------------");
+    }
 
 }

+ 1 - 0
service-oa/service-oa-biz/src/main/resources/mapper/oa/OaApprovalMapper.xml

@@ -7,6 +7,7 @@
         <id column="id" property="id" />
         <result column="doc_no" property="docNo" />
         <result column="approval_uid" property="approvalUid" />
+        <result column="proposer" property="proposer" />
         <result column="type" property="type" />
         <result column="approval_status" property="approvalStatus" />
         <result column="opinion" property="opinion" />

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません