Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
a33f2f19b4
  1. 21
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
  2. 8
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java
  3. 1
      hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql
  4. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml
  5. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  6. 40
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  7. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  8. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java
  9. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java
  10. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java

21
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java

@ -1,5 +1,6 @@
package com.hnac.hzims.middle.processflow.consumer; package com.hnac.hzims.middle.processflow.consumer;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
@ -41,6 +42,21 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
log.info("监听到数据:{}", message); log.info("监听到数据:{}", message);
ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class); ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class);
String taskDefinitionKey = response.getProcessDefinitionKey(); String taskDefinitionKey = response.getProcessDefinitionKey();
//记录操作日志
WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response,regularWorkflowOperationLog);
if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) {
regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
regularWorkflowOperationLog.setTakeId(response.getTaskId());
regularWorkflowOperationLog.setTakeName(response.getTaskName());
regularWorkflowOperationLog.setIsOperationLog(true);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog);
workflowOperationLogService.save(regularWorkflowOperationLog);
}
WorkflowQueue ticker = new WorkflowQueue(); WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey); ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类 //判断执行具体的实现类
@ -58,6 +74,11 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog(); WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response,workflowOperationLog); BeanUtils.copyProperties(response,workflowOperationLog);
if (ObjectUtils.isNotEmpty(workflowOperationLog)) { if (ObjectUtils.isNotEmpty(workflowOperationLog)) {
regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
regularWorkflowOperationLog.setTakeId(response.getTaskId());
regularWorkflowOperationLog.setTakeName(response.getTaskName());
regularWorkflowOperationLog.setIsOperationLog(false);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog); log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog);
workflowOperationLogService.save(workflowOperationLog); workflowOperationLogService.save(workflowOperationLog);
} }

8
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java

@ -68,7 +68,7 @@ public class WorkflowOperationLog implements Serializable {
/** /**
* 用户Id * 用户Id
*/ */
@TableField("variables") @TableField("user_id")
private String userId; private String userId;
@ -92,4 +92,10 @@ public class WorkflowOperationLog implements Serializable {
private Boolean Deleted; private Boolean Deleted;
/**
* 记录正常日志 或错误日志
*/
private Boolean isOperationLog;
} }

1
hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql

@ -0,0 +1 @@
alter table hzims_workflow_operation_log add is_operation_log tinyint(1) comment '1 正常日志 0 错误日志';

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml

@ -30,12 +30,12 @@
</resultMap> </resultMap>
<select id="getList" resultType="com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity"> <select id="getList" resultType="com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity">
SELECT * FROM HZIMS_OPER_ACCESS_MATERIAL SELECT * FROM HZIMS_OPER_ACCESS_MATERIAL
WHERE WHERE IS_DELETE = 0
<if test="planId !=null and planId != ''"> <if test="planId !=null and planId != ''">
PLAN_ID = #{planId,jdbcType=BIGINT} AND PLAN_ID = #{planId,jdbcType=BIGINT}
</if> </if>
<if test="taskId !=null and taskId != ''"> <if test="taskId !=null and taskId != ''">
TASK_ID = #{taskId,jdbcType=BIGINT} AND TASK_ID = #{taskId,jdbcType=BIGINT}
</if> </if>
</select> </select>

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml

