Browse Source

fix:bugfix

caozixuan 1 year ago
parent
commit
2b82b8dcf6

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

@@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.base.BaseEntity;
 import com.qmth.sop.common.base.BaseEntity;
 import com.qmth.sop.common.enums.DingSubmitStatusEnum;
 import com.qmth.sop.common.enums.DingSubmitStatusEnum;
-import com.qmth.sop.common.enums.RoleTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 

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

@@ -89,10 +89,10 @@ public interface TBCrmMapper extends BaseMapper<TBCrm> {
      */
      */
 
 
     IPage<TBCrmResult> query(IPage<Map> iPage, @Param("serviceId") Long serviceId, @Param("isBind") Boolean isBind, @Param("leadId") Long leadId, @Param("crmUserId") Long crmUserId, @Param("type") String type,
     IPage<TBCrmResult> query(IPage<Map> iPage, @Param("serviceId") Long serviceId, @Param("isBind") Boolean isBind, @Param("leadId") Long leadId, @Param("crmUserId") Long crmUserId, @Param("type") String type,
-            @Param("custom") String custom, @Param("crmNo") String crmNo, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
+            @Param("custom") String custom, @Param("crmNo") String crmNo, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("dpr") DataPermissionDto dpr);
 
 
     int count(@Param("serviceId") Long serviceId, @Param("isBind") Boolean isBind, @Param("leadId") Long leadId, @Param("crmUserId") Long crmUserId, @Param("type") String type, @Param("custom") String custom,
     int count(@Param("serviceId") Long serviceId, @Param("isBind") Boolean isBind, @Param("leadId") Long leadId, @Param("crmUserId") Long crmUserId, @Param("type") String type, @Param("custom") String custom,
-            @Param("crmNo") String crmNo, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
+            @Param("crmNo") String crmNo, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("dpr") DataPermissionDto dpr);
 
 
     /**
     /**
      * 根据sopNo查询派单项目信息
      * 根据sopNo查询派单项目信息

+ 6 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBCrmServiceImpl.java

@@ -294,27 +294,31 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
     @Override
     @Override
     public IPage<TBCrmResult> query(IPage<Map> iPage, Long serviceId, Boolean isBind, Long leadId, Long crmUserId,
     public IPage<TBCrmResult> query(IPage<Map> iPage, Long serviceId, Boolean isBind, Long leadId, Long crmUserId,
             ProductTypeEnum type, String custom, String crmNo, Long startTime, Long endTime) {
             ProductTypeEnum type, String custom, String crmNo, Long startTime, Long endTime) {
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         if (custom != null && custom.length() > 0) {
         if (custom != null && custom.length() > 0) {
             custom = SystemConstant.translateSpecificSign(custom);
             custom = SystemConstant.translateSpecificSign(custom);
         }
         }
         if (crmNo != null && crmNo.length() > 0) {
         if (crmNo != null && crmNo.length() > 0) {
             crmNo = SystemConstant.translateSpecificSign(crmNo);
             crmNo = SystemConstant.translateSpecificSign(crmNo);
         }
         }
+        DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
         return this.baseMapper.query(iPage, serviceId, isBind, leadId, crmUserId,
         return this.baseMapper.query(iPage, serviceId, isBind, leadId, crmUserId,
-                Objects.nonNull(type) ? type.name() : null, custom, crmNo, startTime, endTime);
+                Objects.nonNull(type) ? type.name() : null, custom, crmNo, startTime, endTime, dpr);
     }
     }
 
 
     @Override
     @Override
     public int count(Long serviceId, Boolean isBind, Long leadId, Long crmUserId, ProductTypeEnum type, String custom,
     public int count(Long serviceId, Boolean isBind, Long leadId, Long crmUserId, ProductTypeEnum type, String custom,
             String crmNo, Long startTime, Long endTime) {
             String crmNo, Long startTime, Long endTime) {
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         if (custom != null && custom.length() > 0) {
         if (custom != null && custom.length() > 0) {
             custom = SystemConstant.translateSpecificSign(custom);
             custom = SystemConstant.translateSpecificSign(custom);
         }
         }
         if (crmNo != null && crmNo.length() > 0) {
         if (crmNo != null && crmNo.length() > 0) {
             crmNo = SystemConstant.translateSpecificSign(crmNo);
             crmNo = SystemConstant.translateSpecificSign(crmNo);
         }
         }
+        DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
         return this.baseMapper.count(serviceId, isBind, leadId, crmUserId, Objects.nonNull(type) ? type.name() : null,
         return this.baseMapper.count(serviceId, isBind, leadId, crmUserId, Objects.nonNull(type) ? type.name() : null,
-                custom, crmNo, startTime, endTime);
+                custom, crmNo, startTime, endTime, dpr);
     }
     }
 
 
     /**
     /**

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

@@ -240,14 +240,19 @@
             </if>
             </if>
             <if test="startTime != null and startTime != '' ">
             <if test="startTime != null and startTime != '' ">
                 <![CDATA[
                 <![CDATA[
-               and a.create_time >= #{startTime}
+               and a.begin_time >= #{startTime}
                ]]>
                ]]>
             </if>
             </if>
             <if test="endTime != null and endTime != ''">
             <if test="endTime != null and endTime != ''">
                 <![CDATA[
                 <![CDATA[
-                and a.create_time <= #{endTime}
+                and a.begin_time <= #{endTime}
                 ]]>
                 ]]>
             </if>
             </if>
+            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo and !dpr.hasBusiness">
+                <if test="dpr.hasRegionManager">
+                    AND a.lead_id = #{dpr.requestUserId}
+                </if>
+            </if>
         </where>
         </where>
 
 
 
 
@@ -435,14 +440,19 @@
             </if>
             </if>
             <if test="startTime != null and startTime != '' ">
             <if test="startTime != null and startTime != '' ">
                 <![CDATA[
                 <![CDATA[
-               and a.create_time >= #{startTime}
+               and a.begin_time >= #{startTime}
                ]]>
                ]]>
             </if>
             </if>
             <if test="endTime != null and endTime != ''">
             <if test="endTime != null and endTime != ''">
                 <![CDATA[
                 <![CDATA[
-                and a.create_time <= #{endTime}
+                and a.begin_time <= #{endTime}
                 ]]>
                 ]]>
             </if>
             </if>
+            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo and !dpr.hasBusiness">
+                <if test="dpr.hasRegionManager">
+                    AND a.lead_id = #{dpr.requestUserId}
+                </if>
+            </if>
         </where>
         </where>
     </select>
     </select>
     <select id="findAllCrm" resultType="com.qmth.sop.business.entity.TBCrm">
     <select id="findAllCrm" resultType="com.qmth.sop.business.entity.TBCrm">

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

@@ -68,21 +68,21 @@ public class StartRunning implements CommandLineRunner {
 //        log.info("rtzf用户推送定时任务 start");
 //        log.info("rtzf用户推送定时任务 start");
 //        Map<Object,Object> rtzfUserPushMap = new HashMap<>();
 //        Map<Object,Object> rtzfUserPushMap = new HashMap<>();
 //        rtzfUserPushMap.put(SystemConstant.NAME, RtzfUserPushJob.class.getName());
 //        rtzfUserPushMap.put(SystemConstant.NAME, RtzfUserPushJob.class.getName());
-//        quartzService.deleteJob(JobEnum.SYNC_RTZF_USER_PUSH.name(), JobEnum.SYNC_RTZF_USER_PUSH_GROUP.name());
+        quartzService.deleteJob(JobEnum.SYNC_RTZF_USER_PUSH.name(), JobEnum.SYNC_RTZF_USER_PUSH_GROUP.name());
 //        quartzService.addJob(RtzfUserPushJob.class, JobEnum.SYNC_RTZF_USER_PUSH.name(), JobEnum.SYNC_RTZF_USER_PUSH_GROUP.name(), "0 0/5 6-23 * * ?", rtzfUserPushMap);
 //        quartzService.addJob(RtzfUserPushJob.class, JobEnum.SYNC_RTZF_USER_PUSH.name(), JobEnum.SYNC_RTZF_USER_PUSH_GROUP.name(), "0 0/5 6-23 * * ?", rtzfUserPushMap);
 //        log.info("rtzf用户推送定时任务 end");
 //        log.info("rtzf用户推送定时任务 end");
 //
 //
 //        log.info("rtzf用户更新定时任务 start");
 //        log.info("rtzf用户更新定时任务 start");
 //        Map<Object,Object> rtzfUserUpdateMap = new HashMap<>();
 //        Map<Object,Object> rtzfUserUpdateMap = new HashMap<>();
 //        rtzfUserUpdateMap.put(SystemConstant.NAME, RtzfUserUpdateJob.class.getName());
 //        rtzfUserUpdateMap.put(SystemConstant.NAME, RtzfUserUpdateJob.class.getName());
-//        quartzService.deleteJob(JobEnum.SYNC_RTZF_USER_UPDATE.name(), JobEnum.SYNC_RTZF_USER_UPDATE_GROUP.name());
+        quartzService.deleteJob(JobEnum.SYNC_RTZF_USER_UPDATE.name(), JobEnum.SYNC_RTZF_USER_UPDATE_GROUP.name());
 //        quartzService.addJob(RtzfUserUpdateJob.class, JobEnum.SYNC_RTZF_USER_UPDATE.name(), JobEnum.SYNC_RTZF_USER_UPDATE_GROUP.name(), "0 2/5 6-23 * * ?", rtzfUserUpdateMap);
 //        quartzService.addJob(RtzfUserUpdateJob.class, JobEnum.SYNC_RTZF_USER_UPDATE.name(), JobEnum.SYNC_RTZF_USER_UPDATE_GROUP.name(), "0 2/5 6-23 * * ?", rtzfUserUpdateMap);
 //        log.info("rtzf用户更新定时任务 end");
 //        log.info("rtzf用户更新定时任务 end");
 //
 //
 //        log.info("自动打卡定时任务 start");
 //        log.info("自动打卡定时任务 start");
 //        Map<Object,Object> autoAddDingRecordMap = new HashMap<>();
 //        Map<Object,Object> autoAddDingRecordMap = new HashMap<>();
 //        autoAddDingRecordMap.put(SystemConstant.NAME, AutoAddDingRecordJob.class.getName());
 //        autoAddDingRecordMap.put(SystemConstant.NAME, AutoAddDingRecordJob.class.getName());
-//        quartzService.deleteJob(JobEnum.AUTO_ADD_DING_RECORD.name(), JobEnum.AUTO_ADD_DING_RECORD_GROUP.name());
+        quartzService.deleteJob(JobEnum.AUTO_ADD_DING_RECORD.name(), JobEnum.AUTO_ADD_DING_RECORD_GROUP.name());
 //        quartzService.addJob(AutoAddDingRecordJob.class, JobEnum.AUTO_ADD_DING_RECORD.name(), JobEnum.AUTO_ADD_DING_RECORD_GROUP.name(), "0 30 23 * * ?", autoAddDingRecordMap);
 //        quartzService.addJob(AutoAddDingRecordJob.class, JobEnum.AUTO_ADD_DING_RECORD.name(), JobEnum.AUTO_ADD_DING_RECORD_GROUP.name(), "0 30 23 * * ?", autoAddDingRecordMap);
 //        log.info("自动打卡定时任务 end");
 //        log.info("自动打卡定时任务 end");
 
 
@@ -91,7 +91,7 @@ public class StartRunning implements CommandLineRunner {
         dingStatisticMap.put(SystemConstant.NAME, DingStatisticJob.class.getName());
         dingStatisticMap.put(SystemConstant.NAME, DingStatisticJob.class.getName());
         quartzService.deleteJob(JobEnum.DING_STATISTIC.name(), JobEnum.DING_STATISTIC_GROUP.name());
         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);
+        quartzService.addJob(DingStatisticJob.class, JobEnum.DING_STATISTIC.name(), JobEnum.DING_STATISTIC_GROUP.name(), "0 0/1 * * * ?", dingStatisticMap);
         log.info("考勤统计定时任务 end");
         log.info("考勤统计定时任务 end");
 
 
         log.info("服务器启动时执行 end");
         log.info("服务器启动时执行 end");