|
@@ -1,6 +1,9 @@
|
|
|
package cn.newfeifan.mall.module.distri.service.shopsettlement;
|
|
|
|
|
|
+import cn.newfeifan.mall.module.api.shop.ShopApi;
|
|
|
+import cn.newfeifan.mall.module.api.shop.dto.ShopDTO;
|
|
|
import cn.newfeifan.mall.module.distri.constant.DistriConstants;
|
|
|
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.TransferTemplateRespVO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.orderitemsettlement.OrderItemSettlementDO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.ordersettlement.OrderSettlementDO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.ptsettlement.PtSettlementDO;
|
|
@@ -26,6 +29,7 @@ import cn.newfeifan.mall.module.distri.dal.mysql.shopsettlement.ShopSettlementMa
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -58,6 +62,9 @@ public class ShopSettlementServiceImpl implements ShopSettlementService {
|
|
|
@Resource
|
|
|
private PtSettlementMapper ptSettlementMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ShopApi shopApi;
|
|
|
+
|
|
|
@Override
|
|
|
public Long createShopSettlement(ShopSettlementSaveReqVO createReqVO) {
|
|
|
// 插入
|
|
@@ -105,6 +112,31 @@ public class ShopSettlementServiceImpl implements ShopSettlementService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<TransferTemplateRespVO> excelShopSettlementPage(ShopSettlementPageReqVO pageReqVO) {
|
|
|
+ PageResult<ShopSettlementDO> shopSettlementDOPageResult = shopSettlementMapper.selectPage(pageReqVO);
|
|
|
+
|
|
|
+ PageResult<ShopSettlementRespVO> result = BeanUtils.toBean(shopSettlementDOPageResult, ShopSettlementRespVO.class);
|
|
|
+
|
|
|
+ List<TransferTemplateRespVO> list = new ArrayList<>();
|
|
|
+
|
|
|
+ for (ShopSettlementRespVO respVO : result.getList()) {
|
|
|
+ ShopDTO shop = shopApi.getShop(respVO.getShopId());
|
|
|
+
|
|
|
+ // 定义日期时间格式
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+
|
|
|
+ list.add(TransferTemplateRespVO.builder()
|
|
|
+ .payeeName(shop.getAccountName())
|
|
|
+ .payeeAccount(shop.getAccountNumber())
|
|
|
+ .payeeBankName(shop.getBankName())
|
|
|
+ .money(respVO.getShopTotalHighAmount().divide(BigDecimal.valueOf(DistriConstants.ONE_HUNDRED), 2, RoundingMode.HALF_UP).toString())
|
|
|
+ .mark("账单日期: " + formatter.format(respVO.getCreateTime().minusDays(1)))
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 把数据库的积分转换为数据库的钱
|
|
|
*
|
|
@@ -112,8 +144,8 @@ public class ShopSettlementServiceImpl implements ShopSettlementService {
|
|
|
* @return 钱
|
|
|
*/
|
|
|
public static Integer integral2Money(Long integral) {
|
|
|
- Long l = (integral / DistriConstants.MONEY2INTEGRAL);
|
|
|
- return l.intValue();
|
|
|
+ long l = (integral / DistriConstants.MONEY2INTEGRAL);
|
|
|
+ return (int) l;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -130,7 +162,7 @@ public class ShopSettlementServiceImpl implements ShopSettlementService {
|
|
|
// 代收积分
|
|
|
Long ptPayIntegral = 0L;
|
|
|
// 店铺应得金额(成本 * 数量)
|
|
|
- Integer ptShopAmount = 0;
|
|
|
+ int ptShopAmount = 0;
|
|
|
BigDecimal ptShopHighAmount = BigDecimal.ZERO;
|
|
|
|
|
|
for (MerchantDTO merchant : merchantDTOS) {
|
|
@@ -149,7 +181,7 @@ public class ShopSettlementServiceImpl implements ShopSettlementService {
|
|
|
// 代收积分
|
|
|
Long payIntegral = 0L;
|
|
|
// 店铺应得金额(成本 * 数量)
|
|
|
- Integer shopAmount = 0;
|
|
|
+ int shopAmount = 0;
|
|
|
BigDecimal shopHighAmount = BigDecimal.ZERO;
|
|
|
|
|
|
//获取该店铺下的订单
|