Jelajahi Sumber

fix: 考勤打卡

caozixuan 1 tahun lalu
induk
melakukan
42fba6fe22

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

@@ -238,7 +238,7 @@ public class TBDingController {
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         Long requestUserId = requestUser.getId();
 
-        List<TBCrm> tbCrmList = tbCrmService.findOccupiedCrm(requestUserId, null);
+        List<TBCrm> tbCrmList = tbCrmService.findAllCrm(requestUserId, null);
         if (CollectionUtils.isNotEmpty(tbCrmList)) {
             List<Long> serviceUnitIdList = tbCrmList.stream()
                     .map(TBCrm::getServiceId)
@@ -261,6 +261,9 @@ public class TBDingController {
                 for (TBCrm tbCrm : crmInServiceList) {
                     CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(null, tbCrm.getCrmNo());
                     List<String> sopNoList = tbSopInfoService.findFlowPassageByCrmNo(tbCrm.getCrmNo(), requestUserId);
+                    if (CollectionUtils.isEmpty(sopNoList)){
+                        continue;
+                    }
                     List<SopInfoResult> sopInfo = new ArrayList<>();
                     for (String sopNo : sopNoList) {
                         SopInfoResult result = new SopInfoResult();
@@ -276,9 +279,13 @@ public class TBDingController {
                         }
                         sopInfo.add(result);
                     }
-                    cell.setSopInfo(sopInfo);
+                    if (CollectionUtils.isNotEmpty(sopInfo)){
+                        cell.setSopInfo(sopInfo);
+                    }
+                }
+                if (CollectionUtils.isNotEmpty(cell.getSopInfo())){
+                    resultList.add(cell);
                 }
-                resultList.add(cell);
             }
         }
         return ResultUtil.ok(resultList);

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

@@ -38,13 +38,9 @@ public interface TBCrmMapper extends BaseMapper<TBCrm> {
      * @param dpr           数据权限
      * @return 分页查询结果
      */
-    IPage<CrmServiceResult> findServiceScopePage(@Param("iPage") Page<SysLogResult> iPage,
-                                                 @Param("serviceUnitId") Long serviceUnitId,
-                                                 @Param("city") String city,
-                                                 @Param("productType") ProductTypeEnum productType,
-                                                 @Param("customName") String customName,
-                                                 @Param("bindStatus") Boolean bindStatus,
-                                                 @Param("dpr") DataPermissionDto dpr);
+    IPage<CrmServiceResult> findServiceScopePage(@Param("iPage") Page<SysLogResult> iPage, @Param("serviceUnitId") Long serviceUnitId,
+            @Param("city") String city, @Param("productType") ProductTypeEnum productType, @Param("customName") String customName,
+            @Param("bindStatus") Boolean bindStatus, @Param("dpr") DataPermissionDto dpr);
 
     /**
      * 服务范围管理派单分页查询
@@ -57,13 +53,9 @@ public interface TBCrmMapper extends BaseMapper<TBCrm> {
      * @param dpr           数据权限
      * @return 分页查询结果
      */
-    List<CrmServiceResult> findServiceScopeList(@Param("serviceUnitId") Long serviceUnitId,
-                                                @Param("city") String city,
-                                                @Param("productType") ProductTypeEnum productType,
-                                                @Param("customName") String customName,
-                                                @Param("bindStatus") Boolean bindStatus,
-                                                @Param("dpr") DataPermissionDto dpr);
-
+    List<CrmServiceResult> findServiceScopeList(@Param("serviceUnitId") Long serviceUnitId, @Param("city") String city,
+            @Param("productType") ProductTypeEnum productType, @Param("customName") String customName, @Param("bindStatus") Boolean bindStatus,
+            @Param("dpr") DataPermissionDto dpr);
 
     /**
      * 服务范围管理-未绑定派单分页查询
@@ -77,13 +69,9 @@ public interface TBCrmMapper extends BaseMapper<TBCrm> {
      * @param endTime     派单时间 - 截止
      * @return 分页查询结果
      */
-    IPage<CrmServiceResult> findUnbindOrderPage(@Param("iPage") Page<SysLogResult> iPage,
-                                                @Param("crmUserId") Long crmUserId,
-                                                @Param("productType") ProductTypeEnum productType,
-                                                @Param("customName") String customName,
-                                                @Param("crmNo") String crmNo,
-                                                @Param("startTime") Long startTime,
-                                                @Param("endTime") Long endTime);
+    IPage<CrmServiceResult> findUnbindOrderPage(@Param("iPage") Page<SysLogResult> iPage, @Param("crmUserId") Long crmUserId,
+            @Param("productType") ProductTypeEnum productType, @Param("customName") String customName, @Param("crmNo") String crmNo,
+            @Param("startTime") Long startTime, @Param("endTime") Long endTime);
 
     /**
      * 根据服务单元id集合查询派单部分信息
@@ -100,9 +88,11 @@ public interface TBCrmMapper extends BaseMapper<TBCrm> {
      * @return
      */
 
-    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);
+    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);
 
-    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);
+    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);
 
     /**
      * 根据sopNo查询派单项目信息
@@ -135,8 +125,16 @@ public interface TBCrmMapper extends BaseMapper<TBCrm> {
      * @param userArchivesId 工程师档案id
      * @return 被占用的派单
      */
