Procházet zdrojové kódy

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

changhaoning před 2 roky
rodič
revize
d60f8e7de9

+ 24 - 19
src/main/java/com/dk/mdm/controller/ivt/outBound/OutboundController.java

@@ -1,7 +1,12 @@
 package com.dk.mdm.controller.ivt.outBound;
 
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.model.pojo.ivt.Outbound;
 import com.dk.common.service.BaseService;
+import com.dk.mdm.model.query.ivt.OutboundQuery;
+import com.dk.mdm.model.response.ivt.OutboundResponse;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import io.swagger.annotations.Api;
@@ -20,16 +25,16 @@ public class OutboundController {
     @Autowired
     private OutboundService outboundService;
 
-//    /**
-//     * @desc : 一览页销售出库
-//     * @author : 付斌
-//     * @date : 2023/1/9 10:36
-//     */
-//    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
-//    @PostMapping({"list_by"})
-//    public ResponseResultVO<PageList<OutboundResponse>> selectByCond(@RequestBody OutboundQuery outboundQuery) {
-//        return outboundService.selectByCond(outboundQuery);
-//    }
+    /**
+     * @desc : 一览页销售出库
+     * @author : 付斌
+     * @date : 2023/1/9 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<OutboundResponse>> selectByCond(@RequestBody OutboundQuery outboundQuery) {
+        return outboundService.selectByCond(outboundQuery);
+    }
 //
 //    /**
 //     * @desc : 一览页销售出库明细(货物、附件)
@@ -42,15 +47,15 @@ public class OutboundController {
 //    }
 //
 //
-//    /**
-//     * @desc : 查询出库明细(货物、附件)
-//     * @author : 付斌
-//     * @date : 2024/3/6 10:36
-//     */
-//    @PostMapping({"/{id}"})
-//    public ResponseResultVO selectById(@PathVariable String id) {
-//        return outboundService.selectById(id);
-//    }
+    /**
+     * @desc : 查询出库明细(货物、附件)
+     * @author : 付斌
+     * @date : 2024/3/6 10:36
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return outboundService.selectById(id);
+    }
 //
 //    /**
 //     * @desc : 获取销售出库信息(编辑用)

+ 4 - 1
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml

@@ -207,6 +207,9 @@
             <if test="intoTypes != null and intoTypes.size()>0">
                 AND tpi.into_type =any(#{intoTypes,typeHandler=StringListTypeHandler})
             </if>
+            <if test="intoReasonList != null and intoReasonList.size()>0">
+                AND tpi.into_reason =any(#{intoReasonList,typeHandler=UuidListTypeHandler})
+            </if>
             <if test="searchText !=null and searchText != ''">
                 AND (
                     tpi.into_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
@@ -387,7 +390,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_b.t_psi_inbound
-        WHERE into_id = #{intoId}
+        WHERE into_id = #{id}::uuid
         for update
     </select>
 

+ 17 - 0
src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml

@@ -114,6 +114,23 @@
             <if test="outType != null and outType != ''">
                 AND t.out_type = #{outType}
             </if>
+            <if test="outTypeList != null and outTypeList.size()>0">
+                AND t.out_type =any(#{outTypeList,typeHandler=StringListTypeHandler})
+            </if>
+            <if test="outReasonList != null and outReasonList.size()>0">
+                AND t.out_reason =any(#{outReasonList,typeHandler=UuidListTypeHandler})
+            </if>
+            <if test="searchText !=null and searchText != ''">
+                AND (
+                t.out_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or t.from_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                )
+            </if>
             <if test="fromId != null and fromId != ''">
                 AND t.from_id = #{fromId}
             </if>

+ 5 - 0
src/main/java/com/dk/mdm/model/query/ivt/InboundQuery.java

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.dk.common.infrastructure.handler.StringListTypeHandler;
 import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidListTypeHandler;
 import com.dk.common.infrastructure.handler.UuidTypeHandler;
 import com.dk.common.model.pojo.PageInfo;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -185,6 +186,10 @@ public class InboundQuery extends PageInfo<InboundQuery>{
     @ApiModelProperty(value = "入库状态List")
     private List<String> intoStatusList;
 
+    @ApiModelProperty(value = "入库原因List")
+    @TableField(typeHandler = UuidListTypeHandler.class)
+    private List<String> intoReasonList;
+
 
     @ApiModelProperty(value = "入库时间开始")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")

+ 18 - 3
src/main/java/com/dk/mdm/model/query/ivt/OutboundQuery.java

@@ -5,9 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.dk.common.infrastructure.annotaiton.ExportTitle;
-import com.dk.common.infrastructure.handler.JsonTypeHandler;
-import com.dk.common.infrastructure.handler.TimestampTypeHandler;
-import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.infrastructure.handler.*;
 import com.dk.common.model.pojo.PageInfo;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
@@ -56,6 +54,13 @@ public class OutboundQuery extends PageInfo<OutboundQuery> {
     @ApiModelProperty(value = "出库类型 (【系统字典】销售出库、采退出库、其他出库)")
     private String outType;
 
+    /**
+     * 出库类型-传入多个
+     */
+    @ApiModelProperty(value = "出库类型")
+    @TableField(typeHandler = StringListTypeHandler.class)
+    private List<String> outTypeList;
+
 
     /**
      * 来源单ID (销售订单、入库退货)
@@ -218,6 +223,12 @@ public class OutboundQuery extends PageInfo<OutboundQuery> {
 
 
     /**
+     * 小程序的查询条件
+     */
+    @ApiModelProperty(value = "小程序的查询条件")
+    private String searchText;
+
+    /**
      * 企业ID
      */
     @ApiModelProperty(value = "企业ID")
@@ -241,6 +252,10 @@ public class OutboundQuery extends PageInfo<OutboundQuery> {
     @ApiModelProperty(value = "出库状态List")
     private List<String> outStatusList;
 
+    @ApiModelProperty(value = "入库原因List")
+    @TableField(typeHandler = UuidListTypeHandler.class)
+    private List<String> outReasonList;
+
     @ApiModelProperty(value = "制单时间开始")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private LocalDate makeTimeStart;

+ 5 - 0
src/main/java/com/dk/mdm/service/ivt/inbound/InboundService.java

@@ -42,6 +42,11 @@ import java.util.Map;
 public class InboundService extends BaseService<Inbound> {
 
 	@Override
+	public String getPrimaryKey() {
+		return "into_id";
+	}
+
+	@Override
 	public BaseMapper<Inbound> getRepository() {
 		return inboundMapper;
 	}

+ 36 - 26
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundService.java

@@ -1,5 +1,9 @@
 package com.dk.mdm.service.ivt.outbound;
 
+import com.dk.common.infrastructure.annotaiton.Pagination;
+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.ivt.OutboundConvert;
 import com.dk.mdm.infrastructure.convert.ivt.OutboundItemConvert;
 import com.dk.mdm.mapper.ivt.OutboundItemMapper;
@@ -7,11 +11,17 @@ import com.dk.mdm.model.pojo.ivt.Outbound;
 import com.dk.mdm.mapper.ivt.OutboundMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.ivt.OutboundItemQuery;
+import com.dk.mdm.model.query.ivt.OutboundQuery;
+import com.dk.mdm.model.response.ivt.OutboundItemResponse;
+import com.dk.mdm.model.response.ivt.OutboundResponse;
 import com.dk.mdm.service.common.CommonService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
+
 @Service
 @Transactional
 public class OutboundService extends BaseService<Outbound> {
@@ -42,16 +52,16 @@ public class OutboundService extends BaseService<Outbound> {
     private OutboundItemConvert outboundItemConvert;
 
 
-//    /**
-//     * @desc : 一览页销售出库
-//     * @author : 付斌
-//     * @date : 2023/1/9 10:40
-//     */
-//    @Pagination
-//    public ResponseResultVO<PageList<OutboundResponse>> selectByCond(OutboundQuery outboundQuery) {
-//        return super.mergeListWithCount(outboundQuery, outboundMapper.selectByCond(outboundQuery),
-//                outboundMapper.countByCond(outboundQuery));
-//    }
+    /**
+     * @desc : 一览页销售出库
+     * @author : 付斌
+     * @date : 2023/1/9 10:40
+     */
+    @Pagination
+    public ResponseResultVO<PageList<OutboundResponse>> selectByCond(OutboundQuery outboundQuery) {
+        return super.mergeListWithCount(outboundQuery, outboundMapper.selectByCond(outboundQuery),
+                outboundMapper.countByCond(outboundQuery));
+    }
 //
 //    /**
 //     * @desc : 一览页销售出库明细(货物、附件)
@@ -70,22 +80,22 @@ public class OutboundService extends BaseService<Outbound> {
 //        return ResponseResultUtil.success(result);
 //    }
 //
-//    /**
-//     * @desc : 查询出库明细(货物、附件)
-//     * @author : 付斌
-//     * @date : 2024-02-28 13:25
-//     */
-//    @Pagination
-//    public ResponseResultVO selectById(String id) {
-//
-//        OutboundResponse outboundResponse = outboundMapper.selectById(id);
-//        // 商品明细
-//        List<OutboundItemResponse> outboundItem = outboundItemMapper.selectByCond(new OutboundItemQuery().setOutId(id));
-//        outboundResponse.setGoodsList(outboundItem);
-//
-//        // 附件
-//        return ResponseResultUtil.success(outboundResponse);
-//    }
+    /**
+     * @desc : 查询出库明细(货物、附件)
+     * @author : 付斌
+     * @date : 2024-02-28 13:25
+     */
+    @Pagination
+    public ResponseResultVO selectById(String id) {
+
+        OutboundResponse outboundResponse = outboundMapper.selectById(id);
+        // 商品明细
+        List<OutboundItemResponse> outboundItem = outboundItemMapper.selectByCond(new OutboundItemQuery().setOutId(id));
+        outboundResponse.setGoodsList(outboundItem);
+
+        // 附件
+        return ResponseResultUtil.success(outboundResponse);
+    }
 //
 //    /**
 //     * @desc : 获取销售出库信息(编辑用)

+ 24 - 10
src/main/java/com/dk/mdm/service/mac/AccountService.java

@@ -213,7 +213,10 @@ public class AccountService extends BaseService<Account> {
             if (outbound.getReceivableId() != null) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISACC.getMessage());
             }
-
+            // 账务日期不能为空
+            if (outbound.getOutDate() == null) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ACC_DATE_ISNULL.getMessage());
+            }
             // 插入账款明细
             accountItemInsert.setAccItemType(Constant.accItemType.YING_SHOU.getName())
                     .setObjectId(objectId).setOrgId(outbound.getOrgId()).setStaffId(outbound.getStaffId())
@@ -224,9 +227,11 @@ public class AccountService extends BaseService<Account> {
             accountItemMapper.insert(accountItemInsert);
 
             // 更新出库单上的账款明细Id
-            Outbound outboundUpdate = new Outbound();
-            outboundUpdate.setReceivableId(accountItemInsert.getItemId()).setOutId(invoiceId);
-            outboundService.updateByUuid(outboundUpdate);
+            LambdaUpdateWrapper<Outbound> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.set(Outbound::getReceivableId, UUID.fromString(accountItemInsert.getItemId())).eq(Outbound::getOutId, UUID.fromString(invoiceId));
+            outboundMapper.update(null, updateWrapper);
+        } else if ("t_mac_income".equals(biznisType)) {
+            // 其它收入单 todo
         }
 
         // 更新账款总表上的总应收账款和总剩余应收
@@ -268,6 +273,8 @@ public class AccountService extends BaseService<Account> {
             LambdaUpdateWrapper<Outbound> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(Outbound::getReceivableId, null).eq(Outbound::getOutId, UUID.fromString(invoiceId));
             outboundMapper.update(null, updateWrapper);
+        } else if ("t_mac_income".equals(biznisType)) {
+            // 其它支出单 todo
         }
 
         // 删除账款明细
@@ -301,9 +308,12 @@ public class AccountService extends BaseService<Account> {
             if (inbound.getReceivableId() != null) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISACC.getMessage());
             }
-
+            // 账务日期不能为空
+            if (inbound.getIntoDate() == null) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ACC_DATE_ISNULL.getMessage());
+            }
             // 插入账款明细
