Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
tyty 2 years ago
parent
commit
e69d2ac15b
  1. 20
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java
  2. 5
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MessageTemplateEntity.java
  3. 5
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
  4. 6
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java
  5. 29
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java
  6. 10
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java
  7. 4
      hzims-service/equipment/pom.xml
  8. 15
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  9. 47
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  10. 2
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java
  11. 23
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java
  12. 10
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  13. 15
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java
  14. 41
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
  15. 8
      hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java
  16. 24
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
  17. 89
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  18. 8
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java
  19. 30
      hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MessageTemplateWrapper.java
  20. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  21. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java
  22. 15
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/consumer/StandardWorkTicketConsumer.java
  23. 23
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java
  24. 9
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/abstracts/ProcessAbstractService.java
  25. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java
  26. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/entity/WorkflowQueue.java
  27. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/service/ProcessService.java
  28. 30
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/MakeProcessServiceImpl.java
  29. 20
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OperatorProcessServiceImpl.java
  30. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/SignatureProcessServiceImpl.java
  31. 7
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java
  32. 22
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/ProcessWorkFlowResponse.java
  33. 20
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardWorkTicketController.java
  34. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java
  35. 19
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java
  36. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java
  37. 38
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  38. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketInfoServiceImpl.java
  39. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/SafetyMeasuresVo.java
  40. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/TeamGroupVo.java
  41. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/TeamPersonnelVo.java
  42. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/WorkTicketVo.java

20
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java

@ -14,6 +14,7 @@ import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
@ -22,6 +23,13 @@ import java.time.LocalDateTime;
@EqualsAndHashCode @EqualsAndHashCode
public class MessagePushRecordEntity extends MessageTemplateEntity { public class MessagePushRecordEntity extends MessageTemplateEntity {
@ApiModelProperty("站点编码")
@QueryField(condition = SqlCondition.EQUAL)
private String stationCode;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("业务任务ID") @ApiModelProperty("业务任务ID")
@QueryField(condition = SqlCondition.EQUAL) @QueryField(condition = SqlCondition.EQUAL)
private Long taskId; private Long taskId;
@ -66,4 +74,16 @@ public class MessagePushRecordEntity extends MessageTemplateEntity {
@ApiModelProperty(value = "响应说明") @ApiModelProperty(value = "响应说明")
private String respondRemark; private String respondRemark;
@ApiModelProperty("查询开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
@TableField(exist = false)
private LocalDate startTime;
@ApiModelProperty("查询结束时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
@TableField(exist = false)
private LocalDate endTime;
} }

5
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MessageTemplateEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzims.message.entity.config; package com.hnac.hzims.message.entity.config;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -51,4 +52,8 @@ public class MessageTemplateEntity extends TenantEntity implements Serializable
@QueryField(condition = SqlCondition.EQUAL) @QueryField(condition = SqlCondition.EQUAL)
private String advanceTimeUnit; private String advanceTimeUnit;
@TableField(exist = false)
@ApiModelProperty(value = "创建人名称")
private String creatorName;
} }

5
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java

@ -3,6 +3,7 @@ package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.PushDto; import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.dto.SmsPushDto; import com.hnac.hzims.message.dto.SmsPushDto;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestBody;
public interface IMessageClient { public interface IMessageClient {
String API_PREFIX = "/feign/message"; String API_PREFIX = "/feign/message";
String SEND_SMS_MESSAGE = API_PREFIX + "/send-sms-message"; String SEND_SMS_MESSAGE = API_PREFIX + "/send-sms-message";
String SEND_MESSAGE = API_PREFIX + "/sendMessage";
/** /**
* 推送消息短信 * 推送消息短信
* @param pushDto * @param pushDto
@ -25,4 +27,7 @@ public interface IMessageClient {
*/ */
@PostMapping(SEND_SMS_MESSAGE) @PostMapping(SEND_SMS_MESSAGE)
R sendSmsMessage(SmsPushDto pushDto); R sendSmsMessage(SmsPushDto pushDto);
@PostMapping(SEND_MESSAGE)
R<Boolean> sendMessage(@RequestBody MessagePushRecordEntity request);
} }

6
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java

@ -2,6 +2,7 @@ package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.dto.PushDto; import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.dto.SmsPushDto; import com.hnac.hzims.message.dto.SmsPushDto;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -15,4 +16,9 @@ public class MessageClientFallback implements IMessageClient {
public R sendSmsMessage(SmsPushDto pushDto) { public R sendSmsMessage(SmsPushDto pushDto) {
return R.fail("推送失败"); return R.fail("推送失败");
} }
@Override
public R<Boolean> sendMessage(MessagePushRecordEntity request) {
return R.fail("推送失败");
}
} }

29
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.message.vo.msgpushrecord;
import lombok.Data;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 11:58
*/
@Data
public class MessagePushRecordEntityVo {
/**
* 站点编号
*/
private String stationCode;
/**
* 月份
*/
private Integer month;
/**
* type
*/
private String type;
}

10
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java

