From 98655b3923baf72b25006b4123191adbadf540c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 10 Jul 2023 08:43:15 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=B8=A4=E7=A5=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=9C=88=E6=8A=A5=E5=AF=BC=E5=87=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../twoTicket/controller/TicketCountController.java | 5 +++-- .../ticket/twoTicket/service/TicketCountService.java | 8 +++----- .../twoTicket/service/impl/TicketCountServiceImpl.java | 17 +++++++---------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java index 202bb4e..f757ac2 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java +++ b/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") - public R export(HttpServletResponse response) { - ticketCountService.exportTicketCount(response); + public R export(String dateTime, HttpServletResponse response) { + ticketCountService.exportTicketCount(dateTime,response); return R.success("导出成功"); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java index 5838b40..02f9562 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java +++ b/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; -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.TicketInfoDanger; import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo; import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo; import org.springblade.core.mp.base.BaseService; import javax.servlet.http.HttpServletResponse; -import java.time.YearMonth; import java.util.List; /** @@ -35,7 +31,9 @@ public interface TicketCountService extends BaseService { /** * 两票统计分析导出 + * + * @param dateTime * @param response */ - void exportTicketCount(HttpServletResponse response); + void exportTicketCount(String dateTime, HttpServletResponse response); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java index 0003eaa..4594890 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java +++ b/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; -import cn.hutool.http.server.HttpServerResponse; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.support.ExcelTypeEnum; 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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.ticket.allTicket.entity.TicketInfoEvaluateEntity; 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 javax.servlet.http.HttpServletResponse; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.OutputStream; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.*; @@ -158,15 +152,18 @@ public class TicketCountServiceImpl extends BaseServiceImpl ticketCounts = baseMapper.selectList(null); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TicketCount::getDateTime, dateTime); + List ticketCounts = baseMapper.selectList(queryWrapper); List countResponseList = getTicketCountResponseList(ticketCounts); //导出 //内容样式策略 @@ -304,7 +301,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl getStandardTicketCountList(List createDept, List items, String ticketType, String dateTime, BladeUser user) { List ticketInfoEntities = - standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); + standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType, dateTime); if (CollectionUtils.isEmpty(ticketInfoEntities)) { return null; } @@ -371,7 +368,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl ticketInfoEntities = - workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); + workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType, dateTime); if (CollectionUtils.isEmpty(ticketInfoEntities)) { return null; } From 0b7b06876c925941b61467cd5db5e021270b38be Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 10 Jul 2023 13:39:54 +0800 Subject: [PATCH 2/5] =?UTF-8?q?#=E9=A3=8E=E7=94=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../access/mapper/OperAccessMaterialMapper.xml | 6 ++-- .../service/impl/AccessPlanV4ServiceImpl.java | 39 +++++++++++++++------- .../service/impl/AccessTaskV4ServiceImpl.java | 1 + 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml index 4d658b6..1e3758a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml @@ -30,12 +30,12 @@ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java index 997314a..2ec9697 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java +++ b/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.middle.process.to.ProcessWorkFlowResponse; 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.OperAccessMaterialEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity; @@ -51,6 +52,8 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ private final IOperAccessContentService contentService; + private final IOperAccessContentDetailService contentDetailService; + private final AccessTaskV4Service accessTaskV4Service; private final ISysClient sysClient; @@ -105,23 +108,17 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ return; } // 查询计划是否绑定检修材料 - List existsDetails = materialService.list(new LambdaQueryWrapper() {{ + List materials = materialService.list(new LambdaQueryWrapper() {{ eq(OperAccessMaterialEntity::getPlanId, entity.getId()); eq(OperAccessMaterialEntity::getIsDeleted, 0L); }}); - Set detailIds = entity.getAccessMaterials().stream().map(OperAccessMaterialDTO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); - List ids = existsDetails.stream().map(OperAccessMaterialEntity::getId).filter(id -> !detailIds.contains(id)).collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(ids)) { - materialService.deleteLogic(ids); + if(CollectionUtil.isNotEmpty(materials)){ + materialService.deleteLogic(materials.stream().map(OperAccessMaterialEntity::getId).collect(Collectors.toList())); } - // 材料添加/修改 - for (OperAccessMaterialDTO material : entity.getAccessMaterials()) { + for (OperAccessMaterialDTO material : entity.getAccessMaterials()){ + material.setId(null); material.setPlanId(entity.getId()); - if (ObjectUtil.isEmpty(material.getId())) { - materialService.doSave(material); - continue; - } - materialService.updateById(material); + materialService.save(material); } } @@ -143,7 +140,23 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ } for (OperAccessContentDTO detail : entity.getAccessContents()){ detail.setPlanId(entity.getId()); + detail.setId(null); contentService.save(detail); + if(CollectionUtil.isNotEmpty(detail.getAccessContentDetails())){ + for (OperAccessContentDetailDTO contentDetail : detail.getAccessContentDetails()){ + List contentDetails = contentDetailService.list(new LambdaQueryWrapper() {{ + 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 +234,12 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ task.setPlanId(entity.getId()); task.setContentId(item.getId()); task.setEmCode(item.getEmCode()); + task.setCreateUser(item.getManager()); // 任务详情 if(CollectionUtil.isNotEmpty(item.getAccessContentDetails())){ task.setAccessTaskDetails(item.getAccessContentDetails().stream().map(content -> { OperAccessTaskDetailDTO detail = BeanUtil.copy(content, OperAccessTaskDetailDTO.class); + detail.setCreateUser(entity.getCreateUser()); detail.setContentDetailId(content.getId()); detail.setContent(content.getContent()); detail.setName(content.getName()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java index 88aca69..f757463 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java +++ b/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())); } for (OperAccessTaskDetailDTO detail : entity.getAccessTaskDetails()){ + detail.setId(null); detail.setTaskId(entity.getId()); detailService.save(detail); } From 0c41504839cbf266a48faf332067e1fdd87edaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 10 Jul 2023 16:21:30 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E6=93=8D=E4=BD=9C=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processflow/consumer/StandardWorkTicketConsumer.java | 15 +++++++++++++++ .../middle/processflow/entity/WorkflowOperationLog.java | 8 +++++++- .../hzims-middle/src/main/resources/db/1.0.1.sql | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java index 2cddc09..ad38337 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java +++ b/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; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; @@ -41,6 +42,18 @@ public class StandardWorkTicketConsumer implements IQueueConsume { log.info("监听到数据:{}", message); ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class); String taskDefinitionKey = response.getProcessDefinitionKey(); + + //记录操作日志 + WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog(); + BeanUtils.copyProperties(response,regularWorkflowOperationLog); + if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) { + regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); + regularWorkflowOperationLog.setIsOperationLog(true); + log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog); + workflowOperationLogService.save(regularWorkflowOperationLog); + } + + WorkflowQueue ticker = new WorkflowQueue(); ticker.setProcessDefinitionKey(taskDefinitionKey); //判断执行具体的实现类 @@ -58,6 +71,8 @@ public class StandardWorkTicketConsumer implements IQueueConsume { WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog(); BeanUtils.copyProperties(response,workflowOperationLog); if (ObjectUtils.isNotEmpty(workflowOperationLog)) { + regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables())); + regularWorkflowOperationLog.setIsOperationLog(false); log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog); workflowOperationLogService.save(workflowOperationLog); } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java index ebfcf10..f819648 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/entity/WorkflowOperationLog.java +++ b/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 */ - @TableField("variables") + @TableField("user_id") private String userId; @@ -92,4 +92,10 @@ public class WorkflowOperationLog implements Serializable { private Boolean Deleted; + /** + * 记录正常日志 或错误日志 + */ + private Boolean isOperationLog; + + } diff --git a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql new file mode 100644 index 0000000..3b40c96 --- /dev/null +++ b/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 '0 正常日志 1 错误日志'; \ No newline at end of file From 3b4613e988daf0442b12791a199b098383f33456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 10 Jul 2023 16:35:32 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../middle/processflow/consumer/StandardWorkTicketConsumer.java | 6 ++++++ hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java index ad38337..7f55a09 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java @@ -48,7 +48,10 @@ public class StandardWorkTicketConsumer implements IQueueConsume { 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); } @@ -72,7 +75,10 @@ public class StandardWorkTicketConsumer implements IQueueConsume { BeanUtils.copyProperties(response,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); workflowOperationLogService.save(workflowOperationLog); } diff --git a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql index 3b40c96..a3478ce 100644 --- a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql +++ b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql @@ -1 +1 @@ -alter table hzims_workflow_operation_log add is_operation_log tinyint(1) comment '0 正常日志 1 错误日志'; \ No newline at end of file +alter table hzims_workflow_operation_log add is_operation_log tinyint(1) comment '1 正常日志 0 错误日志'; \ No newline at end of file From fa28c26580bdd412d643cac986c11dcb040b07f9 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 10 Jul 2023 16:47:11 +0800 Subject: [PATCH 5/5] =?UTF-8?q?#=E6=A3=80=E4=BF=AE=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../access/mapper/OperAccessTaskMapper.xml | 32 ++++++++++------------ .../service/impl/AccessPlanV4ServiceImpl.java | 1 + 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml index b876795..bd4b72a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml @@ -48,48 +48,46 @@