huangfuli 3 роки тому
батько
коміт
fc9cd3dbbf
13 змінених файлів з 248 додано та 39 видалено
  1. 4 3
      pom.xml
  2. 3 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/constant/StatusEnum.java
  3. 27 3
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/RepaymentManagementController.java
  4. 4 5
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/TradeWarehouseReceiptApplController.java
  5. 5 4
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/RepaymentManagement.java
  6. 24 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/TradeWarehouseReceiptAppl.java
  7. 19 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/RepaymentManagementMapper.java
  8. 14 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IRepaymentManagementService.java
  9. 2 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ITradeWarehouseReceiptApplService.java
  10. 80 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/RepaymentManagementServiceImpl.java
  11. 31 20
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TradeWarehouseReceiptApplServiceImpl.java
  12. 31 1
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/RepaymentManagementMapper.xml
  13. 4 2
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/TradeWarehouseReceiptApplMapper.xml

+ 4 - 3
pom.xml

@@ -184,6 +184,9 @@
             <properties>
                 <env>local</env>
             </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
         </profile>
         <profile>
             <id>dev</id>
@@ -202,9 +205,7 @@
             <properties>
                 <env>prod</env>
             </properties>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
+
 
         </profile>
     </profiles>

+ 3 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/constant/StatusEnum.java

@@ -131,6 +131,9 @@ public enum StatusEnum {
 
     TO_BE_TRADERETURN("1", "待还款", "to_be_tradereturn"),
 
+    //贸易仓单状态
+    RETURN_TRADE_WAREHOUSE_RECEIPT("0", "已退回", "return_trade_warehouse_receipt"),
+
     ;
     @Getter
     private String flag;

+ 27 - 3
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/RepaymentManagementController.java

@@ -1,9 +1,11 @@
 package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.RepaymentManagement;
+import com.yh.saas.plugin.yiliangyiyun.service.IRepaymentManagementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * <p>
@@ -17,5 +19,27 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/repaymentManagement")
 public class RepaymentManagementController {
 
+    @Autowired
+    private IRepaymentManagementService repaymentManagementService;
+
+    /**
+     * 还款列表
+     * @param repaymentManagement
+     * @return
+     */
+    @GetMapping("/selectRepaymentManagement")
+    public Page<RepaymentManagement> selectRepaymentManagement(RepaymentManagement repaymentManagement){
+        return repaymentManagementService.selectRepaymentManagement(repaymentManagement);
+    }
+
+    /**
+     * 还款
+     * @param repaymentManagement
+     * @return
+     */
+    @PostMapping("/api/repaymentMoney")
+    public String repaymentMoney(@RequestBody RepaymentManagement repaymentManagement){
+        return repaymentManagementService.repaymentMoney(repaymentManagement);
+    }
 }
 

+ 4 - 5
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/TradeWarehouseReceiptApplController.java

@@ -2,10 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
 import com.baomidou.mybatisplus.plugins.Page;
-import com.yh.saas.plugin.yiliangyiyun.entity.PurchaseReceiptReport;
-import com.yh.saas.plugin.yiliangyiyun.entity.SalePlanInfo;
-import com.yh.saas.plugin.yiliangyiyun.entity.TradeWarehouseReceiptAppl;
-import com.yh.saas.plugin.yiliangyiyun.service.IPurchaseReceiptReportService;
+import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.service.ITradeWarehouseReceiptApplService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -25,6 +22,7 @@ import java.util.List;
 public class TradeWarehouseReceiptApplController {
     @Autowired
     private ITradeWarehouseReceiptApplService tradeWarehouseReceiptApplService;
+
     /**
      * 列表
      * @param tradeWarehouseReceiptAppl
@@ -82,7 +80,7 @@ public class TradeWarehouseReceiptApplController {
         return tradeWarehouseReceiptApplService.getTrageInfo(id);
     }
     /**
-     * 详情
+     * 删除
      *
      * @return
      */
@@ -91,5 +89,6 @@ public class TradeWarehouseReceiptApplController {
          tradeWarehouseReceiptApplService.deleteTrageInfo(id);
     }
 
+
 }
 

+ 5 - 4
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/RepaymentManagement.java

@@ -9,10 +9,12 @@ import com.baomidou.mybatisplus.annotations.TableName;
 import com.baomidou.mybatisplus.annotations.Version;
 
 import com.baomidou.mybatisplus.enums.IdType;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yh.saas.common.support.entity.BaseModel;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -55,13 +57,11 @@ public class RepaymentManagement extends BaseModel<RepaymentManagement> {
      * 还款金额(元)
      */
     private Float repaymentEdAmount;
-    /**
-     * 未还金额(元)
-     */
-    private Float repaymentNotAmount;
     /**
      * 还款日期
      */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date repaymentDate;
     /**
      * 还款截图
@@ -78,4 +78,5 @@ public class RepaymentManagement extends BaseModel<RepaymentManagement> {
         return this.id;
     }
 
+
 }

+ 24 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/TradeWarehouseReceiptAppl.java

@@ -192,6 +192,22 @@ public class TradeWarehouseReceiptAppl extends BaseModel<TradeWarehouseReceiptAp
      * 保险费显示隐藏
      */
     private String insurancePremiumFlag;
+    /**
+     * 修改费用1
+     */
+    private String modifyExpense1;
+    /**
+     * 修改费用2
+     */
+    private String modifyExpense2;
+    /**
+     * 修改费用3
+     */
+    private String modifyExpense3;
+    /**
+     * 修改费用4
+     */
+    private String modifyExpense4;
     /**
      * 附件
      */
@@ -261,4 +277,12 @@ public class TradeWarehouseReceiptAppl extends BaseModel<TradeWarehouseReceiptAp
         return this.id;
     }
 
+    public static class QueryFiles {
+
+        public static final String COMP_ID = "comp_id";
+
+        public static final String DELETE_FLAG = "delete_flag";
+
+    }
+
 }

