fubin %!s(int64=2) %!d(string=hai) anos
pai
achega
da700ab30b

+ 3 - 0
src/main/java/com/dk/mdm/model/vo/mac/RecPayVO.java

@@ -23,6 +23,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  收付款单
@@ -268,6 +269,8 @@ public class RecPayVO extends PageInfo<RecPayVO> implements Serializable {
     @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
     private String opDbUser;
 
+    @ApiModelProperty(value = "明细")
+    private List<RecPayItemVO> itemList;
 
     /*
      * 相关属性

+ 110 - 86
src/main/java/com/dk/mdm/service/mac/RecPayService.java

@@ -1,7 +1,5 @@
 package com.dk.mdm.service.mac;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.infrastructure.constant.Constant;
@@ -9,6 +7,9 @@ import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mac.RecPayConvert;
+import com.dk.mdm.infrastructure.convert.mac.RecPayItemConvert;
+import com.dk.mdm.mapper.mac.AccountItemMapper;
+import com.dk.mdm.mapper.mac.AccountMapper;
 import com.dk.mdm.mapper.mac.RecPayItemMapper;
 import com.dk.mdm.model.pojo.mac.RecPay;
 import com.dk.mdm.mapper.mac.RecPayMapper;
@@ -17,10 +18,9 @@ import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.pojo.mac.RecPayItem;
 import com.dk.mdm.model.query.mac.RecPayItemQuery;
 import com.dk.mdm.model.query.mac.RecPayQuery;
-import com.dk.mdm.model.query.sale.OrderItemQuery;
 import com.dk.mdm.model.response.mac.RecPayItemResponse;
 import com.dk.mdm.model.response.mac.RecPayResponse;
-import com.dk.mdm.model.response.sale.OrderItemResponse;
+import com.dk.mdm.model.vo.mac.RecPayItemVO;
 import com.dk.mdm.model.vo.mac.RecPayVO;
 import com.dk.mdm.service.common.CommonService;
 import org.springframework.stereotype.Service;
@@ -36,86 +36,110 @@ import java.util.UUID;
 @Transactional
 public class RecPayService extends BaseService<RecPay> {
 
-	@Override
-	public String getPrimaryKey() {
-		return "rp_id";
-	}
-
-	@Override
-	public BaseMapper<RecPay> getRepository() {
-		return recPayMapper;
-	}
-
-	@Autowired
-	private RecPayMapper recPayMapper;
-
-	@Autowired
-	private RecPayItemMapper recPayItemMapper;
-
-//	@Autowired
-//	private AccountService accountService;
-//
-//	@Autowired
-//	private AccountMapper accountMapper;
-
-	@Autowired
-	private CommonService commonService;
-
-	@Autowired
-	private RecPayConvert recPayConvert;
-	
-	/**
-	 * @desc : 条件查询
-	 * @author : 付斌
-	 * @date : 2023/1/9 10:40
-	 */
-	@Pagination
-	public ResponseResultVO<PageList<RecPayResponse>> selectByCond(RecPayQuery recPayQuery) {
-		return super.mergeListWithCount(recPayQuery, recPayMapper.selectByCond(recPayQuery),
-				recPayMapper.countByCond(recPayQuery));
-	}
-
-	/**
-	 * @desc : 查询收款明细
-	 * @author : 付斌
-	 * @date : 2024-02-28 13:25
-	 */
-	@Pagination
-	public ResponseResultVO<Map<String, Object>> selectRpInfoById(String id) {
-		Map<String, Object> result = new HashMap<>();
-		// 收款明细
-		List<RecPayItemResponse> recPayItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(id));
-		result.put("recPayItem", recPayItem);
-
-		// 附件
-		return ResponseResultUtil.success(result);
-	}
-
-	/**
-	 * @desc : 新建方法
-	 * @author : 付斌
-	 * @date : 2023/1/9 10:49
-	 */
-	@Transactional(
-			rollbackFor = {Exception.class}
-	)
-	public ResponseResultVO<?> insert(RecPayVO recPayVO) {
-
-
-		return ResponseResultUtil.success();
-	}
-
-	/**
-	 * @desc : 编辑方法
-	 * @author : 付斌
-	 * @date : 2023/1/9 10:49
-	 */
-	@Transactional(
-			rollbackFor = {Exception.class}
-	)
-	public ResponseResultVO<?> update(RecPayVO recPayVO) {
-		RecPay recPay = recPayConvert.convertToPo(recPayVO);
-		return ResponseResultUtil.success(super.update(recPay, new UpdateWrapper<RecPay>().lambda().eq(RecPay::getRpId,
-				UUID.fromString(recPay.getRpId()))));
-	}
+    @Override
+    public String getPrimaryKey() {
+        return "rp_id";
+    }
+
+    @Override
+    public BaseMapper<RecPay> getRepository() {
+        return recPayMapper;
+    }
+
+    @Autowired
+    private RecPayMapper recPayMapper;
+
+    @Autowired
+    private RecPayItemMapper recPayItemMapper;
+
+    @Autowired
+    private AccountService accountService;
+
+    @Autowired
+    private AccountMapper accountMapper;
+
+    @Autowired
+    private AccountItemService accountItemService;
+
+    @Autowired
+    private AccountItemMapper accountItemMapper;
+
+    @Autowired
+    private CommonService commonService;
+
+    @Autowired
+    private RecPayConvert recPayConvert;
+
+    @Autowired
+    private RecPayItemConvert recPayItemConvert;
+
+    /**
+     * @desc : 条件查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:40
+     */
+    @Pagination
+    public ResponseResultVO<PageList<RecPayResponse>> selectByCond(RecPayQuery recPayQuery) {
+        return super.mergeListWithCount(recPayQuery, recPayMapper.selectByCond(recPayQuery),
+                recPayMapper.countByCond(recPayQuery));
+    }
+
+    /**
+     * @desc : 查询收款明细
+     * @author : 付斌
+     * @date : 2024-02-28 13:25
+     */
+    @Pagination
+    public ResponseResultVO<Map<String, Object>> selectRpInfoById(String id) {
+        Map<String, Object> result = new HashMap<>();
+        // 收款明细
+        List<RecPayItemResponse> recPayItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(id));
+        result.put("recPayItem", recPayItem);
+
+        // 附件
+        return ResponseResultUtil.success(result);
+    }
+
+    /**
+     * @desc : 新建方法
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> insert(RecPayVO recPayVO) {
+
+        // 获取单号
+        Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
+        recPayVO.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString());
+        // 转化实体
+        RecPay recPay = recPayConvert.convertToPo(recPayVO);
+        // 订单总单保存
+        super.insert(recPay);
+
+        // 订单明细保存
+        if (recPayVO.getItemList() != null && recPayVO.getItemList().size() > 0) {
+            for (RecPayItemVO recPayItemVO : recPayVO.getItemList()) {
+                RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
+                recPayItem.setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setAccDate(recPay.getAccDate());
+                recPayItemMapper.insert(recPayItem);
+            }
+        }
+        return ResponseResultUtil.success();
+    }
+
+    /**
+     * @desc : 编辑方法
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> update(RecPayVO recPayVO) {
+        RecPay recPay = recPayConvert.convertToPo(recPayVO);
+        return ResponseResultUtil.success(super.update(recPay, new UpdateWrapper<RecPay>().lambda().eq(RecPay::getRpId,
+                UUID.fromString(recPay.getRpId()))));
+    }
 }