|
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.sun.org.apache.regexp.internal.RE; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
@ -96,27 +97,22 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
// 处理查询结果
|
|
|
|
if (allocationBills != null && !allocationBills.isEmpty()) { |
|
|
|
// 获取更新列表
|
|
|
|
List<AllocationBill> updateList = allocationBillMapper.selectList( |
|
|
|
new LambdaQueryWrapper<AllocationBill>() |
|
|
|
.in(AllocationBill::getDjid, allocationBills.stream().map(AllocationBillQuery::getDjid).collect(Collectors.toList()))); |
|
|
|
List<AllocationBill> updateList = allocationBillMapper.selectList(new LambdaQueryWrapper<AllocationBill>().in(AllocationBill::getFlid, allocationBills.stream().map(AllocationBillQuery::getDjid).collect(Collectors.toList()))); |
|
|
|
if (!updateList.isEmpty()) { |
|
|
|
Map<String, AllocationBill> updateMap = updateList.stream() |
|
|
|
.collect(Collectors.toMap(AllocationBill::getFlid, updateBill -> updateBill)); |
|
|
|
Map<String, AllocationBill> updateMap = updateList.stream().collect(Collectors.toMap(AllocationBill::getFlid, updateBill -> updateBill)); |
|
|
|
// 替换为修改记录
|
|
|
|
allocationBills = allocationBills.stream() |
|
|
|
.map(a -> { |
|
|
|
AllocationBill updatedBill = updateMap.get(a.getDjid()); |
|
|
|
if (updatedBill != null) { |
|
|
|
a.setUpdate_id(updatedBill.getUpdate_id()); |
|
|
|
a.setUpdate_name(updatedBill.getUpdate_name()); |
|
|
|
a.setUpdate_time(updatedBill.getUpdate_time()); |
|
|
|
a.setShjg(updatedBill.getShjg()); |
|
|
|
} |
|
|
|
a.setJhdrrq(LocalDateTime.parse(a.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
a.setJhdcrq(LocalDateTime.parse(a.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
return a; |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
allocationBills = allocationBills.stream().map(a -> { |
|
|
|
AllocationBill updatedBill = updateMap.get(a.getDjid()); |
|
|
|
if (updatedBill != null) { |
|
|
|
a.setUpdate_id(updatedBill.getUpdate_id()); |
|
|
|
a.setUpdate_name(updatedBill.getUpdate_name()); |
|
|
|
a.setUpdate_time(updatedBill.getUpdate_time()); |
|
|
|
a.setShjg(updatedBill.getShjg()); |
|
|
|
} |
|
|
|
a.setJhdrrq(LocalDateTime.parse(a.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
a.setJhdcrq(LocalDateTime.parse(a.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
return a; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
return CommonPage.getPage(allocationBills, totalCount.get(), params.getPage(), params.getSize()); |
|
|
@ -144,39 +140,35 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
} |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
// 获取更新列表
|
|
|
|
List<AllocationBill> updateList = allocationBillMapper.selectList( |
|
|
|
new LambdaQueryWrapper<AllocationBill>().eq(AllocationBill::getDjid, allocationBillList.get(0).getDjid())); |
|
|
|
List<AllocationBill> updateList = allocationBillMapper.selectList(new LambdaQueryWrapper<AllocationBill>().eq(AllocationBill::getDjid, allocationBillList.get(0).getDjid())); |
|
|
|
if (!updateList.isEmpty()) { |
|
|
|
Map<String, AllocationBill> updateMap = updateList.stream() |
|
|
|
.collect(Collectors.toMap(AllocationBill::getFlid, updateBill -> updateBill)); |
|
|
|
Map<String, AllocationBill> updateMap = updateList.stream().collect(Collectors.toMap(AllocationBill::getFlid, updateBill -> updateBill)); |
|
|
|
// 替换为修改记录
|
|
|
|
allocationBillList = allocationBillList.stream() |
|
|
|
.map(allocationBill -> { |
|
|
|
AllocationBill updatedBill = updateMap.get(allocationBill.getFlid()); |
|
|
|
if (updatedBill != null) { |
|
|
|
allocationBill.setYwrq(updatedBill.getYwrq()); |
|
|
|
allocationBill.setBtbz(updatedBill.getBtbz()); |
|
|
|
allocationBill.setJldw(updatedBill.getJldw()); |
|
|
|
allocationBill.setSl(updatedBill.getSl()); |
|
|
|
allocationBill.setDcckbm(updatedBill.getDcckbm()); |
|
|
|
allocationBill.setDckwbm(updatedBill.getDckwbm()); |
|
|
|
allocationBill.setDrckbm(updatedBill.getDrckbm()); |
|
|
|
allocationBill.setDrkwbm(updatedBill.getDrkwbm()); |
|
|
|
allocationBill.setUpdate_id(updatedBill.getUpdate_id()); |
|
|
|
allocationBill.setUpdate_name(updatedBill.getUpdate_name()); |
|
|
|
allocationBill.setUpdate_time(updatedBill.getUpdate_time()); |
|
|
|
if (updatedBill.getJhdrrq().contains("/") || updatedBill.getJhdcrq().contains("/")) { |
|
|
|
allocationBill.setJhdrrq(LocalDateTime.parse(updatedBill.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
allocationBill.setJhdcrq(LocalDateTime.parse(updatedBill.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
} else { |
|
|
|
allocationBill.setJhdrrq(updatedBill.getJhdrrq()); |
|
|
|
allocationBill.setJhdcrq(updatedBill.getJhdcrq()); |
|
|
|
} |
|
|
|
allocationBill.setBtbz(updatedBill.getBz()); |
|
|
|
} |
|
|
|
return allocationBill; |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
allocationBillList = allocationBillList.stream().map(allocationBill -> { |
|
|
|
AllocationBill updatedBill = updateMap.get(allocationBill.getFlid()); |
|
|
|
if (updatedBill != null) { |
|
|
|
allocationBill.setYwrq(updatedBill.getYwrq()); |
|
|
|
allocationBill.setBtbz(updatedBill.getBtbz()); |
|
|
|
allocationBill.setJldw(updatedBill.getJldw()); |
|
|
|
allocationBill.setSl(updatedBill.getSl()); |
|
|
|
allocationBill.setDcckbm(updatedBill.getDcckbm()); |
|
|
|
allocationBill.setDckwbm(updatedBill.getDckwbm()); |
|
|
|
allocationBill.setDrckbm(updatedBill.getDrckbm()); |
|
|
|
allocationBill.setDrkwbm(updatedBill.getDrkwbm()); |
|
|
|
allocationBill.setUpdate_id(updatedBill.getUpdate_id()); |
|
|
|
allocationBill.setUpdate_name(updatedBill.getUpdate_name()); |
|
|
|
allocationBill.setUpdate_time(updatedBill.getUpdate_time()); |
|
|
|
if (updatedBill.getJhdrrq().contains("/") || updatedBill.getJhdcrq().contains("/")) { |
|
|
|
allocationBill.setJhdrrq(LocalDateTime.parse(updatedBill.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
allocationBill.setJhdcrq(LocalDateTime.parse(updatedBill.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
} else { |
|
|
|
allocationBill.setJhdrrq(updatedBill.getJhdrrq()); |
|
|
|
allocationBill.setJhdcrq(updatedBill.getJhdcrq()); |
|
|
|
} |
|
|
|
allocationBill.setBtbz(updatedBill.getBz()); |
|
|
|
} |
|
|
|
return allocationBill; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
return CommonPage.getPage(allocationBillList, totalCount, params.getPage(), params.getSize()); |
|
|
@ -190,12 +182,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<AllocationBill> query(AllocationBillVO params) { |
|
|
|
return allocationBillMapper.selectList(new QueryWrapper<AllocationBill>() |
|
|
|
.lambda() |
|
|
|
.eq(ObjectUtil.isNotEmpty(params), AllocationBill::getDjbh, params.getFuzzy()) |
|
|
|
.or() |
|
|
|
.eq(ObjectUtil.isNotEmpty(params), AllocationBill::getDjid, params.getFuzzy()) |
|
|
|
); |
|
|
|
return allocationBillMapper.selectList(new QueryWrapper<AllocationBill>().lambda().eq(ObjectUtil.isNotEmpty(params), AllocationBill::getDjbh, params.getFuzzy()).or().eq(ObjectUtil.isNotEmpty(params), AllocationBill::getDjid, params.getFuzzy())); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -204,8 +191,15 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
* @param params 查询条件 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<InventoryInfos> getInventoryInfo(AllocationBillVO params) { |
|
|
|
return allocationBillMapper.selectByCondition(params.getDckcbm(), params.getDcckbm(), params.getDckwbm(), params.getWlbm(), params.getPc(), params.getGzh()); |
|
|
|
public CommonPage<InventoryInfos> getInventoryInfo(AllocationBillVO params) { |
|
|
|
// if (StringUtils.isBlank(params.getDckcbm()) && StringUtils.isBlank(params.getDcckbm()) && StringUtils.isBlank(params.getDckwbm()) && StringUtils.isBlank(params.getWlbm()) && StringUtils.isBlank(params.getPc())&& StringUtils.isBlank(params.getGzh())
|
|
|
|
// {
|
|
|
|
// return null;
|
|
|
|
// }else{
|
|
|
|
// List<InventoryInfos> result = allocationBillMapper.selectByCondition(params.getDckcbm(), params.getDcckbm(), params.getDckwbm(), params.getWlbm(), params.getPc(), "999");
|
|
|
|
// return CommonPage.restPage(result);
|
|
|
|
// }
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -232,26 +226,25 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
allocationBillDto.setInWhUser(SecurityUtils.getCurrentUsername()); |
|
|
|
List<AllocationBillDetailDto> entrys = new ArrayList<>(); |
|
|
|
params.forEach(r -> { |
|
|
|
AllocationBillDetailDto dto = new AllocationBillDetailDto(); |
|
|
|
dto.setSeq(r.getFlxh()); |
|
|
|
dto.setEntryId(r.getFlid()); |
|
|
|
dto.setQty(r.getSl()); |
|
|
|
dto.setUnitNo(r.getJldw()); |
|
|
|
dto.setReceiptWarehouseNo(r.getDrckbm()); |
|
|
|
dto.setReceiptLocationNo(r.getDrkwbm()); |
|
|
|
dto.setIssueWarehouseNo(r.getDcckbm()); |
|
|
|
dto.setIssueLocationNo(r.getDckwbm()); |
|
|
|
if (r.getJhdrrq().contains("/") || r.getJhdcrq().contains("/")) { |
|
|
|
dto.setReceiptPlanDate(LocalDateTime.parse(r.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
dto.setIssuePlanDate(LocalDateTime.parse(r.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
} else { |
|
|
|
dto.setReceiptPlanDate(r.getJhdrrq()); |
|
|
|
dto.setIssuePlanDate(r.getJhdcrq()); |
|
|
|
} |
|
|
|
dto.setRemark(r.getBz()); |
|
|
|
entrys.add(dto); |
|
|
|
} |
|
|
|
); |
|
|
|
AllocationBillDetailDto dto = new AllocationBillDetailDto(); |
|
|
|
dto.setSeq(r.getFlxh()); |
|
|
|
dto.setEntryId(r.getFlid()); |
|
|
|
dto.setQty(r.getSl()); |
|
|
|
dto.setUnitNo(r.getJldw()); |
|
|
|
dto.setReceiptWarehouseNo(r.getDrckbm()); |
|
|
|
dto.setReceiptLocationNo(r.getDrkwbm()); |
|
|
|
dto.setIssueWarehouseNo(r.getDcckbm()); |
|
|
|
dto.setIssueLocationNo(r.getDckwbm()); |
|
|
|
if (r.getJhdrrq().contains("/") || r.getJhdcrq().contains("/")) { |
|
|
|
dto.setReceiptPlanDate(LocalDateTime.parse(r.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
dto.setIssuePlanDate(LocalDateTime.parse(r.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
} else { |
|
|
|
dto.setReceiptPlanDate(r.getJhdrrq()); |
|
|
|
dto.setIssuePlanDate(r.getJhdcrq()); |
|
|
|
} |
|
|
|
dto.setRemark(r.getBz()); |
|
|
|
entrys.add(dto); |
|
|
|
}); |
|
|
|
allocationBillDto.setEntrys(entrys); |
|
|
|
AllocationEasData easData = new AllocationEasData(); |
|
|
|
easData.setData(allocationBillDto); |
|
|
@ -270,8 +263,11 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
if (allocationBill == null) { |
|
|
|
// 如果不存在该记录,则插入数据
|
|
|
|
AllocationBill bill = new AllocationBill(); |
|
|
|
bill.setDjid(id); |
|
|
|
bill.setFlid(id); |
|
|
|
bill.setShjg(msgDto.getMsg()); |
|
|
|
bill.setUpdate_id(SecurityUtils.getCurrentUsername()); |
|
|
|
bill.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
bill.setUpdate_time(DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")); |
|
|
|
this.save(bill); |
|
|
|
} else { |
|
|
|
// 如果存在该记录,则更新数据
|
|
|
|