@ -5,6 +5,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.YearMonth;
/** /**
* @Author WL * @Author WL
@ -17,6 +18,12 @@ public class MessagePushRecordVo implements Serializable {
/** /**
*
*/
private Integer year;
/**
* 月份 * 月份
*/ */
private Integer month; private Integer month;
@ -25,7 +32,8 @@ public class MessagePushRecordVo implements Serializable {
/** /**
* 实现推送时间 * 实现推送时间
*/ */
private String strMonth; private YearMonth strMonth;
/** /**
* 消息类型 * 消息类型

4
hzims-service/equipment/pom.xml

@ -94,6 +94,10 @@
<artifactId>hzims-operational-api</artifactId> <artifactId>hzims-operational-api</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
</dependencies> </dependencies>

15
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java

@ -117,21 +117,6 @@ public class EmInfoController extends BladeController {
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入em_info") @ApiOperation(value = "新增", notes = "传入em_info")
public R save(@Valid @RequestBody EmInfoAddVo em_info) { public R save(@Valid @RequestBody EmInfoAddVo em_info) {
List<EmInfoEntity> name = em_infoService.list(new QueryWrapper<EmInfoEntity>() {{
eq("NAME", em_info.getInfo().getName());
}});
if (CollectionUtil.isNotEmpty(name)) {
return R.fail("设备名称已存在");
}
if(Func.isNotEmpty(em_info.getInfo().getEmIndex())) {
List<EmInfoEntity> exist = em_infoService.list(Wrappers.<EmInfoEntity>lambdaQuery()
.eq(EmInfoEntity::getCreateDept, AuthUtil.getDeptId())
.eq(EmInfoEntity::getEmIndex, em_info.getInfo().getEmIndex())
);
Assert.isTrue(CollectionUtil.isEmpty(exist),() -> {
throw new ServiceException("该设备序号已存在,设备新增失败");
});
}
return em_infoService.saveInfo(em_info); return em_infoService.saveInfo(em_info);
} }

47
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -23,6 +23,7 @@ import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.vo.CreateTableVO; import org.springblade.system.vo.CreateTableVO;
@ -103,17 +104,11 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Override @Override
@Transactional @Transactional
public R saveInfo(@Valid EmInfoAddVo em_info) { public R saveInfo(@Valid EmInfoAddVo em_info) {
// 查询设备编码设备实例是否已存在 // 验证设备信息
R<Boolean> existResult = deviceClient.isDeviceCodeExist(em_info.getInfo().getNumber()); this.validEmInfo(em_info);
Assert.isTrue(existResult.isSuccess() && !existResult.getData(),() -> { EmInfoEntity infoEntity = em_info.getInfo();
throw new ServiceException("该设备编码在设备实例中找到对应记录,保存失败!"); //infoEntity.setNumber(Func.);
}); if (this.save(infoEntity)) {
EmInfoEntity emInfoEntity = this.baseMapper.selectEmInfoByCode(em_info.getInfo().getNumber());
if (ObjectUtil.isNotEmpty(emInfoEntity)) {
return R.fail("设备编号已存在");
}
if (this.save(em_info.getInfo())) {
this.getStationCodeStoreRedis(); this.getStationCodeStoreRedis();
Long infoId = em_info.getInfo().getId(); Long infoId = em_info.getInfo().getId();
if (em_info.getAttach() != null) { if (em_info.getAttach() != null) {
@ -469,4 +464,34 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
// 设置缓存 // 设置缓存
redisTemplate.opsForValue().set(em_info_list_path, JSONObject.toJSONString(list.stream().filter(o-> Math.abs(o.getInstalledCapacity()) > 0 || MapUtils.isNotEmpty(o.getPoint())).collect(Collectors.toList()))); redisTemplate.opsForValue().set(em_info_list_path, JSONObject.toJSONString(list.stream().filter(o-> Math.abs(o.getInstalledCapacity()) > 0 || MapUtils.isNotEmpty(o.getPoint())).collect(Collectors.toList())));
} }
private void validEmInfo(EmInfoAddVo em_info) {
// 验证设备名称
List<EmInfoEntity> existName = this.list(
Wrappers.<EmInfoEntity>lambdaQuery().eq(EmInfoEntity::getName, em_info.getInfo().getName())
);
Assert.isTrue(CollectionUtil.isEmpty(existName),()-> {
throw new ServiceException("设备名称已存在");
});
// 验证设备序号
if(Func.isNotEmpty(em_info.getInfo().getEmIndex())) {
List<EmInfoEntity> exist = super.list(Wrappers.<EmInfoEntity>lambdaQuery()
.eq(EmInfoEntity::getCreateDept, AuthUtil.getDeptId())
.eq(EmInfoEntity::getEmIndex, em_info.getInfo().getEmIndex())
);
Assert.isTrue(CollectionUtil.isEmpty(exist),() -> {
throw new ServiceException("该设备序号已存在,设备新增失败");
});
}
// 查询设备编码设备实例是否已存在
R<Boolean> existResult = deviceClient.isDeviceCodeExist(em_info.getInfo().getNumber());
Assert.isTrue(existResult.isSuccess() && !existResult.getData(),() -> {
throw new ServiceException("该设备编码在设备实例中找到对应记录,保存失败!");
});
// 验证设备编号是否已存在
EmInfoEntity emInfoEntity = this.baseMapper.selectEmInfoByCode(em_info.getInfo().getNumber());
Assert.isTrue(ObjectUtil.isEmpty(emInfoEntity),() -> {
throw new ServiceException("设备编号已存在");
});
}
} }

2
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

@ -54,7 +54,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/send/{id}") @GetMapping("/send/{id}")
@ApiOperation("推送消息记录") @ApiOperation("推送消息记录")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
public R<Boolean> send(@PathVariable @ApiParam("消息记录ID") String id) { public R<Boolean> send(@PathVariable @ApiParam("消息记录ID") Long id) {
return R.data(messagePushRecordService.send(id)); return R.data(messagePushRecordService.send(id));
} }
} }

23
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java

@ -1,10 +1,7 @@
package com.hnac.hzims.message.controller.web; package com.hnac.hzims.message.controller.web;
import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.vo.msgpushrecord.BusinessTypeStatVo; import com.hnac.hzims.message.vo.msgpushrecord.*;
import com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordTypeVo;
import com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo;
import com.hnac.hzims.message.vo.msgpushrecord.UserPushStatTypeVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -23,7 +20,7 @@ import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/api/message/statistics") @RequestMapping("/message/statistics")
public class MessageStatisticsController { public class MessageStatisticsController {
@ -35,9 +32,9 @@ public class MessageStatisticsController {
* @return * @return
*/ */
@GetMapping("/smsPushStat") @GetMapping("/smsPushStat")
public R smsPushStat() { public R smsPushStat(MessagePushRecordEntityVo vo) {
log.info("短信推送统计"); log.info("短信推送统计");
List<MessagePushRecordTypeVo> messagePushRecordVos = messagePushRecordService.smsPushStat(); List<MessagePushRecordTypeVo> messagePushRecordVos = messagePushRecordService.smsPushStat(vo);
log.info("短信推送统计 返回的数据: {}",messagePushRecordVos); log.info("短信推送统计 返回的数据: {}",messagePushRecordVos);
return R.data(messagePushRecordVos); return R.data(messagePushRecordVos);
} }
@ -48,9 +45,9 @@ public class MessageStatisticsController {
* 业务类型统计 * 业务类型统计
*/ */
@GetMapping("/businessTypeStat") @GetMapping("/businessTypeStat")
public R businessTypeStat() { public R businessTypeStat(MessagePushRecordEntityVo vo) {
log.info("业务类型统计"); log.info("业务类型统计");
List<BusinessTypeStatVo> messagePushRecordVos = messagePushRecordService.businessTypeStat(); List<BusinessTypeStatVo> messagePushRecordVos = messagePushRecordService.businessTypeStat(vo);
log.info("业务类型统计 返回的数据: {}",messagePushRecordVos); log.info("业务类型统计 返回的数据: {}",messagePushRecordVos);
return R.data(messagePushRecordVos); return R.data(messagePushRecordVos);
} }
@ -60,9 +57,9 @@ public class MessageStatisticsController {
* 人员发送统计 * 人员发送统计
*/ */
@GetMapping("/userPushStat") @GetMapping("/userPushStat")
public R userPushStat() { public R userPushStat(MessagePushRecordEntityVo vo) {
log.info("人员发送统计"); log.info("人员发送统计");
List<UserPushStatTypeVo> messagePushRecordVos = messagePushRecordService.userPushStat(); List<UserPushStatTypeVo> messagePushRecordVos = messagePushRecordService.userPushStat(vo);
log.info("人员发送统计 返回的数据: {}",messagePushRecordVos); log.info("人员发送统计 返回的数据: {}",messagePushRecordVos);
return R.data(messagePushRecordVos); return R.data(messagePushRecordVos);
} }
@ -72,8 +69,8 @@ public class MessageStatisticsController {
* 推送成功失败统计 * 推送成功失败统计
*/ */
@GetMapping("/pushStat") @GetMapping("/pushStat")
public R pushStat() { public R pushStat(MessagePushRecordEntityVo vo) {
List<PushStatTypeVo> messagePushRecordVos = messagePushRecordService.pushStat(); List<PushStatTypeVo> messagePushRecordVos = messagePushRecordService.pushStat(vo);
log.info("推送成功失败统计 返回的数据: {}",messagePushRecordVos); log.info("推送成功失败统计 返回的数据: {}",messagePushRecordVos);
return R.data(messagePushRecordVos); return R.data(messagePushRecordVos);
} }

10
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.PushDto; import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.dto.SmsPushDto; import com.hnac.hzims.message.dto.SmsPushDto;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.service.IMessageService; import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl; import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -23,6 +25,8 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
public class MessageClient extends BladeController implements IMessageClient{ public class MessageClient extends BladeController implements IMessageClient{
private final IMessagePushRecordService recordService;
@Override @Override
@PostMapping(SEND_SMS_MESSAGE) @PostMapping(SEND_SMS_MESSAGE)
public R sendSmsMessage(@RequestBody SmsPushDto pushDto) { public R sendSmsMessage(@RequestBody SmsPushDto pushDto) {
@ -30,4 +34,10 @@ public class MessageClient extends BladeController implements IMessageClient{
return messageService.send(pushDto); return messageService.send(pushDto);
} }
@Override
@PostMapping(SEND_MESSAGE)
public R<Boolean> sendMessage(@RequestBody MessagePushRecordEntity request) {
return R.status(recordService.saveAndSend(request));
}
} }

15
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java

@ -1,14 +1,11 @@
package com.hnac.hzims.message.mapper; package com.hnac.hzims.message.mapper;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.vo.msgpushrecord.BusinessTypeStatVo; import com.hnac.hzims.message.vo.msgpushrecord.*;
import com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordVo; import org.apache.ibatis.annotations.Param;
import com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo;
import com.hnac.hzims.message.vo.msgpushrecord.UserPushStatTypeVo;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List; import java.util.List;
import java.util.Map;
public interface MessagePushRecordMapper extends UserDataScopeBaseMapper<MessagePushRecordEntity> { public interface MessagePushRecordMapper extends UserDataScopeBaseMapper<MessagePushRecordEntity> {
@ -16,27 +13,27 @@ public interface MessagePushRecordMapper extends UserDataScopeBaseMapper<Message
* 根据type统计数量 * 根据type统计数量
* @return * @return
*/ */
List<MessagePushRecordVo> smsPushStat(); List<MessagePushRecordVo> smsPushStat(@Param("vo") MessagePushRecordEntityVo vo);
/** /**
* 业务类型统计 * 业务类型统计
* @return * @return
*/ */
List<BusinessTypeStatVo> businessTypeStat(); List<BusinessTypeStatVo> businessTypeStat(@Param("vo") MessagePushRecordEntityVo vo);
/** /**
* 人员发送统计 * 人员发送统计
* @return * @return
*/ */
List<UserPushStatTypeVo> userPushStat(); List<UserPushStatTypeVo> userPushStat(@Param("vo") MessagePushRecordEntityVo vo);
/** /**
* 推送成功失败统计 * 推送成功失败统计
* @return * @return
*/ */
List<PushStatTypeVo> pushStat(); List<PushStatTypeVo> pushStat(@Param("vo") MessagePushRecordEntityVo vo);
} }

41
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml

@ -23,6 +23,11 @@
type type
from hzims_message_push_record from hzims_message_push_record
where IS_DELETED = 0 where IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
group by strMonth, TYPE group by strMonth, TYPE
</select> </select>
@ -32,6 +37,18 @@
count(1) power count(1) power
from hzims_message_push_record from hzims_message_push_record
where IS_DELETED = 0 where IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.month != null and vo.month != ''">
and
date_format(PLAN_TIME, '%m') = #{vo.month}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
group by businessClassify group by businessClassify
</select> </select>
@ -42,6 +59,18 @@
count(1) count count(1) count
from hzims_message_push_record from hzims_message_push_record
where IS_DELETED = 0 where IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.month != null and vo.month != ''">
and
date_format(PLAN_TIME, '%m') = #{vo.month}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
group by businessClassify, pusherName group by businessClassify, pusherName
</select> </select>
@ -61,6 +90,18 @@
<select id="pushStat" resultMap="PushStatResultMap"> <select id="pushStat" resultMap="PushStatResultMap">
select BUSINESS_CLASSIFY businessClassify,STATUS status,count(1) count select BUSINESS_CLASSIFY businessClassify,STATUS status,count(1) count
from hzims_message_push_record from hzims_message_push_record
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.month != null and vo.month != ''">
and
date_format(PLAN_TIME, '%m') = #{vo.month}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
group by businessClassify,status group by businessClassify,status
</select> </select>
</mapper> </mapper>

8
hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java

@ -17,6 +17,7 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -54,9 +55,13 @@ public class MessagePushSchedule {
endTime = DateUtil.plus(endTime, template.getAdvanceDuration(), template.getAdvanceTimeUnit()); endTime = DateUtil.plus(endTime, template.getAdvanceDuration(), template.getAdvanceTimeUnit());
LambdaQueryWrapper<MessagePushRecordEntity> lqw = Wrappers.<MessagePushRecordEntity>lambdaQuery() LambdaQueryWrapper<MessagePushRecordEntity> lqw = Wrappers.<MessagePushRecordEntity>lambdaQuery()
.eq(MessagePushRecordEntity::getStatus, MessageConstants.NOT_PUSH) .eq(MessagePushRecordEntity::getStatus, MessageConstants.NOT_PUSH)
.eq(MessagePushRecordEntity::getTemplateId,template.getId())
.ge(MessagePushRecordEntity::getPlanTime, now) .ge(MessagePushRecordEntity::getPlanTime, now)
.le(MessagePushRecordEntity::getPlanTime, endTime); .le(MessagePushRecordEntity::getPlanTime, endTime);
List<MessagePushRecordEntity> list = recordService.list(lqw); List<MessagePushRecordEntity> list = recordService.list(lqw);
if(CollectionUtil.isEmpty(list) || list.size() == 0) {
return;
}
this.sendMessage(list); this.sendMessage(list);
}); });
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
@ -77,6 +82,9 @@ public class MessagePushSchedule {
// 完善推送内容 // 完善推送内容
request.setContent(this.getPushContent(type,records)); request.setContent(this.getPushContent(type,records));
Boolean flag = service.send(request); Boolean flag = service.send(request);
if(!flag) {
return;
}
List<Long> ids = records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()); List<Long> ids = records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList());
// 更新消息推送状态 // 更新消息推送状态
LambdaUpdateWrapper<MessagePushRecordEntity> lwq = Wrappers.<MessagePushRecordEntity>lambdaUpdate() LambdaUpdateWrapper<MessagePushRecordEntity> lwq = Wrappers.<MessagePushRecordEntity>lambdaUpdate()

24
hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java

@ -2,15 +2,11 @@ package com.hnac.hzims.message.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.vo.msgpushrecord.BusinessTypeStatVo; import com.hnac.hzims.message.vo.msgpushrecord.*;
import com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordTypeVo;
import com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo;
import com.hnac.hzims.message.vo.msgpushrecord.UserPushStatTypeVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IMessagePushRecordService extends BaseService<MessagePushRecordEntity> { public interface IMessagePushRecordService extends BaseService<MessagePushRecordEntity> {
@ -35,34 +31,42 @@ public interface IMessagePushRecordService extends BaseService<MessagePushRecord
* @Param ids 消息记录ID * @Param ids 消息记录ID
* @return * @return
**/ **/
Boolean send(String id); Boolean send(Long id);
/** @Author hx
* @Description 保存并推送消息
* @Date 2023/4/6 20:14
* @Param request 消息推送记录
* @return
**/
Boolean saveAndSend(MessagePushRecordEntity request);
/** /**
* 短信推送统计 * 短信推送统计
*/ */
List<MessagePushRecordTypeVo> smsPushStat(); List<MessagePushRecordTypeVo> smsPushStat(MessagePushRecordEntityVo vo);
/** /**
* 业务类型统计 * 业务类型统计
* @return * @return
*/ */
List<BusinessTypeStatVo> businessTypeStat(); List<BusinessTypeStatVo> businessTypeStat(MessagePushRecordEntityVo vo);
/** /**
* 人员发送统计 * 人员发送统计
* @return * @return
*/ */
List<UserPushStatTypeVo> userPushStat(); List<UserPushStatTypeVo> userPushStat(MessagePushRecordEntityVo vo);
/** /**
* 推送成功失败统计 * 推送成功失败统计
* @return * @return
*/ */
List<PushStatTypeVo> pushStat(); List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo);

89
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -1,7 +1,10 @@
package com.hnac.hzims.message.service.impl; package com.hnac.hzims.message.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.config.MessageFactory; import com.hnac.hzims.message.config.MessageFactory;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.enums.PushStatEnum; import com.hnac.hzims.message.enums.PushStatEnum;
@ -11,12 +14,16 @@ import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzims.message.vo.msgpushrecord.*; import com.hnac.hzims.message.vo.msgpushrecord.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.time.YearMonth; import java.time.YearMonth;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
@ -40,24 +47,61 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
} }
@Override @Override
public Boolean send(String id) { public Boolean send(Long id) {
MessagePushRecordEntity record = this.getById(id); MessagePushRecordEntity record = this.getById(id);
IMessageService messageSend = MessageFactory.getMessageSend(record.getType()); IMessageService messageSend = MessageFactory.getMessageSend(record.getType());
return messageSend.send(record); Boolean result = messageSend.send(record);
Assert.isTrue(result , ()-> {
throw new ServiceException("发送消息失败!");
});
// 更新推送状态以及推送时间
LambdaUpdateWrapper<MessagePushRecordEntity> luw = Wrappers.<MessagePushRecordEntity>lambdaUpdate()
.set(MessagePushRecordEntity::getPushTime, LocalDateTime.now())
.set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)
.eq(MessagePushRecordEntity::getId, id);
return this.update(luw);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveAndSend(MessagePushRecordEntity request) {
if(Func.isEmpty(request.getPlanTime())) {
request.setPlanTime(LocalDateTime.now());
}
if(this.save(request) && Func.isNotEmpty(request.getId())) {
return this.send(request.getId());
}
return false;
} }
/** /**
* 获取 QueryWrapper
* @param request 查询条件
* @return QueryWrapper
*/
private LambdaQueryWrapper<MessagePushRecordEntity> getQueryWrapper(MessagePushRecordEntity request) {
LambdaQueryWrapper<MessagePushRecordEntity> lambda = Condition.getQueryWrapper(request).lambda();
if(Func.isNotEmpty(request.getStartTime())) {
lambda.ge(MessagePushRecordEntity::getPushTime,request.getStartTime());
}
if(Func.isNotEmpty(request.getEndTime())) {
lambda.le(MessagePushRecordEntity::getPushTime,request.getEndTime());
}
lambda.orderByDesc(MessagePushRecordEntity::getPushTime);
return lambda;
}
/**
* 短信推送统计 * 短信推送统计
*/ */
@Override @Override
public List<MessagePushRecordTypeVo> smsPushStat() { public List<MessagePushRecordTypeVo> smsPushStat(MessagePushRecordEntityVo vo) {
//根据type统计数量 //根据type统计数量
List<MessagePushRecordVo> messagePushRecordVos = baseMapper.smsPushStat(); List<MessagePushRecordVo> messagePushRecordVos = baseMapper.smsPushStat(vo);
messagePushRecordVos.forEach(item -> { messagePushRecordVos.forEach(item -> {
String strMonth = item.getStrMonth(); YearMonth strMonth = item.getStrMonth();
// 字符串转localDate 获取月份 // 字符串转localDate 获取月份
int month = this.getCurrentMonth(strMonth); item.setMonth(strMonth.getMonthValue());
item.setMonth(month); item.setYear(strMonth.getYear());
}); });
//按类型分组 //按类型分组
@ -81,8 +125,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
* @return * @return
*/ */
@Override @Override
public List<BusinessTypeStatVo> businessTypeStat() { public List<BusinessTypeStatVo> businessTypeStat(MessagePushRecordEntityVo vo) {
List<BusinessTypeStatVo> businessTypeStatVos = baseMapper.businessTypeStat(); List<BusinessTypeStatVo> businessTypeStatVos = baseMapper.businessTypeStat(vo);
businessTypeStatVos.forEach(item -> { businessTypeStatVos.forEach(item -> {
String businessClassifyByName = this.getBusinessClassifyByName(item.getBusinessClassify()); String businessClassifyByName = this.getBusinessClassifyByName(item.getBusinessClassify());
item.setBusinessClassifyName(businessClassifyByName); item.setBusinessClassifyName(businessClassifyByName);
@ -96,8 +140,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
* @return * @return
*/ */
@Override @Override
public List<UserPushStatTypeVo> userPushStat() { public List<UserPushStatTypeVo> userPushStat(MessagePushRecordEntityVo vo) {
List<UserPushStatTypeVo> userPushStatTypeVos = baseMapper.userPushStat(); List<UserPushStatTypeVo> userPushStatTypeVos = baseMapper.userPushStat(vo);
//添加业务类型名称 //添加业务类型名称
userPushStatTypeVos.forEach(item -> { userPushStatTypeVos.forEach(item -> {
List<UserPushStatVo> pushStatList = item.getPushStatList(); List<UserPushStatVo> pushStatList = item.getPushStatList();
@ -117,8 +161,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
* @return * @return
*/ */
@Override @Override
public List<PushStatTypeVo> pushStat() { public List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo) {
List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(); List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(vo);
pushStatTypeVos.forEach(item -> { pushStatTypeVos.forEach(item -> {
//业务类型名称 //业务类型名称
String businessClassify = item.getBusinessClassify(); String businessClassify = item.getBusinessClassify();
@ -141,21 +185,6 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
/** /**
* 获取 QueryWrapper
*
* @param request 查询条件
* @return QueryWrapper
*/
private LambdaQueryWrapper<MessagePushRecordEntity> getQueryWrapper(MessagePushRecordEntity request) {
LambdaQueryWrapper<MessagePushRecordEntity> lambda = Condition.getQueryWrapper(request).lambda();
if (Func.isNotEmpty(request.getStatus())) {
lambda.eq(MessagePushRecordEntity::getStatus, request.getStatus());
}
return lambda;
}
/**
* 状态 ===> 状态名称 * 状态 ===> 状态名称
* *
* @param key 状态 * @param key 状态
@ -220,8 +249,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
//获取年月 //获取年月
YearMonth yearMonth = YearMonth.parse(strMonth, dateTimeFormatter); YearMonth yearMonth = YearMonth.parse(strMonth, dateTimeFormatter);
//减去3个月 //减去3个月
YearMonth month = yearMonth.minusMonths(3); //YearMonth month = yearMonth.minusMonths(3);
return month.getMonthValue(); return yearMonth.getMonthValue();
} }

8
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java

@ -6,10 +6,12 @@ import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity; import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.mapper.MessageTemplateMapper; import com.hnac.hzims.message.mapper.MessageTemplateMapper;
import com.hnac.hzims.message.service.IMessageTemplateService; import com.hnac.hzims.message.service.IMessageTemplateService;
import com.hnac.hzims.message.wrapper.MessageTemplateWrapper;
import groovy.util.logging.Slf4j; import groovy.util.logging.Slf4j;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,12 +23,14 @@ import java.util.List;
public class MessageTemplateServiceImpl extends BaseServiceImpl<MessageTemplateMapper, MessageTemplateEntity> implements IMessageTemplateService { public class MessageTemplateServiceImpl extends BaseServiceImpl<MessageTemplateMapper, MessageTemplateEntity> implements IMessageTemplateService {
@Override @Override
public List<MessageTemplateEntity> list(MessageTemplateEntity req) { public List<MessageTemplateEntity> list(MessageTemplateEntity req) {
return this.list(this.getQueryWrapper(req)); List<MessageTemplateEntity> record = this.list(this.getQueryWrapper(req));
return MessageTemplateWrapper.build().listVO(record);
} }
@Override @Override
public IPage<MessageTemplateEntity> listPage(MessageTemplateEntity req, Query query) { public IPage<MessageTemplateEntity> listPage(MessageTemplateEntity req, Query query) {
return this.page(Condition.getPage(query) , this.getQueryWrapper(req)); IPage<MessageTemplateEntity> page = this.page(Condition.getPage(query), this.getQueryWrapper(req));
return page.setRecords(MessageTemplateWrapper.build().listVO(page.getRecords()));
} }
/** /**

30
hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MessageTemplateWrapper.java

@ -0,0 +1,30 @@
package com.hnac.hzims.message.wrapper;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.system.cache.DictCache;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import java.util.Optional;
/**
* @ClassName MessageTemplateWrapper
* @description:
* @author: hx
* @create: 2023-04-06 17:30
* @Version 4.0
**/
public class MessageTemplateWrapper extends BaseEntityWrapper<MessageTemplateEntity,MessageTemplateEntity> {
public static MessageTemplateWrapper build() {
return new MessageTemplateWrapper();
}
@Override
public MessageTemplateEntity entityVO(MessageTemplateEntity entity) {
User user = UserCache.getUser(entity.getCreateUser());
entity.setCreatorName(Optional.ofNullable(user).map(User::getName).orElse(entity.getCreateUser().toString()));
return entity;
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -641,7 +641,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
if(CollectionUtil.isNotEmpty(list) && list.size() > 1) { if(CollectionUtil.isNotEmpty(list) && list.size() > 1) {
throw new ServiceException("获取站点数量超过一条"); throw new ServiceException("获取站点数量超过一条");
} }
return Optional.ofNullable(list).map(l -> l.get(0)).orElse(null); return list.size() > 0 ? list.get(0) : null;
} }
/** /**

14
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java

@ -0,0 +1,14 @@
package com.hnac.hzims.ticket.processflow.constant;
/**
* 开票常量类
*
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 10:53
*/
public class TicketProcessConstant {
public final static String STARTEVENT = "startEvent1";
}

15
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/consumer/StandardWorkTicketConsumer.java

@ -5,14 +5,13 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.ticket.processflow.entity.WorkflowOperationLog; import com.hnac.hzims.ticket.processflow.entity.WorkflowOperationLog;
import com.hnac.hzims.ticket.processflow.service.WorkflowOperationLogService; import com.hnac.hzims.ticket.processflow.service.WorkflowOperationLogService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.processflow.strategy.service.TicketService; import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.queue.annotation.RedisQueue; import org.springblade.queue.annotation.RedisQueue;
import org.springblade.queue.consume.IQueueConsume; import org.springblade.queue.consume.IQueueConsume;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.listener.RetryListenerSupport;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -32,7 +31,7 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
@Autowired @Autowired
private List<TicketService> ticketServiceList; private List<ProcessService> ticketServiceList;
@Autowired @Autowired
private WorkflowOperationLogService workflowOperationLogService; private WorkflowOperationLogService workflowOperationLogService;
@ -40,12 +39,12 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
@Override @Override
public void handlerMessage(String message) { public void handlerMessage(String message) {
log.info("监听到数据:{}", message); log.info("监听到数据:{}", message);
WorkTicketMessageResponse response = JSONObject.parseObject(message, WorkTicketMessageResponse.class); ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class);
String taskDefinitionKey = response.getTaskDefinitionKey(); String taskDefinitionKey = response.getProcessDefinitionKey();
WorkflowQueue ticker = new WorkflowQueue(); WorkflowQueue ticker = new WorkflowQueue();
ticker.setDeploymentId(taskDefinitionKey); ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类 //判断执行具体的实现类
TicketService ticketService = ticketServiceList.stream().filter(item -> item.isWorkflowTicket(ticker)) ProcessService ticketService = ticketServiceList.stream().filter(item -> item.isWorkflowProcess(ticker))
.findFirst().orElse(null); .findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(ticketService)) { if (ObjectUtils.isNotEmpty(ticketService)) {
//执行业务方法 //执行业务方法

23
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java

@ -10,8 +10,8 @@ import com.hnac.hzims.ticket.processflow.properties.TicketProperties;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties; import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties;
import com.hnac.hzims.ticket.processflow.service.ProcessTypeService; import com.hnac.hzims.ticket.processflow.service.ProcessTypeService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.processflow.strategy.service.TicketService; import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.jackson.JsonUtil;
@ -48,7 +48,7 @@ public class ProcessTypeController {
private final List<TicketService> ticketServiceList; private final List<ProcessService> ticketServiceList;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
@ -80,12 +80,12 @@ public class ProcessTypeController {
public String list(@PathVariable String key) { public String list(@PathVariable String key) {
//判断执行具体的实现类 //判断执行具体的实现类
WorkflowQueue workflowQueue = new WorkflowQueue(); WorkflowQueue workflowQueue = new WorkflowQueue();
workflowQueue.setDeploymentId(key); workflowQueue.setProcessDefinitionKey(key);
TicketService ticketService = ProcessService ticketService =
ticketServiceList.stream().filter(item -> item.isWorkflowTicket(workflowQueue)) ticketServiceList.stream().filter(item -> item.isWorkflowProcess(workflowQueue))
.findFirst().orElse(null); .findFirst().orElse(null);
String calculate = ticketService.calculate(null); ticketService.calculate(null);
return calculate; return "key";
} }
@ -111,12 +111,11 @@ public class ProcessTypeController {
action ="审批流处理") action ="审批流处理")
@GetMapping("/build") @GetMapping("/build")
public void addList() { public void addList() {
ProcessWorkFlowResponse workTicketMessageResponse = new ProcessWorkFlowResponse();
WorkTicketMessageResponse workTicketMessageResponse = new WorkTicketMessageResponse();
workTicketMessageResponse.setTaskId("1"); workTicketMessageResponse.setTaskId("1");
workTicketMessageResponse.setProcessInstanceKey("1"); workTicketMessageResponse.setProcessDefinitionKey("1");
workTicketMessageResponse.setTaskName("1"); workTicketMessageResponse.setTaskName("1");
workTicketMessageResponse.setFormData(1); workTicketMessageResponse.setFormData("1");
String qqqq = JsonUtil.toJson(workTicketMessageResponse); String qqqq = JsonUtil.toJson(workTicketMessageResponse);
queueProduceService.sendMessage("blade:queue:flow",qqqq); queueProduceService.sendMessage("blade:queue:flow",qqqq);
} }

9
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/abstracts/TicketAbstractService.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/abstracts/ProcessAbstractService.java

@ -1,11 +1,8 @@
package com.hnac.hzims.ticket.processflow.strategy.abstracts; package com.hnac.hzims.ticket.processflow.strategy.abstracts;
import com.hnac.hzims.ticket.processflow.entity.ProcessType; import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties;
import com.hnac.hzims.ticket.processflow.properties.TicketProperties;
import com.hnac.hzims.ticket.processflow.service.ProcessTypeService; import com.hnac.hzims.ticket.processflow.service.ProcessTypeService;
import com.hnac.hzims.ticket.processflow.service.WorkflowOperationLogService; import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import com.hnac.hzims.ticket.processflow.strategy.service.TicketService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -18,7 +15,7 @@ import java.util.List;
* @Date 2023/3/28 9:02 * @Date 2023/3/28 9:02
*/ */
@Slf4j @Slf4j
public abstract class TicketAbstractService implements TicketService { public abstract class ProcessAbstractService implements ProcessService {
@ -30,7 +27,7 @@ public abstract class TicketAbstractService implements TicketService {
* *
* @return * @return
*/ */
public List<ProcessType> getTicketList() { public List<ProcessType> getProcessList() {
log.info("实例化:" + processTypeService); log.info("实例化:" + processTypeService);
List<ProcessType> workTickets = processTypeService.list(); List<ProcessType> workTickets = processTypeService.list();
return workTickets; return workTickets;

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/TicketIdWorker.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java

@ -2,7 +2,6 @@ package com.hnac.hzims.ticket.processflow.strategy.core;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.hnac.hzims.common.config.RedisMessageListener;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
@ -24,7 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* @Date 2023/3/27 10:11 * @Date 2023/3/27 10:11
*/ */
@Component @Component
public class TicketIdWorker { public class ProcessIdWorker {
private static Map<String, TicketCode> cacheMap = new HashMap<>(); private static Map<String, TicketCode> cacheMap = new HashMap<>();

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/entity/WorkflowQueue.java

@ -16,7 +16,7 @@ public class WorkflowQueue {
/** /**
* 当前环节流程ID * 当前环节流程ID
*/ */
private String deploymentId; private String processDefinitionKey;
} }

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/service/TicketService.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/service/ProcessService.java

@ -1,6 +1,6 @@
package com.hnac.hzims.ticket.processflow.strategy.service; package com.hnac.hzims.ticket.processflow.strategy.service;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
/** /**
@ -9,20 +9,20 @@ import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
* @Serial 1.0 * @Serial 1.0
* @Date 2023/3/27 16:39 * @Date 2023/3/27 16:39
*/ */
public interface TicketService { public interface ProcessService {
/** /**
* 设置执行那种实现类 * 设置执行那种实现类
* @param flowQueue * @param flowQueue
* @return * @return
*/ */
Boolean isWorkflowTicket(WorkflowQueue flowQueue); Boolean isWorkflowProcess(WorkflowQueue flowQueue);
/** /**
* 两票管理业务方法 * 两票管理业务方法
* @param response * @param response
*/ */
String calculate(WorkTicketMessageResponse response); void calculate(ProcessWorkFlowResponse response);
} }

30
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/MakeTicketServiceImpl.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/MakeProcessServiceImpl.java

@ -1,10 +1,12 @@
package com.hnac.hzims.ticket.processflow.strategy.serviceimpl; package com.hnac.hzims.ticket.processflow.strategy.serviceimpl;
import com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant;
import com.hnac.hzims.ticket.processflow.entity.ProcessType; import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties; import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.TicketAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -20,7 +22,14 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Service @Service
public class MakeTicketServiceImpl extends TicketAbstractService { @RequiredArgsConstructor
public class MakeProcessServiceImpl extends ProcessAbstractService {
private final TicketProcessService ticketProcessService;
/** /**
* 设置执行那种实现类 * 设置执行那种实现类
* *
@ -28,11 +37,9 @@ public class MakeTicketServiceImpl extends TicketAbstractService {
* @return * @return
*/ */
@Override @Override
public Boolean isWorkflowTicket(WorkflowQueue flowQueue) { public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行开工作票流程环节操作~~~~,流程ticket: {}", flowQueue); log.info("是否执行开工作票流程环节操作~~~~,流程ticket: {}", flowQueue);
List<ProcessType> ticketList = this.getTicketList(); if (TicketProcessConstant.STARTEVENT.equals(flowQueue.getProcessDefinitionKey())) {
ProcessType properties = ticketList.get(0);
if (properties.getDeploymentId().equals(flowQueue.getDeploymentId())) {
log.info("已执行开工作票流程环节操作~~~~"); log.info("已执行开工作票流程环节操作~~~~");
return true; return true;
} }
@ -46,9 +53,8 @@ public class MakeTicketServiceImpl extends TicketAbstractService {
* @param response * @param response
*/ */
@Override @Override
public String calculate(WorkTicketMessageResponse response) { public void calculate(ProcessWorkFlowResponse response) {
System.out.println("OperatorTicketServiceImpl"); log.info("启动开票流程环节....");
return "开票"; ticketProcessService.startUp(response);
} }
} }

20
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OperatorTicketServiceImpl.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OperatorProcessServiceImpl.java

@ -1,9 +1,8 @@
package com.hnac.hzims.ticket.processflow.strategy.serviceimpl; package com.hnac.hzims.ticket.processflow.strategy.serviceimpl;
import com.hnac.hzims.ticket.processflow.entity.ProcessType; import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties; import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.TicketAbstractService; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -20,7 +19,10 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Service @Service
public class OperatorTicketServiceImpl extends TicketAbstractService { public class OperatorProcessServiceImpl extends ProcessAbstractService {
/** /**
* 设置执行那种实现类 * 设置执行那种实现类
* *
@ -28,11 +30,11 @@ public class OperatorTicketServiceImpl extends TicketAbstractService {
* @return * @return
*/ */
@Override @Override
public Boolean isWorkflowTicket(WorkflowQueue flowQueue) { public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue); log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue);
List<ProcessType> ticketList = this.getTicketList(); List<ProcessType> ticketList = this.getProcessList();
ProcessType properties = ticketList.get(2); ProcessType properties = ticketList.get(2);
if (properties.getDeploymentId().equals(flowQueue.getDeploymentId())) { if (properties.getDeploymentId().equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行运行人接收操作~~~~"); log.info("已执行运行人接收操作~~~~");
return true; return true;
} }
@ -46,9 +48,7 @@ public class OperatorTicketServiceImpl extends TicketAbstractService {
* @param response * @param response
*/ */
@Override @Override
public String calculate(WorkTicketMessageResponse response) { public void calculate(ProcessWorkFlowResponse response) {
System.out.println("OperatorTicketServiceImpl"); System.out.println("OperatorTicketServiceImpl");
return "运行人接收";
} }
} }

16
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/SignatureTicketServiceImpl.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/SignatureProcessServiceImpl.java

@ -1,9 +1,8 @@
package com.hnac.hzims.ticket.processflow.strategy.serviceimpl; package com.hnac.hzims.ticket.processflow.strategy.serviceimpl;
import com.hnac.hzims.ticket.processflow.entity.ProcessType; import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties; import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.TicketAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -20,7 +19,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Service @Service
public class SignatureTicketServiceImpl extends TicketAbstractService { public class SignatureProcessServiceImpl extends ProcessAbstractService {
/** /**
@ -30,11 +29,11 @@ public class SignatureTicketServiceImpl extends TicketAbstractService {
* @return * @return
*/ */
@Override @Override
public Boolean isWorkflowTicket(WorkflowQueue flowQueue) { public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue); log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue);
List<ProcessType> ticketList = this.getTicketList(); List<ProcessType> ticketList = this.getProcessList();
ProcessType properties = ticketList.get(1); ProcessType properties = ticketList.get(1);
if (properties.getDeploymentId().equals(flowQueue.getDeploymentId())){ if (properties.getDeploymentId().equals(flowQueue.getProcessDefinitionKey())){
log.info("已执行运行人接收操作~~~~"); log.info("已执行运行人接收操作~~~~");
return true; return true;
} }
@ -48,8 +47,7 @@ public class SignatureTicketServiceImpl extends TicketAbstractService {
* @param response * @param response
*/ */
@Override @Override
public String calculate(WorkTicketMessageResponse response) { public void calculate(ProcessWorkFlowResponse response) {
System.out.println("SignatureTicketServiceImpl"); System.out.println("SignatureTicketServiceImpl");
return "签发人签发";
} }
} }

7
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java

@ -3,7 +3,7 @@ package com.hnac.hzims.ticket.redisConsume;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.common.config.RedisMessageListener; import com.hnac.hzims.common.config.RedisMessageListener;
import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -31,8 +31,9 @@ public class WorkTicketMsgConsume {
Assert.isTrue(StringUtil.isNotBlank(message),() -> { Assert.isTrue(StringUtil.isNotBlank(message),() -> {
throw new ServiceException("两票接收流程消息为空!"); throw new ServiceException("两票接收流程消息为空!");
}); });
WorkTicketMessageResponse response = JSONObject.parseObject(message, WorkTicketMessageResponse.class); ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class);
TicketConstants.WorkTicketFlowEnum workTicketFlowEnum = TicketConstants.WorkTicketFlowEnum.getEnumByFlowId(response.getTaskDefinitionKey()); TicketConstants.WorkTicketFlowEnum workTicketFlowEnum =
TicketConstants.WorkTicketFlowEnum.getEnumByFlowId(response.getProcessDefinitionKey());
switch(workTicketFlowEnum) { switch(workTicketFlowEnum) {
case START: case START:
//FIXME 开票暂用此接口 //FIXME 开票暂用此接口

22
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/WorkTicketMessageResponse.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/ProcessWorkFlowResponse.java

@ -7,16 +7,17 @@ import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/** /**
*
* @author hx * @author hx
* @version 1.0 * @version 1.0
* @date 2023/3/14 19:13 * @date 2023/3/14 19:13
*/ */
@Data @Data
@EqualsAndHashCode @EqualsAndHashCode
public class WorkTicketMessageResponse implements Serializable { public class ProcessWorkFlowResponse implements Serializable {
/**当前任务ID**/ /**当前任务ID**/
@NotNull
private String taskId; private String taskId;
/**当前任务名称**/ /**当前任务名称**/
@ -24,20 +25,27 @@ public class WorkTicketMessageResponse implements Serializable {
/**当前环节流程ID**/ /**当前环节流程ID**/
@NotNull @NotNull
private String taskDefinitionKey; private String processDefinitionKey;
/**
* 业务Id
*/
private String businessKey;
/** /**
* 流程实例key * 流程实例key
*/ */
private String processInstanceKey; private String processInstanceId;
/**下一环节处理人**/ /**
@NotNull * 下一环节处理人
*/
private String nextStepOperator; private String nextStepOperator;
/**票据表单**/ /**票据表单**/
private Object formData; private String formData;
} }

20
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardWorkTicketController.java

@ -2,13 +2,13 @@ package com.hnac.hzims.ticket.standardTicket.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse; import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.standardTicket.service.StandardWorkTicketService; import com.hnac.hzims.ticket.standardTicket.service.StandardWorkTicketService;
import com.hnac.hzims.ticket.processflow.properties.TicketProperties; import com.hnac.hzims.ticket.processflow.properties.TicketProperties;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties; import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue; import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.processflow.strategy.service.TicketService; import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import com.hnac.hzims.ticket.processflow.strategy.core.TicketIdWorker; import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -43,11 +43,11 @@ public class StandardWorkTicketController {
@Autowired @Autowired
private TicketIdWorker standardTicketIdWorker; private ProcessIdWorker standardTicketIdWorker;
@Autowired @Autowired
List<TicketService> ticketService; List<ProcessService> ticketService;
@Autowired @Autowired
@ -56,7 +56,7 @@ public class StandardWorkTicketController {
@ApiOperation("测试开票") @ApiOperation("测试开票")
@PostMapping("/createTicket") @PostMapping("/createTicket")
public R createTicket() { public R createTicket() {
WorkTicketMessageResponse workTicketMessageResponse = new WorkTicketMessageResponse(); ProcessWorkFlowResponse workTicketMessageResponse = new ProcessWorkFlowResponse();
workTicketMessageResponse.setTaskId(IdWorker.get32UUID()); workTicketMessageResponse.setTaskId(IdWorker.get32UUID());
workTicketMessageResponse.setTaskName("工作流"); workTicketMessageResponse.setTaskName("工作流");
String jsonString = JSON.toJSONString(workTicketMessageResponse); String jsonString = JSON.toJSONString(workTicketMessageResponse);
@ -79,11 +79,11 @@ public class StandardWorkTicketController {
@GetMapping("/hello/{type}") @GetMapping("/hello/{type}")
public R hello(@PathVariable String type) { public R hello(@PathVariable String type) {
WorkflowQueue ticket = new WorkflowQueue(); WorkflowQueue ticket = new WorkflowQueue();
ticket.setDeploymentId(type); ticket.setProcessDefinitionKey(type);
TicketService service = ticketService.stream().filter(item -> item.isWorkflowTicket(ticket)) ProcessService service = ticketService.stream().filter(item -> item.isWorkflowProcess(ticket))
.findFirst().orElse(null); .findFirst().orElse(null);
String calculate = service.calculate(new WorkTicketMessageResponse()); service.calculate(new ProcessWorkFlowResponse());
return R.data(calculate); return R.data("hello");
} }

17
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java

@ -0,0 +1,17 @@
package com.hnac.hzims.ticket.twoTicket.mapper;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 11:29
*/
@Repository
public interface WorkTicketInfoMapper extends UserDataScopeBaseMapper<WorkTicketInfoEntity> {
}

19
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java

@ -0,0 +1,19 @@
package com.hnac.hzims.ticket.twoTicket.service;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
/**
* 开票处理流程接口
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 11:08
*/
public interface TicketProcessService {
/**
* 启动开票流程
* @param response
*/
void startUp(ProcessWorkFlowResponse response);
}

14
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java

@ -0,0 +1,14 @@
package com.hnac.hzims.ticket.twoTicket.service;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 11:31
*/
public interface WorkTicketInfoService extends BaseService<WorkTicketInfoEntity> {
}

38
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -0,0 +1,38 @@
package com.hnac.hzims.ticket.twoTicket.service.impl;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.service.WorkTicketInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.stereotype.Service;
/**
* 开票处理流程实现类
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 11:11
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class TicketProcessServiceImpl implements TicketProcessService {
private final IFlowClient flowClient;
private final WorkTicketInfoService workTicketInfoService;
/**
* 启动开票流程
*
* @param response
*/
@Override
public void startUp(ProcessWorkFlowResponse response) {
}
}

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

@ -0,0 +1,17 @@
package com.hnac.hzims.ticket.twoTicket.service.impl;
import com.hnac.hzims.ticket.twoTicket.mapper.WorkTicketInfoMapper;
import com.hnac.hzims.ticket.twoTicket.service.WorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/8 11:32
*/
@Service
public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMapper,WorkTicketInfoEntity> implements WorkTicketInfoService {
}

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/vo/SafetyMeasuresVo.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/SafetyMeasuresVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.ticket.processflow.vo; package com.hnac.hzims.ticket.twoTicket.vo.process;
import lombok.Data; import lombok.Data;

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/vo/TeamGroupVo.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/TeamGroupVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.ticket.processflow.vo; package com.hnac.hzims.ticket.twoTicket.vo.process;
import lombok.Data; import lombok.Data;

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/vo/TeamPersonnelVo.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/TeamPersonnelVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.ticket.processflow.vo; package com.hnac.hzims.ticket.twoTicket.vo.process;
import lombok.Data; import lombok.Data;

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/vo/WorkTicketVo.java → hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/WorkTicketVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.ticket.processflow.vo; package com.hnac.hzims.ticket.twoTicket.vo.process;
import lombok.Data; import lombok.Data;
Loading…
Cancel
Save