Parcourir la source

Merge remote-tracking branch 'origin/dev_v1.0.0' into dev_v1.0.0

# Conflicts:
#	sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java
wangliang il y a 1 an
Parent
commit
b25b12e9a2

+ 0 - 2
sop-business/src/main/java/com/qmth/sop/business/entity/SysDingGroup.java

@@ -40,11 +40,9 @@ public class SysDingGroup extends BaseEntity implements Serializable {
     private Long supplierId;
 
     @ApiModelProperty(value = "签到时段")
-    @NotBlank(message = "签到时段不能为空")
     private String signInTime;
 
     @ApiModelProperty(value = "签退时段")
-    @NotBlank(message = "签退时段不能为空")
     private String signOutTime;
 
     @ApiModelProperty(value = "是否开启人脸,0:不开启,1:开启")

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

@@ -2,6 +2,7 @@ package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.bean.dto.DataPermissionDto;
 import com.qmth.sop.business.bean.result.DingApplyDoneResult;
 import com.qmth.sop.business.bean.result.DingApplyUnDoneResult;
 import com.qmth.sop.business.entity.TBDingApply;
@@ -35,7 +36,7 @@ public interface TBDingApplyMapper extends BaseMapper<TBDingApply> {
      * @param applyEndTime
      * @return
      */
-    IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, @Param("userIdList") List<String> userIdList, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("customName") String customName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime);
+    IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, @Param("userIdList") List<String> userIdList, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("customName") String customName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime, @Param("dpr") DataPermissionDto dpr);
 
     /**
      * 异常已审核接口
@@ -53,5 +54,5 @@ public interface TBDingApplyMapper extends BaseMapper<TBDingApply> {
      * @param applyEndTime
      * @return
      */
-    IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, @Param("userIdList") List<String> userIdList, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("dingExceptionApprove") String dingExceptionApprove, @Param("customName") String customName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime);
+    IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, @Param("userIdList") List<String> userIdList, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("dingExceptionApprove") String dingExceptionApprove, @Param("customName") String customName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime, @Param("dpr") DataPermissionDto dpr);
 }

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

