wangliang 1 год назад
Родитель
Сommit
270d7cf1b1

+ 3 - 3
sop-api/install/mysql/init/init.sql

@@ -4467,9 +4467,9 @@ INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `ti
 INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (16, 'SIGN', 'FORM', 'sign', 'sign', '添加签名', 'STRING', 1, 0, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, NULL, 'QUALITY_PROBLEM_FLOW', 4, 0, NULL, NULL, 1, 1);
 INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (17, 'TEXTAREA', 'FORM', 'approve_remark', 'approve_remark', '备注', 'STRING', 0, 0, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 12, NULL, NULL, 'QUALITY_PROBLEM_FLOW', 4, 0, NULL, NULL, 1, 1);
 INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (18, 'RADIO', 'FORM', 'service_scope_radio', 'service_scope_radio', '服务范围', 'STRING', 1, 0, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, '[{\"value\":\"SCAN\",\"label\":\"仅扫描\"},{\"value\":\"SCAN_MARK\",\"label\":\"扫描+阅卷\"}]', 'OFFICE_SOP_FLOW', 1, 0, NULL, NULL, 1, 1);
-INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (19, 'RADIO', 'FORM', 'deploy_way_radio', 'deploy_way_radio', '部署方式', 'STRING', 1, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, '[{\"value\":\"ONLINE\",\"label\":\"线上部署\"},{\"value\":\"LOCAL\",\"label\":\"本地部署\"}]', 'OFFICE_SOP_FLOW', 1, 0, NULL, NULL, 1, 2);
-INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (20, 'RADIO', 'FORM', 'mark_way_radio', 'mark_way_radio', '阅卷方式', 'STRING', 1, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, '[{\"value\":\"TOGETHER\",\"label\":\"集中阅卷\"},{\"value\":\"ANYTIME\",\"label\":\"分散阅卷\"}]', 'OFFICE_SOP_FLOW', 1, 0, NULL, NULL, 1, 3);
-INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (21, 'RADIO', 'FORM', 'scan_net_radio', 'scan_net_radio', '扫描场地网络情况', 'STRING', 1, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, '[{\"value\":\"INTERNET\",\"label\":\"提供外网\"},{\"value\":\"LOCALHOST\",\"label\":\"不提供外网\"}]', 'OFFICE_SOP_FLOW', 1, 0, NULL, NULL, 1, 4);
+INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (19, 'RADIO', 'FORM', 'deploy_way_radio', 'deploy_way_radio', '部署方式', 'STRING', 1, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, '[{\"value\":\"ONLINE\",\"label\":\"线上部署\"},{\"value\":\"LOCAL\",\"label\":\"本地部署\"}]', 'OFFICE_SOP_FLOW', 1, 0, 1000, NULL, 1, 2);
+INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (20, 'RADIO', 'FORM', 'mark_way_radio', 'mark_way_radio', '阅卷方式', 'STRING', 1, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, '[{\"value\":\"TOGETHER\",\"label\":\"集中阅卷\"},{\"value\":\"ANYTIME\",\"label\":\"分散阅卷\"}]', 'OFFICE_SOP_FLOW', 1, 0, 1000, NULL, 1, 3);
+INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (21, 'RADIO', 'FORM', 'scan_net_radio', 'scan_net_radio', '扫描场地网络情况', 'STRING', 1, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, '[{\"value\":\"INTERNET\",\"label\":\"提供外网\"},{\"value\":\"LOCALHOST\",\"label\":\"不提供外网\"}]', 'OFFICE_SOP_FLOW', 1, 0, 1000, NULL, 1, 4);
 INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (22, 'TEXT', 'FORM', 'contacts', 'contacts', '联系人', 'STRING', 1, 0, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, NULL, 'OFFICE_SOP_FLOW', 1, 0, NULL, NULL, 1, 5);
 INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (23, 'TEXT', 'FORM', 'mobile_number', 'mobile_number', '电话', 'STRING', 1, 0, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 6, NULL, NULL, 'OFFICE_SOP_FLOW', 1, 0, NULL, NULL, 1, 6);
 INSERT INTO `t_d_form_widget` (`id`, `code`, `type`, `form_id`, `form_name`, `title`, `input_type`, `required`, `readable`, `writable`, `visable`, `scale`, `length`, `binding`, `data_grid`, `tips`, `format`, `span`, `sub_title`, `options`, `flow_type`, `form_setup`, `handle`, `form_group`, `role_type`, `create_id`, `create_time`) VALUES (24, 'DATE', 'FORM', 'scan_start_time', 'scan_start_time', '扫描开始时间', 'LONG', 1, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, 'yyyy-MM-dd', 6, NULL, NULL, 'OFFICE_SOP_FLOW', 1, 1, NULL, NULL, 1, 7);

+ 2 - 4
sop-api/src/main/java/com/qmth/sop/server/api/TBCrmDetailController.java

@@ -6,7 +6,6 @@ import com.qmth.sop.business.bean.result.EditResult;
 import com.qmth.sop.business.service.TBCrmDetailService;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.ExceptionResultEnum;
-import com.qmth.sop.common.enums.ProductTypeEnum;
 import com.qmth.sop.common.lock.MemoryLock;
 import com.qmth.sop.common.util.Result;
 import com.qmth.sop.common.util.ResultUtil;
@@ -48,8 +47,7 @@ public class TBCrmDetailController {
     @ApiResponses({ @ApiResponse(code = 200, message = "导入成功", response = EditResult.class) })
     public Result sopImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
             @ApiParam(value = "派单号", required = true) @RequestParam String crmNo,
-            @ApiParam(value = "过程变量", required = true) @RequestParam String processVar,
-            @ApiParam(value = "类型", required = true) @RequestParam ProductTypeEnum type) throws IOException {
+            @ApiParam(value = "过程变量", required = true) @RequestParam String processVar) throws IOException {
         boolean lock = memoryLock.lock(SystemConstant.LOCK_CRM_DETAIL_SOP_PREFIX + crmNo, crmNo,
                 SystemConstant.LOCK_CRM_DETAIL_SOP_TIME_OUT);
         if (!lock) {
@@ -57,7 +55,7 @@ public class TBCrmDetailController {
         }
         Map<String, String> map = null;
         try {
-            map = tbCrmDetailService.sopExcelImport(file, crmNo, processVar, type);
+            map = tbCrmDetailService.sopExcelImport(file, crmNo, processVar);
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             if (e instanceof ApiException) {

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TBCrm.java

@@ -98,6 +98,17 @@ public class TBCrm extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "派单发布时间")
     private Long publishTime;
 
+    @ApiModelProperty(value = "过程变量")
+    private String processVar;
+
+    public String getProcessVar() {
+        return processVar;
+    }
+
+    public void setProcessVar(String processVar) {
+        this.processVar = processVar;
+    }
+
     public String getCrmNo() {
         return crmNo;
     }

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

@@ -33,9 +33,6 @@ public class TBCrmDetail extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "sop单号")
     private String sopNo;
 
-    @ApiModelProperty(value = "过程变量")
-    private String processVar;
-
     @ApiModelProperty(value = "状态,UN_PUBLISH:未发布,PUBLISH:发布")
     private CrmStatusEnum status;
 
@@ -70,12 +67,10 @@ public class TBCrmDetail extends BaseEntity implements Serializable {
 
     }
 
-    public TBCrmDetail(String crmNo, String flowDeploymentId, String processVar, CrmDetailImportDto crmDetailImportDto,
-            Long userId) {
+    public TBCrmDetail(String crmNo, String flowDeploymentId, CrmDetailImportDto crmDetailImportDto, Long userId) {
         setId(SystemConstant.getDbUuid());
         this.crmNo = crmNo;
         this.flowDeploymentId = flowDeploymentId;
-        this.processVar = processVar;
         this.courseName = crmDetailImportDto.getCourseName();
         this.examStudentCount = crmDetailImportDto.getExamStudentCount();
         this.contacts = crmDetailImportDto.getContacts();
@@ -117,14 +112,6 @@ public class TBCrmDetail extends BaseEntity implements Serializable {
         this.sopNo = sopNo;
     }
 
-    public String getProcessVar() {
-        return processVar;
-    }
-
-    public void setProcessVar(String processVar) {
-        this.processVar = processVar;
-    }
-
     public CrmStatusEnum getStatus() {
         return status;
     }

+ 1 - 4
sop-business/src/main/java/com/qmth/sop/business/service/TBCrmDetailService.java

@@ -2,7 +2,6 @@ package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.sop.business.entity.TBCrmDetail;
-import com.qmth.sop.common.enums.ProductTypeEnum;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
@@ -24,10 +23,8 @@ public interface TBCrmDetailService extends IService<TBCrmDetail> {
      * @param file
      * @param crmNo
      * @param processVar
-     * @param type
      * @return
      * @throws IOException
      */
-    public Map<String, String> sopExcelImport(MultipartFile file, String crmNo, String processVar, ProductTypeEnum type)
-            throws IOException;
+    public Map<String, String> sopExcelImport(MultipartFile file, String crmNo, String processVar) throws IOException;
 }

+ 15 - 10
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBCrmDetailServiceImpl.java

@@ -4,12 +4,11 @@ import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.sop.business.bean.dto.CrmDetailImportDto;
-import com.qmth.sop.business.entity.SysUser;
-import com.qmth.sop.business.entity.TBCrmDetail;
-import com.qmth.sop.business.entity.TFCustomFlow;
+import com.qmth.sop.business.entity.*;
 import com.qmth.sop.business.mapper.TBCrmDetailMapper;
 import com.qmth.sop.business.service.TBCrmDetailService;
 import com.qmth.sop.business.service.TBCrmService;
+import com.qmth.sop.business.service.TBServiceService;
 import com.qmth.sop.business.service.TFCustomFlowService;
 import com.qmth.sop.business.util.excel.BasicExcelListener;
 import com.qmth.sop.common.contant.SystemConstant;
@@ -55,27 +54,31 @@ public class TBCrmDetailServiceImpl extends ServiceImpl<TBCrmDetailMapper, TBCrm
     @Resource
     TFCustomFlowService tfCustomFlowService;
 
+    @Resource
+    TBServiceService tbServiceService;
+
     /**
      * 派单明细sop导入
      *
      * @param file
      * @param crmNo
      * @param processVar
-     * @param type
      * @return
      * @throws IOException
      */
     @Override
     @Transactional
-    public Map<String, String> sopExcelImport(MultipartFile file, String crmNo, String processVar, ProductTypeEnum type)
-            throws IOException {
+    public Map<String, String> sopExcelImport(MultipartFile file, String crmNo, String processVar) throws IOException {
         log.debug("导入Excel开始...");
         long start = System.currentTimeMillis();
 
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        tbCrmService.findByCrmNo(crmNo);
+        TBCrm tbCrm = tbCrmService.findByCrmNo(crmNo);
+        TBService tbService = tbServiceService.getById(tbCrm.getServiceId());
+        Objects.requireNonNull(tbService, "未找到服务单元");
+
         TFCustomFlow tfCustomFlow = null;
-        if (type == ProductTypeEnum.OFFICE) {
+        if (tbService.getType() == ProductTypeEnum.OFFICE) {
             tfCustomFlow = tfCustomFlowService.findMaxVersion(null, null, TFCustomTypeEnum.OFFICE_SOP_FLOW);
         }
         Objects.requireNonNull(tfCustomFlow, "未找到教务处流程");
@@ -106,14 +109,16 @@ public class TBCrmDetailServiceImpl extends ServiceImpl<TBCrmDetailMapper, TBCrm
                 List<TBCrmDetail> tbCrmDetailList = new ArrayList<>(crmDetailImportDtoList.size());
                 for (int i = 0; i < crmDetailImportDtoList.size(); i++) {
                     CrmDetailImportDto c = crmDetailImportDtoList.get(i);
-                    tbCrmDetailList.add(
-                            new TBCrmDetail(crmNo, tfCustomFlow.getFlowDeploymentId(), processVar, c, sysUser.getId()));
+                    tbCrmDetailList.add(new TBCrmDetail(crmNo, tfCustomFlow.getFlowDeploymentId(), c, sysUser.getId()));
                 }
                 if (!CollectionUtils.isEmpty(tbCrmDetailList)) {
                     successData.add("共导入").add(crmDetailImportDtoList.size() + "").add("条数据");
                     tbCrmDetailService.saveBatch(tbCrmDetailList);
                 }
             }
+            tbCrm.setProcessVar(processVar);
+            tbCrm.updateInfo(sysUser.getId());
+            tbCrmService.updateById(tbCrm);
 
             messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
             messageMap.put(SystemConstant.EXCEL_ERROR, errorData.length() > 0 ? errorData.toString() : "无");

+ 4 - 3
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -13,8 +13,6 @@ CREATE TABLE t_b_crm_detail
         COMMENT '流程部署id' NOT NULL,
     sop_no VARCHAR(100)
         COMMENT 'sop单号' NULL,
-    process_var MEDIUMTEXT
-        COMMENT '过程变量' NOT NULL,
     status VARCHAR(20)
         COMMENT '状态,UN_PUBLISH:未发布,PUBLISH:发布' NOT NULL,
     course_name VARCHAR(255)
@@ -52,4 +50,7 @@ INSERT INTO sys_privilege
 VALUES(3079, '创建sop', 'CreateSop', 'LINK', 51, 4, 'AUTH', NULL, 1, 0, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(3080, '派单管理', '/api/admin/tb/crm/detail/sop/import', 'URL', 3079, 1, 'AUTH', NULL, 1, 1, 0);
+VALUES(3080, '派单管理', '/api/admin/tb/crm/detail/sop/import', 'URL', 3079, 1, 'AUTH', NULL, 1, 1, 0);
+
+ALTER TABLE t_b_crm ADD process_var MEDIUMTEXT
+    COMMENT '过程变量' NULL after publish_time;