zhangyuewww hace 2 años
padre
commit
86783bbacc

+ 8 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ContractManagementInfoController.java

@@ -45,6 +45,14 @@ public class ContractManagementInfoController {
         return contractManagementInfoService.selectContract(contractManagementInfo);
     }
 
+    /**
+     * 全部合同号下拉
+     */
+    @GetMapping("/selectContractAll")
+    public List<ContractManagementInfo> selectContractAll(ContractManagementInfo contractManagementInfo) {
+        return contractManagementInfoService.selectContractAll(contractManagementInfo);
+    }
+
     /**
      * 编辑合同信息
      */

+ 17 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ExpenseInfoController.java

@@ -141,6 +141,23 @@ public class ExpenseInfoController {
     public Integer expenseCount(ExpenseInfo expenseInfo){
         return expenseInfoService.expenseCount(expenseInfo);
     }
+    /**
+     * 保证金列表查询
+     *
+     * @param expenseInfo
+     * @return
+     */
+    @GetMapping("/selectBondInfo")
+    public Page<ExpenseInfo> selectBondInfo(ExpenseInfo expenseInfo) {
+        return expenseInfoService.selectBondInfo(expenseInfo);
+    }
+    /**
+     * 抵粮款
+     */
+    @PostMapping("/api/foodAllowance")
+    public String foodAllowance(@RequestBody @Valid ExpenseInfo expenseInfo) {
+        return expenseInfoService.foodAllowance(expenseInfo);
+    }
 
 }
 

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