-            accountItemInsert.setAccItemType(Constant.accItemType.YING_SHOU.getName())
+            accountItemInsert.setAccItemType(Constant.accItemType.YING_FU.getName())
                     .setObjectId(objectId).setOrgId(inbound.getOrgId()).setStaffId(inbound.getStaffId())
                     .setAccDate(inbound.getIntoDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName())
                     .setAmtShould(inbound.getIntoAmt()).setAmtResidue(inbound.getIntoAmt())
@@ -312,9 +322,11 @@ public class AccountService extends BaseService<Account> {
             accountItemMapper.insert(accountItemInsert);
 
             // 更新出库单上的账款明细Id
-            Inbound inboundUpdate = new Inbound();
-            inboundUpdate.setReceivableId(accountItemInsert.getItemId()).setIntoId(invoiceId);
-            inboundService.updateByUuid(inboundUpdate);
+            LambdaUpdateWrapper<Inbound> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.set(Inbound::getReceivableId, UUID.fromString(accountItemInsert.getItemId())).eq(Inbound::getIntoId, UUID.fromString(invoiceId));
+            inboundMapper.update(null, updateWrapper);
+        } else if ("t_mac_outlay".equals(biznisType)) {
+            // 其它支出单 todo
         }
 
         // 更新账款总表上的总应收账款和总剩余应收
