1.根据最新版月度计划导入内容,调整导入逻辑

master
董哲奇 2 months ago
parent 21edae7116
commit ff07ad6850

@ -20,17 +20,16 @@ import com.dsic.gj_erp.service.jcsj.DmCbxxpService;
import com.dsic.gj_erp.service.jhgk.DmSygdMxService;
import com.dsic.gj_erp.service.jhgk.DmYdjhService;
import com.dsic.gj_erp.service.pgd.PgdTzjhService;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.experimental.FieldDefaults;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@ -64,11 +63,12 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
);
list.stream().filter(item->StrUtil.isNotEmpty(item.getDcPl()))
.forEach(item->{
String dcPl = item.getDcPl();
TmpDcPl tmpDcPl = getDcPl(item);
String dcPl=tmpDcPl.dcPl;
String rowType=tmpDcPl.rowType;
try {
dcPl = String.format("%03d", Integer.parseInt(dcPl));
item.setDcPl(dcPl);
} catch (Exception ignored) {
}
@ -76,13 +76,13 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
//一垮龙门和一垮数控
if (item.get1() != null) {
item.set("0");
this.getBomSize(item, "7",(size)->{
this.getBomSize(item, "7"+rowType,(size)->{
item.set(size+"");
.addAndGet(size);
});
item.set("0");
this.getBomSize(item, "8",(size)->{
this.getBomSize(item, "8"+rowType,(size)->{
item.set(size+"");
.addAndGet(size);
});
@ -90,7 +90,7 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get2() != null) {
item.set("0");
this.getBomSize(item, "5",(size)->{
this.getBomSize(item, "5"+rowType,(size)->{
item.set(size+"");
.addAndGet(size);
});
@ -99,17 +99,17 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get3() != null) {
AtomicInteger atomicInteger = new AtomicInteger(0);
this.getBomSize(item, "9",(size)->{
this.getBomSize(item, "9"+rowType,(size)->{
atomicInteger.addAndGet(size);
.addAndGet(size);
});
this.getBomSize(item, "10",(size)->{
this.getBomSize(item, "10"+rowType,(size)->{
atomicInteger.addAndGet(size);
.addAndGet(size);
});
this.getBomSize(item, "12",(size)->{
this.getBomSize(item, "12"+rowType,(size)->{
atomicInteger.addAndGet(size);
.addAndGet(size);
});
@ -120,11 +120,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get4() != null) {
item.set("0");
AtomicInteger atomicInteger = new AtomicInteger(0);
this.getBomSize(item, "6",(size)->{
this.getBomSize(item, "6"+rowType,(size)->{
atomicInteger.addAndGet(size);
.addAndGet(size);
});
this.getBomSize(item, "13", (size)->{
this.getBomSize(item, "13"+rowType, (size)->{
atomicInteger.addAndGet(size);
.addAndGet(size);
});
@ -134,7 +134,7 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get5() != null||item.get()!=null) {
item.set("0");
this.getBomSize(item, "14",(size)->{
this.getBomSize(item, "14"+rowType,(size)->{
item.set(size+"");
.addAndGet(size);
});
@ -142,7 +142,7 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get6() != null) {
item.set("0");
this.getBomSize(item, "11",(size)->{
this.getBomSize(item, "11"+rowType,(size)->{
item.set(size+"");
.addAndGet(size);
});
@ -151,7 +151,7 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get7() != null) {
AtomicInteger atomicInteger = new AtomicInteger(0);
this.getBomSize(item, "15",(size)->{
this.getBomSize(item, "15"+rowType,(size)->{
atomicInteger.addAndGet(size);
.addAndGet(size);
});
@ -198,7 +198,8 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
List<DmYdjh> updateList=new ArrayList<>();
list.stream().filter(item->StrUtil.isAllNotEmpty(item.getDcCh(),item.getDcPl()))
.forEach(item->{
String dcPl = item.getDcPl();
TmpDcPl tmpDcPl = getDcPl(item);
String dcPl=tmpDcPl.dcPl;
try {
dcPl = String.format("%03d", Integer.parseInt(dcPl));
@ -214,115 +215,153 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
.collect(Collectors.groupingBy(DmYdjh::getKw));
//一垮龙门和一垮数控
if (item.get1() != null) {
Optional.ofNullable(collect.get("7")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get1());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get1(),item.get())){
Optional.ofNullable(collect.get("7")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get1());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
Optional.ofNullable(collect.get("8")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get1());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
}
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get1(),item.get())){
Optional.ofNullable(collect.get("8")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get1());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
if (item.get2() != null) {
Optional.ofNullable(collect.get("5")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get2());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get2(),item.get())){
Optional.ofNullable(collect.get("5")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get2());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
if (item.get3() != null) {
Optional.ofNullable(collect.get("9")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get3());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get3(),item.get())){
Optional.ofNullable(collect.get("9")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get3());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
Optional.ofNullable(collect.get("10")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get3());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
}
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get3(),item.get())){
Optional.ofNullable(collect.get("10")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get3());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
Optional.ofNullable(collect.get("12")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get3());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
}
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get3(),item.get())){
Optional.ofNullable(collect.get("12")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get3());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
if (item.get4() != null) {
Optional.ofNullable(collect.get("6")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get4());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get4(),item.get())){
Optional.ofNullable(collect.get("6")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get4());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
Optional.ofNullable(collect.get("13")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get4());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
}
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get4(),item.get())){
Optional.ofNullable(collect.get("13")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get4());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
if (item.get5() != null||item.get()!=null) {
Optional.ofNullable(collect.get("14")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get5());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get5(),item.get())){
Optional.ofNullable(collect.get("14")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get5());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
if (item.get6() != null) {
Optional.ofNullable(collect.get("11")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get6());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get6(),item.get())){
Optional.ofNullable(collect.get("11")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get6());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
if (item.get7() != null) {
Optional.ofNullable(collect.get("15")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get7());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
});
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get7(),item.get())){
Optional.ofNullable(collect.get("15")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get7());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
if(item.get()!=null){
Optional.ofNullable(collect.get("17")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get());
dmYdjh.setId(ydjh.getId());
updateList.add(dmYdjh);
if (!StrUtil.isAllEmpty(item.get(),item.get(),item.get(),item.get())){
Optional.ofNullable(collect.get("17")).ifPresent(ydjhs -> {
ydjhs.forEach(ydjh->{
DmYdjh dmYdjh = this.updateYdjh(item.get(),item.get(),item.get());
dmYdjh.setId(ydjh.getId());
dmYdjh.setJssj(item.get());
updateList.add(dmYdjh);
});
});
});
}
}
}
});
@ -355,14 +394,16 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
list.stream()
.filter(item -> !item.getDcPl().contains("-"))//批次范围的数据暂不处理
.forEach(item -> {
String dcPl = item.getDcPl();
TmpDcPl tmpDcPl = getDcPl(item);
String dcPl=tmpDcPl.dcPl;
String rowType=tmpDcPl.rowType;
try {
dcPl = String.format("%03d", Integer.parseInt(dcPl));
} catch (Exception ignored) {
}
item.setDcPl(dcPl);
List<DmSygdMx> sygdmx = (List<DmSygdMx>) redisTemplate.opsForHash().get(GJSCGK_SYGDMX_KEY + fileName, item.getDcCh() + "_" + dcPl);
List<DmSygdMx> sygdmx = (List<DmSygdMx>) redisTemplate.opsForHash().get(GJSCGK_SYGDMX_KEY + fileName, item.getDcCh() + "_" + dcPl+rowType);
if (ObjUtil.isNotEmpty(sygdmx)) {
sygdMxList.addAll(sygdmx);
}
@ -471,12 +512,9 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
.forEach(item -> {
List<DmSygdMx> addList = new ArrayList<>();
String dcPl = item.getDcPl();
try {
dcPl = String.format("%03d", Integer.parseInt(dcPl));
} catch (Exception ignored) {
}
TmpDcPl tmpDcPl = getDcPl(item);
String dcPl=tmpDcPl.dcPl;
String rowType=tmpDcPl.rowType;
List<DmBom> bomList = bomService.getBomUni(item.getDcCh(), dcPl,null);
@ -500,14 +538,13 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
Map<String, List<DmBom>> collect = bomList.stream().collect(Collectors.groupingBy(DmBom::getKw));
//一垮龙门和一垮数控
String finalDcPl = dcPl;
if (item.get1() != null) {
Optional.ofNullable(collect.get("7")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_7",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_7"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get1());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -517,11 +554,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
});
Optional.ofNullable(collect.get("8")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_8",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_8"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get1());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -533,11 +570,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get2() != null) {
Optional.ofNullable(collect.get("5")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_5",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_5"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get2());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -549,11 +586,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get3() != null) {
Optional.ofNullable(collect.get("9")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_9",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_9"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get3());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -563,11 +600,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
});
Optional.ofNullable(collect.get("10")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_10",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_10"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get3());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -577,11 +614,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
});
Optional.ofNullable(collect.get("12")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_12",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_12"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get3());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -593,11 +630,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get4() != null) {
Optional.ofNullable(collect.get("6")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_6",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_6"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get4());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -606,11 +643,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
});
});
Optional.ofNullable(collect.get("13")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_13",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_13"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get4());
dmSygdMx.setQbs("1");
dmSygdMx.setQjgrq(item.get());
@ -625,11 +662,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get5() != null||item.get()!=null) {
Optional.ofNullable(collect.get("14")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_14",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_14"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get5());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -657,11 +694,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get6() != null) {
Optional.ofNullable(collect.get("11")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_11",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_11"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get6());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -673,11 +710,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if (item.get7() != null) {
Optional.ofNullable(collect.get("15")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_15",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_15"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get7());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -690,11 +727,11 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
if(item.get()!=null){
Optional.ofNullable(collect.get("17")).ifPresent(boms -> {
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), finalDcPl +"_17",boms.size());
redisTemplate.opsForHash().put(GJSCGK_BOM_COUNT_KEY+item.getDcCh(), item.getDcPl() +"_17"+rowType,boms.size());
boms.forEach(bom -> {
DmSygdMx dmSygdMx = new DmSygdMx();
dmSygdMx.setDcCh(item.getDcCh());
dmSygdMx.setDcPl(item.getDcPl());
dmSygdMx.setDcPl(dcPl);
dmSygdMx.setQgrq(item.get());
dmSygdMx.setJssj(item.get());
dmSygdMx.setGjjsDz(item.getQfxqrqdz());
@ -704,7 +741,51 @@ public class YdjhImportNewService extends ServiceImpl<YdjhImportNewMapper, YdjhI
});
}
redisTemplate.opsForHash().put(GJSCGK_SYGDMX_KEY + fileName, item.getDcCh() + "_" + dcPl, addList);
redisTemplate.opsForHash().put(GJSCGK_SYGDMX_KEY + fileName, item.getDcCh() + "_" + dcPl+rowType, addList);
});
}
private TmpDcPl getDcPl(YdjhImportNew item) {
String dcPl = item.getDcPl();
String rowType="";
if (dcPl!=null&&dcPl.toUpperCase(Locale.ROOT).contains("XT")){
dcPl=dcPl.toUpperCase(Locale.ROOT).replace("XT","");
rowType="XT";
}
if (dcPl!=null&&dcPl.toUpperCase(Locale.ROOT).contains("DT")){
dcPl=dcPl.toUpperCase(Locale.ROOT).replace("DT","");
rowType="DT";
}
if (dcPl!=null&&dcPl.toUpperCase(Locale.ROOT).contains("T")){
dcPl=dcPl.toUpperCase(Locale.ROOT).replace("T","");
rowType="T";
}
if (dcPl!=null&&dcPl.toUpperCase(Locale.ROOT).contains("Q")){
dcPl=dcPl.toUpperCase(Locale.ROOT).replace("Q","");
rowType="Q";
}
try {
assert dcPl != null;
dcPl = String.format("%03d", Integer.parseInt(dcPl));
} catch (Exception ignored) {}
return new TmpDcPl(dcPl,rowType);
}
@FieldDefaults(level = AccessLevel.PUBLIC)
private static class TmpDcPl{
String dcPl;
String rowType;
public TmpDcPl(String dcpl, String rowType) {
this.dcPl=dcpl;
this.rowType=rowType;
}
}
}

Loading…
Cancel
Save