修改OTA批号验重问题

This commit is contained in:
高嵩
2023-06-07 09:12:38 +08:00
parent 431b80d10a
commit 2e9d8116e6
@@ -63,17 +63,17 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
* @return
*/
public OtaBaCxJbxx add(OtaBaCxJbxx otaBaCxJbxx) throws Exception {
String ggpc = otaBaCxJbxx.getGgpc();
String djbh = otaBaCxJbxx.getDjbh();
//对比填写记录用的
OtaBaCxJbxx otaBaCxJbxxOld = new OtaBaCxJbxx();
Date now = new Date();
OtaBaCxList otaBaCxList;
if (StringUtils.isEmpty(otaBaCxJbxx.getOtaId())) {
if (StringUtils.isNotEmpty(ggpc)) {
if (StringUtils.isNotEmpty(djbh)) {
List<OtaBaCxJbxx> xxList = this.list();
for (OtaBaCxJbxx xx : xxList) {
if (ggpc.equals(xx.getGgpc())) {
throw new JeroBootException("公告批次重复");
if (djbh.equals(xx.getDjbh())) {
throw new JeroBootException("产品登记编号重复");
}
}
}
@@ -87,11 +87,11 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
otaBaCxJbxx.setCreateTime(now);
} else {
otaBaCxJbxxOld = this.getByOtaId(otaBaCxJbxx.getOtaId());
if (StringUtils.isNotEmpty(ggpc)) {
if (StringUtils.isNotEmpty(djbh)) {
List<OtaBaCxJbxx> xxList = this.list();
for (OtaBaCxJbxx xx : xxList) {
if (!xx.getOtaId().equals(otaBaCxJbxx.getOtaId()) && ggpc.equals(xx.getGgpc())) {
throw new JeroBootException("公告批次重复");
if (!xx.getOtaId().equals(otaBaCxJbxx.getOtaId()) && djbh.equals(xx.getDjbh())) {
throw new JeroBootException("产品登记编号重复");
}
}
}
@@ -241,26 +241,25 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
if (cpbh.length() > 500) {
throw new JeroBootException("产品登记编号字数超过500");
}
jbxx.setDjbh(cpbh);
row = s.getRow(4);
cell = row.getCell(1);
String ggpc = ImportFileUtil.getCellValue(cell, wb);
if (StringUtils.isNotEmpty(ggpc)) {
if (StringUtils.isNotEmpty(cpbh)) {
List<OtaBaCxJbxx> xxList = this.list();
for (OtaBaCxJbxx xx : xxList) {
if (ggpc.equals(xx.getGgpc())) {
throw new JeroBootException("公告批次重复");
if (cpbh.equals(xx.getDjbh())) {
throw new JeroBootException("产品登记编号重复");
}
}
}
jbxx.setGgpc(ggpc);
jbxx.setDjbh(cpbh);
row = s.getRow(1);
cell = row.getCell(1);
jbxx.setQymc(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(3);
cell = row.getCell(1);
jbxx.setCplb(ImportFileUtil.getCellValueDict(cell, wb, "product_category", sysDictService, cut));
row = s.getRow(4);
cell = row.getCell(1);
jbxx.setGgpc(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(5);
cell = row.getCell(1);
jbxx.setCpsb(ImportFileUtil.getCellValue(cell, wb));