|
|
@@ -187,6 +187,41 @@ public class STKServiceImpl implements STKService {
|
|
|
return Result.success(map);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result getRecBalanceNoticeList(ProductPageDTO productPageDTO) {
|
|
|
+ int pageNum = 1;
|
|
|
+ int pageSize = 20;
|
|
|
+ if (productPageDTO !=null){
|
|
|
+ pageNum = Integer.valueOf(productPageDTO.getPageNum());
|
|
|
+ pageSize = Integer.valueOf(productPageDTO.getPageSize());
|
|
|
+ }else{
|
|
|
+ return Result.error("参数错误!");
|
|
|
+ }
|
|
|
+ int start = ((pageNum - 1) * pageSize + 1);
|
|
|
+ int end = pageNum * pageSize;
|
|
|
+
|
|
|
+ List<RecBalanceNoticeDTO> recBalanceNoticeDTOS = baseDao.query("select * from (select rownum rn,AA.* from (select rb_code,rb_kind,rb_date,rb_status,rb_custid,rb_custcode,rb_custname,rb_currency,rb_rate,rb_amount,rb_cmcurrency,rb_cmamount,rb_getdate,rb_counterfee,rb_monthly,rb_yamount,rb_sellercode,rb_sellername,rb_departmentcode,rb_departmentname,rb_zat_user,rb_attention,rb_remark,rb_recorder,rb_recorddate,rb_auditer,rb_auditdate,rb_attach,rb_actamount,rb_cateid,rb_catecode,rb_catename,rb_statuscode,rb_id from RecBalanceNotice where rb_kind='预收款' and rb_statuscode='AUDITED' order by rb_id desc) AA ) where rn>="+start+" and rn<="+end , RecBalanceNoticeDTO.class);
|
|
|
+
|
|
|
+ if (recBalanceNoticeDTOS.size() == 0 ){
|
|
|
+ return Result.error("回款通知(预收)无数据!");
|
|
|
+ }
|
|
|
+ // 4. 批量查询回款通知明细
|
|
|
+ List<RecBalanceNoticeDetailDTO> recBalanceNoticeDetailDTOS = baseDao.query("select rbd_id,rbd_rbid,rbd_detno,rbd_sacode,rbd_date,rbd_currency,rbd_amount,rbd_sellercode,rbd_sellername,rbd_payments,rbd_ordertype,rbd_remark,sa_total,sa_prepayamount,sa_quyu_user from RECBALANCENOTICEDetail LEFT JOIN Sale on rbd_sacode=sa_code where rbd_rbid in (select rb_id from (select rownum rn,AA.* from (select * from RecBalanceNotice where rb_statuscode in ('AUDITED') order by rb_id desc) AA) where rn>="+start+" and rn<="+end+") order by rbd_rbid desc,rbd_detno" , RecBalanceNoticeDetailDTO.class);
|
|
|
+ // 5. 按回款通知ID分组订单明细
|
|
|
+ Map<BigDecimal, List<RecBalanceNoticeDetailDTO>> recBalanceNoticeDetailMap = recBalanceNoticeDetailDTOS.stream().collect(Collectors.groupingBy(RecBalanceNoticeDetailDTO::getRbd_rbid));
|
|
|
+ // 6. 组装数据
|
|
|
+ List<RecBalanceNoticeResp> recBalanceNoticeResps = assembleRecBalanceNoticeData(recBalanceNoticeDTOS, recBalanceNoticeDetailMap);
|
|
|
+
|
|
|
+ int count = baseDao.getCount("select count(1) from RecBalanceNotice where rb_statuscode in ('AUDITED') ");
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("pageNum", pageNum);
|
|
|
+ map.put("pageSize", pageSize);
|
|
|
+ map.put("size", count);
|
|
|
+ map.put("list", recBalanceNoticeResps);
|
|
|
+ return Result.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Result createVisitRecord(VisitRecordDTO customerVisitDTO) {
|
|
|
if(customerVisitDTO == null) {
|
|
|
@@ -300,6 +335,41 @@ public class STKServiceImpl implements STKService {
|
|
|
return SaleDetailConvertor.toSaleDetailResp(item);
|
|
|
}
|
|
|
|
|
|
+ private List<RecBalanceNoticeResp> assembleRecBalanceNoticeData(List<RecBalanceNoticeDTO> orders, Map<BigDecimal, List<RecBalanceNoticeDetailDTO>> itemsMap) {
|
|
|
+ return orders.stream()
|
|
|
+ .map(order -> {
|
|
|
+ RecBalanceNoticeResp recBalanceNoticeListResp = convertToVOByRecBalanceNotice(order);
|
|
|
+
|
|
|
+ // 设置订单明细
|
|
|
+ List<RecBalanceNoticeDetailDTO> items = itemsMap.get(order.getRb_id());
|
|
|
+ if (!CollectionUtils.isEmpty(items)) {
|
|
|
+ List<RecBalanceNoticeDetailResp> itemVOS = items.stream()
|
|
|
+ .map(this::convertToItemVOByRecBalanceNotice)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ recBalanceNoticeListResp.setItems(itemVOS);
|
|
|
+ } else {
|
|
|
+ recBalanceNoticeListResp.setItems(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ return recBalanceNoticeListResp;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转换订单主表为VO
|
|
|
+ */
|
|
|
+ private RecBalanceNoticeResp convertToVOByRecBalanceNotice(RecBalanceNoticeDTO order) {
|
|
|
+ return RecBalanceNoticeConvertor.toRecBalanceNoticeResp(order);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转换订单明细为VO
|
|
|
+ */
|
|
|
+ private RecBalanceNoticeDetailResp convertToItemVOByRecBalanceNotice(RecBalanceNoticeDetailDTO item) {
|
|
|
+ return RecBalanceNoticeDetailConvertor.toRecBalanceNoticeDetailResp(item);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Result getProduct(HttpServletRequest request, ProductReq req) {
|
|
|
String code = req.getCode();
|