Prechádzať zdrojové kódy

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

wangliang 1 rok pred
rodič
commit
91872de138

+ 5 - 2
sop-api/src/main/java/com/qmth/sop/server/api/TBServiceRegionController.java

@@ -18,6 +18,8 @@ import javax.annotation.Resource;
 import javax.validation.Valid;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -62,8 +64,9 @@ public class TBServiceRegionController {
     @RequestMapping(value = "/remove", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "删除成功", response = ServiceRegionResult.class)})
     @OperationLog(logType = LogTypeEnum.DELETE)
-    public Result removeServiceRegion(@ApiParam(value = "服务单元id") @RequestParam(required = false) String serviceRegionId) {
-        tbServiceRegionService.removeServiceRegion(SystemConstant.convertIdToLong(serviceRegionId));
+    public Result removeServiceRegion(@ApiParam(value = "服务单元id") @RequestParam(required = false) List<String> serviceRegionIdList) {
+        List<Long> idList = serviceRegionIdList.stream().map(Long::parseLong).collect(Collectors.toList());
+        tbServiceRegionService.removeServiceRegion(idList);
         return ResultUtil.ok();
     }
 

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/TaskListResult.java

@@ -42,6 +42,9 @@ public class TaskListResult implements Serializable {
     @ApiModelProperty(value = "创建时间")
     Long createTime;
 
+    @ApiModelProperty(value = "更新时间")
+    Long updateTime;
+
     @ApiModelProperty(value = "是否有导入文件")
     Boolean hasImportFile;
 
@@ -118,6 +121,14 @@ public class TaskListResult implements Serializable {
         this.createTime = createTime;
     }
 
+    public Long getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Long updateTime) {
+        this.updateTime = updateTime;
+    }
+
     public Boolean getHasImportFile() {
         return hasImportFile;
     }

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

@@ -42,7 +42,7 @@ public class SysDevice extends BaseEntity implements Serializable {
     private String model;
 
     @ApiModelProperty(value = "购买时间")
-    @NotNull(message = "购买时间不能为空")
+//    @NotNull(message = "购买时间不能为空")
     private Long buyTime;
 
     @ApiModelProperty(value = "供应商id")

+ 2 - 2
sop-business/src/main/java/com/qmth/sop/business/service/TBServiceRegionService.java

@@ -45,9 +45,9 @@ public interface TBServiceRegionService extends IService<TBServiceRegion> {
     /**
      * 删除大区规划
      *
-     * @param serviceRegionId 删除服务区域规划
+     * @param serviceRegionIdList 删除服务区域规划
      */
-    void removeServiceRegion(Long serviceRegionId);
+    void removeServiceRegion(List<Long> serviceRegionIdList);
 
 
     /**

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

@@ -511,7 +511,7 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
                         matchInfoError = String.format("纷享销客派单[%s]中的相关信息在质控平台中缺失,请先补充质控平台系统的派单相关信息: %s \n", crmNo, matchInfoError);
                         errorMsgList.add(matchInfoError);
                     } else {
-                        // 没有任何异常 -> 组装信息
+                        // 没有任何异常 -> 组装信息(派单号重复的不同步)
                         List<TBCrm> tbCrmList = this.list(new QueryWrapper<TBCrm>()
                                 .lambda()
                                 .eq(TBCrm::getCrmNo, crmNo)
@@ -532,8 +532,8 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
                             tbCrm.setEnable(true);
                             tbCrm.setStatus(CrmStatusEnum.UN_PUBLISH);
                             this.save(tbCrm);
-                            successCount++;
                         }
+                        successCount++;
                     }
                 }
             }
@@ -541,7 +541,7 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
                 throw ExceptionResultEnum.ERROR.exception(String.join(";\n", errorMsgList));
             }
             map.put(SystemConstant.SUCCESS, successCount);
-            map.put(SystemConstant.ERROR, totalCount - successCount);
+            map.put(SystemConstant.RESULT_ERROR, totalCount - successCount);
             return map;
         } catch (Exception e) {
             throw ExceptionResultEnum.ERROR.exception(e.getMessage());

+ 22 - 20
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBServiceRegionServiceImpl.java

@@ -213,28 +213,30 @@ public class TBServiceRegionServiceImpl extends ServiceImpl<TBServiceRegionMappe
 
     @Transactional
     @Override
-    public void removeServiceRegion(Long serviceRegionId) {
-        // 物理删除
-        TBServiceRegion tbServiceRegion = this.getById(serviceRegionId);
-        if (Objects.isNull(tbServiceRegion)) {
-            throw ExceptionResultEnum.ERROR.exception("服务区域规划不存在");
-        }
-        // 同时清除派单和大区经理的关系
-        Long serviceId = tbServiceRegion.getServiceId();
-        Long leadId = tbServiceRegion.getLeadId();
-        UpdateWrapper<TBCrm> crmUpdateWrapper = new UpdateWrapper<>();
-        crmUpdateWrapper.lambda()
-                .eq(TBCrm::getServiceId, serviceId)
-                .eq(TBCrm::getLeadId, leadId)
-                .set(TBCrm::getLeadId, null);
-        tbCrmService.update(crmUpdateWrapper);
+    public void removeServiceRegion(List<Long> serviceRegionIdList) {
+        for (Long serviceRegionId : serviceRegionIdList) {
+            // 物理删除
+            TBServiceRegion tbServiceRegion = this.getById(serviceRegionId);
+            if (Objects.isNull(tbServiceRegion)) {
+                throw ExceptionResultEnum.ERROR.exception("服务区域规划不存在");
+            }
+            // 同时清除派单和大区经理的关系
+            Long serviceId = tbServiceRegion.getServiceId();
+            Long leadId = tbServiceRegion.getLeadId();
+            UpdateWrapper<TBCrm> crmUpdateWrapper = new UpdateWrapper<>();
+            crmUpdateWrapper.lambda()
+                    .eq(TBCrm::getServiceId, serviceId)
+                    .eq(TBCrm::getLeadId, leadId)
+                    .set(TBCrm::getLeadId, null);
+            tbCrmService.update(crmUpdateWrapper);
 
-        // 删除派单规划详情
-        tbServiceRegionDetailService.remove(new QueryWrapper<TBServiceRegionDetail>().lambda().eq(TBServiceRegionDetail::getServiceRegionId, tbServiceRegion.getId()));
+            // 删除派单规划详情
+            tbServiceRegionDetailService.remove(new QueryWrapper<TBServiceRegionDetail>().lambda().eq(TBServiceRegionDetail::getServiceRegionId, tbServiceRegion.getId()));
 
-        // 删除派单规划
-        tbServiceRegion.setEnable(false);
-        this.removeById(tbServiceRegion);
+            // 删除派单规划
+            tbServiceRegion.setEnable(false);
+            this.removeById(tbServiceRegion);
+        }
     }
 
     @Override

+ 2 - 0
sop-business/src/main/java/com/qmth/sop/business/templete/execute/AsyncFxxkCrmSyncService.java

@@ -51,6 +51,7 @@ public class AsyncFxxkCrmSyncService extends AsyncSyncDataTaskTemplate {
             int successSize = Integer.parseInt(String.valueOf(result.get(SystemConstant.SUCCESS)));
             int errorSize = Integer.parseInt(String.valueOf(result.get(SystemConstant.RESULT_ERROR)));
             stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}{4}{5}{6}{7}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), FINISH_TITLE, (successSize + errorSize), FINISH_TOTAL_SIZE, successSize, FINISH_SUCCESS_SIZE, errorSize, FINISH_ERROR_SIZE));
+            tbTask.setResult(TaskResultEnum.SUCCESS);
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_TITLE, EXCEPTION_DATA, e.getMessage()));
@@ -60,6 +61,7 @@ public class AsyncFxxkCrmSyncService extends AsyncSyncDataTaskTemplate {
             } else {
                 ResultUtil.error(e.getMessage());
             }
+            tbTask.setResult(TaskResultEnum.ERROR);
         } finally {//生成txt文件
             tbTask.setSummary(stringJoinerSummary.toString());
             super.createTxt(tbTask);