Browse Source

佘莉 原标签打印流水号业务的逻辑BUG

master
DOUDOU 2 years ago
parent
commit
a83b68d8f2
  1. 10
      src/main/java/com/gaotao/modules/finishedProduct/service/ReportfileSeqinfoService.java
  2. 65
      src/main/java/com/gaotao/modules/finishedProduct/service/impl/ReportfileSeqinfoServiceImpl.java
  3. 16
      src/main/java/com/gaotao/modules/print/service/impl/RollPrintServiceImpl.java

10
src/main/java/com/gaotao/modules/finishedProduct/service/ReportfileSeqinfoService.java

@ -3,7 +3,17 @@ package com.gaotao.modules.finishedProduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gaotao.modules.finishedProduct.entity.ReportfileSeqinfo;
import java.util.Map;
public interface ReportfileSeqinfoService extends IService<ReportfileSeqinfo> {
String getSeqNumber(String reportId,String seq);
/**
* @description: 修改原业务中的BUG
* @author LR
* @date 2024/1/18 10:44
* @version 1.0
*/
String getSeqNumber(String reportId, String seqNumber, Map<String, String> itemMap);
}

65
src/main/java/com/gaotao/modules/finishedProduct/service/impl/ReportfileSeqinfoServiceImpl.java

@ -8,10 +8,14 @@ import com.gaotao.modules.finishedProduct.entity.ReportfileSeqinfo;
import com.gaotao.modules.finishedProduct.service.ReportcontentitemSeqruleService;
import com.gaotao.modules.finishedProduct.service.ReportcontentitemService;
import com.gaotao.modules.finishedProduct.service.ReportfileSeqinfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -33,6 +37,67 @@ public class ReportfileSeqinfoServiceImpl extends ServiceImpl<ReportfileSeqinfoD
@Autowired
private ReportcontentitemSeqruleService reportcontentitemSeqruleService;
private Logger logger = LoggerFactory.getLogger(getClass());
//LR 20245-01-18 后来修改的方法
@Override
public String getSeqNumber(String reportId, String seq, Map<String, String> itemMap) {
Reportcontentitem reportcontentitem = reportcontentitemService.getReportcontentitem(reportId, seq);
Integer serialNumber = null;
if (reportcontentitem != null) {
// 获取规则
List<ReportcontentitemSeqrule> reportcontentitemSeqrules = reportcontentitemSeqruleService.lambdaQuery()
.eq(ReportcontentitemSeqrule::getReportid, reportcontentitem.getReportid())
.orderByAsc(ReportcontentitemSeqrule::getSeqno).list();
if (reportcontentitemSeqrules.size() > 0) {
String keyInfo = reportcontentitemSeqrules.stream().map(ReportcontentitemSeqrule::getObjectname).collect(Collectors.joining("+"));
logger.info("流水号规则的key:"+keyInfo);
//根据值获取value信息
String keyValueInfo = Arrays.stream(keyInfo.split("\\+"))
.map(key -> itemMap.get(key))
.filter(value-> value!= null)
.collect(Collectors.joining("+"));
logger.info("流水号规则的值:"+keyValueInfo);
// 获取流水号规则
ReportfileSeqinfo reportfileSeqinfo = reportfileSeqinfoService.lambdaQuery()
.eq(ReportfileSeqinfo::getReportid, reportcontentitem.getReportid())
.eq(ReportfileSeqinfo::getItemno, reportcontentitem.getItemno())
.eq(ReportfileSeqinfo::getKeyinfo, keyValueInfo).one();
// 获取流水号
if (reportfileSeqinfo == null) {
serialNumber = reportcontentitem.getInterval();
// 没有打印过 则是初始值加
reportfileSeqinfo = new ReportfileSeqinfo();
reportfileSeqinfo.setItemno(reportcontentitem.getItemno());
reportfileSeqinfo.setLastseqno(serialNumber);
reportfileSeqinfo.setReportid(reportcontentitem.getReportid());
reportfileSeqinfo.setKeyinfo(keyValueInfo);
// 保存流水号
reportfileSeqinfoService.save(reportfileSeqinfo);
} else {
// 打印过该流水规则
serialNumber = reportfileSeqinfo.getLastseqno() + reportcontentitem.getInterval();
// 获取流水号之后 修改流水号
this.baseMapper.updateSerialNumber(reportcontentitem.getReportid(), reportcontentitem.getItemno(), keyValueInfo, serialNumber);
// reportfileSeqinfoService.lambdaUpdate().set(ReportfileSeqinfo::getLastseqno, serialNumber)
// .eq(ReportfileSeqinfo::getReportid, reportcontentitem.getReportid())
// .eq(ReportfileSeqinfo::getKeyinfo, keyInfo)
// .eq(ReportfileSeqinfo::getItemno, reportcontentitem.getItemno()).update();
}
}
}
if (serialNumber != null) {
Integer sequencebits = reportcontentitem.getSequencebits();
String number = "00000000000000000000000000";
number += serialNumber;
return number.substring(number.length() - sequencebits);
}
return null;
}
//原佘莉写得方法
@Override
public String getSeqNumber(String reportId, String seq) {
Reportcontentitem reportcontentitem = reportcontentitemService.getReportcontentitem(reportId, seq);

16
src/main/java/com/gaotao/modules/print/service/impl/RollPrintServiceImpl.java

@ -185,12 +185,7 @@ public class RollPrintServiceImpl implements RollPrintService {
List<Reportcontentitem> reportcontentitemList = reportcontentitemService.getReportcontentitemList(reportFileVo.getReportId());
Map<String, String> itemMap = reportcontentitemList.stream().collect(Collectors.toMap(Reportcontentitem::getObjectgroup, Reportcontentitem::getDbfieldname));
// 3.判断是否包含流水号 包含测返回流水号
String seqNumber = reportfileSeqinfoService.getSeqNumber(reportFileVo.getReportId(), OutBoxConstant.SEQ_NUMBER);
if (StringUtils.isNotEmpty(seqNumber)) {
itemMap.put("流水号", seqNumber.toString());
}
log.info("流水号处理完成");
// Map<String, String> paramMap = outBoxParamVo.getParam().stream().collect(Collectors.toMap(ReportParametersEntity::getParametername, ReportParametersEntity::getOptionvalue));
Map<String, String> paramMap = rollParamVo.getParam().stream().collect(HashMap::new, (m, v) -> m.put(v.getParametername(), v.getOptionvalue()), HashMap::putAll);
log.info("手工参数处理开始{}", paramMap.toString());
@ -221,6 +216,15 @@ public class RollPrintServiceImpl implements RollPrintService {
itemMap.put("数量", printData.get("数量"));
}
log.info("手工参数处理结束{}", paramMap.toString());
// 3.判断是否包含流水号 包含测返回流水号
String seqNumber = reportfileSeqinfoService.getSeqNumber(reportFileVo.getReportId(), OutBoxConstant.SEQ_NUMBER, itemMap);
//原佘莉写得方法
//String seqNumber = reportfileSeqinfoService.getSeqNumber(reportFileVo.getReportId(), OutBoxConstant.SEQ_NUMBER);
if (StringUtils.isNotEmpty(seqNumber)) {
itemMap.put("流水号", seqNumber.toString());
}
log.info("流水号处理完成");
// 打印接口参数集
Map<String, Object> printOutMap = new HashMap<>();
int printQty = StringUtils.isNotEmpty(paramMap.get(OutBoxConstant.COPIES)) ? Integer.valueOf(paramMap.get(OutBoxConstant.COPIES)) : 1;

Loading…
Cancel
Save