zhangyuewww 3 лет назад
Родитель
Сommit
26d272cb32

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

@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * <p>
@@ -35,6 +36,13 @@ public class ContractManagementInfoController {
     public String addInfo(@RequestBody @Valid ContractManagementInfo contractManagementInfo) {
         return contractManagementInfoService.addInfo(contractManagementInfo);
     }
+    /**
+     * 查对应的合同
+     */
+    @GetMapping("/selectContract")
+    public List<ContractManagementInfo> selectContract(ContractManagementInfo contractManagementInfo) {
+        return contractManagementInfoService.selectContract(contractManagementInfo);
+    }
 
     /**
      * 编辑合同信息

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

@@ -58,6 +58,18 @@ public class ContractManagementInfo extends BaseModel<ContractManagementInfo> {
      * 交货方式(1我方自提2对方送货)
      */
     private String deliverType;
+    /**
+     * 类型(合同,补充协议)
+     */
+    private String agreementType;
+    /**
+     * 价格类型(定价销售,随行就市)
+     */
+    private String priceType;
+    /**
+     * 补充协议编号
+     */
+    private String agreementNo;
     /**
      * 运输方式
      */

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/exception/YExceptionEnum.java

@@ -12,6 +12,7 @@ public enum YExceptionEnum {
 
 	WAREHOSE_SYSTEM_ERROR("ERROR", "现有库存不为0,不可删除!"),
 	CONTRACT_NO_ERROR("ERROR", "合同编号已存在,不可重复!"),
+	AGREEMENT_NO_ERROR("ERROR", "补充协议已存在,不可重复!"),
 	WAREHOUSE_NO_ERROR("ERROR","仓库不存在"),
 	WAREHOUSE_NAME_ERROR("ERROR", "仓库名称已存在,不可重复!"),
 	POSITION_NO_ERROR("ERROR","库位不存在"),

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.service.IService;
 import com.baomidou.mybatisplus.plugins.Page;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * <p>
@@ -66,5 +67,11 @@ public interface IContractManagementInfoService extends IService<ContractManagem
      * @throws Exception
      */
     void export(ContractManagementInfo example, HttpServletResponse response) throws Exception;
+    /**
+     * 查对应的合同
+     *
+     * @param contractManagementInfo
+     */
+    List<ContractManagementInfo> selectContract(ContractManagementInfo contractManagementInfo);
 
 }

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

@@ -93,6 +93,17 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
         if (contractManagementInfos.size() > 0) {
             throw new YException(YExceptionEnum.CONTRACT_NO_ERROR);
         }
+        if (contractManagementInfo.getAgreementNo()!=null){
+            //判断补充协议编号是否唯一
+            List<ContractManagementInfo> contractManagementInfoList =
+                    contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
+                            .eq(ContractManagementInfo.QueryFiles.COMP_ID, AuthSecurityUtils.getCurrentUserInfo().getCompId())
+                            .eq(ContractManagementInfo.QueryFiles.CONTRACT_NO, contractManagementInfo.getAgreementNo())
+                            .eq(ContractManagementInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
+            if (contractManagementInfoList.size() > 0) {
+                throw new YException(YExceptionEnum.AGREEMENT_NO_ERROR);
+            }
+        }
         // 货物信息新增
         ContractGoodsInfo contractGoodsInfo = contractManagementInfo.getContractGoodsInfo();
         contractGoodsInfo.setId(IdGenerator.generateUUID());
@@ -480,6 +491,31 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
         return "NG";
     }
 
+    /**
+     * 查对应的合同
+     * @param contractManagementInfo
+     * @return
+     */
+    @Override
+    public List<ContractManagementInfo> selectContract(ContractManagementInfo contractManagementInfo) {
+        List<ContractManagementInfo> contractManagementInfoList=this.selectList(new EntityWrapper<ContractManagementInfo>()
+        .eq("agreement_type",contractManagementInfo.getAgreementType())
+        .eq("goods_type",contractManagementInfo.getGoodsType())
+        .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
+        .orderBy("update_date",false));
+        if (CollectionUtils.isNotEmpty(contractManagementInfoList)) {
+            for (ContractManagementInfo contractManagementInfo1 : contractManagementInfoList) {
+                //货物信息
+                ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, contractManagementInfo1.getId()));
+                //流程信息
+                ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, contractManagementInfo1.getId()));
+                contractManagementInfo1.setContractGoodsInfo(contractGoodsInfo);
+                contractManagementInfo1.setContractProcessInfo(contractProcessInfo);
+            }
+        }
+        return contractManagementInfoList;
+    }
+
     /**
      * 删除
      *