排产修改

master
xiaoning 1 year ago
parent 7bbe788e2f
commit 52aa862205

@ -61,5 +61,11 @@ public class EmSbcnp implements Serializable {
@ApiModelProperty(value = "夜班定额工时") @ApiModelProperty(value = "夜班定额工时")
private Double degsYb; private Double degsYb;
@ApiModelProperty(value = "所属部门")
private String szcs;
@ApiModelProperty(value = "默认设备")
private String sbmc;
private String sbbh;
} }

@ -1,9 +1,6 @@
package com.dsic.gj_erp.bean.jcsj; package com.dsic.gj_erp.bean.jcsj;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -299,12 +296,16 @@ public class EmSbjbb implements Serializable {
private String whsj; private String whsj;
private Integer xqrs; private Integer xqrs;
private String gz;
private String tzbh;
private String gx; private String gx;
private Double degsYb;
private Double degs;
private Double sdgs;
private String cndw;
} }

@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsic.gj_erp.annotation.AuthFunction; import com.dsic.gj_erp.annotation.AuthFunction;
import com.dsic.gj_erp.bean.ResultBean; import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.bean.jcsj.DmCbxxp; import com.dsic.gj_erp.bean.jcsj.DmCbxxp;
@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -85,9 +87,24 @@ public class DmQfxqController {
List<DmQfxq> list1 = BeanUtil.copyToList(objList1, DmQfxq.class); List<DmQfxq> list1 = BeanUtil.copyToList(objList1, DmQfxq.class);
String username=(String) req.getAttribute("yhms"); String username=(String) req.getAttribute("yhms");
String day= DateUtil.format(DateUtil.date(), "yyyy/MM/dd"); String day= DateUtil.format(DateUtil.date(), "yyyy/MM/dd");
service.saveXzList(list,username,day); list= service.saveXzList(list,username,day);
service.saveDzList(list1,username,day); List<DmQfxq> list2=new ArrayList<>(list);
return new ResultBean(); if (list1.size()>0){
list1= service.saveDzList(list1,username,day);
for (DmQfxq qfxq : list1) {
for (DmQfxq dmQfxq : list) {
if (qfxq.getId().equals(dmQfxq.getId())){
int index= list.indexOf(dmQfxq);
list2.set(index,qfxq);
}else {
list2.add(qfxq);
}
}
}
}
service.generateYdjh(list2);
return new ResultBean(list2);
} }
//保存 //保存

@ -163,7 +163,7 @@ public class ComputePlan {
canUseDevice.forEach(item -> { canUseDevice.forEach(item -> {
//未定义图纸及工序的设备,无法参加排产 //未定义图纸及工序的设备,无法参加排产
if (StrUtil.hasEmpty(item.getTzbh(),item.getGx())){ if (StrUtil.hasEmpty(item.getGx())){
return; return;
} }
//维修时间 //维修时间
@ -242,30 +242,33 @@ public class ComputePlan {
private static RealCapacity initRealCapacity(EmGcrl gcrl, JSONObject deviceJson) { private static RealCapacity initRealCapacity(EmGcrl gcrl, JSONObject deviceJson) {
//设备产能,根据图号和工序去重,注意:同图号和工序下,不同组立对应的产能要一致 //设备产能,根据图号和工序去重,注意:同图号和工序下,不同组立对应的产能要一致
List<EmSbcnp> list = instance().sbcnList.stream() // List<EmSbcnp> list = instance().sbcnList.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection(()-> // .collect(Collectors.collectingAndThen(Collectors.toCollection(()->
new TreeSet<>(Comparator.comparing(o->o.getTzbh()+o.getGx()))),ArrayList::new)); // new TreeSet<>(Comparator.comparing(o->o.getSbbh()+o.getGx()))),ArrayList::new));
String gx=deviceJson.getString("gx"); // String gx=deviceJson.getString("gx");
String tzbh=deviceJson.getString("tzbh"); // String tzbh=deviceJson.getString("tzbh");
RealCapacity capacity = new RealCapacity(); RealCapacity capacity = new RealCapacity();
list.forEach(sbcnp->{ // list.forEach(sbcnp->{
if (sbcnp.getGx().equals(gx)&& // if (sbcnp.getGx().equals(gx)&&
sbcnp.getTzbh().equals(tzbh)){ // sbcnp.getTzbh().equals(tzbh)){
Double degs=deviceJson.getDouble("degs");
Double degsYb=deviceJson.getDouble("degsYb");
degs=ObjectUtil.isEmpty(degs)?0.0:degs;
degsYb=ObjectUtil.isEmpty(degsYb)?0.0:degsYb;
if ("3".equals(gcrl.getPb())) { if ("3".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegs() * 7 + sbcnp.getDegsYb() * 7); capacity.setCapacity(degs * 7 + degsYb * 7);
} }
if ("1".equals(gcrl.getPb())) { if ("1".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegs() * 7); capacity.setCapacity(degs * 7);
} }
if ("2".equals(gcrl.getPb())) { if ("2".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegsYb() * 7); capacity.setCapacity(degsYb * 7);
} }
} // }
}); // });
capacity.setDeviceName(deviceJson.getString("sbbh")); capacity.setDeviceName(deviceJson.getString("sbbh"));
capacity.setDate(gcrl.getGl()); capacity.setDate(gcrl.getGl());
capacity.setGx(gx); capacity.setGx(deviceJson.getString("gx"));
capacity.setTzbh(tzbh);
return capacity; return capacity;
} }

