Ver código fonte

Merge branch 'dev_1.1.1' into dev_1.1.2
merge

wangliang 8 meses atrás
pai
commit
047231ab43

+ 5 - 1
sop-api/install/mysql/upgrade/1.1.1.sql

@@ -797,4 +797,8 @@ SET name='人员配置', url='Allocation', `type`='LINK', parent_id=41, `sequenc
 WHERE id=3089;
 UPDATE sys_privilege
 SET name='人员配置', url='Allocation', `type`='LINK', parent_id=42, `sequence`=1, property='AUTH', related='3088,2061', enable=1, default_auth=0, front_display=1
-WHERE id=3090;
+WHERE id=3090;
+
+-- 2024-09-25
+INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('2105', '工时统计-统计计算', '/api/admin/tb/ding/statistic/calculate', 'URL', '29', '3', 'AUTH', '1', '1', '0');
+INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('2106', '统计计算', 'calculate', 'BUTTON', '29', '6', 'AUTH', '2105', '1', '0', '1');

+ 9 - 0
sop-api/src/main/java/com/qmth/sop/server/api/TBDingStatisticController.java

@@ -81,4 +81,13 @@ public class TBDingStatisticController {
         tbDingStatisticService.exportStatisticData(serviceId, type);
         return ResultUtil.ok();
     }
+
+    @ApiOperation(value = "工时统计-统计计算")
+    @RequestMapping(value = "/calculate", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "返回信息", response = Object.class) })
+    @OperationLog(logType = LogTypeEnum.UPDATE)
+    public Result dingStatisticCalculate() {
+        tbDingStatisticService.dingStatisticCalculate();
+        return ResultUtil.ok();
+    }
 }

+ 13 - 2
sop-business/src/main/java/com/qmth/sop/business/mapper/TBDingApplyMapper.java

@@ -32,9 +32,14 @@ public interface TBDingApplyMapper extends BaseMapper<TBDingApply> {
      * @param endTime
      * @param applyStartTime
      * @param applyEndTime
+     * @param roleTypeEnum
      * @return
      */
-    IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("customName") String customName, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime, @Param("dpr") DataPermissionDto dpr);
+    IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, @Param("serviceId") Long serviceId,
+            @Param("name") String name, @Param("supplierId") Long supplierId, @Param("customName") String customName,
+            @Param("startTime") Long startTime, @Param("endTime") Long endTime,
+            @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime,
+            @Param("dpr") DataPermissionDto dpr, @Param("roleTypeEnum") String roleTypeEnum);
 
     /**
      * 异常已审核接口
@@ -49,7 +54,13 @@ public interface TBDingApplyMapper extends BaseMapper<TBDingApply> {
      * @param endTime
      * @param applyStartTime
      * @param applyEndTime
+     * @param roleTypeEnum
      * @return
      */
-    IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("dingExceptionApprove") String dingExceptionApprove, @Param("customName") String customName, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime, @Param("dpr") DataPermissionDto dpr);
+    IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, @Param("serviceId") Long serviceId,
+            @Param("name") String name, @Param("supplierId") Long supplierId,
+            @Param("dingExceptionApprove") String dingExceptionApprove, @Param("customName") String customName,
+            @Param("startTime") Long startTime, @Param("endTime") Long endTime,
+            @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime,
+            @Param("dpr") DataPermissionDto dpr, @Param("roleTypeEnum") String roleTypeEnum);
 }

+ 5 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TBDingStatisticService.java

@@ -89,4 +89,9 @@ public interface TBDingStatisticService extends IService<TBDingStatistic> {
      * @return 结果
      */
     SopPeriodDto findSopPeriod(TBCrmDetail tbCrmDetail);
+
+    /**
+     * 考勤提交及统计计算
+     */
+    void dingStatisticCalculate();
 }

+ 4 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -185,7 +185,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         }
         dpr = roleType == RoleTypeEnum.REGION_COORDINATOR ? null : dpr;
         IPage<DingApplyUnDoneResult> dingApplyUnDoneResultIPage = this.baseMapper.flowTaskUnDoneList(iPage, serviceId,
-                name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
+                name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime, dpr,
+                Objects.nonNull(roleType) ? roleType.name() : null);
         if (Objects.nonNull(dingApplyUnDoneResultIPage) && !CollectionUtils.isEmpty(
                 dingApplyUnDoneResultIPage.getRecords())) {
             for (DingApplyUnDoneResult d : dingApplyUnDoneResultIPage.getRecords()) {
@@ -261,7 +262,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         dpr = roleType == RoleTypeEnum.REGION_COORDINATOR ? null : dpr;
         IPage<DingApplyDoneResult> dingApplyDoneResultIPage = this.baseMapper.flowTaskDoneList(iPage, serviceId, name,
                 supplierId, Objects.nonNull(dingExceptionApprove) ? dingExceptionApprove.name() : null, customName,
-                startTime, endTime, applyStartTime, applyEndTime, dpr);
+                startTime, endTime, applyStartTime, applyEndTime, dpr,
+                Objects.nonNull(roleType) ? roleType.name() : null);
         if (Objects.nonNull(dingApplyDoneResultIPage) && !CollectionUtils.isEmpty(
                 dingApplyDoneResultIPage.getRecords())) {
             for (DingApplyDoneResult d : dingApplyDoneResultIPage.getRecords()) {

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

@@ -135,7 +135,8 @@ public class TBDingStatisticServiceImpl extends ServiceImpl<TBDingStatisticMappe
     @Transactional
     @Override
     public void buildDingStatistic() {
-        Long currentEarliestTime = DateDisposeUtils.getEarliestTime(System.currentTimeMillis());
+//        Long currentEarliestTime = DateDisposeUtils.getEarliestTime(System.currentTimeMillis());
+        Long currentEarliestTime = System.currentTimeMillis();
 
         // 统计前一天的数据
         List<TBDing> datasource = tbDingService.list().stream().filter(e -> {
@@ -503,4 +504,11 @@ public class TBDingStatisticServiceImpl extends ServiceImpl<TBDingStatisticMappe
         sopPeriodDto.setMarkPaperPeriod(markPaperPeriod);
         return sopPeriodDto;
     }
+
+    @Transactional
+    @Override
+    public void dingStatisticCalculate() {
+        this.buildDingStatistic();
+        this.buildStatisticData();
+    }
 }

+ 20 - 0
sop-business/src/main/resources/mapper/TBDingApplyMapper.xml

@@ -92,6 +92,16 @@
             <if test="applyStartTime != null and applyStartTime != '' and applyEndTime != null and applyEndTime != ''">
                 and (tbda.create_time <![CDATA[ >= ]]> #{applyStartTime} and tbda.create_time <![CDATA[ <= ]]> #{applyEndTime})
             </if>
+            <if test="roleTypeEnum != null and roleTypeEnum != ''">
+                <choose>
+                    <when test="roleTypeEnum=='REGION_COORDINATOR'">
+                        AND tbda.sop_no is null
+                    </when>
+                    <otherwise>
+                        AND tbda.sop_no is not null
+                    </otherwise>
+                </choose>
+            </if>
             <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
                 <choose>
                     <when test="dpr.hasBusiness">
@@ -215,6 +225,16 @@
             <if test="applyStartTime != null and applyStartTime != '' and applyEndTime != null and applyEndTime != ''">
                 and (tbda.create_time <![CDATA[ >= ]]> #{applyStartTime} and tbda.create_time <![CDATA[ <= ]]> #{applyEndTime})
             </if>
+            <if test="roleTypeEnum != null and roleTypeEnum != ''">
+                <choose>
+                    <when test="roleTypeEnum=='REGION_COORDINATOR'">
+                        AND tbda.sop_no is null
+                    </when>
+                    <otherwise>
+                        AND tbda.sop_no is not null
+                    </otherwise>
+                </choose>
+            </if>
             <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
                 <choose>
                     <when test="dpr.hasBusiness">

+ 2 - 2
sop-task/src/main/java/com/qmth/sop/task/job/service/impl/JobServiceImpl.java

@@ -305,9 +305,9 @@ public class JobServiceImpl implements JobService {
         tbDingService.autoAddDingRecord(signYear, signDay);
     }
 
+    @Transactional
     @Override
     public void dingStatistic() {
-        tbDingStatisticService.buildDingStatistic();
-        tbDingStatisticService.buildStatisticData();
+        tbDingStatisticService.dingStatisticCalculate();
     }
 }