|
|
@ -25,6 +25,8 @@ import javax.annotation.Resource; |
|
|
|
import org.nl.common.base.CommonPage; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
@ -55,11 +57,19 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@SaIgnore |
|
|
|
public CommonPage<AllocationBill> allocationPage(AllocationBillQuery params) { |
|
|
|
public CommonPage<AllocationBillQuery> allocationPage(AllocationBillQuery params) { |
|
|
|
// 查询总记录数
|
|
|
|
long totalCount = allocationBillMapper.getAllocationCount(params.getFuzzy()); |
|
|
|
List<AllocationBill> allocationBills = allocationBillMapper.allocationPage(params.getFuzzy(),params.getPage(),params.getSize()); |
|
|
|
return CommonPage.getPage(allocationBills, totalCount,params.getPage(),params.getSize()); |
|
|
|
List<AllocationBillQuery> allocationBills = allocationBillMapper.allocationPage(params.getFuzzy(), params.getPage(), params.getSize()); |
|
|
|
if (!allocationBills.isEmpty()) { |
|
|
|
allocationBills = allocationBills.stream() |
|
|
|
.peek(r -> { |
|
|
|
r.setJhdrrq(LocalDateTime.parse(r.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
r.setJhdcrq(LocalDateTime.parse(r.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); |
|
|
|
}) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
return CommonPage.getPage(allocationBills, totalCount, params.getPage(), params.getSize()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -70,12 +80,12 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public CommonPage<AllocationBillQuery> page(AllocationBillQuery params) { |
|
|
|
if (StringUtils.isBlank(params.getDjbh())) { |
|
|
|
if (StringUtils.isBlank(params.getDjid())) { |
|
|
|
throw new BadRequestException("单据编号不能为空"); |
|
|
|
} |
|
|
|
// 查询总记录数
|
|
|
|
long totalCount = allocationBillMapper.getTotalCount(params.getDjbh()); |
|
|
|
List<AllocationBillQuery> allocationBillList = allocationBillMapper.allocationDetailPage(params.getPage(),params.getSize(), params.getDjbh(), params.getFuzzy()); |
|
|
|
long totalCount = allocationBillMapper.getTotalCount(params.getDjid()); |
|
|
|
List<AllocationBillQuery> allocationBillList = allocationBillMapper.allocationDetailPage(params.getPage(), params.getSize(), params.getDjid(), params.getFuzzy()); |
|
|
|
if (!allocationBillList.isEmpty()) { |
|
|
|
// 获取更新列表
|
|
|
|
List<AllocationBill> updateList = allocationBillMapper.selectList( |
|
|
@ -96,8 +106,13 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
allocationBill.setDckwbm(updatedBill.getDckwbm()); |
|
|
|
allocationBill.setDrckbm(updatedBill.getDrckbm()); |
|
|
|
allocationBill.setDrkwbm(updatedBill.getDrkwbm()); |
|
|
|
allocationBill.setJhdrrq(updatedBill.getJhdrrq()); |
|
|
|
allocationBill.setJhdcrq(updatedBill.getJhdcrq()); |
|
|
|
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; |
|
|
@ -105,7 +120,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
return CommonPage.getPage(allocationBillList, totalCount,params.getPage(), params.getSize()); |
|
|
|
return CommonPage.getPage(allocationBillList, totalCount, params.getPage(), params.getSize()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -145,7 +160,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
allocationBillDto.setBillNo(params.get(0).getDjbh()); |
|
|
|
allocationBillDto.setBizDate(params.get(0).getYwrq()); |
|
|
|
allocationBillDto.setDescription(params.get(0).getBz()); |
|
|
|
allocationBillDto.setInWhUser(SecurityUtils.getCurrentNickName() == null ? "admin" : SecurityUtils.getCurrentNickName()); |
|
|
|
allocationBillDto.setInWhUser("A110813006"); |
|
|
|
List<AllocationBillDetailDto> entrys = new ArrayList<>(); |
|
|
|
params.forEach(r -> { |
|
|
|
AllocationBillDetailDto dto = new AllocationBillDetailDto(); |
|
|
@ -157,8 +172,13 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
dto.setReceiptLocationNo(r.getDrkwbm()); |
|
|
|
dto.setIssueWarehouseNo(r.getDcckbm()); |
|
|
|
dto.setIssueLocationNo(r.getDckwbm()); |
|
|
|
dto.setReceiptPlanDate(r.getJhdrrq()); |
|
|
|
dto.setIssuePlanDate(r.getJhdcrq()); |
|
|
|
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); |
|
|
|
} |
|
|
@ -187,7 +207,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper, |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void update(AllocationBillVO entity) { |
|
|
|
AllocationBill allocationBill = this.getById(entity.getDjid()); |
|
|
|
AllocationBill allocationBill = this.getById(entity.getFlid()); |
|
|
|
if (allocationBill == null) { |
|
|
|
// 如果不存在该记录,则插入数据
|
|
|
|
AllocationBill allocationBillNew = new AllocationBill(); |
|
|
|