Browse Source

fix:bugfix

caozixuan 1 year ago
parent
commit
1d108999b9

+ 3 - 3
sop-api/src/main/java/com/qmth/sop/server/api/TBDingController.java

@@ -199,9 +199,9 @@ public class TBDingController {
     @ApiOperation(value = "考勤结果统计")
     @RequestMapping(value = "/ding_statistic", method = RequestMethod.POST)
     @ApiResponses({ @ApiResponse(code = 200, message = "查询成功", response = DingStatisticResult.class) })
-    public Result findDingStatistic(@ApiParam(value = "sop单号", required = true) @RequestParam String sopNo) {
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        return ResultUtil.ok(tBDingService.findDingStatistic(sopNo, requestUser.getId()));
+    public Result findDingStatistic(@ApiParam(value = "sop单号", required = true) @RequestParam String sopNo,
+            @ApiParam(value = "打卡人id", required = true) @RequestParam String userId) {
+        return ResultUtil.ok(tBDingService.findDingStatistic(sopNo, SystemConstant.convertIdToLong(userId)));
     }
 
     @ApiOperation(value = "考勤打卡保存")

+ 17 - 6
sop-business/src/main/java/com/qmth/sop/business/bean/result/DingSubmitResult.java

@@ -3,7 +3,6 @@ package com.qmth.sop.business.bean.result;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.enums.DingSubmitStatusEnum;
-import com.qmth.sop.common.enums.RoleTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 /**
@@ -12,6 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
  * @Date: 2023-08-25
  */
 public class DingSubmitResult {
+
     @ApiModelProperty(value = "服务单元id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long serviceUnitId;
@@ -64,7 +64,10 @@ public class DingSubmitResult {
     private String archivesInfo;
 
     @ApiModelProperty(value = "项目角色")
-    private RoleTypeEnum roleType;
+    private String roleName;
+
+    @ApiModelProperty(value = "sop身份")
+    private String sopRoleTypeStr;
 
     @ApiModelProperty("供应商id")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -249,12 +252,20 @@ public class DingSubmitResult {
         this.archivesInfo = archivesInfo;
     }
 
-    public RoleTypeEnum getRoleType() {
-        return roleType;
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public String getSopRoleTypeStr() {
+        return sopRoleTypeStr;
     }
 
-    public void setRoleType(RoleTypeEnum roleType) {
-        this.roleType = roleType;
+    public void setSopRoleTypeStr(String sopRoleTypeStr) {
+        this.sopRoleTypeStr = sopRoleTypeStr;
     }
 
     public Long getSupplierId() {

+ 17 - 5
sop-business/src/main/java/com/qmth/sop/business/entity/TBDingStatistic.java

@@ -40,6 +40,10 @@ public class TBDingStatistic extends BaseEntity {
     @ApiModelProperty(value = "城市")
     private String city;
 
+    @ApiModelProperty(value = "用户id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long userId;
+
     @ApiModelProperty(value = "人员档案id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long userArchivesId;
@@ -63,7 +67,7 @@ public class TBDingStatistic extends BaseEntity {
     private Long markPaperEndTime;
 
     @ApiModelProperty(value = "打卡时该用户在sop的身份集合")
-    private String sopRoleType;
+    private String roleName;
 
     @ApiModelProperty(value = "供应商id")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -147,6 +151,14 @@ public class TBDingStatistic extends BaseEntity {
         this.city = city;
     }
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     public Long getUserArchivesId() {
         return userArchivesId;
     }
@@ -203,12 +215,12 @@ public class TBDingStatistic extends BaseEntity {
         this.markPaperEndTime = markPaperEndTime;
     }
 
-    public String getSopRoleType() {
-        return sopRoleType;
+    public String getRoleName() {
+        return roleName;
     }
 
-    public void setSopRoleType(String sopRoleType) {
-        this.sopRoleType = sopRoleType;
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
     }
 
     public Long getSupplierId() {

+ 5 - 5
sop-business/src/main/java/com/qmth/sop/business/entity/TBDingSubmit.java

@@ -53,7 +53,7 @@ public class TBDingSubmit extends BaseEntity implements Serializable {
     private Long departureTime;
 
     @ApiModelProperty(value = "项目角色")
-    private RoleTypeEnum roleType;
+    private String roleName;
 
     @ApiModelProperty(value = "实际出勤(天)")
     private Integer actualDays;
@@ -163,12 +163,12 @@ public class TBDingSubmit extends BaseEntity implements Serializable {
         this.departureTime = departureTime;
     }
 
-    public RoleTypeEnum getRoleType() {
-        return roleType;
+    public String getRoleName() {
+        return roleName;
     }
 
-    public void setRoleType(RoleTypeEnum roleType) {
-        this.roleType = roleType;
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
     }
 
     public Integer getActualDays() {

+ 1 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingServiceImpl.java

@@ -565,8 +565,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
 
                 Long flowId = tfFlowApprove.getFlowId();
                 TFFlowLog tfFlowLog = tfFlowLogService.getOne(
-                        new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, flowId).eq(TFFlowLog::getApproveRemark, "通过").eq(TFFlowLog::getApproveSetup, 1)
-                                .eq(TFFlowLog::getApproveOperation, FlowApproveOperationEnum.START).orderByDesc(TFFlowLog::getId).last("limit 1"));
+                        new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, flowId).eq(TFFlowLog::getApproveRemark, "通过").eq(TFFlowLog::getApproveSetup, 1).orderByDesc(TFFlowLog::getId).last("limit 1"));
                 if (Objects.isNull(tfFlowLog)) {
                     throw ExceptionResultEnum.ERROR.exception("未找到流程提交记录");
                 }

+ 2 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingStatisticServiceImpl.java

@@ -218,6 +218,7 @@ public class TBDingStatisticServiceImpl extends ServiceImpl<TBDingStatisticMappe
             tbDingStatistic.setCustomName(crmProjectResult.getCustomName());
             tbDingStatistic.setProvince(crmProjectResult.getCustomProvince());
             tbDingStatistic.setCity(crmProjectResult.getCustomCity());
+            tbDingStatistic.setUserId(userId);
             tbDingStatistic.setUserArchivesId(userArchivesId);
             tbDingStatistic.setUserArchivesName(tbUserArchives.getName());
             tbDingStatistic.setUserArchivesCode(tbUserArchives.getCode());
@@ -225,7 +226,7 @@ public class TBDingStatisticServiceImpl extends ServiceImpl<TBDingStatisticMappe
             tbDingStatistic.setScanEndTime(scanEndTime);
             tbDingStatistic.setMarkPaperStartTime(markPaperStartTime);
             tbDingStatistic.setMarkPaperEndTime(markPaperEndTime);
-            tbDingStatistic.setSopRoleType(sopRoleType);
+            tbDingStatistic.setRoleName(sopRoleType);
             tbDingStatistic.setSupplierId(tbUserArchives.getSupplierId());
             tbDingStatistic.setSupplierName(tbUserArchives.getSupplierName());
             tbDingStatistic.setActualDays(actualDays);

+ 21 - 7
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingSubmitServiceImpl.java

@@ -1,5 +1,6 @@
 package com.qmth.sop.business.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,10 +15,7 @@ import com.qmth.sop.business.mapper.TBDingSubmitMapper;
 import com.qmth.sop.business.service.SysUserService;
 import com.qmth.sop.business.service.TBDingSubmitService;
 import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.DingSubmitOperateEnum;
-import com.qmth.sop.common.enums.DingSubmitStatusEnum;
-import com.qmth.sop.common.enums.ExceptionResultEnum;
-import com.qmth.sop.common.enums.RoleTypeEnum;
+import com.qmth.sop.common.enums.*;
 import com.qmth.sop.common.util.DateDisposeUtils;
 import com.qmth.sop.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
@@ -69,9 +67,17 @@ public class TBDingSubmitServiceImpl extends ServiceImpl<TBDingSubmitMapper, TBD
             }
             supplierId = userSupplierId;
         }
-        return this.baseMapper.findDingSubmitPage(new Page<>(pageNumber, pageSize),
+        IPage<DingSubmitResult> page = this.baseMapper.findDingSubmitPage(new Page<>(pageNumber, pageSize),
                 serviceUnitId, dingSubmitStatusEnumList, submitUserId, archivesName, supplierId, customName, sopNo,
                 violationHoursLimit, dingExceptionLimit, exceptionLimit, dpr);
+        page.getRecords().forEach(e -> {
+            String sopRoleTypeStr = e.getSopRoleTypeStr();
+            if (SystemConstant.strNotNull(sopRoleTypeStr)) {
+                List<SopRoleTypeEnum> sopRoleTypeEnumList = JSONArray.parseArray(sopRoleTypeStr, SopRoleTypeEnum.class);
+                e.setRoleName(sopRoleTypeEnumList.stream().map(SopRoleTypeEnum::getTitle).collect(Collectors.joining(",")));
+            }
+        });
+        return page;
     }
 
     @Override
@@ -196,7 +202,11 @@ public class TBDingSubmitServiceImpl extends ServiceImpl<TBDingSubmitMapper, TBD
                 dto.setMarkPaperEndTime(DateDisposeUtils.getDateStr(e.getMarkPaperEndTime()));
             }
             dto.setArchivesInfo(e.getArchivesInfo());
-            dto.setRoleType(e.getRoleType().getDesc());
+            String sopRoleTypeStr = e.getSopRoleTypeStr();
+            if (SystemConstant.strNotNull(sopRoleTypeStr)) {
+                List<SopRoleTypeEnum> sopRoleTypeEnumList = JSONArray.parseArray(sopRoleTypeStr, SopRoleTypeEnum.class);
+                dto.setRoleType(sopRoleTypeEnumList.stream().map(SopRoleTypeEnum::getTitle).collect(Collectors.joining(",")));
+            }
             dto.setSupplierName(e.getSupplierName());
             dto.setActualDays(e.getActualDays());
             dto.setWeekdays(e.getWeekdays());
@@ -240,7 +250,11 @@ public class TBDingSubmitServiceImpl extends ServiceImpl<TBDingSubmitMapper, TBD
         tbDingSubmit.setScanEndTime(dingSubmitResult.getScanEndTime());
         tbDingSubmit.setMarkPaperStartTime(dingSubmitResult.getMarkPaperStartTime());
         tbDingSubmit.setMarkPaperEndTime(dingSubmitResult.getMarkPaperEndTime());
-        tbDingSubmit.setRoleType(dingSubmitResult.getRoleType());
+        String sopRoleTypeStr = dingSubmitResult.getSopRoleTypeStr();
+        if (SystemConstant.strNotNull(sopRoleTypeStr)) {
+            List<SopRoleTypeEnum> sopRoleTypeEnumList = JSONArray.parseArray(sopRoleTypeStr, SopRoleTypeEnum.class);
+            tbDingSubmit.setRoleName(sopRoleTypeEnumList.stream().map(SopRoleTypeEnum::getTitle).collect(Collectors.joining(",")));
+        }
         tbDingSubmit.setActualDays(dingSubmitResult.getActualDays());
         tbDingSubmit.setWeekdays(dingSubmitResult.getWeekdays());
         tbDingSubmit.setWeekends(dingSubmitResult.getWeekends());

+ 8 - 0
sop-business/src/main/resources/db/log/caozixuan_update_log.sql

@@ -155,3 +155,11 @@ ALTER TABLE sys_ding_obj
 
 -- 2024-05-28
 UPDATE sys_privilege SET related = '2024,2061,2062,3080,3081,3082,3083,3084,3085,3086,3087' WHERE (id = '3079');
+
+-- 2024-05-30
+ALTER TABLE t_b_ding_statistic
+    CHANGE COLUMN sop_role_type role_name VARCHAR(100) CHARACTER SET 'utf8mb4' NOT NULL COMMENT '打卡时该用户在sop的身份集合' ;
+ALTER TABLE t_b_ding_submit
+    CHANGE COLUMN role_type role_name VARCHAR(100) CHARACTER SET 'utf8mb4' NOT NULL COMMENT '项目角色类型' ;
+ALTER TABLE t_b_ding_statistic
+    ADD COLUMN user_id BIGINT NOT NULL COMMENT '打卡用户id' AFTER city;

+ 1 - 1
sop-business/src/main/resources/mapper/TBDingMapper.xml

@@ -17,7 +17,7 @@
             d.mark_paper_end_time markPaperEndTime,
             ua.name user_name,
             ua.`code` user_no,
-            r.`name` role_name,
+            d.role_name as roleName,
             s.NAME supplier,
             d.actual_days attendance,
             d.weekdays weekdays,

+ 8 - 2
sop-business/src/main/resources/mapper/TBDingSubmitMapper.xml

@@ -11,6 +11,8 @@
             sta.custom_name AS customName,
             sta.province AS province,
             sta.city AS city,
+            sta.user_id AS userId,
+            sta.user_archives_id AS archivesId,
             sta.user_archives_code AS archivesCode,
             sta.user_archives_name AS archivesName,
             CONCAT(sta.user_archives_name,
@@ -21,13 +23,14 @@
             sta.scan_end_time AS scanEndTime,
             sta.mark_paper_start_time AS markPaperStartTime,
             sta.mark_paper_end_time AS markPaperEndTime,
-            sta.sop_role_type AS roleType,
+            sta.role_name AS sopRoleTypeStr,
             sta.supplier_name AS supplierName,
             sta.actual_days AS actualDays,
             sta.weekdays AS weekdays,
             sta.weekends AS weekends,
             sta.legal_holidays AS legalHolidays,
             sta.violation_days AS violationDays,
+            sta.work_hours AS workHours,
             sta.ding_exception_count AS dingExceptionCount,
             sta.remain_count AS remainCount,
             sta.exception_count AS exceptionCount,
@@ -108,6 +111,8 @@
             sta.custom_name AS customName,
             sta.province AS province,
             sta.city AS city,
+            sta.user_id AS userId,
+            sta.user_archives_id AS archivesId,
             sta.user_archives_code AS archivesCode,
             sta.user_archives_name AS archivesName,
             CONCAT(sta.user_archives_name,
@@ -118,13 +123,14 @@
             sta.scan_end_time AS scanEndTime,
             sta.mark_paper_start_time AS markPaperStartTime,
             sta.mark_paper_end_time AS markPaperEndTime,
-            sta.sop_role_type AS roleType,
+            sta.role_name AS sopRoleTypeStr,
             sta.supplier_name AS supplierName,
             sta.actual_days AS actualDays,
             sta.weekdays AS weekdays,
             sta.weekends AS weekends,
             sta.legal_holidays AS legalHolidays,
             sta.violation_days AS violationDays,
+            sta.work_hours AS workHours,
             sta.ding_exception_count AS dingExceptionCount,
             sta.remain_count AS remainCount,
             sta.exception_count AS exceptionCount,

+ 2 - 1
sop-task/src/main/java/com/qmth/sop/task/start/StartRunning.java

@@ -90,7 +90,8 @@ public class StartRunning implements CommandLineRunner {
         Map<Object,Object> dingStatisticMap = new HashMap<>();
         dingStatisticMap.put(SystemConstant.NAME, DingStatisticJob.class.getName());
         quartzService.deleteJob(JobEnum.DING_STATISTIC.name(), JobEnum.DING_STATISTIC_GROUP.name());
-        quartzService.addJob(DingStatisticJob.class, JobEnum.DING_STATISTIC.name(), JobEnum.DING_STATISTIC_GROUP.name(), "0 0 2 * * ?", dingStatisticMap);
+//        quartzService.addJob(DingStatisticJob.class, JobEnum.DING_STATISTIC.name(), JobEnum.DING_STATISTIC_GROUP.name(), "0 0 2 * * ?", dingStatisticMap);
+        quartzService.addJob(DingStatisticJob.class, JobEnum.DING_STATISTIC.name(), JobEnum.DING_STATISTIC_GROUP.name(), "0 0/1 6-23 * * ?", dingStatisticMap);
         log.info("考勤统计定时任务 end");
 
         log.info("服务器启动时执行 end");