@@ -49,6 +49,10 @@ public class ExpenseInfo extends BaseModel<ExpenseInfo> {
      * 公司id
      */
     private String compId;
+    /**
+     * 关联id
+     */
+    private String relationId;
     /**
      * 费用编号
      */
@@ -354,6 +358,16 @@ public class ExpenseInfo extends BaseModel<ExpenseInfo> {
      */
     @TableField(exist = false)
     private String unallocatedNumber;
+    /**
+     * 客户
+     */
+    @TableField(exist = false)
+    private String customer;
+    /**
+     * 合同类型(1销售2采购3收购)
+     */
+    @TableField(exist = false)
+    private String contractType;
 
 
     @Override

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

@@ -45,4 +45,19 @@ public interface ExpenseInfoMapper extends BaseMapper<ExpenseInfo> {
      * @return
      */
     List<ExpenseInfo> getExpenseListByCondition(Map<String, Object> pageView);
+    /**
+     * 根据条件查询保证金总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getBondCountByCondition(Map<String, Object> pageView);
+
+    /**
+     * 根据条件查询保证金列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<ExpenseInfo> getBondListByCondition(Map<String, Object> pageView);
 }

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

@@ -94,6 +94,12 @@ public interface IContractManagementInfoService extends IService<ContractManagem
      * @param contractManagementInfo
      */
     List<ContractManagementInfo> selectContract(ContractManagementInfo contractManagementInfo);
+    /**
+     * 全部合同号下拉
+     *
+     * @param contractManagementInfo
+     */
+    List<ContractManagementInfo> selectContractAll(ContractManagementInfo contractManagementInfo);
     /**
      * 导出代收合同
      * @param example

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

@@ -95,4 +95,17 @@ public interface IExpenseInfoService extends IService<ExpenseInfo> {
      * @param expenseInfo
      */
     Integer expenseCount(ExpenseInfo expenseInfo);
+    /**
+     * 保证金列表查询
+     *
+     * @param expenseInfo
+     * @return
+     */
+    Page<ExpenseInfo> selectBondInfo(ExpenseInfo expenseInfo);
+    /**
+     * 抵粮款
+     *
+     * @param expenseInfo
+     */
+    String foodAllowance(ExpenseInfo expenseInfo);
 }

+ 8 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ContractManagementInfoServiceImpl.java

@@ -1175,6 +1175,14 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
         return contractManagementInfoList;
     }
 
+    @Override
+    public List<ContractManagementInfo> selectContractAll(ContractManagementInfo contractManagementInfo) {
+        List<ContractManagementInfo> contractManagementInfoList=this.selectList(new EntityWrapper<ContractManagementInfo>()
+                .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
+                .orderBy("update_date",false));
+        return contractManagementInfoList;
+    }
+
     @Override
     public void exportCollection(ContractManagementInfo example, HttpServletResponse response) throws Exception {
 

+ 118 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java

@@ -687,6 +687,18 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
             expenseInfo.setStatusFlag(StatusEnum.REJECTED.getFlag());
             expenseInfo.setStatus(StatusEnum.REJECTED.getName());
         }
+        //确认保证金抵粮款
+        else if ("7".equals(expenseInfo.getFlag())) {
+            List<ExpenseInfo> expenseInfoList=this.selectList(new EntityWrapper<ExpenseInfo>()
+            .eq("relation_id",expenseInfo1.getRelationId()));
+            if (!CollectionUtils.isEmpty(expenseInfoList)){
+                for (ExpenseInfo expenseInfo2:expenseInfoList){
+                    expenseInfo2.setStatusFlag(StatusEnum.COMPLETED.getFlag());
+                    expenseInfo2.setStatus(StatusEnum.COMPLETED.getName());
+                    this.updateById(expenseInfo2);
+                }
+            }
+        }
         // 主表信息编辑
         this.updateById(expenseInfo);
         if (flag == 1) {
@@ -1188,6 +1200,112 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
         return count;
     }
 
+    @Override
+    public Page<ExpenseInfo> selectBondInfo(ExpenseInfo expenseInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (expenseInfo.getCurrentPage() - 1)
+                * expenseInfo.getPageSize());
+        pageView.put("searchKeyWord", expenseInfo.getSearchKeyWord());
+        pageView.put("searchType", expenseInfo.getSearchType());
+        pageView.put("contractType", expenseInfo.getContractType());
+        pageView.put("pageSize", expenseInfo.getPageSize());
+        pageView.put("currentPage", expenseInfo.getCurrentPage());
+        pageView.put("contractNo", expenseInfo.getContractNo());
+        // 查询总数
+        Integer dataCount = baseMapper.getBondCountByCondition(pageView);
+        List<ExpenseInfo> dataList = baseMapper.getBondListByCondition(pageView);
+        Page<ExpenseInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(expenseInfo.getCurrentPage());
+        page.setSize(expenseInfo.getPageSize());
+        return page;
+    }
+
+    @Override
+    public String foodAllowance(ExpenseInfo expenseInfo) {
+        String relationId=IdGenerator.generateUUID();
+        //生成抵粮款的费用信息
+        ExpenseInfo expenseInfo1=new ExpenseInfo();
+        expenseInfo1.setId(IdGenerator.generateUUID());
+        expenseInfo1.setRelationId(relationId);
+        expenseInfo1.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
+        expenseInfo1.setAmountMoney(expenseInfo.getAmountMoney());
+        expenseInfo1.setExpensesType("2");
+        expenseInfo1.setExpenseName("保证金抵粮款");
+        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
+        Integer num=this.expenseCount(expenseInfo1)+1;
+        String newNo="";
+        //一位数
+        if (num < 10) {
+            newNo="000" + num;
+        }
+        //两位数
+        else if (num < 100) {
+            newNo="00" + num;
+        }
+        //三位数
+        else if (num < 1000) {
+            newNo="0" + num;
+        }
+        //四位数
+        else if (num < 10000) {
+            newNo=String.valueOf(num);
+        }
+        String no = "HTF"+df.format(new Date())+newNo;
+        expenseInfo1.setCostNo(no);
+        expenseInfo1.setStatusFlag(StatusEnum.TO_BE_CONFIRMED.getFlag());
+        expenseInfo1.setStatus(StatusEnum.TO_BE_CONFIRMED.getName());
+        expenseInfo1.setExpensesPurpose("1");
+        expenseInfo1.setCostType("5");
+        expenseInfo1.setContractNo(expenseInfo.getContractNo());
+        expenseInfo1.setAgent(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffName());
+        expenseInfo1.setUnallocatedAmount(0d);
+        boolean one =this.insert(expenseInfo1);
+        ExpenseInfo expenseInfo2=new ExpenseInfo();
+        expenseInfo2.setId(IdGenerator.generateUUID());
+        expenseInfo2.setRelationId(relationId);
+        expenseInfo2.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
+        expenseInfo2.setAmountMoney(expenseInfo.getAmountMoney());
+        expenseInfo2.setExpensesType("1");
+        expenseInfo2.setExpenseName("保证金抵粮款");
+        SimpleDateFormat df1 = new SimpleDateFormat("yyyyMMddHHmmss");
+        Integer num1=this.expenseCount(expenseInfo2)+1;
+        String newNo1="";
+        //一位数
+        if (num < 10) {
+            newNo1="000" + num1;
+        }
+        //两位数
+        else if (num < 100) {
+            newNo1="00" + num1;
+        }
+        //三位数
+        else if (num < 1000) {
+            newNo1="0" + num1;
+        }
+        //四位数
+        else if (num < 10000) {
+            newNo1=String.valueOf(num1);
+        }
+        String no1 = "HTF"+df1.format(new Date())+newNo1;
+        expenseInfo2.setCostNo(no1);
+        expenseInfo2.setStatusFlag(StatusEnum.TO_BE_CONFIRMED.getFlag());
+        expenseInfo2.setStatus(StatusEnum.TO_BE_CONFIRMED.getName());
+        expenseInfo2.setExpensesPurpose("1");
+        expenseInfo2.setCostType("1");
+        expenseInfo2.setContractNo(expenseInfo.getContractNo());
+        expenseInfo2.setAgent(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffName());
+        expenseInfo2.setUnallocatedAmount(0d);
+        boolean two =this.insert(expenseInfo2);
+        // 假如 都成功返回ok
+        if (one && two) {
+            return "OK";
+        } else {
+            return "NG";
+        }
+    }
+
     private String addDateOneDay(Date date) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));

