Commit 5b075329 authored by fhj's avatar fhj

采购计划和需求计划在首页展示统计时BUG

parent b63ccfb0
......@@ -22,6 +22,10 @@ import com.ssy.lingxi.purchase.repository.purchaseplan.PurchasePlanRecordReposit
import com.ssy.lingxi.purchase.repository.purchaseplan.PurchasePlanRepository;
import com.ssy.lingxi.purchase.service.purchaseplan.PurchasePlanService;
import com.ssy.lingxi.purchase.utils.DateUtil;
import com.ssy.lingxi.report.api.enums.OperateDataSourceEnum;
import com.ssy.lingxi.report.api.enums.PurchasePlanOperateTypeEnum;
import com.ssy.lingxi.report.api.feign.ReportControllerFeign;
import com.ssy.lingxi.report.api.vo.request.OperateNoticeVO;
import com.ssy.lingxi.workflow.api.feign.ProcessFeign;
import com.ssy.lingxi.workflow.api.model.contant.ProcessTaskStatusEnum;
import com.ssy.lingxi.workflow.api.model.vo.request.InternalProcessQueryVO;
......@@ -39,6 +43,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -73,6 +78,8 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
private PurchasePlanRecordRepository purchasePlanRecordRepository;
@Resource
private NeedPlanRecordRepository needPlanRecordRepository;
@Resource
private ReportControllerFeign reportControllerFeign;
@Override
@ApiOperation(value = "内部状态")
......@@ -285,6 +292,13 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
needPlan.setInnerTaskId(wrapper.getData().getTaskId());
needPlan.setPurchasePlanId(null);
needPlanRepository.saveAndFlush(needPlan);
//调用报表服务 -> 新增操作通知(如果调用过程出现异常, 无需回滚, 直接catch打印日志正常返回。)
addOperateNotice(
user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
PurchasePlanOperateTypeEnum.TO_BE_SUMMARY_COUNT.getCode(), null,
null, null
);
}else {
log.error("工作流服务异常:" + wrapper.getMessage());
return Wrapper.fail("工作流服务异常,请稍后再试!");
......@@ -295,6 +309,13 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
}
}
//调用报表服务 -> 新增操作通知(如果调用过程出现异常, 无需回滚, 直接catch打印日志正常返回。)
addOperateNotice(
user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
null, null,
PurchasePlanOperateTypeEnum.TO_BE_COMMIT_VALIFY_COUNT.getCode(), 1L
);
return Wrapper.success();
}
......@@ -345,6 +366,13 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
throw new BusinessException(ResponseCode.SERVICE_WORKFLOW_ERROR);
}
//调用报表服务 -> 新增操作通知(如果调用过程出现异常, 无需回滚, 直接catch打印日志正常返回。)
addOperateNotice(
user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
PurchasePlanOperateTypeEnum.TO_BE_VALIFY_STEP1_COUNT.getCode(), 1L,
PurchasePlanOperateTypeEnum.TO_BE_COMMIT_VALIFY_COUNT.getCode(), 1L
);
return Wrapper.success();
}
......@@ -399,6 +427,21 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
throw new BusinessException(ResponseCode.SERVICE_WORKFLOW_ERROR);
}
//调用报表服务 -> 新增操作通知(如果调用过程出现异常, 无需回滚, 直接catch打印日志正常返回。)
if(dto.getStatus().equals(CommonBooleanEnum.YES.getCode())) {
addOperateNotice(
user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
PurchasePlanOperateTypeEnum.TO_BE_VALIFY_STEP2_COUNT.getCode(), 1L,
PurchasePlanOperateTypeEnum.TO_BE_VALIFY_STEP1_COUNT.getCode(), 1L
);
}else {
addOperateNotice(
user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
null, null,
PurchasePlanOperateTypeEnum.TO_BE_VALIFY_STEP1_COUNT.getCode(), 1L
);
}
return Wrapper.success();
}
......@@ -453,6 +496,21 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
throw new BusinessException(ResponseCode.SERVICE_WORKFLOW_ERROR);
}
//调用报表服务 -> 新增操作通知(如果调用过程出现异常, 无需回滚, 直接catch打印日志正常返回。)
if(dto.getStatus().equals(CommonBooleanEnum.YES.getCode())) {
addOperateNotice(
user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
PurchasePlanOperateTypeEnum.TO_BE_EXECUTE_COUNT.getCode(), 1L,
PurchasePlanOperateTypeEnum.TO_BE_VALIFY_STEP2_COUNT.getCode(), 1L
);
}else {
addOperateNotice(
user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
null, null,
PurchasePlanOperateTypeEnum.TO_BE_VALIFY_STEP2_COUNT.getCode(), 1L
);
}
return Wrapper.success();
}
......@@ -492,6 +550,13 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
purchasePlan.setInnerStatus(wrapper.getData().getStatus());
purchasePlan.setInnerTaskId(wrapper.getData().getTaskId());
purchasePlanRepository.saveAndFlush(purchasePlan);
//调用报表服务 -> 新增操作通知(如果调用过程出现异常, 无需回滚, 直接catch打印日志正常返回。)
addOperateNotice(
purchasePlan.getMemberId(), purchasePlan.getRoleId(), OperateDataSourceEnum.PURCHASE_PLAN.getCode(),
null, null,
PurchasePlanOperateTypeEnum.TO_BE_EXECUTE_COUNT.getCode(), 1L
);
}else {
log.error("采购计划ID为:{},工作流服务异常:{}", purchasePlan.getId(), wrapper.getMessage());
}
......@@ -543,4 +608,40 @@ public class PurchasePlanServiceImpl implements PurchasePlanService {
return new PageData<>(totalCount, list);
}
/**
* 新增操作通知
* @param memberId 会员ID
* @param roleId 角色ID
* @param dataSource 数据源
* @param increaseStatus 增加的待办
* @param increaseNum 增加的数量
* @param reduceStatus 减少的待办
* @param reduceNum 减少的数量
*/
@Async
public void addOperateNotice(Long memberId, Long roleId, Integer dataSource, Integer increaseStatus, Long increaseNum, Integer reduceStatus, Long reduceNum) {
try {
OperateNoticeVO noticeVO = new OperateNoticeVO();
noticeVO.setMemberId(memberId);
noticeVO.setRoleId(roleId);
noticeVO.setDataSource(dataSource);
//增加的待办与数量
if(increaseStatus != null) {
noticeVO.setIncreaseOperateType(increaseStatus);
noticeVO.setIncreaseCount(increaseNum);
}
//减少的待办与数量
if(reduceStatus != null) {
noticeVO.setReduceOperateType(reduceStatus);
noticeVO.setReduceCount(reduceNum);
}
reportControllerFeign.addOperateNotice(noticeVO);
} catch (Exception e) {
log.info("调用报表服务新增操作通知接口失败:{}", e.getMessage());
}
}
}
......@@ -9,10 +9,10 @@ import java.util.Arrays;
* @version 2.0.0
*/
public enum PurchaseNeedPlanOperateTypeEnum {
TO_BE_COMMIT_VALIFY_COUNT(1,"待提交审核需求计划",""),
TO_BE_VALIFY_STEP1_COUNT(2,"待审核需求计划(一级)",""),
TO_BE_VALIFY_STEP2_COUNT(3,"待审核需求计划(二级)",""),
TO_BE_COMMIT_COUNT(4,"待提交需求计划",""),
TO_BE_COMMIT_VALIFY_COUNT(1,"待提交审核需求计划","/memberCenter/procurementAbility/demandPlan/demandPlanAdded"),
TO_BE_VALIFY_STEP1_COUNT(2,"待审核需求计划(一级)","/memberCenter/procurementAbility/demandPlan/demandPlanOne"),
TO_BE_VALIFY_STEP2_COUNT(3,"待审核需求计划(二级)","/memberCenter/procurementAbility/demandPlan/demandPlanTwo"),
TO_BE_COMMIT_COUNT(4,"待提交需求计划","/memberCenter/procurementAbility/demandPlan/demandPlanSubmit"),
;
/**
* 编码
......
......@@ -9,11 +9,11 @@ import java.util.Arrays;
* @version 2.0.0
*/
public enum PurchasePlanOperateTypeEnum {
TO_BE_SUMMARY_COUNT(1,"待汇总需求计划",""),
TO_BE_COMMIT_VALIFY_COUNT(2,"待提交采购计划",""),
TO_BE_VALIFY_STEP1_COUNT(3,"待审核采购计划(一级)",""),
TO_BE_VALIFY_STEP2_COUNT(4,"待审核采购计划(二级)",""),
TO_BE_EXECUTE_COUNT(5,"待执行采购计划",""),
TO_BE_SUMMARY_COUNT(1,"待汇总需求计划","/memberCenter/procurementAbility/purchasePlan/demandPlanSummary"),
TO_BE_COMMIT_VALIFY_COUNT(2,"待提交采购计划","/memberCenter/procurementAbility/purchasePlan/purchasePlanSubmit"),
TO_BE_VALIFY_STEP1_COUNT(3,"待审核采购计划(一级)","/memberCenter/procurementAbility/purchasePlan/purchasePlanOne"),
TO_BE_VALIFY_STEP2_COUNT(4,"待审核采购计划(二级)","/memberCenter/procurementAbility/purchasePlan/purchasePlanTwo"),
TO_BE_EXECUTE_COUNT(5,"待执行采购计划","/memberCenter/procurementAbility/purchasePlan/purchasePlanPerform"),
;
/**
* 编码
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment