Selaa lähdekoodia

add. 区协打卡选择客户

caozixuan 7 kuukautta sitten
vanhempi
commit
e2d747e414

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

@@ -245,7 +245,8 @@ public class TBDingController {
                 if (Objects.isNull(service)) {
                     throw ExceptionResultEnum.ERROR.exception("未找到服务单元");
                 }
-                if (ServiceStatusEnum.FINISH.equals(service.getStatus()) || ServiceStatusEnum.CANCEL.equals(service.getStatus())){
+                if (ServiceStatusEnum.FINISH.equals(service.getStatus()) || ServiceStatusEnum.CANCEL.equals(
+                        service.getStatus())) {
                     // 已关闭和已作废的服务单元不显示打卡信息
                     continue;
                 }
@@ -310,7 +311,8 @@ public class TBDingController {
             if (Objects.isNull(service)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到服务单元");
             }
-            if (ServiceStatusEnum.FINISH.equals(service.getStatus()) || ServiceStatusEnum.CANCEL.equals(service.getStatus())){
+            if (ServiceStatusEnum.FINISH.equals(service.getStatus()) || ServiceStatusEnum.CANCEL.equals(
+                    service.getStatus())) {
                 // 已关闭和已作废的服务单元不显示打卡信息
                 continue;
             }
@@ -329,4 +331,11 @@ public class TBDingController {
         }
         return ResultUtil.ok(resultList);
     }
+
+    @ApiOperation(value = "查询区协可选择的客户")
+    @RequestMapping(value = "/find_custom", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "查询成功", response = SearchResult.class) })
+    public Result findCustomList(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
+        return ResultUtil.ok(tBDingService.findCustomList(serviceId));
+    }
 }

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/params/DingSaveParam.java