+ 36 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehousingOrderServiceImpl.java

@@ -967,6 +967,42 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectById(warehousingOrder.getContractId());
                 contractManagementInfo.setAllocatedMargin(contractManagementInfo.getAllocatedMargin() + warehousingOrder.getMoney());
                 contractManagementInfoService.updateById(contractManagementInfo);
+                //生成保证金分配费用信息
+                ExpenseInfo expenseInfo=new ExpenseInfo();
+                expenseInfo.setId(IdGenerator.generateUUID());
+                expenseInfo.setCompId(warehousingOrder1.getCompId());
+                expenseInfo.setAmountMoney(warehousingOrder.getMoney());
+                expenseInfo.setExpensesType("2");
+                expenseInfo.setExpenseName("保证金分配");
+                SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
+                Integer num=expenseInfoService.expenseCount(expenseInfo)+1;
+                String newNo="";
+                //一位数
+                if (num < 10) {
+                    newNo="000" + num;
+                }
+                //两位数
+                else if (num < 100) {
+                    newNo="00" + num;
+                }
+                //三位数
+                else if (num < 1000) {
+                    newNo="0" + num;
+                }
+                //四位数
+                else if (num < 10000) {
+                    newNo=String.valueOf(num);
+                }
+                String no = "HTF"+df.format(new Date())+newNo;
+                expenseInfo.setCostNo(no);
+                expenseInfo.setStatusFlag(StatusEnum.COMPLETED.getFlag());
+                expenseInfo.setStatus(StatusEnum.COMPLETED.getName());
+                expenseInfo.setExpensesPurpose("1");
+                expenseInfo.setCostType("5");
+                expenseInfo.setContractNo(warehousingOrder1.getContractNo());
+                expenseInfo.setAgent(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffName());
+                expenseInfo.setUnallocatedAmount(0d);
+                expenseInfoService.insert(expenseInfo);
                 // 先删除任务
                 noticeService.removeNotice(BaseNotice.NoticeStatus.TASK, "WAREHOUSING-ORDER-APPROVE",
                         warehousingOrder1.getId(), null);