@@ -352,10 +364,12 @@ public class AccountService extends BaseService<Account> {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISHANDLE.getMessage());
             }
 
-            // 将库单上的账款明细Id更为null
+            // 将库单上的账款明细Id更为null
             LambdaUpdateWrapper<Inbound> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(Inbound::getReceivableId, null).eq(Inbound::getIntoId, UUID.fromString(invoiceId));
             inboundMapper.update(null, updateWrapper);
+        } else if ("t_mac_outlay".equals(biznisType)) {
+            // 其它支出单 todo
         }
 
         // 删除账款明细

+ 12 - 2
src/main/java/com/dk/mdm/test/Test.java

@@ -25,12 +25,22 @@ public class Test {
 
 
     @org.junit.Test
-    public void testaccReceivable() {
+    public void accReceivable() {
         accountService.accReceivable("10112024-0312-0000-0000-00000fd3a80b","t_psi_outbound");
     }
 
     @org.junit.Test
-    public void testreverseReceivable() {
+    public void reverseReceivable() {
         accountService.reverseReceivable("10112024-0312-0000-0000-00000fd3a80b","t_psi_outbound");
     }
+
+    @org.junit.Test
+    public void accPayable() {
+        accountService.accPayable("10112024-0308-0000-0000-00000d06fd8f","t_psi_inbound");
+    }
+
+    @org.junit.Test
+    public void reversePayable() {
+        accountService.reversePayable("10112024-0308-0000-0000-00000d06fd8f","t_psi_inbound");
+    }
 }