@@ -52,6 +52,10 @@ public class DingSaveParam {
     @NotBlank(message = "缺少y坐标")
     private String axisY;
 
+    @ApiModelProperty("区协选择的客户id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long coordinatorCustomId;
+
     public Long getServiceId() {
         return serviceId;
     }
@@ -115,4 +119,12 @@ public class DingSaveParam {
     public void setAxisY(String axisY) {
         this.axisY = axisY;
     }
+
+    public Long getCoordinatorCustomId() {
+        return coordinatorCustomId;
+    }
+
+    public void setCoordinatorCustomId(Long coordinatorCustomId) {
+        this.coordinatorCustomId = coordinatorCustomId;
+    }
 }

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TBDingApply.java

@@ -56,6 +56,10 @@ public class TBDingApply implements Serializable {
     @NotNull(message = "补卡时间不能为空")
     private Long applyTime;
 
+    @ApiModelProperty("区协补卡选择的客户id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long applyCustomId;
+
     @ApiModelProperty(value = "补卡原因")
     @NotBlank(message = "补卡原因不能为空")
     private String reason;
@@ -241,6 +245,14 @@ public class TBDingApply implements Serializable {
         this.applyTime = applyTime;
     }
 
+    public Long getApplyCustomId() {
+        return applyCustomId;
+    }
+
+    public void setApplyCustomId(Long applyCustomId) {
+        this.applyCustomId = applyCustomId;
+    }
+
     public String getReason() {
         return reason;
     }

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

@@ -75,4 +75,13 @@ public interface TBDingMapper extends BaseMapper<TBDing> {
      * @return 暂用的打卡次数
      */
     int findDingExceptionApplyCount(@Param("userId") Long userId, @Param("serviceId") Long serviceId, @Param("sopNo") String sopNo);
+
+    /**
+     * 查询区域协调人可选客户列表
+     *
+     * @param serviceId 服务单元id
+     * @param userId    用户id
+     * @return 查询结果
+     */
+    List<SearchResult> findCoordinatorCustomList(@Param("serviceId") Long serviceId, @Param("userId") Long userId);
 }

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

@@ -148,4 +148,13 @@ public interface TBDingService extends IService<TBDing> {
      * @return 区协打卡时间段
      */
     RegionCoordinatorDingTimeDto findRegionCoordinatorDingTime();
+
+    /**
+     * '
+     * 区协根据服务单元查询可选客户
+     *
+     * @param serviceId 服务单元id
+     * @return 客户集合
+     */
+    List<SearchResult> findCustomList(Long serviceId);
 }

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

@@ -342,9 +342,11 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                 if (tbDingApply.getType() == InOutTypeEnum.IN) {
                     tbDing.setSignInTime(tbDingApply.getApplyTime());
                     tbDing.setSignInAddress("(补卡)");
+                    tbDing.setSignInCustomId(tbDingApply.getApplyCustomId());
                 } else if (tbDingApply.getType() == InOutTypeEnum.OUT) {
                     tbDing.setSignOutTime(tbDingApply.getApplyTime());
                     tbDing.setSignOutAddress("(补卡)");
+                    tbDing.setSignOutCustomId(tbDingApply.getApplyCustomId());
                 }
                 if (Objects.isNull(tbDing.getDateType())) {
                     DingDateTypeEnum dateType = sysDingDateService.getDingDateType(
@@ -386,9 +388,11 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                 if (tbDingApply.getType() == InOutTypeEnum.IN) {
                     tbDing.setSignInTime(tbDingApply.getApplyTime());
                     tbDing.setSignInAddress("(补卡)");
+                    tbDing.setSignInCustomId(tbDingApply.getApplyCustomId());
                 } else if (tbDingApply.getType() == InOutTypeEnum.OUT) {
                     tbDing.setSignOutTime(tbDingApply.getApplyTime());
                     tbDing.setSignOutAddress("(补卡)");
+                    tbDing.setSignOutCustomId(tbDingApply.getApplyCustomId());
                 }
                 DingDateTypeEnum dateType = sysDingDateService.getDingDateType(
                         DateDisposeUtils.timestampToLocalDate(tbDingApply.getApplyTime()));

+ 19 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingServiceImpl.java

@@ -355,6 +355,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
         String facePhotoPath = dingSaveParam.getFacePhotoPath();
         String axisX = dingSaveParam.getAxisX();
         String axisY = dingSaveParam.getAxisY();
+        Long coordinatorCustomId = dingSaveParam.getCoordinatorCustomId();
 
         TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(userId);
         Long userArchivesId = tbUserArchives.getId();
@@ -469,6 +470,9 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                 tbDing.setAxisInX(axisX);
                 tbDing.setAxisInY(axisY);
                 tbDing.setFaceInPass(facePass);
+                if (coordinatorCustomId != null){
+                    tbDing.setSignInCustomId(coordinatorCustomId);
+                }
                 break;
             case OUT: // 签退打卡
                 tbDing.setSignOutTime(signTime);
@@ -476,6 +480,9 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                 tbDing.setAxisOutX(axisX);
                 tbDing.setAxisOutY(axisY);
                 tbDing.setFaceOutPass(facePass);
+                if (coordinatorCustomId != null){
+                    tbDing.setSignOutCustomId(coordinatorCustomId);
+                }
                 break;
             }
             this.save(tbDing);
@@ -492,6 +499,9 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                 tbDing.setAxisInX(axisX);
                 tbDing.setAxisInY(axisY);
                 tbDing.setFaceInPass(facePass);
+                if (coordinatorCustomId != null){
+                    tbDing.setSignInCustomId(coordinatorCustomId);
+                }
                 break;
             case OUT: // 签退打卡
                 tbDing.setSignOutTime(signTime);
@@ -499,6 +509,9 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                 tbDing.setAxisOutX(axisX);
                 tbDing.setAxisOutY(axisY);
                 tbDing.setFaceOutPass(facePass);
+                if (coordinatorCustomId != null){
+                    tbDing.setSignOutCustomId(coordinatorCustomId);
+                }
                 break;
             }
             this.updateById(tbDing);
@@ -828,4 +841,10 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
         }
         return JSON.parseObject(sysConfig.getConfigValue(), RegionCoordinatorDingTimeDto.class);
     }
+
+    @Override
+    public List<SearchResult> findCustomList(Long serviceId) {
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
+        return this.baseMapper.findCoordinatorCustomList(serviceId, requestUser.getId());
+    }
 }

+ 4 - 1
sop-business/src/main/resources/db/log/caozixuan_update_log.sql

@@ -16,4 +16,7 @@ CREATE TABLE `t_b_ding_add` (
     `update_id` BIGINT DEFAULT NULL COMMENT '更新人id',
     `update_time` BIGINT DEFAULT NULL COMMENT '更新时间',
     PRIMARY KEY (`id`) USING BTREE
-)  ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='工时追加表';
+)  ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='工时追加表';
+
+ALTER TABLE t_b_ding_apply
+    ADD COLUMN apply_custom_id BIGINT NULL COMMENT '区协补卡选择的客户id' AFTER reason;

+ 12 - 8
sop-business/src/main/resources/mapper/TBDingApplyMapper.xml

@@ -20,9 +20,9 @@
                      tbs.id as serviceId,
                      tbs.name as serviceName,
                      tbs.type as serviceType,
-                     sc.id as customId,
-                     sc.type as customType,
-                     IFNULL(sc.name,'--') as customName,
+                     IFNULL(sc.id, sca.id) as customId,
+                     IFNULL(sc.type, sca.type) as customType,
+                     IFNULL(sc.name, IFNULL(sca.name, '--')) as customName,
                      tfcfe.create_id as createId,
                      su.real_name as createRealName,
                      tfcfe.flow_id as flowId,
@@ -57,6 +57,8 @@
                 tbs.id = tbda.service_id
                 left join sys_custom sc on
                 sc.id = tbc.custom_id
