fubin 2 年 前
コミット
89dac84ad2

+ 4 - 2
src/main/java/com/dk/mdm/controller/mac/ReceiptController.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mac.ReceiptService;
 
+import java.util.Map;
+
 
 @Api(tags = "收【退】款单API接口")
 @RestController
@@ -54,8 +56,8 @@ public class ReceiptController{
      */
     @ApiOperation(value = "新建", notes = "新建")
     @PostMapping({"insert"})
-    public ResponseResultVO<?> insert(@RequestBody ReceiptVO receiptVO) {
-        return receiptService.insert(receiptVO);
+    public ResponseResultVO<?> insert(@RequestBody Map<String, Object> map) {
+        return receiptService.insert(map);
     }
 
     /**

+ 3 - 1
src/main/java/com/dk/mdm/mapper/mac/ReceiptMapper.xml

@@ -167,6 +167,7 @@
                t.staff_id,
                tms.staff_name                                    as "staffName",
                t.receipt_mac,
+               tmma.mac_name                                     as "receiptMacName",
                t.receipt_amt,
                t.receivable_id,
                t.waive_amt,
@@ -181,12 +182,13 @@
                t.cp_id
         FROM dkic_b.t_mac_receipt as t
                  left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.receipt_type
+                 left join dkic_b.t_mst_money_account as tmma on tmma.mac_id = t.receipt_mac
                  left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
                  left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
                  left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
                  left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
                  left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
-                <include refid="Condition"/>
+        <include refid="Condition"/>
         order by t.op_create_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}

+ 3 - 0
src/main/java/com/dk/mdm/model/response/mac/ReceiptResponse.java

@@ -279,6 +279,9 @@ public class ReceiptResponse extends PageInfo<ReceiptResponse> implements Serial
     @ApiModelProperty(value = "收款类型")
     private String receiptTypeName;
 
+    @ApiModelProperty(value = "账户名称")
+    private String receiptMacName;
+
     @ApiModelProperty(value = "订单单号")
     private String orderNo;
 

+ 66 - 58
src/main/java/com/dk/mdm/service/mac/ReceiptService.java

@@ -1,5 +1,7 @@
 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;
@@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -26,71 +29,76 @@ import java.util.UUID;
 @Transactional
 public class ReceiptService extends BaseService<Receipt> {
 
-	@Override
-	public String getPrimaryKey() {
-		return "receipt_id";
-	}
+    @Override
+    public String getPrimaryKey() {
+        return "receipt_id";
+    }
 
-	@Override
-	public BaseMapper<Receipt> getRepository() {
-		return receiptMapper;
-	}
+    @Override
+    public BaseMapper<Receipt> getRepository() {
+        return receiptMapper;
+    }
 
-	@Autowired
-	private ReceiptMapper receiptMapper;
+    @Autowired
+    private ReceiptMapper receiptMapper;
 
-	@Autowired
-	private CommonService commonService;
+    @Autowired
+    private CommonService commonService;
 
-	@Autowired
-	private ReceiptConvert receiptConvert;
-	
-	/**
-	 * @desc : 条件查询
-	 * @author : 付斌
-	 * @date : 2023/1/9 10:40
-	 */
-	@Pagination
-	public ResponseResultVO<PageList<ReceiptResponse>> selectByCond(ReceiptQuery receiptQuery) {
-		return super.mergeListWithCount(receiptQuery, receiptMapper.selectByCond(receiptQuery),
-				receiptMapper.countByCond(receiptQuery));
-	}
+    @Autowired
+    private ReceiptConvert receiptConvert;
 
+    /**
+     * @desc : 条件查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:40
+     */
+    @Pagination
+    public ResponseResultVO<PageList<ReceiptResponse>> selectByCond(ReceiptQuery receiptQuery) {
+        return super.mergeListWithCount(receiptQuery, receiptMapper.selectByCond(receiptQuery),
+                receiptMapper.countByCond(receiptQuery));
+    }
 
-	/**
-	 * @desc : 新建方法
-	 * @author : 付斌
-	 * @date : 2023/1/9 10:49
-	 */
-	@Transactional(
-			rollbackFor = {Exception.class}
-	)
-	public ResponseResultVO<?> insert(ReceiptVO receiptVO) {
 
-		// 获取单号
-		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSRECEIPT.getName(), false);
-		receiptVO.setReceiptId(codeMap.get("outId").toString()).setReceiptNo(codeMap.get("outNote").toString())
-				.setReceiptType(Constant.DocumentType.ORDER.getName());
-		// 转化实体
-		Receipt receipt = receiptConvert.convertToPo(receiptVO);
-		// Receipt总单保存
-		super.insert(receipt);
+    /**
+     * @desc : 新建方法
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> insert(Map<String, Object> map) {
 
-		
-		return ResponseResultUtil.success();
-	}
+        List<ReceiptVO> receiptVOList = JSONArray.parseArray(JSON.toJSONString(map.get("itemList"))).toJavaList(ReceiptVO.class);
+        // 明细保存
+        if (receiptVOList != null && receiptVOList.size() > 0) {
+            for (ReceiptVO receiptVO : receiptVOList) {
+                // 获取单号
+                Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSRECEIPT.getName(), false);
+                receiptVO.setReceiptId(codeMap.get("outId").toString()).setReceiptNo(codeMap.get("outNote").toString())
+                        .setReceiptType(Constant.DocumentType.ORDER.getName());
+                // 转化实体
+                Receipt receipt = receiptConvert.convertToPo(receiptVO);
+                // Receipt总单保存
+                super.insert(receipt);
+            }
+        }
 
-	/**
-	 * @desc : 编辑方法
-	 * @author : 付斌
-	 * @date : 2023/1/9 10:49
-	 */
-	@Transactional(
-			rollbackFor = {Exception.class}
-	)
-	public ResponseResultVO<?> update(ReceiptVO receiptVO) {
-		Receipt receipt = receiptConvert.convertToPo(receiptVO);
-		return ResponseResultUtil.success(super.update(receipt, new UpdateWrapper<Receipt>().lambda().eq(Receipt::getReceiptId,
-				UUID.fromString(receipt.getReceiptId()))));
-	}
+        return ResponseResultUtil.success();
+    }
+
+    /**
+     * @desc : 编辑方法
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> update(ReceiptVO receiptVO) {
+        Receipt receipt = receiptConvert.convertToPo(receiptVO);
+        return ResponseResultUtil.success(super.update(receipt, new UpdateWrapper<Receipt>().lambda().eq(Receipt::getReceiptId,
+                UUID.fromString(receipt.getReceiptId()))));
+    }
 }