|
|
@ -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,15 +97,11 @@ 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 -> { |
|
|
|
allocationBills = allocationBills.stream().map(a -> { |
|
|
|
AllocationBill updatedBill = updateMap.get(a.getDjid()); |
|
|
|
if (updatedBill != null) { |
|
|
|
a.setUpdate_id(updatedBill.getUpdate_id()); |
|
|
@ -115,8 +112,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
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()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
return CommonPage.getPage(allocationBills, totalCount.get(), params.getPage(), params.getSize()); |
|
|
@ -144,14 +140,11 @@ 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 -> { |
|
|
|
allocationBillList = allocationBillList.stream().map(allocationBill -> { |
|
|
|
AllocationBill updatedBill = updateMap.get(allocationBill.getFlid()); |
|
|
|
if (updatedBill != null) { |
|
|
|
allocationBill.setYwrq(updatedBill.getYwrq()); |
|
|
@ -175,8 +168,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
allocationBill.setBtbz(updatedBill.getBz()); |
|
|
|
} |
|
|
|
return allocationBill; |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
}).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; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -250,8 +244,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
} |
|
|
|
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 { |
|
|
|
// 如果存在该记录,则更新数据
|
|
|
|