zyw 4 лет назад
Родитель
Сommit
1c59b22bd7

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

@@ -4,9 +4,18 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.yh.saas.plugin.yiliangyiyun.service.IContractManagementInfoService;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import com.winsea.svc.base.base.util.page.PageUtil;
+import com.winsea.svc.base.base.util.page.PageView;
+import com.yh.saas.common.support.plugin.PluginFeature;
+import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
+import com.yh.saas.plugin.yiliangyiyun.service.IContractManagementInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.baomidou.mybatisplus.plugins.Page;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -22,27 +31,62 @@ public class ContractManagementInfoController {
 
     @Autowired
     private IContractManagementInfoService contractManagementInfoService;
+
     /**
      * 新增合同信息
-     *
      */
     @PostMapping("/addInfo")
-    public String addInfo(@RequestBody ContractManagementInfo contractManagementInfo){
+    public String addInfo(@RequestBody ContractManagementInfo contractManagementInfo) {
         return contractManagementInfoService.addInfo(contractManagementInfo);
     }
+
     /**
      * 编辑合同信息
      */
     @PostMapping("/editInfo")
-    public String editInfo(@RequestBody ContractManagementInfo contractManagementInfo){
+    public String editInfo(@RequestBody ContractManagementInfo contractManagementInfo) {
         return contractManagementInfoService.editInfo(contractManagementInfo);
     }
+
     /**
      * 查看合同信息
      */
     @GetMapping("/getInfo")
-    public ContractManagementInfo getInfo(String id){
+    public ContractManagementInfo getInfo(String id) {
         return contractManagementInfoService.getInfo(id);
     }
+
+    /**
+     * 信息分页列表查询
+     *
+     * @param pageView
+     * @return
+     */
+    @GetMapping("/selectinfo")
+    public Page<ContractManagementInfo> selectinfo(@RequestBody PageView pageView) {
+        return contractManagementInfoService.selectInfo(pageView);
+    }
+
+    /**
+     * 更改状态
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/editStatus")
+    public String editStatus(String id) {
+        return contractManagementInfoService.editStatus(id);
+    }
+
+    /**
+     * 删除
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/deleteInfo")
+    public void deleteInfo(String id) {
+        contractManagementInfoService.deleteInfo(id);
+    }
 }
 

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

@@ -12,6 +12,7 @@ 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;
@@ -159,12 +160,58 @@ public class ContractManagementInfo extends BaseModel<ContractManagementInfo> {
      */
     private String remarks;
 
+    /**
+     * 货名
+     */
+    @TableField(exist = false)
+    private String goodsName;
+    /**
+     * 品级
+     */
+    @TableField(exist = false)
+    private String grade;
+
+
+    /**
+     * 已完成发运量(吨)
+     */
+    @TableField(exist = false)
+    private Float imperfectGrain;
+    /**
+     * 未收款
+     */
+    @TableField(exist = false)
+    private Float mildewGrain;
+    /**
+     * 模糊查询
+     */
+    @TableField(exist = false)
+    private Float searchKeyWord;
+    /**
+     * 开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @TableField(exist = false)
+    private Date startTime;
+    /**
+     * 结束时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @TableField(exist = false)
+    private Date endTime;
+    /**
+     * 查询类型
+     */
+    @TableField(exist = false)
+    private Float searchType;
+
     @TableField(exist = false)
     private ContractGoodsInfo contractGoodsInfo;
 
     @TableField(exist = false)
     private ContractProcessInfo contractProcessInfo;
 
+
     @Override
     protected Serializable pkVal() {
         return this.id;

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

@@ -1,8 +1,12 @@
 package com.yh.saas.plugin.yiliangyiyun.mapper;
 
+import com.winsea.svc.base.base.util.page.PageView;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 合同管理 Mapper 接口
@@ -13,4 +17,20 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  */
 public interface ContractManagementInfoMapper extends BaseMapper<ContractManagementInfo> {
 
+    /**
+     * 根据条件查询合同总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getCountByCondition(Map<String, Object> pageView);
+
+    /**
+     * 根据条件查询合同信息列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<ContractManagementInfo> getListByCondition(Map<String, Object> pageView);
+
 }

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

@@ -1,7 +1,12 @@
 package com.yh.saas.plugin.yiliangyiyun.service;
 
+import com.winsea.svc.base.base.util.page.PageView;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.baomidou.mybatisplus.service.IService;
+import com.baomidou.mybatisplus.plugins.Page;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -12,19 +17,48 @@ import com.baomidou.mybatisplus.service.IService;
  * @since 2021-05-17
  */
 public interface IContractManagementInfoService extends IService<ContractManagementInfo> {
-/**
- * 添加
- * @param contractManagementInfo
- */
-public String addInfo(ContractManagementInfo contractManagementInfo);
-/**
- * 编辑
- *@param contractManagementInfo
- */
-public String editInfo(ContractManagementInfo contractManagementInfo);
-/**
- *查看
- *@param
- */
-public ContractManagementInfo getInfo(String id);
+    /**
+     * 添加
+     *
+     * @param contractManagementInfo
+     */
+    public String addInfo(ContractManagementInfo contractManagementInfo);
+
+    /**
+     * 编辑
+     *
+     * @param contractManagementInfo
+     */
+    public String editInfo(ContractManagementInfo contractManagementInfo);
+
+    /**
+     * 查看
+     *
+     * @param
+     */
+    public ContractManagementInfo getInfo(String id);
+
+    /**
+     * 信息分页列表查询
+     *
+     * @param pageView
+     * @return
+     */
+    Page<ContractManagementInfo> selectInfo(PageView pageView);
+
+    /**
+     * 更改状态
+     *
+     * @param id
+     * @return
+     */
+    String editStatus(String id);
+
+    /**
+     * 删除
+     *
+     * @param id
+     */
+    void deleteInfo(String id);
+
 }

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

@@ -3,6 +3,10 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractGoodsInfo;
+import com.google.common.collect.Lists;
+import com.winsea.svc.base.base.util.page.PageView;
+import com.winsea.svc.base.security.entity.User;
+import com.winsea.svc.base.security.util.AuthSecurityUtils;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractProcessInfo;
 import com.yh.saas.plugin.yiliangyiyun.mapper.ContractManagementInfoMapper;
@@ -12,8 +16,14 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.yh.saas.plugin.yiliangyiyun.service.IContractProcessInfoService;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.xmlbeans.impl.xb.xsdschema.Public;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.baomidou.mybatisplus.plugins.Page;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
+
 /**
  * <p>
  * 合同管理 服务实现类
@@ -85,15 +95,71 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
      * @param id
      * @return
      */
-    public ContractManagementInfo getInfo(String id){
+    public ContractManagementInfo getInfo(String id) {
         // 主表信息
         ContractManagementInfo contractManagementInfo = this.selectById(id);
         //货物信息
-        ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>().eq("contract_id",id));
+        ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>().eq("contract_id", id));
         //流程信息
-        ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq("contract_id",id));
+        ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq("contract_id", id));
         contractManagementInfo.setContractGoodsInfo(contractGoodsInfo);
         contractManagementInfo.setContractProcessInfo(contractProcessInfo);
         return contractManagementInfo;
     }
+
+    @Override
+    public Page<ContractManagementInfo> selectInfo(PageView pageView) {
+        // 状态类型(1未完成2已完成3待回款)
+        pageView.put("startRecord", (Integer.parseInt((String) pageView.get("currentPage")) - 1)
+                * Integer.parseInt((String) pageView.get("pageSize")));
+        // 公司ID
+        pageView.put("compId", AuthSecurityUtils.getCurrentUserInfo().getCompId());
+        // 查询服务商总数
+        Integer dataCount = baseMapper.getCountByCondition(pageView);
+        List<ContractManagementInfo> dataList = baseMapper.getListByCondition(pageView);
+        Page<ContractManagementInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(pageView.getCurrentPage());
+        page.setSize(pageView.getPageSize());
+
+        return page;
+    }
+
+
+    /**
+     *  更改状态
+     * @param id
+     * @return
+     */
+    @Override
+    public String editStatus(String id) {
+        // 查询合同信息
+        ContractManagementInfo contractManagementInfo = this.selectById(id);
+        if (contractManagementInfo != null) {
+            if (StatusEnum.CONTRACT_DO.getFlag().equals(contractManagementInfo.getStatusFlag())) {
+                contractManagementInfo.setStatusFlag(StatusEnum.CONTRACT_COMPLETED.getFlag());
+                contractManagementInfo.setStatus(StatusEnum.CONTRACT_COMPLETED.getName());
+            }
+            else{
+                contractManagementInfo.setStatusFlag(StatusEnum.CONTRACT_DO.getFlag());
+                contractManagementInfo.setStatus(StatusEnum.CONTRACT_DO.getName());
+            }
+            this.updateById(contractManagementInfo);
+            return "OK";
+        }
+        return "NG";
+    }
+
+    /**
+     *  删除
+     * @param id
+     */
+    @Override
+    public void deleteInfo(String id){
+        ContractManagementInfo contractManagementInfo = this.selectById(id);
+        if (contractManagementInfo != null) {
+            this.deleteById(contractManagementInfo.getId());
+        }
+    }
 }

+ 86 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ContractManagementInfoMapper.xml

@@ -1,5 +1,91 @@
 <?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.ContractManagementInfoMapper">
+    <!-- 获得合同总数 -->
+    <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(1)
+        FROM contract_management_info m
+        left join contract_goods_info g on m.contract_id=g.id
+        left join contract_process_info p on m.contract_id=p.id
+        WHERE
+        m.comp_id = #{compId}
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND m.status_flag == '1'
+            </if>
+            <if test="searchType == 2">
+                AND m.status_flag == '3'
+            </if>
+            <if test="searchType == 3">
+                AND p.mildew_grain != 0
+            </if>
 
+        </if>
+        <if test="startTime != null and startTime != ''">
+            AND DATE_FORMAT(m.signing_date,"%Y%m%d") ge
+            DATE_FORMAT(#{startTime},"%Y%m%d")
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND DATE_FORMAT(m.signing_date,"%Y%m%d") le
+            DATE_FORMAT(#{endTime},"%Y%m%d")
+        </if>
+        <if test="searchType != null and searchType != ''">
+            AND m.contract_id LIKE #{contractId}
+            OR m.buyer LIKE #{buyer}
+            OR m.seller LIKE #{seller}
+        </if>
+    </select>
+    <!-- 合同列表查询 -->
+    <select id="getListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo">
+        SELECT
+        m.contract_id as contractId,
+        g.goods_name as goodsName,
+        g.grade as grade,
+        m.weight,
+        m.unit_contract_price as unitContractPrice,
+        m.packing_method as packingMethod,
+        m.buyer,
+        m.seller,
+        p.imperfect_grain as imperfectGrain,
+        m.status,
+        m.signing_date as signingDate,
+        p.mildew_grain as mildewGrain,
+        m.address_url as addressUrl
+        FROM contract_management_info m
+        left join contract_goods_info g on m.contract_id=g.id
+        left join contract_process_info p on m.contract_id=p.id
+        WHERE
+        m.comp_id = #{compId}
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND m.status_flag == '1'
+            </if>
+            <if test="searchType == 2">
+                AND m.status_flag == '3'
+            </if>
+            <if test="searchType == 3">
+                AND p.mildew_grain != 0
+            </if>
+
+        </if>
+        <if test="startTime != null and startTime != ''">
+            AND DATE_FORMAT(m.signing_date,"%Y%m%d") ge
+            DATE_FORMAT(#{startTime},"%Y%m%d")
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND DATE_FORMAT(m.signing_date,"%Y%m%d") le
+            DATE_FORMAT(#{endTime},"%Y%m%d")
+        </if>
+        <if test="searchType != null and searchType != ''">
+            AND m.contract_id LIKE #{contractId}
+            OR m.buyer LIKE #{buyer}
+            OR m.seller LIKE #{seller}
+        </if>
+        ORDER BY m.signing_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>

+ 2 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ContractProcessInfoMapper.xml

@@ -2,4 +2,6 @@
 <!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.ContractProcessInfoMapper">
 
+
+
 </mapper>