+ 19 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/RepaymentManagementMapper.java

@@ -2,6 +2,10 @@ package com.yh.saas.plugin.yiliangyiyun.mapper;
 
 import com.yh.saas.plugin.yiliangyiyun.entity.RepaymentManagement;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.yh.saas.plugin.yiliangyiyun.entity.WeighingManagement;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +17,19 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  */
 public interface RepaymentManagementMapper extends BaseMapper<RepaymentManagement> {
 
+    /**
+     * 根据条件查询还款管理总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getCountByCondition(Map<String, Object> pageView);
+
+    /**
+     * 根据条件查询还款管理列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<RepaymentManagement> getListByCondition(Map<String, Object> pageView);
 }

+ 14 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IRepaymentManagementService.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service;
 
+import com.baomidou.mybatisplus.plugins.Page;
 import com.yh.saas.plugin.yiliangyiyun.entity.RepaymentManagement;
 import com.baomidou.mybatisplus.service.IService;
 
@@ -13,4 +14,17 @@ import com.baomidou.mybatisplus.service.IService;
  */
 public interface IRepaymentManagementService extends IService<RepaymentManagement> {
 
+    /**
+     * 还款列表
+     * @param repaymentManagement
+     * @return
+     */
+    Page<RepaymentManagement> selectRepaymentManagement(RepaymentManagement repaymentManagement);
+
+    /**
+     * 还款
+     * @param repaymentManagement
+     * @return
+     */
+    String repaymentMoney(RepaymentManagement repaymentManagement);
 }

+ 2 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ITradeWarehouseReceiptApplService.java

@@ -68,4 +68,6 @@ public interface ITradeWarehouseReceiptApplService extends IService<TradeWarehou
      * @return
      */
     void deleteTrageInfo(String id);
+
+
 }

+ 80 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/RepaymentManagementServiceImpl.java

