huangjn 2 ani în urmă
părinte
comite
ad58de9f6d

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ContractLogVO.java

@@ -42,6 +42,9 @@ public class ContractLogVO extends ContractLog {
 
 	private List<String> selectPrimaryKeyIds;
 
+	@ApiModelProperty("是否有删除、废除权限")
+	private boolean operation;
+
 	public void setSelectNodeList(String primaryKeyId, String title){
 		if(this.selectNodeList == null){
 			this.selectNodeList = new ArrayList<>();

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.java

@@ -35,7 +35,7 @@ public interface ContractLogMapper extends BaseMapper<ContractLog> {
 
 	List<ContractLog> queryFillUser(@Param("vo") ContractLogVO vo);
 
-	List<ContractLog> constructionLogPage(@Param("current") Integer current, @Param("size") Integer size, @Param("vo") ContractLogVO vo);
+	List<ContractLog> constructionLogPage(@Param("current") Integer current, @Param("size") Integer size, @Param("vo") ContractLogVO vo, @Param("currentUserId") Long currentUserId);
 
 	Integer selectPageCount(@Param("vo") ContractLogVO vo);
 

+ 33 - 2
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.xml

@@ -29,6 +29,34 @@
         <result column="batch" property="batch"/>
     </resultMap>
 
+    <!-- 通用查询映射结果 -->
+    <resultMap id="contractLogVoResultMap" type="org.springblade.business.vo.ContractLogVO">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="project_id" property="projectId"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="wbs_node_id" property="wbsNodeId"/>
+        <result column="wbs_node_type" property="wbsNodeType"/>
+        <result column="record_time" property="recordTime"/>
+        <result column="record_number" property="recordNumber"/>
+        <result column="project_pileno" property="projectPileno"/>
+        <result column="project_part" property="projectPart"/>
+        <result column="data_id" property="dataId"/>
+        <result column="create_user_name" property="createUserName"/>
+        <result column="file_name" property="fileName"/>
+        <result column="pdf_url" property="pdfUrl"/>
+        <result column="e_visa_pdf_url" property="eVisaPdfUrl"/>
+        <result column="audit_user_id_and_name" property="auditUserIdAndName"/>
+        <result column="batch" property="batch"/>
+        <result column="operation" property="operation"/>
+    </resultMap>
+
     <select id="getSubmitLogDateList" resultType="java.lang.String">
         select record_time from u_contract_log where is_deleted = 0 and wbs_node_id = #{primaryKeyId} and contract_id = #{contractId} and record_time like concat('%',#{year},'%') group by record_time order by record_time DESC
     </select>
@@ -37,7 +65,7 @@
       select create_user, create_user_name from u_contract_log where is_deleted = 0 and wbs_node_id = #{vo.wbsNodeId}
     </select>
 
-    <select id="constructionLogPage" resultMap="contractLogResultMap">
+    <select id="constructionLogPage" resultMap="contractLogVoResultMap">
         select
           id,
           record_time,
@@ -51,7 +79,10 @@
           pdf_url,
           e_visa_pdf_url,
           audit_user_id_and_name,
-          batch
+          batch,
+          CASE
+          WHEN create_user = #{currentUserId} THEN true
+          ELSE false END AS operation
         from
           u_contract_log
         where

+ 5 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/IMessageWarningService.java

@@ -21,6 +21,8 @@ import org.springblade.business.vo.MessageWarningVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  *  服务类
  *
@@ -32,6 +34,8 @@ public interface IMessageWarningService extends BaseService<MessageWarning> {
 	/**
 	 * 保存记录
 	 */
-	void savePushUserMessageWarning(MessageWarningVO vo);
+	void savePushUserMessageWarning(MessageWarningVO vos);
+
+	void savePushUserMessageWarning(List<MessageWarningVO> vo);
 
 }

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java

@@ -27,6 +27,7 @@ import org.springblade.business.vo.FileUserVO;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
@@ -80,7 +81,7 @@ public class ContractLogServiceImpl extends BaseServiceImpl<ContractLogMapper, C
 		//总数
 		Integer count = this.baseMapper.selectPageCount(logVO);
 		//分页信息
-		List<ContractLog> result = this.baseMapper.constructionLogPage(current, logVO.getSize(), logVO);
+		List<ContractLog> result = this.baseMapper.constructionLogPage(current, logVO.getSize(), logVO, AuthUtil.getUserId());
 		//没有数据
 		if(result == null || result.size() == 0){
 			return Condition.getPage(query);

+ 10 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/MessageWarningServiceImpl.java

@@ -16,6 +16,8 @@
  */
 package org.springblade.business.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import org.springblade.business.entity.MessageWarning;
 import org.springblade.business.mapper.MessageWarningMapper;
 import org.springblade.business.service.IMessageWarningService;
@@ -24,6 +26,8 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  *  服务实现类
  *
@@ -33,6 +37,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class MessageWarningServiceImpl extends BaseServiceImpl<MessageWarningMapper, MessageWarning> implements IMessageWarningService {
 
+	@Override
+	public void savePushUserMessageWarning(List<MessageWarningVO> vos) {
+		List<MessageWarning> saveList = JSONArray.parseArray(JSONObject.toJSONString(vos), MessageWarning.class);
+		this.saveBatch(saveList);
+	}
+
 	@Override
 	public void savePushUserMessageWarning(MessageWarningVO vo) {
 		MessageWarning messageWarning = new MessageWarning();

+ 52 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -10,6 +10,7 @@ import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.entity.*;
 import org.springblade.business.mapper.TaskMapper;
 import org.springblade.business.service.*;
+import org.springblade.business.vo.MessageWarningVO;
 import org.springblade.business.vo.TaskApprovalVO;
 import org.springblade.business.vo.TaskVO;
 import org.springblade.common.utils.SnowFlakeUtil;
@@ -31,6 +32,10 @@ import org.springblade.flow.core.feign.NewFlowClient;
 import org.springblade.flow.core.utils.FlowUtil;
 import org.springblade.flow.core.utils.TaskUtil;
 import org.springblade.flow.core.vo.FlowProcessVO;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.manager.feign.ContractClient;
+import org.springblade.manager.feign.ProjectClient;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
@@ -67,6 +72,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
     private final IContractLogService contractLogService;
 
+    private final IMessageWarningService messageWarningService;
+
+    private final ProjectClient projectClient;
+
+    private final ContractClient contractClient;
+
     @Override
     public List<TaskParallel> queryApprovalUser(String formDataIds) {
         //返回结果
@@ -363,6 +374,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             List<TaskParallel> otherLink = this.taskParallelService.queryOtherLinkList(parallelProcessInstanceId);
             //主流程实例ID
             String masterProcessInstanceId;
+
             if(otherLink != null && otherLink.size() > 0){
                 masterProcessInstanceId = otherLink.get(0).getProcessInstanceId();
                 for(TaskParallel parallel : otherLink){
@@ -382,10 +394,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     }
                 }
             } else {
-                //获取主流程数据
-                Task task = this.getOne(Wrappers.<Task>lambdaQuery().eq(Task::getIsDeleted, 0).eq(Task::getProcessInstanceId, currentLink.getProcessInstanceId()));
                 //找到实例ID
-                masterProcessInstanceId = task.getProcessInstanceId();
+                masterProcessInstanceId = currentLink.getProcessInstanceId();
             }
 
             //处理完分支流程后,将主流程结束并设置状态为废除
@@ -398,6 +408,45 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             this.update(Wrappers.<Task>lambdaUpdate().set(Task::getStatus, 3).set(Task::getUpdateTime, new Date()).eq(Task::getProcessInstanceId, masterProcessInstanceId));
             //修改对应的业务数据状态为已废除
             this.updateBusinessDataByFormDataId(this.getOne(Wrappers.<Task>lambdaQuery().eq(Task::getProcessInstanceId, masterProcessInstanceId)), 3, null);
+
+            //查询合同段及项目名称
+            ProjectInfo projectInfo = this.projectClient.queryProjectList(Func.toStrList(masterTask.getProjectId())).get(0);
+            String projectName = StringUtils.isNotEmpty(projectInfo.getProjectAlias()) ? projectInfo.getProjectAlias() : projectInfo.getProjectName();
+            ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(masterTask.getContractId()));
+            String contractName = contractInfo.getContractName();
+
+            try{
+                //设置废除通知信息
+                List<MessageWarningVO> messageWarningList = new ArrayList<>();
+                List<TaskParallel> linkTaskList = this.taskParallelService.list(Wrappers.<TaskParallel>lambdaQuery().eq(TaskParallel::getProcessInstanceId, masterProcessInstanceId));
+                for(TaskParallel parallel : linkTaskList){
+                    if(!currentLink.getId().equals(parallel.getId())){
+                        messageWarningList.add(new MessageWarningVO(
+                                Long.parseLong(masterTask.getProjectId()),
+                                Long.parseLong(masterTask.getContractId()),
+                                3,
+                                "【" + projectName + "-" + contractName + "】的用户【" + AuthUtil.getNickName() + "】废除了【" + masterTask.getTaskName() + "】,废除原因为【" + comment + "】,请及时查看",
+                                Long.parseLong(parallel.getTaskUser()),
+                                0
+                        ));
+                    }
+                }
+
+                //通知上报人
+                messageWarningList.add(new MessageWarningVO(
+                        Long.parseLong(masterTask.getProjectId()),
+                        Long.parseLong(masterTask.getContractId()),
+                        3,
+                        "【" + projectName + "-" + contractName + "】的用户【" + AuthUtil.getNickName() + "】废除了【" + masterTask.getTaskName() + "】,废除原因为【" + comment + "】,请及时查看",
+                        masterTask.getCreateUser(),
+                        0
+                ));
+
+                //生成废除通知
+                this.messageWarningService.savePushUserMessageWarning(messageWarningList);
+            }catch (Exception e){
+                e.printStackTrace();
+            }
         }
 
         return true;