@ -48,48 +48,46 @@
</select> </select>
<select id="pageCondition" resultType="com.hnac.hzims.operational.access.vo.OperAccessTaskVO"> <select id="pageCondition" resultType="com.hnac.hzims.operational.access.vo.OperAccessTaskVO">
SELECT SELECT t.*,p.name as planName
t1.*, t3.`NAME` as planName FROM hzims_oper_access_task t
FROM left join hzims_oper_access_plan p
hzims_oper_access_task t1 LEFT JOIN hzims_oper_access_content t2 ON t1.ID = t2.ID on t.plan_id = p.id
AND t2.IS_DELETED = 0 LEFT JOIN hzims_oper_access_plan t3 ON t2.PLAN_ID = t3.ID
AND t3.IS_DELETED = 0
WHERE WHERE
t1.IS_DELETED =0 t1.IS_DELETED =0
<if test="req.id != null"> <if test="req.id != null">
and t1.id = #{req.id} and t.id = #{req.id}
</if> </if>
<if test="req.code != null and req.code != ''"> <if test="req.code != null and req.code != ''">
AND t1.`CODE` LIKE CONCAT('%',#{req.code},'%') AND t.`CODE` LIKE CONCAT('%',#{req.code},'%')
</if> </if>
<if test="req.handler != null"> <if test="req.handler != null">
AND t1.`HANDLER`=#{req.handler} AND t.`HANDLER`=#{req.handler}
</if> </if>
<if test="req.status != null"> <if test="req.status != null">
AND t1.`STATUS`=#{req.status} AND t.`STATUS`=#{req.status}
</if> </if>
<if test="req.planId != null"> <if test="req.planId != null">
AND t3.ID =#{req.planId} AND p.ID =#{req.planId}
</if> </if>
<if test="req.name != null and req.name != ''"> <if test="req.name != null and req.name != ''">
AND t1.`NAME` LIKE CONCAT('%',#{req.name},'%') AND t.`NAME` LIKE CONCAT('%',#{req.name},'%')
</if> </if>
<if test="req.excludeNullTicket != null and req.excludeNullTicket == 1"> <if test="req.excludeNullTicket != null and req.excludeNullTicket == 1">
and t1.`TICKET_ID` is null and t.`TICKET_ID` is null
</if> </if>
<if test="req.startTime != null and req.startTime != ''"> <if test="req.startTime != null and req.startTime != ''">
and t1.`PLAN_START_TIME` &gt; #{req.startTime} and t.`PLAN_START_TIME` &gt; #{req.startTime}
</if> </if>
<if test="req.endTime != null and req.startTime != '' "> <if test="req.endTime != null and req.startTime != '' ">
and t1.`PLAN_START_TIME` &lt; #{req.endTime} and t.`PLAN_START_TIME` &lt; #{req.endTime}
</if> </if>
<if test="req.deptIds != null"> <if test="req.deptIds != null">
and t1.create_dept in and t.create_dept in
<foreach collection="req.deptIds" item="item" index="index" open="(" close=")" separator=","> <foreach collection="req.deptIds" item="item" index="index" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
ORDER BY t1.ID DESC ORDER BY t.ID DESC
</select> </select>
<select id="selectByEmCode" resultType="com.hnac.hzims.operational.access.entity.OperAccessTaskEntity" parameterType="list"> <select id="selectByEmCode" resultType="com.hnac.hzims.operational.access.entity.OperAccessTaskEntity" parameterType="list">

40
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

@ -8,6 +8,7 @@ import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.dto.*; import com.hnac.hzims.operational.access.dto.*;
import com.hnac.hzims.operational.access.entity.OperAccessContentDetailEntity;
import com.hnac.hzims.operational.access.entity.OperAccessContentEntity; import com.hnac.hzims.operational.access.entity.OperAccessContentEntity;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity;
@ -51,6 +52,8 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
private final IOperAccessContentService contentService; private final IOperAccessContentService contentService;
private final IOperAccessContentDetailService contentDetailService;
private final AccessTaskV4Service accessTaskV4Service; private final AccessTaskV4Service accessTaskV4Service;
private final ISysClient sysClient; private final ISysClient sysClient;
@ -105,23 +108,18 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
return; return;
} }
// 查询计划是否绑定检修材料 // 查询计划是否绑定检修材料
List<OperAccessMaterialEntity> existsDetails = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{ List<OperAccessMaterialEntity> materials = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{
eq(OperAccessMaterialEntity::getPlanId, entity.getId()); eq(OperAccessMaterialEntity::getPlanId, entity.getId());
eq(OperAccessMaterialEntity::getIsDeleted, 0L); eq(OperAccessMaterialEntity::getIsDeleted, 0L);
}}); }});
Set<Long> detailIds = entity.getAccessMaterials().stream().map(OperAccessMaterialDTO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); log.error("save_access_material : {}",materials);
List<Long> ids = existsDetails.stream().map(OperAccessMaterialEntity::getId).filter(id -> !detailIds.contains(id)).collect(Collectors.toList()); if(CollectionUtil.isNotEmpty(materials)){
if (!CollectionUtils.isEmpty(ids)) { materialService.deleteLogic(materials.stream().map(OperAccessMaterialEntity::getId).collect(Collectors.toList()));
materialService.deleteLogic(ids);
} }
// 材料添加/修改 for (OperAccessMaterialDTO material : entity.getAccessMaterials()){
for (OperAccessMaterialDTO material : entity.getAccessMaterials()) { material.setId(null);
material.setPlanId(entity.getId()); material.setPlanId(entity.getId());
if (ObjectUtil.isEmpty(material.getId())) { materialService.save(material);
materialService.doSave(material);
continue;
}
materialService.updateById(material);
} }
} }
@ -143,7 +141,23 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
} }
for (OperAccessContentDTO detail : entity.getAccessContents()){ for (OperAccessContentDTO detail : entity.getAccessContents()){
detail.setPlanId(entity.getId()); detail.setPlanId(entity.getId());
detail.setId(null);
contentService.save(detail); contentService.save(detail);
if(CollectionUtil.isNotEmpty(detail.getAccessContentDetails())){
for (OperAccessContentDetailDTO contentDetail : detail.getAccessContentDetails()){
List<OperAccessContentDetailEntity> contentDetails = contentDetailService.list(new LambdaQueryWrapper<OperAccessContentDetailEntity>() {{
eq(OperAccessContentDetailEntity::getContentId, detail.getId());
}});
// 先删除
if(CollectionUtil.isNotEmpty(contentDetails)){
contentDetailService.deleteLogic(contentDetails.stream().map(OperAccessContentDetailEntity::getId).collect(Collectors.toList()));
}
// 再保存
contentDetail.setId(null);
contentDetail.setContentId(detail.getId());
contentDetailService.save(contentDetail);
}
}
} }
} }
@ -221,10 +235,12 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
task.setPlanId(entity.getId()); task.setPlanId(entity.getId());
task.setContentId(item.getId()); task.setContentId(item.getId());
task.setEmCode(item.getEmCode()); task.setEmCode(item.getEmCode());
task.setCreateUser(item.getManager());
// 任务详情 // 任务详情
if(CollectionUtil.isNotEmpty(item.getAccessContentDetails())){ if(CollectionUtil.isNotEmpty(item.getAccessContentDetails())){
task.setAccessTaskDetails(item.getAccessContentDetails().stream().map(content -> { task.setAccessTaskDetails(item.getAccessContentDetails().stream().map(content -> {
OperAccessTaskDetailDTO detail = BeanUtil.copy(content, OperAccessTaskDetailDTO.class); OperAccessTaskDetailDTO detail = BeanUtil.copy(content, OperAccessTaskDetailDTO.class);
detail.setCreateUser(entity.getCreateUser());
detail.setContentDetailId(content.getId()); detail.setContentDetailId(content.getId());
detail.setContent(content.getContent()); detail.setContent(content.getContent());
detail.setName(content.getName()); detail.setName(content.getName());

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java

@ -146,6 +146,7 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
detailService.deleteLogic(exists.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList())); detailService.deleteLogic(exists.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList()));
} }
for (OperAccessTaskDetailDTO detail : entity.getAccessTaskDetails()){ for (OperAccessTaskDetailDTO detail : entity.getAccessTaskDetails()){
detail.setId(null);
detail.setTaskId(entity.getId()); detail.setTaskId(entity.getId());
detailService.save(detail); detailService.save(detail);
} }

5
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java

@ -53,10 +53,11 @@ public class TicketCountController {
/** /**
* 两票统计分析导出 * 两票统计分析导出
* @param dateTime 月份
*/ */
@GetMapping("/export") @GetMapping("/export")
public R export(HttpServletResponse response) { public R export(String dateTime, HttpServletResponse response) {
ticketCountService.exportTicketCount(response); ticketCountService.exportTicketCount(dateTime,response);
return R.success("导出成功"); return R.success("导出成功");
} }

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java

@ -1,15 +1,11 @@
package com.hnac.hzims.ticket.twoTicket.service; package com.hnac.hzims.ticket.twoTicket.service;
import cn.hutool.http.server.HttpServerResponse;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount; import com.hnac.hzims.ticket.twoTicket.entity.TicketCount;
import com.hnac.hzims.ticket.twoTicket.entity.TicketInfoDanger;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo; import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo; import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.YearMonth;
import java.util.List; import java.util.List;
/** /**
@ -35,7 +31,9 @@ public interface TicketCountService extends BaseService<TicketCount> {
/** /**
* 两票统计分析导出 * 两票统计分析导出
*
* @param dateTime
* @param response * @param response
*/ */
void exportTicketCount(HttpServletResponse response); void exportTicketCount(String dateTime, HttpServletResponse response);
} }

17
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java

@ -1,15 +1,11 @@
package com.hnac.hzims.ticket.twoTicket.service.impl; package com.hnac.hzims.ticket.twoTicket.service.impl;
import cn.hutool.http.server.HttpServerResponse;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.metadata.style.WriteCellStyle; import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
@ -41,9 +37,7 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -158,15 +152,18 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
/** /**
* 两票统计分析导出 * 两票统计分析导出
* *
* @param dateTime
* @param response * @param response
*/ */
@Override @Override
public void exportTicketCount(HttpServletResponse response) { public void exportTicketCount(String dateTime, HttpServletResponse response) {
String fileName = URLEncoder.encode("两票月报分析统计报表.xlsx"); String fileName = URLEncoder.encode("两票月报分析统计报表.xlsx");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName); response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
List<TicketCount> ticketCounts = baseMapper.selectList(null); LambdaQueryWrapper<TicketCount> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TicketCount::getDateTime, dateTime);
List<TicketCount> ticketCounts = baseMapper.selectList(queryWrapper);
List<TicketCountResponseVo> countResponseList = getTicketCountResponseList(ticketCounts); List<TicketCountResponseVo> countResponseList = getTicketCountResponseList(ticketCounts);
//导出 //导出
//内容样式策略 //内容样式策略
@ -304,7 +301,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
*/ */
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
List<StandardTicketInfoEntity> ticketInfoEntities = List<StandardTicketInfoEntity> ticketInfoEntities =
standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType, dateTime);
if (CollectionUtils.isEmpty(ticketInfoEntities)) { if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null; return null;
} }
@ -371,7 +368,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
String dateTime, String dateTime,
BladeUser user) { BladeUser user) {
List<WorkTicketInfoEntity> ticketInfoEntities = List<WorkTicketInfoEntity> ticketInfoEntities =
workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType, dateTime);
if (CollectionUtils.isEmpty(ticketInfoEntities)) { if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null; return null;
} }

Loading…
Cancel
Save