@ -11,5 +11,4 @@ public class RealCapacity {
String date; String date;
Double capacity; Double capacity;
String gx; String gx;
String tzbh;
} }

@ -48,7 +48,7 @@ public class EmSbcnpServiceImpl extends ServiceImpl<EmSbcnpMapper, EmSbcnp> impl
// emSbcnpMapper.test(); // emSbcnpMapper.test();
// } // }
List<EmSbcnp> emSbjbbs=emSbcnpMapper.selectList(queryWrapper.orderByAsc("kw,tzbh,zl,jgsx")); List<EmSbcnp> emSbjbbs=emSbcnpMapper.selectList(queryWrapper.orderByAsc("tzbh,zl,jgsx,kw"));
return emSbjbbs; return emSbjbbs;
} }

@ -52,7 +52,7 @@ public class EmSbjbbServiceImpl extends ServiceImpl<EmSbjbbMapper, EmSbjbb> impl
queryWrapper.eq("GYSBM",gysbm); queryWrapper.eq("GYSBM",gysbm);
} }
queryWrapper.like("SZCS","FP%"); queryWrapper.like("SZCS","FP%");
queryWrapper.orderByDesc("GRRQ"); queryWrapper.orderByAsc("szcs");
List<EmSbjbb> emSbjbbs=emSbjbbMapper.selectList(queryWrapper); List<EmSbjbb> emSbjbbs=emSbjbbMapper.selectList(queryWrapper);
return emSbjbbs; return emSbjbbs;
} }

@ -22,6 +22,7 @@ import java.util.Map;
public interface DmQfxqService extends IService<DmQfxq> { public interface DmQfxqService extends IService<DmQfxq> {
void saveXzList(List<DmQfxq> list, String username, String day); List<DmQfxq> saveXzList(List<DmQfxq> list, String username, String day);
void saveDzList(List<DmQfxq> list, String username, String day); List<DmQfxq> saveDzList(List<DmQfxq> list, String username, String day);
void generateYdjh(List<DmQfxq> list);
} }

