Browse Source

完善消息统计接口

zhongwei
段飞宇 2 years ago
parent
commit
7d642e4268
  1. 29
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java
  2. 10
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java
  3. 21
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java
  4. 15
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java
  5. 43
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
  6. 14
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
  7. 26
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  8. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java
  9. 15
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/consumer/StandardWorkTicketConsumer.java
  10. 23
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java
  11. 9
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/abstracts/ProcessAbstractService.java
  12. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java
  13. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/entity/WorkflowQueue.java
  14. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/service/ProcessService.java
  15. 30
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/MakeProcessServiceImpl.java
  16. 20
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/OperatorProcessServiceImpl.java
  17. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/SignatureProcessServiceImpl.java
  18. 7
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java
  19. 22
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/response/ProcessWorkFlowResponse.java
  20. 20
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardWorkTicketController.java
  21. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java
  22. 19
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java
  23. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java
  24. 38
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  25. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketInfoServiceImpl.java
  26. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/SafetyMeasuresVo.java
  27. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/TeamGroupVo.java
  28. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/TeamPersonnelVo.java
  29. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/process/WorkTicketVo.java

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

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

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

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

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

@ -23,15 +23,32 @@
type
from hzims_message_push_record
where IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
group by strMonth, TYPE
</select>
<!-- 业务类型统计-->
<select id="businessTypeStat" resultType="com.hnac.hzims.message.vo.msgpushrecord.BusinessTypeStatVo">
select BUSINESS_CLASSIFY businessClassify,
count(1) power
count(1) power
from hzims_message_push_record
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
</select>
@ -42,6 +59,18 @@
count(1) count
from hzims_message_push_record
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
</select>
@ -61,6 +90,18 @@
<select id="pushStat" resultMap="PushStatResultMap">
select BUSINESS_CLASSIFY businessClassify,STATUS status,count(1) count
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
</select>
</mapper>

14
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.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.vo.msgpushrecord.BusinessTypeStatVo;
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 com.hnac.hzims.message.vo.msgpushrecord.*;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import java.util.List;
import java.util.Map;
public interface IMessagePushRecordService extends BaseService<MessagePushRecordEntity> {
@ -49,28 +45,28 @@ public interface IMessagePushRecordService extends BaseService<MessagePushRecord
/**
* 短信推送统计
*/
List<MessagePushRecordTypeVo> smsPushStat();
List<MessagePushRecordTypeVo> smsPushStat(MessagePushRecordEntityVo vo);
/**
* 业务类型统计
* @return
*/
List<BusinessTypeStatVo> businessTypeStat();
List<BusinessTypeStatVo> businessTypeStat(MessagePushRecordEntityVo vo);
/**
* 人员发送统计
* @return
*/
List<UserPushStatTypeVo> userPushStat();
List<UserPushStatTypeVo> userPushStat(MessagePushRecordEntityVo vo);
/**
* 推送成功失败统计
* @return
*/
List<PushStatTypeVo> pushStat();
List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo);

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