+ 94 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ExpenseInfoMapper.xml

@@ -344,4 +344,98 @@
             DATE_FORMAT(#{endDate},"%Y%m%d"))
         </if>
     </select>
+    <select id="getBondCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+            COUNT(ei.id)
+        FROM expense_info ei
+        LEFT JOIN contract_management_info cmi on cmi.contract_no=ei.contract_no and cmi.comp_id=ei.comp_id and cmi.delete_flag='0'
+        WHERE
+        ei.delete_flag = '0'
+        and ei.cost_type='5'
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND ei.expenses_type = '1'
+            </if>
+            <if test="searchType == 2">
+                AND ei.expenses_type = '2'
+            </if>
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(cmi.seller) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(cmi.seller) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="contractType != null and contractType != ''">
+            <if test="contractType == 1">
+                AND cmi.agreement_type = '采购合同'
+            </if>
+            <if test="contractType == 2">
+                AND cmi.agreement_type = '销售合同'
+            </if>
+            <if test="contractType == 3">
+                AND cmi.agreement_type = '收购合同'
+            </if>
+            <if test="contractType == 4">
+                AND cmi.agreement_type = '代收合同'
+            </if>
+            <if test="contractType == 5">
+                AND cmi.agreement_type = '代储合同'
+            </if>
+        </if>
+        <if test="contractNo != null and contractNo != ''">
+            AND cmi.contract_no = #{contractNo}
+        </if>
+    </select>
+    <select id="getBondListByCondition" parameterType="Map" resultType="com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo">
+        SELECT
+        ei.id,
+        ei.expenses_type as expensesType,
+        ei.contract_no as contractNo,
+        cmi.contract_type as contractType,
+        case when cmi.contract_type = '1' then cmi.buyer else cmi.seller end as customer,
+        ei.amount_money as amountMoney,
+        ei.expense_name as expenseName,
+        ei.agent,
+        ei.create_date as createDate
+        FROM expense_info ei
+        LEFT JOIN contract_management_info cmi on cmi.contract_no=ei.contract_no and cmi.comp_id=ei.comp_id and cmi.delete_flag='0'
+        WHERE
+        ei.delete_flag = '0'
+        and ei.cost_type='5'
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND ei.expenses_type = '1'
+            </if>
+            <if test="searchType == 2">
+                AND ei.expenses_type = '2'
+            </if>
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(cmi.seller) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(cmi.seller) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="contractType != null and contractType != ''">
+            <if test="contractType == 1">
+                AND cmi.agreement_type = '采购合同'
+            </if>
+            <if test="contractType == 2">
+                AND cmi.agreement_type = '销售合同'
+            </if>
+            <if test="contractType == 3">
+                AND cmi.agreement_type = '收购合同'
+            </if>
+            <if test="contractType == 4">
+                AND cmi.agreement_type = '代收合同'
+            </if>
+            <if test="contractType == 5">
+                AND cmi.agreement_type = '代储合同'
+            </if>
+        </if>
+        <if test="contractNo != null and contractNo != ''">
+            AND cmi.contract_no = #{contractNo}
+        </if>
+        ORDER BY ei.update_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/FuelFillingInfoMapper.xml

@@ -135,6 +135,7 @@
         ff.approve_status as approveStatus,
         ff.create_date as createDate,
         ff.origin_area as originArea,
+        ff.stroke_type as strokeType,
         ff.origin_longitude as originLongitude,
         ff.origin_latitude as originLatitude,
         ff.destination_province as destinationProvince,