diff --git a/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetEntity.java b/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetEntity.java index 79b29ce..be0f26a 100644 --- a/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetEntity.java +++ b/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetEntity.java @@ -1,6 +1,7 @@ package com.hnac.hzims.basic.entity; import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -21,7 +22,7 @@ import java.util.Date; @Data @TableName("hzims_certificatet") @EqualsAndHashCode(callSuper = true) -@ApiModel(value = "档案管理表", description = "档案管理表") +@ApiModel(value = "证书管理表", description = "证书管理表") public class CertificatetEntity extends TenantEntity { private static final long serialVersionUID = 1L; @@ -35,7 +36,7 @@ public class CertificatetEntity extends TenantEntity { /** * 档案类型 */ - @ApiModelProperty(value = "档案类型") + @ApiModelProperty(value = "证书类型") @QueryField(condition = SqlCondition.LIKE) private String type; /** @@ -54,6 +55,11 @@ public class CertificatetEntity extends TenantEntity { */ @ApiModelProperty(value = "图片地址") private String pic; - + /** + * 是否过期 + */ + @TableField(exist = false) + @ApiModelProperty(value = "是否过期") + private String isDead; } diff --git a/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetNoticeEntity.java b/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetNoticeEntity.java new file mode 100644 index 0000000..056acc8 --- /dev/null +++ b/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetNoticeEntity.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.basic.entity; + +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.tenant.mp.TenantEntity; + + + +/** + * 实体类 + * @author Chill + */ +@Data +@TableName("hzims_certificatet_notice") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "证书通知配置表", description = "证书通知配置表") +public class CertificatetNoticeEntity extends TenantEntity { + + private static final long serialVersionUID = 1L; + + /** + * 通知类型 + */ + @ApiModelProperty(value = "通知类型") + @QueryField(condition = SqlCondition.EQUAL) + private String sendType; + /** + * 距离过期前几天通知 + */ + @ApiModelProperty(value = "距离过期前几天通知") + @QueryField(condition = SqlCondition.EQUAL) + private Integer safeTime; + /** + * 通知用户 + */ + @ApiModelProperty(value = "通知用户") + @QueryField(condition = SqlCondition.LIKE) + private String noticeUsers; +} diff --git a/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/vo/PersonManagemetVo.java b/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/vo/PersonManagemetVo.java index ef5fdef..6a32ae0 100644 --- a/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/vo/PersonManagemetVo.java +++ b/hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/vo/PersonManagemetVo.java @@ -62,11 +62,6 @@ public class PersonManagemetVo extends PersonManagemetEntity { ) @ApiModelProperty(value = "到期时间") private Date deadTime; - /** - * 图片地址 - */ - @ApiModelProperty(value = "图片地址") - private String pic; /** * 档案编号 diff --git a/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java b/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java index 788f4cd..adbf9b0 100644 --- a/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java +++ b/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java @@ -36,4 +36,7 @@ public class VoteChartVo { @ApiModelProperty(value = "完成id") @ExcelIgnore private List finishIds; + @ApiModelProperty(value = "完成率") + @ExcelProperty(value = "完成率", index = 3) + private Double finishRate; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java index 1edaf29..5e1572d 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java @@ -87,6 +87,7 @@ public interface MainConstants { String LOAD_PHOTOVOLTAIC_REAL = "loadPhotovoltaicReal"; String DUTY_NOTICE = "dutyNotice"; + String CERTIFICATET_DEAD_LINE_NOTICE = "certificatetDeadLineNotice"; String PROJECT_MANAGER = "projectManager"; diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java index 0f0f9a1..86b931f 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java @@ -60,6 +60,7 @@ public class MessageConstants { OPERATIONTICKETMESSAGE("operation-ticket-message","操作票消息"), ROUTINEMAINTENANCE("operation-maintenance-message","日常维护消息"), OPERATIONDEFECTMESSAGE("operation-defect-message","消缺消息"), + CERTIFICATETNOTICE("certificatet-notice-message","证书消息"), OVERHAUL_PLAN("overhaul-plan","检修计划"), diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index 83c9aaa..5a7d5d3 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -52,4 +52,9 @@ public class TicketProcessConstant { * 值班计划 */ public static final String DUTY_REC = "duty_rec"; + + /** + * 线下工作票 + */ + public static final String OFFLINE_WORK_TICKET = "offlineWorkTicket"; } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/IOfflineTicketProcessClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/IOfflineTicketProcessClient.java new file mode 100644 index 0000000..58452e0 --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/IOfflineTicketProcessClient.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.ticket.ticketprocess.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.constants.TicketConstants; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +@FeignClient(value = TicketConstants.APP_NAME,fallback = OfflineTicketProcessClientFallback.class) +public interface IOfflineTicketProcessClient { + + String API = "/offlineTicket"; + String FIND_PENDING = API + "/findPending"; + + /** + * 线下工作票处理 + * @param response 流程信息 + * @return 处理结果 + */ + @PostMapping(FIND_PENDING) + R findPending(@RequestBody ProcessWorkFlowResponse response); + +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/OfflineTicketProcessClientFallback.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/OfflineTicketProcessClientFallback.java new file mode 100644 index 0000000..11b12dc --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/OfflineTicketProcessClientFallback.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.ticket.ticketprocess.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Component; + +@Component +public class OfflineTicketProcessClientFallback implements IOfflineTicketProcessClient { + + @Override + public R findPending(ProcessWorkFlowResponse response) { + return R.fail("工作票处理流程失败!"); + } + +} diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/CertificatetNoticeController.java b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/CertificatetNoticeController.java new file mode 100644 index 0000000..90cd677 --- /dev/null +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/CertificatetNoticeController.java @@ -0,0 +1,63 @@ +package com.hnac.hzims.basic.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; +import com.hnac.hzims.basic.service.IImsCertificatetNoticeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.web.bind.annotation.*; + + +/** + * 控制器 + * + * @author Chill + */ +@RestController +@AllArgsConstructor +@RequestMapping("/certificatetNotice") +@Api(value = "档案通知配置页面", tags = "档案通知配置页面") +public class CertificatetNoticeController extends BladeController { + + + private final IImsCertificatetNoticeService iImsCertificatetNoticeService; + + + /** + * 新增或修改 + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "增加", notes = "传入imsDutyClass") + public R submit(@RequestBody CertificatetNoticeEntity certificatetNoticeEntity) { + Boolean submit = iImsCertificatetNoticeService.saveOrUpdate(certificatetNoticeEntity); + if (submit) { + return R.success("保存成功"); + } + return R.fail("保存失败"); + + } + + /** + * 新增或修改 + */ + @PostMapping("/getCertificatetNotice") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "增加", notes = "传入imsDutyClass") + public R getCertificatetNotice() { + CertificatetNoticeEntity res = iImsCertificatetNoticeService.getOne(Wrappers.lambdaQuery() + .eq(CertificatetNoticeEntity::getIsDeleted, 0) + .last("limit 1;")); + if (ObjectUtil.isNotEmpty(res)) { + return R.data(res); + } + return R.data(""); + + } + +} diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/CertificatetNoticeMapper.java b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/CertificatetNoticeMapper.java new file mode 100644 index 0000000..fb767da --- /dev/null +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/CertificatetNoticeMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.basic.mapper; + +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * Mapper 接口 + * + * @author Chill + */ +@Mapper +public interface CertificatetNoticeMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/CertificatetNoticeMapper.xml b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/CertificatetNoticeMapper.xml new file mode 100644 index 0000000..e75a8ab --- /dev/null +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/CertificatetNoticeMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml index 3a4091e..da2837d 100644 --- a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml @@ -20,13 +20,15 @@ + diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/IImsCertificatetNoticeService.java b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/IImsCertificatetNoticeService.java new file mode 100644 index 0000000..121419a --- /dev/null +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/IImsCertificatetNoticeService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.basic.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; + +/** + * 服务类 + * + * @author Chill + */ +public interface IImsCertificatetNoticeService extends IService { +} diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/CertificatetNoticeServiceImpl.java b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/CertificatetNoticeServiceImpl.java new file mode 100644 index 0000000..d31c2f2 --- /dev/null +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/CertificatetNoticeServiceImpl.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.basic.service.impl; + +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; +import com.hnac.hzims.basic.mapper.CertificatetNoticeMapper; +import com.hnac.hzims.basic.service.IImsCertificatetNoticeService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + +/** + * 证书实现类 + * @author ty + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class CertificatetNoticeServiceImpl extends BaseServiceImpl implements IImsCertificatetNoticeService { +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OfflineTicketProcessImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OfflineTicketProcessImpl.java new file mode 100644 index 0000000..b6be99a --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OfflineTicketProcessImpl.java @@ -0,0 +1,41 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import com.hnac.hzims.ticket.ticketprocess.feign.IOfflineTicketProcessClient; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OFFLINE_WORK_TICKET; + +@Slf4j +@Service +@AllArgsConstructor +public class OfflineTicketProcessImpl extends ProcessAbstractService { + + private final ProcessDictService processDictService; + private final IOfflineTicketProcessClient offlineTicketProcessClient; + + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + String dictValue = processDictService.selectDictValueByKey(OFFLINE_WORK_TICKET); + return dictValue.equals(flowQueue.getProcessDefinitionKey()); + } + + @Override + public void calculate(ProcessWorkFlowResponse response) { + log.info("线下工作票调用fein接口消费开始---param",response); + R result = offlineTicketProcessClient.findPending(response); + Assert.isTrue(result.isSuccess(),() -> { + throw new ServiceException("线下工作票处理失败!"); + }); + log.info("线下工作票调用fein接口消费结束---"); + } +} diff --git a/hzims-service/hzims-middle/src/main/resources/db/1.0.2.sql b/hzims-service/hzims-middle/src/main/resources/db/1.0.2.sql new file mode 100644 index 0000000..ec8d18f --- /dev/null +++ b/hzims-service/hzims-middle/src/main/resources/db/1.0.2.sql @@ -0,0 +1 @@ +INSERT INTO `process_dict` (`dict_code`, `dict_sort`, `dict_key`, `dict_value`, `dict_label`, `dict_type`, `is_default`, `status`, `create_dept`, `create_time`, `update_time`, `remark`) VALUES (9, 9, 'offlineWorkTicket', 'offlineWorkTicket', '线下工作票', '线下工作票', 'Y', 0, NULL, '2023-12-28 16:35:10', '2023-12-28 16:35:14', '线下工作票流程'); diff --git a/hzims-service/hzims-scheduled/pom.xml b/hzims-service/hzims-scheduled/pom.xml index 3e004f3..f28251e 100644 --- a/hzims-service/hzims-scheduled/pom.xml +++ b/hzims-service/hzims-scheduled/pom.xml @@ -167,6 +167,10 @@ weather-api + com.hnac.hzims + basic-api + + com.alibaba fastjson diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.java new file mode 100644 index 0000000..40f4273 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.mapper.basic; + +import com.hnac.hzims.basic.entity.CertificatetEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * Mapper 接口 + * + * @author Chill + */ +@Mapper +public interface CertificatetMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.xml new file mode 100644 index 0000000..6941d55 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.java new file mode 100644 index 0000000..a2286ae --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.mapper.basic; + +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * Mapper 接口 + * + * @author Chill + */ +@Mapper +public interface CertificatetNoticeMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.xml new file mode 100644 index 0000000..c951079 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.java new file mode 100644 index 0000000..b44102a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.scheduled.mapper.basic; + +import com.hnac.hzims.basic.entity.PersonManagemetEntity; +import com.hnac.hzims.basic.vo.PersonManagemetVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.Date; +import java.util.List; + +/** + * Mapper 接口 + * + * @author Chill + */ +@Mapper +public interface PersonManagemetMapper extends UserDataScopeBaseMapper { + + List getPersonManagemetEntity( + @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, + @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, + @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; + Integer getCountByPersonManagemetEntity( + @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, + @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, + @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.xml new file mode 100644 index 0000000..409cbfb --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/basicScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/basicScheduledTask.java new file mode 100644 index 0000000..9b72730 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/basicScheduledTask.java @@ -0,0 +1,141 @@ +package com.hnac.hzims.scheduled.scheduled; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.basic.entity.CertificatetEntity; +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; +import com.hnac.hzims.basic.entity.PersonManagemetEntity; +import com.hnac.hzims.message.MessageConstants; +import com.hnac.hzims.message.dto.BusinessMessageDTO; +import com.hnac.hzims.message.entity.config.SmsConfigEntity; +import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzims.message.fegin.IMessageConfigClient; +import com.hnac.hzims.scheduled.mapper.basic.PersonManagemetMapper; +import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; +import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +import static com.hnac.hzims.operational.main.constant.MainConstants.*; + + +/** + * 排班到期定时任务通知 + * + * @author ty + */ +@Slf4j +@Component +public class basicScheduledTask { + + @Autowired + private IImsCertificatetService iImsCertificatetService; + @Autowired + private IImsCertificatetNoticeService iImsCertificatetNoticeService; + @Autowired + private ISysClient sysClient; + @Autowired + private IUserClient userClient; + @Autowired + private IMessageClient messageClient; + @Autowired + private PersonManagemetMapper personManagemetMapper; + @Autowired + private IMessageConfigClient messageConfigClient; + + /** + * realId刷新 + */ + @XxlJob(CERTIFICATET_DEAD_LINE_NOTICE) +// @Scheduled(cron = "0 */1 * * * ? ") + public ReturnT certificatetDeadLineNotice(String param) throws ParseException { + Date endTime = new Date(); + if (Func.isBlank(param)) { + endTime = new SimpleDateFormat("yyyy-MM-dd").parse(param); + } + CertificatetNoticeEntity noticeEntity = iImsCertificatetNoticeService.getOne(Wrappers.lambdaQuery() + .eq(CertificatetNoticeEntity::getIsDeleted, 0) + .last("limit 1;")); + //用户档案过期截止时间 + Date date = DateUtil.plusDays(endTime, noticeEntity.getSafeTime()); + List list = iImsCertificatetService.list(Wrappers.lambdaQuery() + .le(CertificatetEntity::getDeadTime, date)); + String noticeUsers = noticeEntity.getNoticeUsers(); + List userList = Arrays.asList(noticeUsers.split(",")); + if (CollectionUtil.isNotEmpty(userList) && CollectionUtil.isNotEmpty(list)) { + List personIds = list.stream().map(CertificatetEntity::getPersonId).collect(Collectors.toList()); + List personManagemetEntities = personManagemetMapper.selectList(Wrappers.query().lambda().in(PersonManagemetEntity::getId, personIds)); + String personNotice=""; + if (CollectionUtil.isNotEmpty(personManagemetEntities)) { + personNotice = personManagemetEntities.stream().map(PersonManagemetEntity::getName).collect(Collectors.joining(",")); + } + if ("1".equals(noticeEntity.getSendType())) { + sendSmsByUserList(userList, date,personNotice); + } + sendMessage(list.get(0), noticeEntity.getSafeTime(), noticeEntity.getNoticeUsers(),personNotice); + } + return new ReturnT<>("SUCCESS"); + } + + private void sendSmsByUserList(List userList, Date date,String personNotice) { + //区分用户 + for (String s : userList) { + User user = UserCache.getUser(Long.valueOf(s)); + String phone = ""; + if (ObjectUtil.isNotEmpty(user)) { + phone = user.getPhone(); + } + //短信推送 + String code = "certificatetNotice"; + SmsConfigEntity smsConfigEntity = messageConfigClient.getSmsConfigByBusinessKey(code); + Map contentParams = new HashMap<>(2); + contentParams.put("one", personNotice); + String deadLine = DateUtil.format(date, "yyyy-MM-dd"); + contentParams.put("two", deadLine); + smsConfigEntity.setTemplateParam(JSONObject.toJSONString(contentParams)); + smsConfigEntity.setPhones(phone); + messageConfigClient.pushSmsMessageByConfig(smsConfigEntity); + } + } + + private void sendMessage(CertificatetEntity certificatetEntity, Integer date, String users,String personNotice) { +// //注意:通知人是创建人所在机构 + BusinessMessageDTO message = new BusinessMessageDTO(); + message.setBusinessClassify("system"); + message.setBusinessKey(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getKey()); + message.setSubject(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getDescription()); + message.setTaskId(System.currentTimeMillis()); + message.setTenantId("200000"); + String countent = + personNotice + "的证书即将到期,请提交新的证书资料"; + message.setContent(countent); + message.setDeptId(certificatetEntity.getCreateDept()); + R deptName = sysClient.getDeptName(certificatetEntity.getCreateDept()); + if (deptName.isSuccess()) { + message.setDeptName(deptName.getData()); + } + message.setUserIds(users); + User admin = userClient.userByAccount("200000", "admin").getData(); + message.setCreateUser(admin.getId()); + messageClient.sendAppAndWsMsgByUsers(message); + } + + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsCertificatetNoticeService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsCertificatetNoticeService.java new file mode 100644 index 0000000..4b3503b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsCertificatetNoticeService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.service.basic; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; + +/** + * 服务类 + * + * @author Chill + */ +public interface IImsCertificatetNoticeService extends IService { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsCertificatetService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsCertificatetService.java new file mode 100644 index 0000000..bba5428 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsCertificatetService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.service.basic; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.basic.entity.CertificatetEntity; + +/** + * 服务类 + * + * @author Chill + */ +public interface IImsCertificatetService extends IService { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetNoticeServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetNoticeServiceImpl.java new file mode 100644 index 0000000..b4e956d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetNoticeServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.basic.impl; + +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; +import com.hnac.hzims.scheduled.mapper.basic.CertificatetNoticeMapper; +import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + +/** + * 证书实现类 + * @author ty + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class CertificatetNoticeServiceImpl extends BaseServiceImpl implements IImsCertificatetNoticeService { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetServiceImpl.java new file mode 100644 index 0000000..8849e80 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.basic.impl; + +import com.hnac.hzims.basic.entity.CertificatetEntity; +import com.hnac.hzims.scheduled.mapper.basic.CertificatetMapper; +import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + + +/** + * 证书实现类 + * @author ty + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class CertificatetServiceImpl extends BaseServiceImpl implements IImsCertificatetService { +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java index 3f0ed50..f5f8b84 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/EventServiceImpl.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.task.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hnac.hzims.operational.defect.constants.DefectConstant; @@ -15,6 +16,7 @@ import com.hnac.hzinfo.inspect.task.mapper.TaskEventMapper; import com.hnac.hzinfo.inspect.task.service.*; import com.hnac.hzinfo.inspect.task.vo.EventAddVO; import com.hnac.hzinfo.inspect.task.vo.EventRecordAddVO; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.mp.base.BaseServiceImpl; @@ -43,6 +45,7 @@ import java.util.List; * @author Chill */ @Service +@Slf4j public class EventServiceImpl extends BaseServiceImpl implements IEventService { @Autowired @@ -187,7 +190,9 @@ public class EventServiceImpl extends BaseServiceImpllambdaQuery().eq(TaskUserEntity::getTaskId,eventVO.getTaskId()).eq(TaskUserEntity::getUserId,user == null ? eventVO.getUserId() : user.getUserId())); + log.info("taskUserEntity:"+JSON.toJSONString(taskUserEntity)); if(taskUserEntity==null){ throw new ServiceException("该任务已被别人领取"); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index 16b509d..455e33f 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java @@ -54,6 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -282,7 +283,7 @@ public class TaskServiceImpl extends BaseServiceImpl imp taskUserService.update(Wrappers.lambdaUpdate().set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).set(TaskUserEntity::getClaimTime, LocalDateTime.now()).eq(TaskUserEntity::getTaskId, task.getId()).eq(TaskUserEntity::getUserId, userId)); //如果是抢占任务,删除能够抢占此任务的其他人 if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) { - taskUserService.remove(Wrappers.lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId()).ne(TaskUserEntity::getId, userId)); + taskUserService.remove(Wrappers.lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId()).ne(TaskUserEntity::getUserId, userId)); } task.setStatus(Integer.valueOf(TaskStatusEnum.UNDERWAY_STATUS.getStatus())); task.setStartTime(LocalDateTime.now()); @@ -1162,6 +1163,12 @@ public class TaskServiceImpl extends BaseServiceImpl imp voteChartVo.setFinishIds(finishIds); voteChartVo.setUndoneNum(undoneIds.size()); voteChartVo.setUndoneIds(undoneIds); + if (CollectionUtil.isEmpty(list)||CollectionUtil.isEmpty(undoneIds)){ + voteChartVo.setFinishRate(0.00d); + }else { + BigDecimal divide = new BigDecimal(list.size()).divide(new BigDecimal(list.size()),2,BigDecimal.ROUND_UP); + voteChartVo.setFinishRate( divide.doubleValue()); + } return voteChartVo; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java index 859102e..cdcd04c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java @@ -799,6 +799,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl s.toString()).collect(Collectors.toList()); } else { + log.error("getCurrentMonthStatic"+"用户权限问题"); throw new WebServiceException("该用户没有此权限"); } if (StringUtil.isNotBlank(deptId)) { diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/feign/OfflineTicketProcessClient.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/feign/OfflineTicketProcessClient.java new file mode 100644 index 0000000..dfb763e --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/feign/OfflineTicketProcessClient.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.ticket.redisConsume.feign; + + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.ticketprocess.feign.IOfflineTicketProcessClient; +import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@AllArgsConstructor +@Slf4j +public class OfflineTicketProcessClient implements IOfflineTicketProcessClient { + + private final TicketProcessService processService; + + @Override + @PostMapping(FIND_PENDING) + public R findPending(@RequestBody ProcessWorkFlowResponse response) { + return R.status(processService.offlineTicketFindPending(response)); + } +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java index c0d95ca..71b2b24 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java @@ -45,6 +45,11 @@ public class TicketProcessController { return R.data(ticketId); } + @ApiOperation("开启工作票线下流程") + @PostMapping("/startUpOfflineTicket") + public R startUpOfflineTicket(@RequestBody WorkTicketVo workTicketVo) { + return R.data(ticketProcessService.startUpOfflineTicket(workTicketVo)); + } /** * 工作票待处理 diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java index 9c67a63..1c58149 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java @@ -27,6 +27,12 @@ public interface TicketProcessService { */ void findPending(ProcessWorkFlowResponse response); + /** + * 线下工作票流程处理 + * @param response 流程信息 + * @return 处理结果 + */ + Boolean offlineTicketFindPending(ProcessWorkFlowResponse response); /** @@ -46,4 +52,6 @@ public interface TicketProcessService { * @param value */ public void getDataConversion(Map dataConversion, String key, Object value); + + Long startUpOfflineTicket(WorkTicketVo workTicketVo); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java index 28b5102..677cb96 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java @@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; import com.hnac.hzims.message.entity.config.PushConfigEntity; import com.hnac.hzims.message.fegin.IMessageConfigClient; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; @@ -21,13 +22,11 @@ import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.WorkTicketConstants; +import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService; -import com.hnac.hzims.ticket.utils.AsposeUtil; -import com.hnac.hzims.ticket.utils.ExcelUtil; -import com.hnac.hzims.ticket.utils.ObjectUtils; -import com.hnac.hzims.ticket.utils.PdfUtils; +import com.hnac.hzims.ticket.utils.*; import com.hnac.hzims.ticket.workTicket.dto.*; import com.hnac.hzims.ticket.workTicket.entity.*; import com.hnac.hzims.ticket.workTicket.mapper.WorkDelayNoScopeMapper; @@ -39,7 +38,7 @@ import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketInfoWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.apache.poi.xwpf.usermodel.*; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.secure.utils.AuthUtil; @@ -54,14 +53,19 @@ import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import org.springframework.util.ResourceUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigDecimal; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -69,6 +73,8 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream; +import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path; + /** * @author hx */ @@ -280,13 +286,23 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl params = this.getTicketParamById(ticketId,workTicketInfoEntity); String tempFileName = WorkTicketConstants.TicketSignageEnum.getTempFileNameByType(workTicketInfoEntity.getType()); Assert.isTrue(StringUtil.isNotBlank(tempFileName),() -> { throw new ServiceException("未找到模板文件,预览失败!"); }); String wordPath = this.getFileSavePath() + params.get("code") + "_" + params.get("addressEquName") +".docx"; - this.exportTicketWord("template/"+tempFileName, wordPath, params); + List documents; + try { + documents = this.getDocuments(workTicketInfoEntity, params); + } catch (Exception e) { + throw new RuntimeException(e); + } + try { + this.exportTicketWord(documents,wordPath); + } catch (IOException e) { + throw new RuntimeException(e); + } String pdfPath = this.getFileSavePath() + params.get("code") + "_" + params.get("addressEquName") +".pdf"; AsposeUtil.wordToPdf(wordPath,pdfPath); PdfUtils.readPdf(response,pdfPath); @@ -371,38 +387,60 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl getDocuments(WorkTicketInfoEntity workTicketInfo,Map params) { + List result = Lists.newArrayList(); + XWPFDocument document = this.fillDocument("template/" + WorkTicketConstants.TicketSignageEnum.getTempFileNameByType(workTicketInfo.getType()), params); + result.add(document); + //安全隔离措施附页 (true,展示附件,false,不展示附件) + if (workTicketInfo.getIsSafety()) { + XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SECURE_PAGE, params); + result.add(xwpfDocument); + } + //危险点分析与预控措施票 (true,展示附件,false,不展示附件) + if (workTicketInfo.getIsHazard()) { + XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SAFETY_PAGE, params); + result.add(xwpfDocument); + } + //动火工作票 (true,展示附件,false,不展示附件) + if (workTicketInfo.getIsRailway()) { + XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.FLIGHT_PAGE, params); + result.add(xwpfDocument); + } + //有限空间监测记录单(true,展示附件,false,不展示附件) + if (workTicketInfo.getIsLimited()) { + XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SPACE_PAGE, params); + result.add(xwpfDocument); + } + //每日开工和收工时间附页 + if (workTicketInfo.getIsStart()) { + XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.START_PAGE, params); + result.add(xwpfDocument); + } + return result; + } + + private XWPFDocument fillDocument(String templatePath, Map params) { XWPFDocument xwpfDocument = null; try { xwpfDocument = WordExportUtil.exportWord07(templatePath, params); } catch (Exception e) { e.printStackTrace(); } - FileOutputStream outputStream = null; - try { - outputStream = new FileOutputStream(savePath); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } - try { - xwpfDocument.write(outputStream); - } - catch(Exception e) { - e.printStackTrace(); + return xwpfDocument; + } + + private void exportTicketWord(List documents, String savePath) throws IOException { + FileOutputStream out = new FileOutputStream(savePath, true); + Path file = Paths.get(path); + if(Files.exists(file)) { + Files.delete(file); } - finally { - try { - outputStream.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } + new File(savePath).createNewFile(); + for (XWPFDocument document : documents) { + document.write(out); } + out.close(); } @Override diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 44d27ce..0d1e79c 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.BusinessMessageDTO; @@ -61,6 +62,7 @@ import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; @@ -488,6 +490,64 @@ public class TicketProcessServiceImpl implements TicketProcessService { } + @Override + public Boolean offlineTicketFindPending(ProcessWorkFlowResponse response) { + log.info("线下工作票接收到的工作票数据为:{}",JSON.toJSONString(response)); + FristWorkTicketVo ticketResponse = JSONObject.parseObject(JSON.toJSONString(response.getVariables()),FristWorkTicketVo.class); + Assert.isTrue(ObjectUtil.isNotEmpty(ticketResponse),() -> { + log.error("接收到的数据为:{}",JSON.toJSONString(response.getVariables())); + throw new ServiceException("线下工作票处理流程环节接收数据失败,请联系管理员"); + }); + WorkTicketVo workTicketVo = ticketResponse.getWorkTicketVo(); + WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); + WorkTicketInfoEntity info = firstWorkTicketService.getById(workTicket.getId()); + if(ObjectUtil.isEmpty(info)) { + return true; + } + workTicket.setProcessInstanceId(response.getProcessInstanceId()); + this.saveWorkTicket(workTicket,response); + List safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); + if(CollectionUtil.isNotEmpty(safetyMeasuresList)) { + workTicketSafetyMeasureService.saveOrUpdateBatch(safetyMeasuresList); + } + List workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); + if(CollectionUtil.isNotEmpty(workTicketContentDtoList)) { + contentService.saveOrUpdateBatch(workTicketContentDtoList); + } + WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); + if(CollectionUtil.isNotEmpty(workTicketContentDtoList)) { + workTicketFinishService.saveOrUpdate(workTicketFinish); + } + // 推送消息 + new Thread(() -> this.sendMessage(workTicket,response.getUserId())).start(); + return true; + } + + /** + * 推送消息 + * @param ticketInfo 票据信息 + */ + private void sendMessage(WorkTicketInfoEntity ticketInfo,String userIds) { + BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); + businessMessageDTO.setBusinessClassify("business"); + businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getKey()); + businessMessageDTO.setSubject(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getDescription()); + businessMessageDTO.setTaskId(ticketInfo.getId()); + businessMessageDTO.setTenantId(ticketInfo.getTenantId()); + String content = "您有一张线下工作票待审批,工作内容: ".concat(ticketInfo.getWorkContent()).concat(",审批环节: ").concat(ticketInfo.getTaskName()); + businessMessageDTO.setContent(content); + businessMessageDTO.setDeptId(ticketInfo.getCreateDept()); + R deptName = sysClient.getDeptName(ticketInfo.getCreateDept()); + if (deptName.isSuccess()) { + businessMessageDTO.setDeptName(deptName.getData()); + } + businessMessageDTO.setUserIds(userIds); + businessMessageDTO.setCreateUser(ticketInfo.getCreateUser()); + R booleanR = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); + if (!booleanR.isSuccess()) { + throw new ServiceException("消息推送失败"); + } + } /** * 保存流程描述 @@ -1298,6 +1358,65 @@ public class TicketProcessServiceImpl implements TicketProcessService { } } + @Override + @Transactional + public Long startUpOfflineTicket(WorkTicketVo workTicketVo) { + WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); + this.saveOfflineTicket(workTicket); + this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket()); + this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); + // 开启工作流 + String processInstanceId = this.startOfflineTicketProcess(workTicketVo); + return workTicket.getId(); + } + + /** + * 开启线下工作票流程 + * @param workTicketVo 工作票 + * @return 工作流实例ID + */ + private String startOfflineTicketProcess(WorkTicketVo workTicketVo) { + WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); + Map params = new HashMap<>(); + workTicketVo.setWorkTicket(workTicket); + params.put("workTicketVo",workTicketVo); + R flowR = + flowClient.startProcessInstanceContainNameByKey("offlineWorkTicket",String.valueOf(workTicket.getId()),workTicket.getWorkContent(), params); + Assert.isTrue(flowR.isSuccess(),() -> { + throw new ServiceException("开启工作流失败,请联系管理员"); + }); + return flowR.getData().getProcessInstanceId(); + } + + /** + * 保存线下工作票 + * @param workTicket 工作票信息 + */ + private void saveOfflineTicket(WorkTicketInfoEntity workTicket) { + StationEntity stationEntity = new StationEntity(); + stationEntity.setCode(workTicket.getSignageCode()); + R stationR = stationClient.getOne(stationEntity); + Assert.isTrue(stationR.isSuccess() && Func.isNotEmpty(stationR.getData().getSignage()),() -> { + throw new ServiceException("获取站点两票抬头失败"); + }); + + workTicket.setSignage(stationR.getData().getSignage()); + workTicket.setSignageCode(stationR.getData().getCode()); + String code = processDictFeignService.getTicketByCode(workTicket.getSignage(), this.getTicketWichCode(workTicket.getType())); + workTicket.setCode(code); + Assert.isTrue(StringUtils.isNotBlank(code),() -> { + throw new ServiceException("生成两票编号失败,请联系管理员!"); + }); + workTicket.setStepOperator(AuthUtil.getUserName()); + workTicket.setIsSafety(false); + workTicket.setIsHazard(false); + workTicket.setIsRailway(false); + workTicket.setIsLimited(false); + Assert.isTrue(firstWorkTicketService.save(workTicket),()-> { + throw new ServiceException("工作票保存失败"); + }); + } + /** * 工作类型生成工作票类型 */ diff --git a/hzims-service/ticket/src/main/resources/file/线下工作票审批流程.bpmn20.xml b/hzims-service/ticket/src/main/resources/file/线下工作票审批流程.bpmn20.xml new file mode 100644 index 0000000..4d87dfc --- /dev/null +++ b/hzims-service/ticket/src/main/resources/file/线下工作票审批流程.bpmn20.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file