-    List<TBCrm> findOccupiedCrm(@Param("userId") Long userId,
-                                @Param("userArchivesId") Long userArchivesId);
+    List<TBCrm> findOccupiedCrm(@Param("userId") Long userId, @Param("userArchivesId") Long userArchivesId);
+
+    /**
+     * 查询工程师正在哪个派单上
+     *
+     * @param userId         工程师用户id
+     * @param userArchivesId 工程师档案id
+     * @return 被占用的派单
+     */
+    List<TBCrm> findAllCrm(@Param("userId") Long userId, @Param("userArchivesId") Long userArchivesId);
 
     /**
      * 根据绑定的服务单元id和客户地址查询符合条件的派单
@@ -146,7 +144,6 @@ public interface TBCrmMapper extends BaseMapper<TBCrm> {
      * @param city          城市
      * @return 派单集合
      */
-    List<TBCrm> findByTBCrmListByServiceUnitIdAndAddress(@Param("serviceUnitId") Long serviceUnitId,
-                                                         @Param("province") String province,
-                                                         @Param("city") String city);
+    List<TBCrm> findByTBCrmListByServiceUnitIdAndAddress(@Param("serviceUnitId") Long serviceUnitId, @Param("province") String province,
+            @Param("city") String city);
 }

+ 9 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TBCrmService.java

@@ -151,6 +151,15 @@ public interface TBCrmService extends IService<TBCrm> {
      */
     List<TBCrm> findOccupiedCrm(Long userId, Long userArchivesId);
 
+    /**
+     * 根据工程师 用户id或档案id
+     *
+     * @param userId         用户id
+     * @param userArchivesId 档案id
+     * @return 所有派单
+     */
+    List<TBCrm> findAllCrm(Long userId, Long userArchivesId);
+
     /**
      * 更新派单发布状态
      *

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

@@ -346,6 +346,11 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
         return this.baseMapper.findOccupiedCrm(userId, userArchivesId);
     }
 
+    @Override
+    public List<TBCrm> findAllCrm(Long userId, Long userArchivesId) {
+        return this.baseMapper.findAllCrm(userId, userArchivesId);
+    }
+
     @Transactional
     @Override
     public void updateCrmStatus(String crmNo, CrmStatusEnum status) {

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

@@ -93,16 +93,15 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         String sopNo = Objects.nonNull(tbDing) ? tbDing.getSopNo() : tbDingApply.getSopNo();
         String crmNo = Objects.nonNull(tbDing) ? tbDing.getCrmNo() : tbDingApply.getCrmNo();
 
-        int count = tbDingService.findRemainCount(tbDingApply.getCreateId(), sopNo);
+        int count = tbDingService.findRemainCount(sysUser.getId(), sopNo);
         if (count == 0) {
             throw ExceptionResultEnum.ERROR.exception("该用户剩余补卡次数为0");
         }
         CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
-        Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
+        Optional.ofNullable(crmProjectResult).orElseThrow(ExceptionResultEnum.CRM_NO_NO_DATA::exception);
 
         List<String> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId(), sysUser.getId(), sopNo);
-        List<String> approveUserIds = new ArrayList<>();
-        approveUserIds.addAll(sysUserRoleList);
+        List<String> approveUserIds = new ArrayList<>(sysUserRoleList);
         FlowApproveParam flowApproveParam = new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, approveUserIds, crmNo);
         flowApproveParam.setApproveRemark(FlowApprovePassEnum.START.getTitle());
         Map<String, Object> map = activitiService.taskApprove(flowApproveParam);

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

@@ -184,7 +184,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                 DingFormResult formResult = new DingFormResult();
                 formResult.setDingId(tbDing.getId());
                 formResult.setSignDate(signDate);
-                formResult.setYear(signYear);
+                formResult.setYear(signYear.substring(0,yearEnd));
                 formResult.setSignInInfo(signInInfo);
                 formResult.setSignOutInfo(signOutInfo);
                 formDingList.add(formResult);
@@ -206,7 +206,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                 String signDate = date.substring(dayStart);
 
                 List<DingFormResult> dingFormResultList = formDingList.stream()
-                        .filter(e -> year.equals(e.getYear()) && signDate.equals(e.getSignDate()))
+                        .filter(e -> year.equals(e.getYear().substring(0,yearEnd)) && signDate.equals(e.getSignDate()))
                         .collect(Collectors.toList());
 
                 DingFormResult dingFormResult = new DingFormResult();
@@ -246,6 +246,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                     dingFormResult.setSignInInfo(in);
                     dingFormResult.setSignOutInfo(out);
                     dingFormResult.setSignDate(signDate);
+                    dingFormResult.setYear(year);
                 }
 
 

+ 16 - 0
sop-business/src/main/resources/mapper/TBCrmMapper.xml

@@ -439,6 +439,22 @@
             </if>
         </where>
     </select>
+    <select id="findAllCrm" resultType="com.qmth.sop.business.entity.TBCrm">
+        SELECT
+        tbc.*
+        FROM
+        t_b_user_archives_allocation tbuaa
+        LEFT JOIN
+        t_b_crm tbc ON tbuaa.crm_no = tbc.crm_no
+        <where>
+            <if test="userId != null">
+                AND tbuaa.user_id = #{userId}
+            </if>
+            <if test="userArchivesId != null">
+                AND tbuaa.archives_id = #{userArchivesId}
+            </if>
+        </where>
+    </select>
 
 
 </mapper>