Эх сурвалжийг харах

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

# Conflicts:
#	sop-business/src/main/java/com/qmth/sop/business/service/impl/TBQualityProblemApplyServiceImpl.java
wangliang 1 жил өмнө
parent
commit
336e30b208

+ 14 - 12
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysNoticeServiceImpl.java

@@ -20,8 +20,11 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * 公告表 服务实现.
@@ -104,20 +107,19 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
     @Override
     @Transactional
     public boolean disable(long[] ids) {
-//        List<SysNotice> sysNotices=new ArrayList<>();
-        for (long id : ids) {
-            SysNotice sysNotice = this.getById(id);
-            sysNotice.setEnable(false);
-            if (NoticeStatusEnum.PUBLISH == sysNotice.getStatus()) {
-                sysNotice.setStatus(NoticeStatusEnum.UN_PUBLISH);
+        //ids数组转化为list
+        List<Long> idList = Arrays.stream(ids).boxed().collect(Collectors.toList());
+        //根据id数组查询公告表
+        List<SysNotice> sysNotices = this.listByIds(idList);
+        sysNotices.forEach(e->{
+            e.setEnable(false);
+            if (NoticeStatusEnum.PUBLISH == e.getStatus()) {
+                e.setStatus(NoticeStatusEnum.UN_PUBLISH);
                 // 需调用撤销发布SysMessage
-                sysMessageService.deleteByNoticeId(id);
+                sysMessageService.deleteByNoticeId(e.getId());
             }
-//            sysNotices.add(sysNotice);
-            this.saveOrUpdate(sysNotice);
-        }
-//        this.updateBatchById(sysNotices);
-        return true;
+        });
+        return this.updateBatchById(sysNotices);
     }
 
     @Override

+ 24 - 19
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBQualityProblemApplyServiceImpl.java

@@ -3,27 +3,24 @@ package com.qmth.sop.business.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.activiti.service.ActivitiService;
-import com.qmth.sop.business.bean.params.FlowApproveParam;
 import com.qmth.sop.business.bean.result.TBQualityProblemApplyResult;
-import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.entity.TBQualityProblemApply;
-import com.qmth.sop.business.entity.TFCustomFlowEntity;
 import com.qmth.sop.business.mapper.TBQualityProblemApplyMapper;
+import com.qmth.sop.business.service.SequenceService;
 import com.qmth.sop.business.service.TBQualityProblemApplyService;
 import com.qmth.sop.business.service.TFCustomFlowEntityService;
-import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.FlowApprovePassEnum;
 import com.qmth.sop.common.enums.InfluenceDegreeEnum;
 import com.qmth.sop.common.enums.QualityProblemReasonEnum;
 import com.qmth.sop.common.enums.QualityProblemTypeEnum;
+import com.qmth.sop.common.enums.TFCustomTypeEnum;
 import com.qmth.sop.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Objects;
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 质量问题反馈表 服务实现.
@@ -43,6 +40,9 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
     @Resource
     ActivitiService activitiService;
 
+    @Resource
+    SequenceService sequenceService;
+
     /**
      * 查询列表
      *
@@ -62,13 +62,20 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
     @Override
     @Transactional
     public Boolean saveTBQualityProblemApply(TBQualityProblemApply tbQualityProblemApply) throws InterruptedException {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbQualityProblemApply.getFlowDeploymentId(), FlowApprovePassEnum.START, tbQualityProblemApply.getFormProperties(), Arrays.asList(String.valueOf(sysUser.getId()))));
-        TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.CUSTOM_FLOW_ENTITY);
-        tbQualityProblemApply.setProblemNo(tfCustomFlowEntity.getCode());
-        tbQualityProblemApply.setId(SystemConstant.getDbUuid());
-        tfCustomFlowEntity.setObjId(tbQualityProblemApply.getId());
-        tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
+        HttpServletRequest request = ServletUtil.getRequest();
+        Map<String, Object> map = new HashMap<>();
+        Map<String, String> formDataMap = new HashMap<>();
+        Map<String, String[]> parameterMap = request.getParameterMap();
+        Set<Map.Entry<String, String[]>> entrySet = parameterMap.entrySet();
+        for (Map.Entry<String, String[]> entry : entrySet) {
+            String key = entry.getKey();
+            String[] value = entry.getValue();
+            formDataMap.put(key, value[0]);
+        }
+        map.putAll(formDataMap);
+        Map<String, Object> resultMap = activitiService.taskApprove(tbQualityProblemApply.getFlowDeploymentId(), tbQualityProblemApply.getApprove(), null, null, tbQualityProblemApply.getFormProperties(), tbQualityProblemApply.getApproveUserIds(), null, map);
+        String problemNo = sequenceService.createFlowCode(TFCustomTypeEnum.QUALITY_PROBLEM_FLOW);
+        tbQualityProblemApply.setProblemNo(problemNo);
         return this.saveOrUpdate(tbQualityProblemApply);
     }
 
@@ -80,10 +87,8 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
     @Override
     @Transactional
     public Boolean delete(long[] ids) {
-        for (long id : ids) {
-            this.removeById(id);
-        }
-        return true;
+        List<Long> idList = Arrays.stream(ids).boxed().collect(Collectors.toList());
+        return this.removeByIds(idList);
     }
 
 }

+ 2 - 2
sop-business/src/main/resources/db/log/shudonghui_update_log.sql

@@ -198,6 +198,6 @@ INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1036, '派单管理', '/api/admin/tb/crm/get', 'URL', 50, 5, 'AUTH', NULL, 1, 1, 0);
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1037, '派单管理', '/api/admin/tb/crm/query', 'URL', 50, 6, 'AUTH', NULL, 1, 1, 0);
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1038, '派单管理', '/api/admin/tb/crm/save', 'URL', 50, 7, 'AUTH', NULL, 1, 1, 0);
-UPDATE `sys_privilege` SET `name` = '派单管理', `url` = 'crm', `type` = 'MENU', `parent_id` = 50, `sequence` = 1, `property` = '1032, 1033,1035,1036,1037,1038', `related` = NULL, `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 51;
-UPDATE `sys_privilege` SET `name` = '统计查询', `url` = 'crmCount', `type` = 'MENU', `parent_id` = 50, `sequence` = 2, `property` = '1034', `related` = NULL, `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 52;
+UPDATE `sop_db`.`sys_privilege` SET `name` = '派单管理', `url` = 'crm', `type` = 'MENU', `parent_id` = 50, `sequence` = 1, `property` = 'AUTH', `related` = '1032, 1033,1035,1036,1037,1038', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 51;
+UPDATE `sop_db`.`sys_privilege` SET `name` = '统计查询', `url` = 'crmCount', `type` = 'MENU', `parent_id` = 50, `sequence` = 2, `property` = 'AUTH', `related` = '1034', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 52;
 -------------------------------