@ -38,7 +38,8 @@ public class DmQfxqServiceImpl extends ServiceImpl<DmQfxqMapper, DmQfxq> impleme
@Override @Override
@Transactional @Transactional
public void saveXzList(List<DmQfxq> list, String username, String day){ public List<DmQfxq> saveXzList(List<DmQfxq> list, String username, String day){
List<DmQfxq> list1=new ArrayList<>();
list.forEach(l->{ list.forEach(l->{
l.setDcPl(l.getDcPl().length() == 1 ? "00" + l.getDcPl() : l.getDcPl().length() == 2 ? "0" + l.getDcPl() : l.getDcPl()); l.setDcPl(l.getDcPl().length() == 1 ? "00" + l.getDcPl() : l.getDcPl().length() == 2 ? "0" + l.getDcPl() : l.getDcPl());
DmQfxq qfxq=this.getOne(new QueryWrapper<DmQfxq>() DmQfxq qfxq=this.getOne(new QueryWrapper<DmQfxq>()
@ -75,20 +76,33 @@ public class DmQfxqServiceImpl extends ServiceImpl<DmQfxqMapper, DmQfxq> impleme
.eq("dc_pl",l.getDcPl()) .eq("dc_pl",l.getDcPl())
.eq("DC_FD",l.getDcFd()) .eq("DC_FD",l.getDcFd())
); );
qfxq.setXzglxq(l.getXzglxq());
qfxq.setXzglxqOld(l.getXzglxqOld());
qfxq.setXdb(l.getXdb());
qfxq.setXskj(l.getXskj());
qfxq.setXpt(l.getXpt());
qfxq.setXyw(l.getXyw());
qfxq.setXxc(l.getXxc());
qfxq.setXtxc(l.getXtxc());
qfxq.setDrcs(l.getDrcs());
qfxq.setXqzt(l.getXqzt());
qfxq.setDrrq(l.getDrrq());
qfxq.setDrr(l.getDrr());
list1.add(qfxq);
}else { }else {
l.setDrr(username); l.setDrr(username);
l.setDrrq(day); l.setDrrq(day);
this.save(l); this.save(l);
list1.add(l);
} }
}); });
return list1;
} }
@Override @Override
@Transactional @Transactional
public void saveDzList(List<DmQfxq> list,String username,String day){ public List<DmQfxq> saveDzList(List<DmQfxq> list,String username,String day){
List<DmQfxq> toYdList=new ArrayList<>(); List<DmQfxq> list1=new ArrayList<>();
list.forEach(l->{ list.forEach(l->{
l.setDcPl(l.getDcPl().length() == 1 ? "00" + l.getDcPl() : l.getDcPl().length() == 2 ? "0" + l.getDcPl() : l.getDcPl()); l.setDcPl(l.getDcPl().length() == 1 ? "00" + l.getDcPl() : l.getDcPl().length() == 2 ? "0" + l.getDcPl() : l.getDcPl());
DmQfxq qfxq=this.getOne(new QueryWrapper<DmQfxq>() DmQfxq qfxq=this.getOne(new QueryWrapper<DmQfxq>()
@ -112,18 +126,23 @@ public class DmQfxqServiceImpl extends ServiceImpl<DmQfxqMapper, DmQfxq> impleme
.eq("dc_pl",l.getDcPl()) .eq("dc_pl",l.getDcPl())
.eq("DC_FD",l.getDcFd()) .eq("DC_FD",l.getDcFd())
); );
qfxq.setDzglxqOld(qfxq.getDzglxq());
qfxq.setDzglxq(l.getDzglxq());
qfxq.setDqb(l.getDqb());
qfxq.setDxc(l.getDxc());
qfxq.setDsj(l.getDsj());
qfxq.setDdb(l.getDdb());
qfxq.setDrrq(l.getDrrq());
qfxq.setDrr(l.getDrr());
list1.add(qfxq);
}else { }else {
l.setDrr(username); l.setDrr(username);
l.setDrrq(day); l.setDrrq(day);
this.save(l); this.save(l);
list1.add(l);
} }
toYdList.add(this.getOne(Wrappers.<DmQfxq>lambdaQuery()
.eq(DmQfxq::getDcCh,l.getDcCh())
.eq(DmQfxq::getDcPl,l.getDcPl())
.eq(DmQfxq::getDcFd,l.getDcFd())
));
}); });
generateYdjh(toYdList); return list1;
} }
/** /**
@ -136,6 +155,7 @@ public class DmQfxqServiceImpl extends ServiceImpl<DmQfxqMapper, DmQfxq> impleme
List<String> ids = list.stream().map(DmQfxq::getId).collect(Collectors.toList()); List<String> ids = list.stream().map(DmQfxq::getId).collect(Collectors.toList());
//获取对应的 三月滚动计划明细 //获取对应的 三月滚动计划明细
//需要再次排产?目前没排 //需要再次排产?目前没排
List<DmYdjh> ydjhList = baseMapper.getYdjh(ids); List<DmYdjh> ydjhList = baseMapper.getYdjh(ids);
if (ydjhList.size() < 1) { if (ydjhList.size() < 1) {
System.out.println("当前导入的前方需求没有对应的三月滚动计划!"); System.out.println("当前导入的前方需求没有对应的三月滚动计划!");
@ -180,6 +200,10 @@ public class DmQfxqServiceImpl extends ServiceImpl<DmQfxqMapper, DmQfxq> impleme
private void removeByMulti(List<DmYdjh> list,String dcCh,String dcPl,int size){ private void removeByMulti(List<DmYdjh> list,String dcCh,String dcPl,int size){
List<String> tzbhList = list.stream().map(DmYdjh::getTzbh).collect(Collectors.toList()); List<String> tzbhList = list.stream().map(DmYdjh::getTzbh).collect(Collectors.toList());
if (tzbhList.size()<=size){
this.remove(tzbhList,dcCh,dcPl);
return;
}
AtomicInteger index=new AtomicInteger(tzbhList.size()/size); AtomicInteger index=new AtomicInteger(tzbhList.size()/size);
do { do {
int i = index.decrementAndGet(); int i = index.decrementAndGet();

@ -108,6 +108,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
List<DmSygdMx> mxList = baseMapper.getMx(begin, end); List<DmSygdMx> mxList = baseMapper.getMx(begin, end);
//todo 排产 //todo 排产
ypc(mxList); ypc(mxList);
this.saveBatch(mxList);
baseMapper.setParent(begin, end); baseMapper.setParent(begin, end);
ResultBean r = new ResultBean(mxList); ResultBean r = new ResultBean(mxList);
r.setSuccess(true); r.setSuccess(true);
@ -120,7 +121,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
* @param list * @param list
*/ */
public void ypc(List<DmSygdMx> list) { public void ypc(List<DmSygdMx> list) {
Map<String, List<DmSygdMx>> mxMap = list.stream().filter(l->StrUtil.isNotEmpty(l.getTzbh())).collect(Collectors.groupingBy(l -> l.getKw() + l.getZl())); // Map<String, List<DmSygdMx>> mxMap = list.stream().filter(l->StrUtil.isNotEmpty(l.getTzbh())).collect(Collectors.groupingBy(l -> l.getKw() + l.getZl()));
ComputePlan c=ComputePlan.instance(); ComputePlan c=ComputePlan.instance();
c.computeRealCapacity(); c.computeRealCapacity();
Map<String,List<RealCapacity>> rel=c.getRealCapacityMap(); Map<String,List<RealCapacity>> rel=c.getRealCapacityMap();
@ -129,18 +130,13 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
List<EmSbcnp> sbcnp =c.getSbcnList(); List<EmSbcnp> sbcnp =c.getSbcnList();
Map<String, List<EmSbcnp>> cnMap = sbcnp.stream().collect(Collectors.groupingBy(l -> l.getTzbh() + l.getZl())); Map<String, List<EmSbcnp>> cnMap = sbcnp.stream().collect(Collectors.groupingBy(l -> l.getTzbh() + l.getZl()));
for (String ljkey : mxMap.keySet()) { list.forEach(l->{
//对应加工顺序 List<EmSbcnp> jgsxList= cnMap.get(l.getKw()+l.getZl());
List<EmSbcnp> jgsxList= cnMap.get(ljkey); if (ObjectUtil.isNotEmpty(jgsxList)&&jgsxList.size()>0 ){
//加工板材
List<DmSygdMx> mxs = mxMap.get(ljkey);
if (ObjectUtil.isEmpty(jgsxList)||jgsxList.size()<1 ){
continue;
}
mxs.forEach(l->{
jggx(rel,l,jgsxList); jggx(rel,l,jgsxList);
}); }
} });
} }
/** /**
@ -154,42 +150,42 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
for (EmSbcnp cn : list) { for (EmSbcnp cn : list) {
//上料 //上料
if (cn.getGx().equals("19")) { if (cn.getGx().equals("19")) {
date=xhcn(rel,l.getKw(),cn.getGx(),1, date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),1, date);
l.setSlrq(date); l.setSlrq(date);
} }
//抛丸 //抛丸
if (cn.getGx().equals("20")) { if (cn.getGx().equals("20")) {
date=xhcn(rel,l.getKw(),cn.getGx(),1, date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),1, date);
l.setPwrq(date); l.setPwrq(date);
} }
//理料 //理料
if (cn.getGx().equals("21")) { if (cn.getGx().equals("21")) {
date=xhcn(rel,l.getKw(),cn.getGx(),1, date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),1, date);
l.setLlrq(date); l.setLlrq(date);
} }
// 划线 // 划线
if ("01,02".indexOf(cn.getGx()) > -1) { if ("01,02".indexOf(cn.getGx()) > -1 && l.getHxcd()>0) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getHxcd(), date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getHxcd(), date);
l.setHxrq(date); l.setHxrq(date);
} }
//切割 //切割
if ("03,04,05,06,07".indexOf(cn.getGx()) > -1) { if ("03,04,05,06,07".indexOf(cn.getGx()) > -1 && l.getQgcd()>0) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getQgcd(), date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getQgcd(), date);
l.setQgrq(date); l.setQgrq(date);
} }
// 坡口 // 坡口
if (ObjectUtil.isNotEmpty(l.getPkcd()) && ("08,10".indexOf(cn.getGx()) > 0)) { if (ObjectUtil.isNotEmpty(l.getPkcd()) && ("08,10".indexOf(cn.getGx()) > 0)) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getPkcd(), date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getPkcd(), date);
l.setPkrq(date); l.setPkrq(date);
} }
// 打磨 // 打磨
if (ObjectUtil.isNotEmpty(l.getDmcd()) && ("16,13".indexOf(cn.getGx()) > 0)) { if (ObjectUtil.isNotEmpty(l.getDmcd()) && ("16,13".indexOf(cn.getGx()) > 0)) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getDmcd(), date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getDmcd(), date);
l.setDmrq(date); l.setDmrq(date);
} }
// 曲 (个) // 曲 (个)
if (StrUtil.isNotEmpty(l.getQbs()) && cn.getGx().equals("18")) { if (StrUtil.isNotEmpty(l.getQbs()) && cn.getGx().equals("18")) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getLjsl(), date); date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getLjsl(), date);
l.setQjgrq(date); l.setQjgrq(date);
} }
@ -200,19 +196,19 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
/** /**
* *
* @param rel , * @param rel ,
* @param tzbh tzbhkw * @param sbbh
* @param gx * @param gx
* @param gzl * @param gzl
* @param kssj * @param kssj
* @return * @return
*/ */
public String xhcn(Map<String,List<RealCapacity>> rel,String tzbh,String gx,double gzl ,String kssj){ public String xhcn(Map<String,List<RealCapacity>> rel,String sbbh,String gx,double gzl ,String kssj){
String jgsj=""; String jgsj="";
if (gzl==0)return jgsj; if (gzl==0)return jgsj;
for (String date:rel.keySet()){ for (String date:rel.keySet()){
if (date.compareTo(kssj)>=0||StrUtil.isEmpty(kssj)){ if (date.compareTo(kssj)>=0||StrUtil.isEmpty(kssj)){
for (RealCapacity l:rel.get(date)){ for (RealCapacity l:rel.get(date)){
if (l.getTzbh().equals(tzbh)&&l.getGx().equals(gx)){ if (l.getDeviceName().equals(sbbh)&&l.getGx().equals(gx)){
if (l.getCapacity()>=gzl){ if (l.getCapacity()>=gzl){
int index = rel.get(date).indexOf(l); int index = rel.get(date).indexOf(l);
l.setCapacity(l.getCapacity()-gzl); l.setCapacity(l.getCapacity()-gzl);
@ -340,7 +336,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
.eq("nf", year) .eq("nf", year)
.ne("zl", 0) .ne("zl", 0)
.between("yf", begin, end)); .between("yf", begin, end));
List<Xbjhdto> xbjhdtoList = BeanUtil.copyToList(xbjhs, Xbjhdto.class); List<Xbjhdto> xbjhdtos = BeanUtil.copyToList(xbjhs, Xbjhdto.class);
//3.根据月份和船号分组 //3.根据月份和船号分组
Map<String, List<DmSygdMx>> monthAndCh = list.stream() Map<String, List<DmSygdMx>> monthAndCh = list.stream()
@ -348,7 +344,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
.collect(Collectors.groupingBy(x -> x.getJssj().substring(5, 7) + x.getDcCh())); .collect(Collectors.groupingBy(x -> x.getJssj().substring(5, 7) + x.getDcCh()));
//4. //4.
xbjhdtoList.forEach(dmXbjh -> { xbjhdtos.forEach(dmXbjh -> {
for (String ch : monthAndCh.keySet()) { for (String ch : monthAndCh.keySet()) {
if (dmXbjh.getDcCh().equals(monthAndCh.get(ch).get(0).getDcCh()) if (dmXbjh.getDcCh().equals(monthAndCh.get(ch).get(0).getDcCh())
&& dmXbjh.getYf().equals(monthAndCh.get(ch).get(0).getJssj().substring(5, 7))) { && dmXbjh.getYf().equals(monthAndCh.get(ch).get(0).getJssj().substring(5, 7))) {
@ -365,6 +361,31 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
} }
} }
}); });
List<Xbjhdto> xbjhdtoList=new ArrayList<>(xbjhdtos);
for (String ch : monthAndCh.keySet()) {
Xbjhdto dmXbjh=new Xbjhdto();
for (Xbjhdto xbjhdto : xbjhdtos) {
if (!(xbjhdto.getDcCh().equals(monthAndCh.get(ch).get(0).getDcCh())
&& xbjhdto.getYf().equals(monthAndCh.get(ch).get(0).getJssj().substring(5, 7)))) {
Double shzl = 0.0;
for (DmSygdMx mx : monthAndCh.get(ch)) {
shzl = shzl + (Objects.isNull(mx.getBcshzl()) ? 0.0 : mx.getBcshzl());
}
shzl = Double.valueOf(String.format("%.2f", Objects.isNull(shzl) ? shzl : shzl / 1000.0));
dmXbjh.setTlt_zl(shzl);
dmXbjh.setXczl(Double.valueOf(String.format("%.2f", shzl - dmXbjh.getZl())));
dmXbjh.setMxList(monthAndCh.get(ch));
dmXbjh.setDcCh(monthAndCh.get(ch).get(0).getDcCh());
dmXbjh.setYf(monthAndCh.get(ch).get(0).getJssj().substring(5, 7));
dmXbjh.setNf(monthAndCh.get(ch).get(0).getJssj().substring(0, 4));//2024/04/05
}
}
if (dmXbjh.getTlt_zl()>0){
xbjhdtoList.add(dmXbjh);
}
}
Map<String, List<Xbjhdto>> yf = xbjhdtoList.stream() Map<String, List<Xbjhdto>> yf = xbjhdtoList.stream()
.filter(mx -> Objects.nonNull(mx.getDcCh())) // group by 的字段不能有null值 .filter(mx -> Objects.nonNull(mx.getDcCh())) // group by 的字段不能有null值
.collect(Collectors.groupingBy(x -> x.getYf())); .collect(Collectors.groupingBy(x -> x.getYf()));

Loading…
Cancel
Save