@ -94,14 +94,14 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
* 短信推送统计
*/
@Override
public List<MessagePushRecordTypeVo> smsPushStat() {
public List<MessagePushRecordTypeVo> smsPushStat(MessagePushRecordEntityVo vo) {
//根据type统计数量
List<MessagePushRecordVo> messagePushRecordVos = baseMapper.smsPushStat();
List<MessagePushRecordVo> messagePushRecordVos = baseMapper.smsPushStat(vo);
messagePushRecordVos.forEach(item -> {
String strMonth = item.getStrMonth();
YearMonth strMonth = item.getStrMonth();
// 字符串转localDate 获取月份
int month = this.getCurrentMonth(strMonth);
item.setMonth(month);
item.setMonth(strMonth.getMonthValue());
item.setYear(strMonth.getYear());
});
//按类型分组
@ -125,8 +125,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
* @return
*/
@Override
public List<BusinessTypeStatVo> businessTypeStat() {
List<BusinessTypeStatVo> businessTypeStatVos = baseMapper.businessTypeStat();
public List<BusinessTypeStatVo> businessTypeStat(MessagePushRecordEntityVo vo) {
List<BusinessTypeStatVo> businessTypeStatVos = baseMapper.businessTypeStat(vo);
businessTypeStatVos.forEach(item -> {
String businessClassifyByName = this.getBusinessClassifyByName(item.getBusinessClassify());
item.setBusinessClassifyName(businessClassifyByName);
@ -140,8 +140,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
* @return
*/
@Override
public List<UserPushStatTypeVo> userPushStat() {
List<UserPushStatTypeVo> userPushStatTypeVos = baseMapper.userPushStat();
public List<UserPushStatTypeVo> userPushStat(MessagePushRecordEntityVo vo) {
List<UserPushStatTypeVo> userPushStatTypeVos = baseMapper.userPushStat(vo);
//添加业务类型名称
userPushStatTypeVos.forEach(item -> {
List<UserPushStatVo> pushStatList = item.getPushStatList();
@ -161,8 +161,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
* @return
*/
@Override
public List<PushStatTypeVo> pushStat() {
List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat();
public List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo) {
List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(vo);
pushStatTypeVos.forEach(item -> {
//业务类型名称
String businessClassify = item.getBusinessClassify();
@ -249,8 +249,8 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
//获取年月
YearMonth yearMonth = YearMonth.parse(strMonth, dateTimeFormatter);
//减去3个月
YearMonth month = yearMonth.minusMonths(3);
return month.getMonthValue();
//YearMonth month = yearMonth.minusMonths(3);
return yearMonth.getMonthValue();
}

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.service.WorkflowOperationLogService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.processflow.strategy.service.TicketService;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import lombok.extern.slf4j.Slf4j;
import org.springblade.queue.annotation.RedisQueue;
import org.springblade.queue.consume.IQueueConsume;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.listener.RetryListenerSupport;
import org.springframework.stereotype.Service;
import java.util.List;
@ -32,7 +31,7 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
@Autowired
private List<TicketService> ticketServiceList;
private List<ProcessService> ticketServiceList;
@Autowired
private WorkflowOperationLogService workflowOperationLogService;
@ -40,12 +39,12 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
@Override
public void handlerMessage(String message) {
log.info("监听到数据:{}", message);
WorkTicketMessageResponse response = JSONObject.parseObject(message, WorkTicketMessageResponse.class);
String taskDefinitionKey = response.getTaskDefinitionKey();
ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class);
String taskDefinitionKey = response.getProcessDefinitionKey();
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);
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.service.ProcessTypeService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.processflow.strategy.service.TicketService;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
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;
@ -80,12 +80,12 @@ public class ProcessTypeController {
public String list(@PathVariable String key) {
//判断执行具体的实现类
WorkflowQueue workflowQueue = new WorkflowQueue();
workflowQueue.setDeploymentId(key);
TicketService ticketService =
ticketServiceList.stream().filter(item -> item.isWorkflowTicket(workflowQueue))
workflowQueue.setProcessDefinitionKey(key);
ProcessService ticketService =
ticketServiceList.stream().filter(item -> item.isWorkflowProcess(workflowQueue))
.findFirst().orElse(null);
String calculate = ticketService.calculate(null);
return calculate;
ticketService.calculate(null);
return "key";
}
@ -111,12 +111,11 @@ public class ProcessTypeController {
action ="审批流处理")
@GetMapping("/build")
public void addList() {
WorkTicketMessageResponse workTicketMessageResponse = new WorkTicketMessageResponse();
ProcessWorkFlowResponse workTicketMessageResponse = new ProcessWorkFlowResponse();
workTicketMessageResponse.setTaskId("1");
workTicketMessageResponse.setProcessInstanceKey("1");
workTicketMessageResponse.setProcessDefinitionKey("1");
workTicketMessageResponse.setTaskName("1");
workTicketMessageResponse.setFormData(1);
workTicketMessageResponse.setFormData("1");
String qqqq = JsonUtil.toJson(workTicketMessageResponse);
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;
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.WorkflowOperationLogService;
import com.hnac.hzims.ticket.processflow.strategy.service.TicketService;
import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,7 +15,7 @@ import java.util.List;
* @Date 2023/3/28 9:02
*/
@Slf4j
public abstract class TicketAbstractService implements TicketService {
public abstract class ProcessAbstractService implements ProcessService {
@ -30,7 +27,7 @@ public abstract class TicketAbstractService implements TicketService {
*
* @return
*/
public List<ProcessType> getTicketList() {
public List<ProcessType> getProcessList() {
log.info("实例化:" + processTypeService);
List<ProcessType> workTickets = processTypeService.list();
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.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.hnac.hzims.common.config.RedisMessageListener;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
@ -24,7 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* @Date 2023/3/27 10:11
*/
@Component
public class TicketIdWorker {
public class ProcessIdWorker {
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
*/
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;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
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
* @Date 2023/3/27 16:39
*/
public interface TicketService {
public interface ProcessService {
/**
* 设置执行那种实现类
* @param flowQueue
* @return
*/
Boolean isWorkflowTicket(WorkflowQueue flowQueue);
Boolean isWorkflowProcess(WorkflowQueue flowQueue);
/**
* 两票管理业务方法
* @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;
import com.hnac.hzims.ticket.processflow.constant.TicketProcessConstant;
import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.TicketAbstractService;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
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 org.springframework.stereotype.Service;
@ -20,7 +22,14 @@ import java.util.List;
*/
@Slf4j
@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
*/
@Override
public Boolean isWorkflowTicket(WorkflowQueue flowQueue) {
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行开工作票流程环节操作~~~~,流程ticket: {}", flowQueue);
List<ProcessType> ticketList = this.getTicketList();
ProcessType properties = ticketList.get(0);
if (properties.getDeploymentId().equals(flowQueue.getDeploymentId())) {
if (TicketProcessConstant.STARTEVENT.equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行开工作票流程环节操作~~~~");
return true;
}
@ -46,9 +53,8 @@ public class MakeTicketServiceImpl extends TicketAbstractService {
* @param response
*/
@Override
public String calculate(WorkTicketMessageResponse response) {
System.out.println("OperatorTicketServiceImpl");
return "开票";
public void calculate(ProcessWorkFlowResponse response) {
log.info("启动开票流程环节....");
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;
import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.TicketAbstractService;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -20,7 +19,10 @@ import java.util.List;
*/
@Slf4j
@Service
public class OperatorTicketServiceImpl extends TicketAbstractService {
public class OperatorProcessServiceImpl extends ProcessAbstractService {
/**
* 设置执行那种实现类
*
@ -28,11 +30,11 @@ public class OperatorTicketServiceImpl extends TicketAbstractService {
* @return
*/
@Override
public Boolean isWorkflowTicket(WorkflowQueue flowQueue) {
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue);
List<ProcessType> ticketList = this.getTicketList();
List<ProcessType> ticketList = this.getProcessList();
ProcessType properties = ticketList.get(2);
if (properties.getDeploymentId().equals(flowQueue.getDeploymentId())) {
if (properties.getDeploymentId().equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行运行人接收操作~~~~");
return true;
}
@ -46,9 +48,7 @@ public class OperatorTicketServiceImpl extends TicketAbstractService {
* @param response
*/
@Override
public String calculate(WorkTicketMessageResponse response) {
public void calculate(ProcessWorkFlowResponse response) {
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;
import com.hnac.hzims.ticket.processflow.entity.ProcessType;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.TicketAbstractService;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.ticket.processflow.strategy.entity.WorkflowQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -20,7 +19,7 @@ import java.util.List;
*/
@Slf4j
@Service
public class SignatureTicketServiceImpl extends TicketAbstractService {
public class SignatureProcessServiceImpl extends ProcessAbstractService {
/**
@ -30,11 +29,11 @@ public class SignatureTicketServiceImpl extends TicketAbstractService {
* @return
*/
@Override
public Boolean isWorkflowTicket(WorkflowQueue flowQueue) {
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行运行人接收操作~~~~,流程flowQueue: {}", flowQueue);
List<ProcessType> ticketList = this.getTicketList();
List<ProcessType> ticketList = this.getProcessList();
ProcessType properties = ticketList.get(1);
if (properties.getDeploymentId().equals(flowQueue.getDeploymentId())){
if (properties.getDeploymentId().equals(flowQueue.getProcessDefinitionKey())){
log.info("已执行运行人接收操作~~~~");
return true;
}
@ -48,8 +47,7 @@ public class SignatureTicketServiceImpl extends TicketAbstractService {
* @param response
*/
@Override
public String calculate(WorkTicketMessageResponse response) {
public void calculate(ProcessWorkFlowResponse response) {
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.hnac.hzims.common.config.RedisMessageListener;
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 lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -31,8 +31,9 @@ public class WorkTicketMsgConsume {
Assert.isTrue(StringUtil.isNotBlank(message),() -> {
throw new ServiceException("两票接收流程消息为空!");
});
WorkTicketMessageResponse response = JSONObject.parseObject(message, WorkTicketMessageResponse.class);
TicketConstants.WorkTicketFlowEnum workTicketFlowEnum = TicketConstants.WorkTicketFlowEnum.getEnumByFlowId(response.getTaskDefinitionKey());
ProcessWorkFlowResponse response = JSONObject.parseObject(message, ProcessWorkFlowResponse.class);
TicketConstants.WorkTicketFlowEnum workTicketFlowEnum =
TicketConstants.WorkTicketFlowEnum.getEnumByFlowId(response.getProcessDefinitionKey());
switch(workTicketFlowEnum) {
case START:
//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;
/**
*
* @author hx
* @version 1.0
* @date 2023/3/14 19:13
*/
@Data
@EqualsAndHashCode
public class WorkTicketMessageResponse implements Serializable {
public class ProcessWorkFlowResponse implements Serializable {
/**当前任务ID**/
@NotNull
private String taskId;
/**当前任务名称**/
@ -24,20 +25,27 @@ public class WorkTicketMessageResponse implements Serializable {
/**当前环节流程ID**/
@NotNull
private String taskDefinitionKey;
private String processDefinitionKey;
/**
* 业务Id
*/
private String businessKey;
/**
* 流程实例key
*/
private String processInstanceKey;
private String processInstanceId;
/**下一环节处理人**/
@NotNull
/**
* 下一环节处理人
*/
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.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.processflow.properties.TicketProperties;
import com.hnac.hzims.ticket.processflow.properties.WorkTicketProperties;
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.core.TicketIdWorker;
import com.hnac.hzims.ticket.processflow.strategy.service.ProcessService;
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@ -43,11 +43,11 @@ public class StandardWorkTicketController {
@Autowired
private TicketIdWorker standardTicketIdWorker;
private ProcessIdWorker standardTicketIdWorker;
@Autowired
List<TicketService> ticketService;
List<ProcessService> ticketService;
@Autowired
@ -56,7 +56,7 @@ public class StandardWorkTicketController {
@ApiOperation("测试开票")
@PostMapping("/createTicket")
public R createTicket() {
WorkTicketMessageResponse workTicketMessageResponse = new WorkTicketMessageResponse();
ProcessWorkFlowResponse workTicketMessageResponse = new ProcessWorkFlowResponse();
workTicketMessageResponse.setTaskId(IdWorker.get32UUID());
workTicketMessageResponse.setTaskName("工作流");
String jsonString = JSON.toJSONString(workTicketMessageResponse);
@ -79,11 +79,11 @@ public class StandardWorkTicketController {
@GetMapping("/hello/{type}")
public R hello(@PathVariable String type) {
WorkflowQueue ticket = new WorkflowQueue();
ticket.setDeploymentId(type);
TicketService service = ticketService.stream().filter(item -> item.isWorkflowTicket(ticket))
ticket.setProcessDefinitionKey(type);
ProcessService service = ticketService.stream().filter(item -> item.isWorkflowProcess(ticket))
.findFirst().orElse(null);
String calculate = service.calculate(new WorkTicketMessageResponse());
return R.data(calculate);
service.calculate(new ProcessWorkFlowResponse());
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;

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;

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;

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;
Loading…
Cancel
Save