|
@@ -34,6 +34,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 处罚单
|
|
|
+ *
|
|
|
* @author :lijh
|
|
|
* @description:TODO
|
|
|
* @date :2024/2/29 12:52
|
|
@@ -51,11 +52,12 @@ public class PunishOrderLogic {
|
|
|
|
|
|
/**
|
|
|
* 处罚工单列表
|
|
|
+ *
|
|
|
* @param zfireParamBean
|
|
|
* @return
|
|
|
*/
|
|
|
- public IPage<PunishOrderVO> list(ExamineZfireParamBean zfireParamBean){
|
|
|
- FieldUtils.supplyParam(zfireParamBean,PunishOrderVO.class,commonLogic.getAdminUser());
|
|
|
+ public IPage<PunishOrderVO> list(ExamineZfireParamBean zfireParamBean) {
|
|
|
+ FieldUtils.supplyParam(zfireParamBean, PunishOrderVO.class, commonLogic.getAdminUser());
|
|
|
IPage<PunishOrderVO> page = commonMapper.punishOrderList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
|
|
|
return page;
|
|
|
}
|
|
@@ -65,23 +67,23 @@ public class PunishOrderLogic {
|
|
|
* 保存处罚工单
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void save(PunishOrderBean punishOrderBean){
|
|
|
+ public void save(PunishOrderBean punishOrderBean) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
- if(CollectionUtils.isEmpty(punishOrderBean.getPunishOrderProducts())){
|
|
|
+ if (CollectionUtils.isEmpty(punishOrderBean.getPunishOrderProducts())) {
|
|
|
throw new RemoteServiceException("产品信息不能为空");
|
|
|
}
|
|
|
- if(CollectionUtils.isEmpty(punishOrderBean.getPunishOrderWorkers())){
|
|
|
+ if (CollectionUtils.isEmpty(punishOrderBean.getPunishOrderWorkers())) {
|
|
|
throw new RemoteServiceException("处罚工程师信息不能为空");
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(punishOrderBean.getId())){
|
|
|
+ if (StringUtils.isNotBlank(punishOrderBean.getId())) {
|
|
|
PunishOrder old = punishOrderService.getById(punishOrderBean.getId());
|
|
|
- if(!StringUtils.equals(old.getStatus(),ExamineStatusEnum.SAVE.getKey())){
|
|
|
+ if (!StringUtils.equals(old.getStatus(), ExamineStatusEnum.SAVE.getKey())) {
|
|
|
throw new RemoteServiceException("非保存状态不可编辑");
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
List<String> insideCodes = punishOrderBean.getPunishOrderProducts().stream().map(PunishOrderProduct::getInsideCode).collect(Collectors.toList());
|
|
|
List<String> outCodes = punishOrderBean.getPunishOrderProducts().stream().map(PunishOrderProduct::getOutCode).collect(Collectors.toList());
|
|
|
- if(!CollectionUtils.isEmpty(insideCodes)) {
|
|
|
+ if (!CollectionUtils.isEmpty(insideCodes)) {
|
|
|
//检查条码是否已存在
|
|
|
Integer count = punishOrderProductService.lambdaQuery()
|
|
|
.in(PunishOrderProduct::getInsideCode, insideCodes)
|
|
@@ -90,7 +92,7 @@ public class PunishOrderLogic {
|
|
|
throw new RemoteServiceException("内机条码已存在");
|
|
|
}
|
|
|
}
|
|
|
- if(!CollectionUtils.isEmpty(outCodes)) {
|
|
|
+ if (!CollectionUtils.isEmpty(outCodes)) {
|
|
|
//检查条码是否已存在
|
|
|
Integer count = punishOrderProductService.lambdaQuery()
|
|
|
.in(PunishOrderProduct::getOutCode, outCodes)
|
|
@@ -101,7 +103,7 @@ public class PunishOrderLogic {
|
|
|
}
|
|
|
}
|
|
|
long count = punishOrderBean.getPunishOrderWorkers().stream().filter(v -> v.getAmount() == null || v.getAmount().doubleValue() < 0).count();
|
|
|
- if(count > 0){
|
|
|
+ if (count > 0) {
|
|
|
throw new RemoteServiceException("处罚金额不能为空或小于0");
|
|
|
}
|
|
|
//总处罚金额
|
|
@@ -112,7 +114,7 @@ public class PunishOrderLogic {
|
|
|
punishOrderBean.setCompanyWechatName(adminUser.getCompanyName());
|
|
|
punishOrderService.saveOrUpdate(punishOrderBean);
|
|
|
//产品信息
|
|
|
- punishOrderProductService.lambdaUpdate().eq(PunishOrderProduct::getPunishOrderId,punishOrderBean.getId()).remove();
|
|
|
+ punishOrderProductService.lambdaUpdate().eq(PunishOrderProduct::getPunishOrderId, punishOrderBean.getId()).remove();
|
|
|
punishOrderBean.getPunishOrderProducts().forEach(v -> v
|
|
|
.setPunishOrderId(punishOrderBean.getId())
|
|
|
.setCompanyWechatId(adminUser.getCompanyWechatId())
|
|
@@ -120,7 +122,7 @@ public class PunishOrderLogic {
|
|
|
);
|
|
|
punishOrderProductService.saveBatch(punishOrderBean.getPunishOrderProducts());
|
|
|
//处罚的工程师信息
|
|
|
- punishOrderWorkerService.lambdaUpdate().eq(PunishOrderWorker::getPunishOrderId,punishOrderBean.getId()).remove();
|
|
|
+ punishOrderWorkerService.lambdaUpdate().eq(PunishOrderWorker::getPunishOrderId, punishOrderBean.getId()).remove();
|
|
|
punishOrderBean.getPunishOrderWorkers().forEach(v -> v
|
|
|
.setPunishOrderId(punishOrderBean.getId())
|
|
|
.setCompanyWechatId(adminUser.getCompanyWechatId())
|
|
@@ -132,43 +134,46 @@ public class PunishOrderLogic {
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- public PunishOrderBean detail(String id){
|
|
|
+ public PunishOrderBean detail(String id) {
|
|
|
PunishOrder punishOrder = punishOrderService.getById(id);
|
|
|
PunishOrderBean punishOrderBean = BeanUtil.copyProperties(punishOrder, PunishOrderBean.class);
|
|
|
//产品信息
|
|
|
- punishOrderBean.setPunishOrderProducts(punishOrderProductService.lambdaQuery().eq(PunishOrderProduct::getPunishOrderId,id).list());
|
|
|
+ punishOrderBean.setPunishOrderProducts(punishOrderProductService.lambdaQuery().eq(PunishOrderProduct::getPunishOrderId, id).list());
|
|
|
//处罚的工程师信息
|
|
|
- punishOrderBean.setPunishOrderWorkers(punishOrderWorkerService.lambdaQuery().eq(PunishOrderWorker::getPunishOrderId,id).list());
|
|
|
+ punishOrderBean.setPunishOrderWorkers(punishOrderWorkerService.lambdaQuery().eq(PunishOrderWorker::getPunishOrderId, id).list());
|
|
|
return punishOrderBean;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
+ *
|
|
|
* @param id
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void delete(String id){
|
|
|
- punishOrderService.lambdaUpdate().eq(PunishOrder::getId,id).remove();
|
|
|
- punishOrderProductService.lambdaUpdate().eq(PunishOrderProduct::getPunishOrderId,id).remove();
|
|
|
- punishOrderWorkerService.lambdaUpdate().eq(PunishOrderWorker::getPunishOrderId,id).remove();
|
|
|
+ public void delete(String id) {
|
|
|
+ punishOrderService.lambdaUpdate().eq(PunishOrder::getId, id).remove();
|
|
|
+ punishOrderProductService.lambdaUpdate().eq(PunishOrderProduct::getPunishOrderId, id).remove();
|
|
|
+ punishOrderWorkerService.lambdaUpdate().eq(PunishOrderWorker::getPunishOrderId, id).remove();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 审批
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @param examineStatus
|
|
|
* @param examineRemark
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void examine(String id, ExamineStatusEnum examineStatus,String examineRemark){
|
|
|
+ public void examine(String id, ExamineStatusEnum examineStatus, String examineRemark) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
PunishOrder punishOrder = punishOrderService.getById(id);
|
|
|
List<PunishOrderWorker> punishOrderWorkers = punishOrderWorkerService.lambdaQuery().eq(PunishOrderWorker::getPunishOrderId, id).list();
|
|
|
- if(!punishOrder.getStatus().equals(ExamineStatusEnum.SAVE.getKey())){
|
|
|
+ if (!punishOrder.getStatus().equals(ExamineStatusEnum.SAVE.getKey())) {
|
|
|
throw new RemoteServiceException("非已保存状态不可审批");
|
|
|
}
|
|
|
punishOrder.setStatus(examineStatus.getKey());
|
|
@@ -177,15 +182,15 @@ public class PunishOrderLogic {
|
|
|
punishOrder.setExamineTime(new Date());
|
|
|
punishOrder.updateById();
|
|
|
|
|
|
- if(!StringUtils.equals(examineStatus.getKey(),ExamineStatusEnum.OK.getKey())){
|
|
|
+ if (!StringUtils.equals(examineStatus.getKey(), ExamineStatusEnum.OK.getKey())) {
|
|
|
return;
|
|
|
}
|
|
|
PgOrderBase orderBase = pgOrderBaseService.getById(punishOrder.getOrderBaseId());
|
|
|
|
|
|
//处罚记录(处罚)
|
|
|
- for(PunishOrderWorker punishOrderWorker : punishOrderWorkers) {
|
|
|
+ for (PunishOrderWorker punishOrderWorker : punishOrderWorkers) {
|
|
|
// 插入结算单
|
|
|
- PgSettleOrder order = converPgSettleOrder(punishOrder,orderBase);
|
|
|
+ PgSettleOrder order = converPgSettleOrder(punishOrder, orderBase);
|
|
|
order.setWorkerName(punishOrderWorker.getWorkerName());
|
|
|
order.setWorkerMobile(punishOrderWorker.getWorkerMobile());
|
|
|
order.setWorkerIdcard("");
|
|
@@ -197,7 +202,7 @@ public class PunishOrderLogic {
|
|
|
}
|
|
|
|
|
|
//处置记录(奖励)
|
|
|
- if(StringUtils.isNotBlank(punishOrder.getDisposeWorkerName())) {
|
|
|
+ if (StringUtils.isNotBlank(punishOrder.getDisposeWorkerName())) {
|
|
|
PgSettleOrder order2 = converPgSettleOrder(punishOrder, orderBase);
|
|
|
order2.setWorkerName(punishOrder.getDisposeWorkerName());
|
|
|
order2.setWorkerMobile(punishOrder.getDisposeWorkerMobile());
|
|
@@ -210,7 +215,7 @@ public class PunishOrderLogic {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public PgSettleOrder converPgSettleOrder(PunishOrder punishOrder,PgOrderBase orderBase){
|
|
|
+ public PgSettleOrder converPgSettleOrder(PunishOrder punishOrder, PgOrderBase orderBase) {
|
|
|
PgSettleOrder order = new PgSettleOrder();
|
|
|
order.setCompanyWechatId(punishOrder.getCompanyWechatId());
|
|
|
order.setCompanyWechatName(punishOrder.getCompanyWechatName());
|
|
@@ -227,7 +232,7 @@ public class PunishOrderLogic {
|
|
|
order.setOrderSmallTypeText(punishOrder.getOrderSmallTypeText());
|
|
|
order.setRemark(punishOrder.getRemark());
|
|
|
order.setPunishOrderId(punishOrder.getId());
|
|
|
- if(orderBase != null){
|
|
|
+ if (orderBase != null) {
|
|
|
order.setOrderCreateTime(orderBase.getCreateTime());
|
|
|
order.setWorkerEndTime(orderBase.getOverTime());
|
|
|
order.setOrderSource(orderBase.getSource());
|