@@ -1,11 +1,29 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
-import com.yh.saas.plugin.yiliangyiyun.entity.RepaymentManagement;
+import com.alipay.sofa.runtime.api.annotation.SofaReference;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
+import com.winsea.svc.base.base.entity.CommonRoleResource;
+import com.winsea.svc.base.base.entity.CommonStaff;
+import com.winsea.svc.base.base.service.ICommonRoleResourceService;
+import com.winsea.svc.base.base.service.ICommonStaffService;
+import com.winsea.svc.base.security.entity.User;
+import com.winsea.svc.base.security.util.AuthSecurityUtils;
+import com.yh.saas.common.support.util.IdGenerator;
+import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.mapper.RepaymentManagementMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IRepaymentManagementService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.yh.saas.plugin.yiliangyiyun.service.ITradeWarehouseReceiptApplService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  * 贸易仓单还款管理 服务实现类
@@ -17,4 +35,65 @@ import org.springframework.stereotype.Service;
 @Service
 public class RepaymentManagementServiceImpl extends ServiceImpl<RepaymentManagementMapper, RepaymentManagement> implements IRepaymentManagementService {
 
+    @Autowired
+    private ITradeWarehouseReceiptApplService tradeWarehouseReceiptApplService;
+    @SofaReference
+    private ICommonRoleResourceService roleResourceService;
+
+    /**
+     * 还款列表
+     * @param repaymentManagement
+     * @return
+     */
+    @Override
+    public Page<RepaymentManagement> selectRepaymentManagement(RepaymentManagement repaymentManagement){
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (repaymentManagement.getCurrentPage() - 1)
+                * repaymentManagement.getPageSize());
+        //公司id
+        pageView.put("compId", repaymentManagement.getCompId());
+        pageView.put("tradeWarehouseReceiptId", repaymentManagement.getTradeWarehouseReceiptId());
+        pageView.put("pageSize", repaymentManagement.getPageSize());
+        pageView.put("currentPage", repaymentManagement.getCurrentPage());
+        // 查询还款总数
+        Integer dataCount = baseMapper.getCountByCondition(pageView);
+        List<RepaymentManagement> dataList = baseMapper.getListByCondition(pageView);
+        Page<RepaymentManagement> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(repaymentManagement.getCurrentPage());
+        page.setSize(repaymentManagement.getPageSize());
+        return page;
+    }
+
+    /**
+     * 还款
+     * @param repaymentManagement
+     * @return
+     */
+    @Override
+    public String repaymentMoney(RepaymentManagement repaymentManagement){
+        //新增主键id
+        repaymentManagement.setId(IdGenerator.generateUUID());
+        //查询贸易仓单信息
+        TradeWarehouseReceiptAppl tradeWarehouseReceiptAppl = tradeWarehouseReceiptApplService.selectOne(new EntityWrapper<TradeWarehouseReceiptAppl>()
+                .eq("id",repaymentManagement.getTradeWarehouseReceiptId()));
+        tradeWarehouseReceiptAppl.setAmountToRepaid(tradeWarehouseReceiptAppl.getAmountToRepaid() - repaymentManagement.getRepaymentEdAmount());
+        repaymentManagement.setRepaymentIngAmount(tradeWarehouseReceiptAppl.getAmountToRepaid());
+        tradeWarehouseReceiptAppl.setAmountRepaid(tradeWarehouseReceiptAppl.getAmountDue() - tradeWarehouseReceiptAppl.getAmountToRepaid());
+        // 操作主表数据
+        this.insert(repaymentManagement);
+        tradeWarehouseReceiptApplService.updateById(tradeWarehouseReceiptAppl);
+        return "OK";
+    }
+
+
+
+    private List<String> getResourceIdList() {
+        User currentUser = AuthSecurityUtils.getCurrentUserInfo();
+        // 当前登录人主要角色
+        return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
+                .map(CommonRoleResource::getResourceId).collect(Collectors.toList());
+    }
+
 }

+ 31 - 20
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TradeWarehouseReceiptApplServiceImpl.java

@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.plugins.Page;
 import com.google.common.collect.Lists;
 import com.winsea.svc.base.base.entity.CommonRoleResource;
 import com.winsea.svc.base.base.service.ICommonRoleResourceService;
-import com.winsea.svc.base.base.util.DateUtils;
 import com.winsea.svc.base.security.entity.User;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
 import com.winsea.svc.base.workflow.entity.Workflow;