@@ -30,11 +30,11 @@ public interface TBDingMapper extends BaseMapper<TBDing> {
      * @return
      */
 
-    IPage<TBDingSubmitQueryResult> query(IPage<Map> iPage, @Param("serviceId") Long serviceId, @Param("status") String status, @Param("createId") Long createId, @Param("userName") String userName, @Param("supplierId") Long supplierId, @Param("custom") String custom, @Param("sopNo") String sopNo, @Param("days") Long days);
+    IPage<TBDingSubmitQueryResult> query(IPage<Map> iPage, @Param("serviceId") Long serviceId, @Param("status") String status, @Param("createId") Long createId, @Param("userName") String userName, @Param("supplierId") Long supplierId, @Param("custom") String custom, @Param("sopNo") String sopNo, @Param("days") Long days, @Param("dpr") DataPermissionDto dpr);
 
     List<TBDingSubmitQueryResult> query(@Param("serviceId") Long serviceId, @Param("status") String status, @Param("createId") Long createId, @Param("userName") String userName, @Param("supplierId") Long supplierId, @Param("custom") String custom, @Param("sopNo") String sopNo, @Param("days") Long days);
 
-    TBDingCountResult count(@Param("serviceId") Long serviceId, @Param("createId") Long createId, @Param("userName") String userName, @Param("supplierId") Long supplierId, @Param("custom") String custom, @Param("sopNo") String sopNo);
+    TBDingCountResult count(@Param("serviceId") Long serviceId, @Param("createId") Long createId, @Param("userName") String userName, @Param("supplierId") Long supplierId, @Param("custom") String custom, @Param("sopNo") String sopNo, @Param("dpr") DataPermissionDto dpr);
 
     IPage<TBDingAttendanceResult> attendanceQuery(IPage<Map> iPage, @Param("serviceId") Long serviceId, @Param("userName") String userName, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("supplierId") Long supplierId, @Param("custom") String custom, @Param("sopNo") String sopNo, @Param("type") String type, @Param("status") String status, @Param("dpr")DataPermissionDto dpr);
 

+ 2 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/TBSopInfoMapper.java

@@ -2,6 +2,7 @@ package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.bean.dto.DataPermissionDto;
 import com.qmth.sop.business.bean.result.SopInfoResult;
 import com.qmth.sop.business.entity.TBSopInfo;
 import org.apache.ibatis.annotations.Param;
@@ -80,7 +81,7 @@ public interface TBSopInfoMapper extends BaseMapper<TBSopInfo> {
      * @return
      */
     @SuppressWarnings("MybatisXMapperMethodInspection")
-    IPage<Map> list(IPage<Map> iPage, @Param("type") String type, @Param("serviceId") Long serviceId, @Param("tableName") String tableName, @Param("fieldName") String fieldName, @Param("fieldValue") String fieldValue);
+    IPage<Map> list(IPage<Map> iPage, @Param("type") String type, @Param("serviceId") Long serviceId, @Param("tableName") String tableName, @Param("fieldName") String fieldName, @Param("fieldValue") String fieldValue, @Param("dpr") DataPermissionDto dpr);
 
     /**
      * 根据crmNo查询在途的sop信息

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.activiti.service.ActivitiService;
+import com.qmth.sop.business.bean.dto.DataPermissionDto;
 import com.qmth.sop.business.bean.params.FlowApproveParam;
 import com.qmth.sop.business.bean.result.CrmProjectResult;
 import com.qmth.sop.business.bean.result.DingApplyDoneResult;
@@ -114,8 +115,10 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
      */
     @Override
     public IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, String customName, String startTime, String endTime, Long applyStartTime, Long applyEndTime) throws Exception {
-//        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        IPage<DingApplyUnDoneResult> dingApplyUnDoneResultIPage = this.baseMapper.flowTaskUnDoneList(iPage, null, serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime);
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
+        DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
+
+        IPage<DingApplyUnDoneResult> dingApplyUnDoneResultIPage = this.baseMapper.flowTaskUnDoneList(iPage, null, serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
         if (Objects.nonNull(dingApplyUnDoneResultIPage) && !CollectionUtils.isEmpty(dingApplyUnDoneResultIPage.getRecords())) {
             for (DingApplyUnDoneResult d : dingApplyUnDoneResultIPage.getRecords()) {
                 if (Objects.nonNull(d.getAttachmentPaths())) {
@@ -149,8 +152,10 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
      */
     @Override
     public IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, DingExceptionApproveEnum dingExceptionApprove, String customName, String startTime, String endTime, Long applyStartTime, Long applyEndTime) throws Exception {
-//        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        IPage<DingApplyDoneResult> dingApplyDoneResultIPage = this.baseMapper.flowTaskDoneList(iPage, null, serviceId, name, supplierId, Objects.nonNull(dingExceptionApprove) ? dingExceptionApprove.getTitle() : null, customName, startTime, endTime, applyStartTime, applyEndTime);
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
+        DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
+
+        IPage<DingApplyDoneResult> dingApplyDoneResultIPage = this.baseMapper.flowTaskDoneList(iPage, null, serviceId, name, supplierId, Objects.nonNull(dingExceptionApprove) ? dingExceptionApprove.getTitle() : null, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
         if (Objects.nonNull(dingApplyDoneResultIPage) && !CollectionUtils.isEmpty(dingApplyDoneResultIPage.getRecords())) {
             for (DingApplyDoneResult d : dingApplyDoneResultIPage.getRecords()) {
                 if (Objects.nonNull(d.getAttachmentPaths())) {

+ 12 - 7
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingServiceImpl.java

@@ -27,10 +27,7 @@ import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -390,7 +387,11 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
 
     @Override
     public IPage<TBDingSubmitQueryResult> query(IPage<Map> iPage, Long serviceId, String status, Long createId, String userName, Long supplierId, String custom, String sopNo, Long days) {
-        return this.baseMapper.query(iPage, serviceId, status, createId, userName, supplierId, custom, sopNo, days);
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
+        Long userId = requestUser.getId();
+        DataPermissionDto dpr = sysUserService.buildUserDataPermission(userId);
+
+        return this.baseMapper.query(iPage, serviceId, status, createId, userName, supplierId, custom, sopNo, days, dpr);
     }
 
     @Override
@@ -400,7 +401,10 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
 
     @Override
     public TBDingCountResult count(Long serviceId, Long createId, String userName, Long supplierId, String custom, String sopNo) {
-        return this.baseMapper.count(serviceId, createId, userName, supplierId, custom, sopNo);
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
+        Long userId = requestUser.getId();
+        DataPermissionDto dpr = sysUserService.buildUserDataPermission(userId);
+        return this.baseMapper.count(serviceId, createId, userName, supplierId, custom, sopNo, dpr);
     }
 
     @Override
@@ -447,11 +451,12 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                     dateList = DateDisposeUtils.getDaysBetween(createTime, currentTime, SystemConstant.DEFAULT_DATE_DAY_PATTERN);
                     result.setSopIsEnd(false);
                 }
+                dateList.sort(Collections.reverseOrder());
                 result.setDateFormList(dateList);
             }
         }
         if (CollectionUtils.isNotEmpty(dateList)) {
-            result.setEndDate(dateList.get(dateList.size() - 1));
+            result.setEndDate(dateList.get(0));
         }
         return result;
     }

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

@@ -319,3 +319,9 @@ ALTER TABLE t_b_ding_apply
 
 UPDATE sys_privilege SET property = 'SYS' WHERE (id = '2033');
 UPDATE sys_privilege SET property = 'SYS' WHERE (id = '2035');
+
+-- 2023-09-26
+ALTER TABLE sys_ding_group
+    CHANGE COLUMN sign_in_time sign_in_time VARCHAR(50) NULL COMMENT '签到时段' ,
+    CHANGE COLUMN sign_out_time sign_out_time VARCHAR(50) NULL COMMENT '签退时段' ;
+

+ 50 - 2
sop-business/src/main/resources/mapper/TBDingApplyMapper.xml

@@ -37,7 +37,10 @@
             tbda.create_time as createTime,
             su1.real_name as approveUserName,
             ss.name as supplierName,
-            ss.code as supplierCode
+            ss.code as supplierCode,
+            tbs.service_lead_id as serviceUnitLeaderId,
+            tbc.lead_id as regionManagerId,
+            tbc.region_coordinator_id as coordinatorId
             from ACT_RU_TASK art
                  left join t_f_flow_approve tffa on art.PROC_INST_ID_ = tffa.flow_id
                  left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
@@ -100,6 +103,27 @@
             <if test="applyStartTime != null and applyStartTime != '' and applyEndTime != null and applyEndTime != ''">
                 and (tbda.apply_time <![CDATA[ >= ]]> #{applyStartTime} or tbda.apply_time <![CDATA[ <= ]]> #{applyEndTime})
             </if>
+            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
+                <choose>
+                    <when test="dpr.hasBusiness">
+                        AND tbs.service_lead_id = #{dpr.requestUserId}
+                    </when>
+                    <otherwise>
+                        <choose>
+                            <when test="dpr.hasRegionManager">
+                                AND tbc.lead_id = #{dpr.requestUserId}
+                            </when>
+                            <otherwise>
+                                <choose>
+                                    <when test="dpr.hasRegionCoordinator">
+                                        AND tbc.region_coordinator_id = #{dpr.requestUserId}
+                                    </when>
+                                </choose>
+                            </otherwise>
+                        </choose>
+                    </otherwise>
+                </choose>
+            </if>
         </where>
     </select>
 
@@ -138,7 +162,10 @@
             tbd.id as dingId,
             ss.name as supplierName,
             ss.code as supplierCode,
-            tbda.approve as dingExceptionApprove
+            tbda.approve as dingExceptionApprove,
+            tbs.service_lead_id as serviceUnitLeaderId,
+            tbc.lead_id as regionManagerId,
+            tbc.region_coordinator_id as coordinatorId
         from t_b_ding_apply tbda
             left join t_f_custom_flow_entity tfcfe on tbda.ding_exception_no = tfcfe.code
             left join t_f_flow_approve tffa on tfcfe.flow_id = tffa.flow_id
@@ -217,6 +244,27 @@
             <if test="applyStartTime != null and applyStartTime != '' and applyEndTime != null and applyEndTime != ''">
                 and (t.applyTime <![CDATA[ >= ]]> #{applyStartTime} or t.applyTime <![CDATA[ <= ]]> #{applyEndTime})
             </if>
+            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
+                <choose>
+                    <when test="dpr.hasBusiness">
+                        AND t.serviceUnitLeaderId = #{dpr.requestUserId}
+                    </when>
+                    <otherwise>
+                        <choose>
+                            <when test="dpr.hasRegionManager">
+                                AND t.regionManagerId = #{dpr.requestUserId}
+                            </when>
+                            <otherwise>
+                                <choose>
+                                    <when test="dpr.hasRegionCoordinator">
+                                        AND t.coordinatorId = #{dpr.requestUserId}
+                                    </when>
+                                </choose>
+                            </otherwise>
+                        </choose>
+                    </otherwise>
+                </choose>
+            </if>
         </where>
     </select>
 </mapper>

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

@@ -65,6 +65,27 @@
                    and d.violation_days > #{days}
                    ]]>
                 </if>
+                <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
+                    <choose>
+                        <when test="dpr.hasBusiness">
+                            AND bs.service_lead_id = #{dpr.requestUserId}
+                        </when>
+                        <otherwise>
+                            <choose>
+                                <when test="dpr.hasRegionManager">
+                                    AND crm.lead_id = #{dpr.requestUserId}
+                                </when>
+                                <otherwise>
+                                    <choose>
+                                        <when test="dpr.hasRegionCoordinator">
+                                            AND crm.region_coordinator_id = #{dpr.requestUserId}
+                                        </when>
+                                    </choose>
+                                </otherwise>
+                            </choose>
+                        </otherwise>
+                    </choose>
+                </if>
             </where>
 
         </select>
@@ -194,6 +215,27 @@
             <if test="sopNo != null and sopNo != ''">
                 and d.sop_no like concat('%', #{sopNo} , '%')
             </if>
+            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
+                <choose>
+                    <when test="dpr.hasBusiness">
+                        AND EXISTS(SELECT 1 FROM t_b_service tbs WHERE d.service_id = tbs.id AND tbs.service_lead_id = #{dpr.requestUserId})
+                    </when>
+                    <otherwise>
+                        <choose>
+                            <when test="dpr.hasRegionManager">
+                                AND crm.lead_id = #{dpr.requestUserId}
+                            </when>
+                            <otherwise>
+                                <choose>
+                                    <when test="dpr.hasRegionCoordinator">
+                                        AND crm.region_coordinator_id = #{dpr.requestUserId}
+                                    </when>
+                                </choose>
+                            </otherwise>
+                        </choose>
+                    </otherwise>
+                </choose>
+            </if>
         </where>
     </select>
 

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

@@ -30,8 +30,8 @@
                  tbd.work_hours AS workHours,
                  tbd.violation_days AS violationDays,
                  tbd.ding_exception_count AS dingExceptionCount,
-                 (sdg.reissue_card_count - sec.cnt) AS remainCount,
-                 ec.cnt AS exceptionCount,
+                 (sdg.reissue_card_count - IFNULL(sec.cnt,0)) AS remainCount,
+                 IFNULL(ec.cnt,0) AS exceptionCount,
                  tbds.id AS submitId,
                  IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
                  tbds.submit_user_id AS submitUserId,
@@ -178,8 +178,8 @@
                  tbd.work_hours AS workHours,
                  tbd.violation_days AS violationDays,
                  tbd.ding_exception_count AS dingExceptionCount,
-                 (sdg.reissue_card_count - sec.cnt) AS remainCount,
-                 ec.cnt AS exceptionCount,
+                 (sdg.reissue_card_count - IFNULL(sec.cnt,0)) AS remainCount,
+                 IFNULL(ec.cnt,0) AS exceptionCount,
                  tbds.id AS submitId,
                  IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
                  tbds.submit_user_id AS submitUserId,

+ 28 - 0
sop-business/src/main/resources/mapper/TBSopInfoMapper.xml

@@ -106,6 +106,34 @@
             <if test="fieldValue != null and fieldValue != ''">
                 ${fieldValue}
             </if>
+            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
+                <choose>
+                    <when test="dpr.hasBusiness">
+                        AND tbs.service_lead_id = #{dpr.requestUserId}
+                    </when>
+                    <otherwise>
+                        <choose>
+                            <when test="dpr.hasRegionManager">
+                                AND tbc.lead_id = #{dpr.requestUserId}
+                            </when>
+                            <otherwise>
+                                <choose>
+                                    <when test="dpr.hasRegionCoordinator">
+                                        AND tbc.region_coordinator_id = #{dpr.requestUserId}
+                                    </when>
+                                    <otherwise>
+                                        <choose>
+                                            <when test="dpr.hasEffectEngineer">
+                                                AND EXISTS(SELECT 1 FROM t_b_user_archives_allocation tbuaa WHERE tbc.crm_no = tbuaa.crm_no AND tbuaa.user_id = #{dpr.requestUserId})
+                                            </when>
+                                        </choose>
+                                    </otherwise>
+                                </choose>
+                            </otherwise>
+                        </choose>
+                    </otherwise>
+                </choose>
+            </if>
             <!--and EXISTS(
             select t.* from(select cast(art.PROC_INST_ID_ as Decimal(24)) as flowId
             from