+                left join sys_custom sca on
+                sca.id = tbda.apply_custom_id
                 left join t_b_ding tbd on
                 tbd.id = tbda.ding_id
                 left join sys_user su on
@@ -84,7 +86,7 @@
                 and ss.id = #{supplierId}
             </if>
             <if test="customName != null and customName != ''">
-                and sc.name like concat('%', #{customName}, '%')
+                and (sc.name like concat('%', #{customName}, '%') or sca.name like concat('%', #{customName}, '%'))
             </if>
             <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
                 and (tbda.apply_time <![CDATA[ >= ]]> #{startTime} and tbda.apply_time <![CDATA[ <= ]]> #{endTime})
@@ -142,9 +144,9 @@
         tbs.id as serviceId,
         tbs.name as serviceName,
         tbs.type as serviceType,
-        sc.id as customId,
-        sc.type as customType,
-        IFNULL(sc.name,'--') as customName,
+        IFNULL(sc.id, sca.id) as customId,
+        IFNULL(sc.type, sca.type) as customType,
+        IFNULL(sc.name, IFNULL(sca.name, '--')) as customName,
         tfcfe.create_id as createId,
         su.real_name as createRealName,
         tfcfe.flow_process_var as flowProcessVar,
@@ -190,6 +192,8 @@
         tbs.id = tbda.service_id
         left join sys_custom sc on
         sc.id = tbc.custom_id
+        left join sys_custom sca on
+        sca.id = tbda.apply_custom_id
         left join t_b_ding tbd on
         tbd.id = tbda.ding_id
         left join sys_user su on
@@ -217,7 +221,7 @@
                 and tbda.approve = #{dingExceptionApprove}
             </if>
             <if test="customName != null and customName != ''">
-                and sc.name like concat('%', #{customName}, '%')
+                and (sc.name like concat('%', #{customName}, '%') or sca.name like concat('%', #{customName}, '%'))
             </if>
             <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
                 and (tbda.apply_time <![CDATA[ >= ]]> #{startTime} and tbda.apply_time <![CDATA[ <= ]]> #{endTime})

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

@@ -161,7 +161,7 @@
         SELECT
         d.sop_no sop_no,
         bs.NAME service,
-        c.NAME custom,
+        IFNULL(c.name,c1.name) as custom,
         ua.province,
         ua.city,
         ua.name user_name,
@@ -184,8 +184,8 @@
         bs.status serviceStatus
         FROM
         (
-        SELECT d.*,d.axis_in_x AS axis_x, d.axis_in_y AS axis_y,d.sign_in_address address, d.sign_in_time sign_time,'IN' AS type FROM t_b_ding d UNION ALL
-        SELECT d.*,d.axis_out_x AS axis_x, d.axis_out_y AS axis_y,d.sign_out_address address, d.sign_out_time sign_time,'OUT' AS type FROM t_b_ding d
+        SELECT d.*,d.axis_in_x AS axis_x, d.axis_in_y AS axis_y,d.sign_in_address address, d.sign_in_time sign_time,'IN' AS type, d.sign_in_custom_id AS custom_id FROM t_b_ding d UNION ALL
+        SELECT d.*,d.axis_out_x AS axis_x, d.axis_out_y AS axis_y,d.sign_out_address address, d.sign_out_time sign_time,'OUT' AS type, d.sign_out_custom_id AS custom_id FROM t_b_ding d
         where
         d.sign_out_time is not null  or
         (d.sign_out_time is  null and
@@ -196,6 +196,7 @@
         LEFT JOIN t_b_service bs ON bs.id = d.service_id
         LEFT JOIN t_b_crm crm ON crm.crm_no = d.crm_no
         LEFT JOIN sys_custom c ON c.id = crm.custom_id
+        LEFT JOIN sys_custom c1 ON c1.id = d.custom_id
         LEFT JOIN sys_supplier s ON s.id = us.supplier_id
         ) a
         <where>
@@ -413,4 +414,28 @@
             </choose>
         </where>
     </select>
+    <select id="findCoordinatorCustomList" resultType="com.qmth.sop.business.bean.result.SearchResult">
+        SELECT
+            t1.id, t1.name AS value
+        FROM
+            (SELECT
+                 custom_id
+             FROM
+                 t_b_crm tbc
+            <where>
+                AND service_id = #{serviceId}
+                AND status = 'PUBLISH'
+                AND EXISTS( SELECT
+                    1
+                FROM
+                    t_b_user_archives_allocation tbuaa
+                WHERE
+                    tbuaa.crm_no = tbc.crm_no
+                AND tbuaa.user_id = #{userId}
+                AND sop_role_type = 'REGION_COORDINATOR')
+            </where>
+             GROUP BY custom_id) t0
+                LEFT JOIN
+            sys_custom t1 ON t0.custom_id = t1.id
+    </select>
 </mapper>