@@ -27,6 +26,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
 
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -203,30 +205,31 @@ public class TradeWarehouseReceiptApplServiceImpl extends ServiceImpl<TradeWareh
             this.updateById(tradeWarehouseReceiptAppl);
         } else {
             this.updateById(tradeWarehouseReceiptAppl);
-            boolean isStartWorkflow = StringUtils.isBlank(tradeWarehouseReceiptAppl.getWorkflowId());
-            // 不是退回的单子
-            if (isStartWorkflow) {
-                Workflow workflow = workflowService
-                        .findLatestWorkflowByBusinessCodeByApp(tradeWarehouseReceiptAppl.getCompId(), "TRADE-WAREHOUSE-REPORT");
-                // 没配置审核流程,直接结束并处理信息
-                if (workflow == null) {
-                    throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+            if("0".equals(tradeWarehouseReceiptAppl.getStatusFlag())){
+                boolean isStartWorkflow = StringUtils.isBlank(tradeWarehouseReceiptAppl.getWorkflowId());
+                // 不是退回的单子
+                if (isStartWorkflow) {
+                    Workflow workflow = workflowService
+                            .findLatestWorkflowByBusinessCodeByApp(tradeWarehouseReceiptAppl.getCompId(), "TRADE-WAREHOUSE-REPORT");
+                    // 没配置审核流程,直接结束并处理信息
+                    if (workflow == null) {
+                        throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                    }
+                    // 开启审核流
+                    else {
+                        // 设置状态 已提交审核
+                        tradeWarehouseReceiptAppl.setWorkflowId(workflow.getId());
+                        this.updateById(tradeWarehouseReceiptAppl);
+                        workflowService.startInstance(workflow.getId(), tradeWarehouseReceiptAppl.getId());
+                    }
                 }
-                // 开启审核流
+                // 退回的单子 再启用
                 else {
 
-                    // 设置状态 已提交审核
-                    tradeWarehouseReceiptAppl.setWorkflowId(workflow.getId());
                     this.updateById(tradeWarehouseReceiptAppl);
-                    workflowService.startInstance(workflow.getId(), tradeWarehouseReceiptAppl.getId());
+                    workflowService.activateInstance(tradeWarehouseReceiptAppl.getWorkflowId(), tradeWarehouseReceiptAppl.getId());
                 }
             }
-            // 退回的单子 再启用
-            else {
-
-                this.updateById(tradeWarehouseReceiptAppl);
-                workflowService.activateInstance(tradeWarehouseReceiptAppl.getWorkflowId(), tradeWarehouseReceiptAppl.getId());
-            }
         }
         return tradeWarehouseReceiptAppl.getId();
     }
@@ -240,11 +243,18 @@ public class TradeWarehouseReceiptApplServiceImpl extends ServiceImpl<TradeWareh
     @Override
     public TradeWarehouseReceiptAppl getTrageInfo(String id){
         TradeWarehouseReceiptAppl tradeWarehouseReceiptAppl = this.selectById(id);
+        String taskId = "";
+        // 只有待审核状态才有taskId
+        if (StringUtils.isNotBlank(tradeWarehouseReceiptAppl.getWorkflowId())) {
+            JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(tradeWarehouseReceiptAppl.getWorkflowId()), tradeWarehouseReceiptAppl.getId());
+            taskId = jsonObject.getString("taskId");
+            tradeWarehouseReceiptAppl.setTaskId(taskId);
+        }
         return tradeWarehouseReceiptAppl;
     }
 
     /**
-     * 查看
+     * 删除
      *
      * @return
      */
@@ -254,6 +264,7 @@ public class TradeWarehouseReceiptApplServiceImpl extends ServiceImpl<TradeWareh
     }
 
 
+
     /**
      * 可用库存
      *

+ 31 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/RepaymentManagementMapper.xml

@@ -1,5 +1,35 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.RepaymentManagementMapper">
-
+    <!-- 获得还款列表总数 -->
+    <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(id)
+        FROM repayment_management
+        WHERE
+        comp_id = #{compId}
+        and delete_flag = '0'
+    </select>
+    <!-- 获得还款管理列表 -->
+    <select id="getListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.RepaymentManagement">
+        SELECT
+        id,
+        comp_id as compId,
+        contract_no as contractNo,
+        repayment_ing_amount as repaymentIngAmount,
+        repayment_ed_amount as repaymentEdAmount,
+        repayment_date as repaymentDate,
+        repayment_screenshot as repaymentScreenshot,
+        operator,
+        create_date as createDate
+        FROM repayment_management
+        WHERE
+        comp_id = #{compId}
+        and delete_flag = '0'
+        ORDER BY create_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>

+ 4 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/TradeWarehouseReceiptApplMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.TradeWarehouseReceiptApplMapper">
 
 
-    <!-- 获得采购入库统计总数 -->
+    <!-- 获得贸易仓单总数 -->
     <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
         SELECT
         COUNT(id)
@@ -48,7 +48,7 @@
             )
         </if>
     </select>
-    <!-- 获得采购入库统计列表 -->
+    <!-- 获得贸易仓单列表 -->
     <select id="getListByCondition" parameterType="Map"
             resultType="com.yh.saas.plugin.yiliangyiyun.entity.TradeWarehouseReceiptAppl">
         SELECT
@@ -59,6 +59,8 @@
         bill_no as billNo,
         warehouse_no as warehouseNo,
         weight,
+        bank,
+        bank_id as bankId,
         unit_price as unitPrice,
         total_value as totalValue,
         payment_amount as paymentAmount,