Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

caozj 1 rok temu
rodzic
commit
1d07e496d6

+ 8 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/vo/AccountManagementVo.java

@@ -1,9 +1,12 @@
 package com.fjhx.account.entity.account.vo;
 
 import com.fjhx.account.entity.account.po.AccountManagement;
+import com.fjhx.account.entity.account.po.AccountRemainder;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * 账户-管理表列表查询返回值实体
  *
@@ -19,4 +22,9 @@ public class AccountManagementVo extends AccountManagement {
      */
     private String corporationName;
 
+    /**
+     * 余额列表
+     */
+    private List<AccountRemainder> accountRemainderList;
+
 }

+ 30 - 17
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountManagementServiceImpl.java

@@ -77,10 +77,23 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         }
         Page<AccountManagementVo> page = baseMapper.getPage(dto.getPage(), wrapper);
         List<AccountManagementVo> records = page.getRecords();
+
+        if (ObjectUtil.isEmpty(records)) {
+            return page;
+        }
+        List<Long> accountManagementIds = records.stream().map(AccountManagement::getId).distinct().collect(Collectors.toList());
+
         //赋值归属公司名称
         corporationService.attributeAssign(records, AccountManagementVo::getCorporationId, (item, corporation) -> {
             item.setCorporationName(corporation.getName());
         });
+        //赋值币种余额列表
+        Map<Long, List<AccountRemainder>> accountRemainderMap = accountRemainderService.mapKGroup(AccountRemainder::getAccountManagementId, q -> q
+                .select(AccountRemainder::getCurrency, AccountRemainder::getRemainder, AccountRemainder::getAccountManagementId)
+                .in(AccountRemainder::getAccountManagementId, accountManagementIds)
+        );
+        records.forEach(item -> item.setAccountRemainderList(accountRemainderMap.get(item.getId())));
+
         return page;
     }
 
@@ -113,7 +126,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         //判断账户的别名是否已存在
         List<AccountManagement> accountManagements = this.list(Wrappers.<AccountManagement>lambdaQuery()
                 .eq(AccountManagement::getAlias, accountManagementDto.getAlias()));
-        if (accountManagements.size()>0){
+        if (accountManagements.size() > 0) {
             throw new ServiceException("数据错误:账户别名已存在请重新创建");
         }
         //添加账户管理表的信息
@@ -132,15 +145,15 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         //判断账户的别名是否已存在
         List<AccountManagement> accountManagements = this.list(Wrappers.<AccountManagement>lambdaQuery()
                 .eq(AccountManagement::getAlias, accountManagementDto.getAlias()));
-        if (accountManagements.size()>1){
+        if (accountManagements.size() > 1) {
             throw new ServiceException("数据错误:账户别名已存在请重新创建");
         }
         //删除账户-余额表的信息
         List<AccountRemainder> accountRemainderList = accountManagementDto.getAccountRemainderList();
         List<Long> ids = accountRemainderList.stream().map(accountRemainder -> accountRemainder.getId()).collect(Collectors.toList());
         accountRemainderService.remove(Wrappers.<AccountRemainder>lambdaQuery()
-                .eq(AccountRemainder::getAccountManagementId,accountManagementDto.getId())
-                .notIn(AccountRemainder::getId,ids)
+                .eq(AccountRemainder::getAccountManagementId, accountManagementDto.getId())
+                .notIn(AccountRemainder::getId, ids)
         );
         //添加账户余额表的信息
         saveAccountRemainder(accountManagementDto);
@@ -156,21 +169,21 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         List<AccountRunningWater> accountRunningWaterList = accountRunningWaterService.list(Wrappers.<AccountRunningWater>lambdaQuery()
                 .eq(AccountRunningWater::getAccountManagementId, id));
         //如果存在流水表的数据则不能删除账户表的信息
-        if (accountRunningWaterList.size()>0){
+        if (accountRunningWaterList.size() > 0) {
             throw new ServiceException("无法删除,该账户已存在流水数据");
         }
         //删除账户-管理表的信息
         this.removeById(id);
         //删除账户-余额表的信息
         accountRemainderService.remove(Wrappers.<AccountRemainder>lambdaQuery()
-                .eq(AccountRemainder::getAccountManagementId,id));
+                .eq(AccountRemainder::getAccountManagementId, id));
     }
 
     /**
      * 账户统计(账户列表)
      */
     @Override
-    public  List<Map<String, Object>> managementStatistics(AccountManagementSelectDto dto) {
+    public List<Map<String, Object>> managementStatistics(AccountManagementSelectDto dto) {
         //存放账户统计数据
         List<Map<String, Object>> list = new ArrayList<>();
 
@@ -185,24 +198,24 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         List<DictTenantDataVo> dictTenantDataVos = getDict("customer_source");
         DynamicDataSourceContextHolder.poll();
 
-        if (dictTenantDataVos.size()==0){
+        if (dictTenantDataVos.size() == 0) {
             throw new ServiceException("数据有误:没有配置币种字典,请先配置");
         }
 
         //赋值
         for (DictTenantDataVo dictTenantDataVo : dictTenantDataVos) {
             //赋初始值信息
-            Map<String,Object> map = new HashMap<>();
-            map.put("currencyKey",dictTenantDataVo.getDictKey());
-            map.put("currencyValue",dictTenantDataVo.getDictValue());
-            map.put("remainder",new BigDecimal(0));
+            Map<String, Object> map = new HashMap<>();
+            map.put("currencyKey", dictTenantDataVo.getDictKey());
+            map.put("currencyValue", dictTenantDataVo.getDictValue());
+            map.put("remainder", new BigDecimal(0));
             //赋值余额信息
-            if (accountRemainderList.size()>0){
+            if (accountRemainderList.size() > 0) {
                 Map<String, List<AccountRemainder>> accountRemainderMap = accountRemainderList.stream()
                         .collect(Collectors.groupingBy(AccountRemainder::getCurrency));
                 List<AccountRemainder> accountRemainderList1 = accountRemainderMap.get(dictTenantDataVo.getDictKey());
-                if (ObjectUtil.isNotEmpty(accountRemainderList1)){
-                    map.put("remainder",accountRemainderList1.get(0).getRemainder());
+                if (ObjectUtil.isNotEmpty(accountRemainderList1)) {
+                    map.put("remainder", accountRemainderList1.get(0).getRemainder());
                 }
             }
             list.add(map);
@@ -212,7 +225,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
     }
 
     //根据字典编码获取字典的数据
-    private List<DictTenantDataVo> getDict(String code){
+    private List<DictTenantDataVo> getDict(String code) {
         DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
         dto.setDictCode(code);
         return dictTenantDataService.getList(dto);
@@ -319,7 +332,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
     /**
      * 添加账户-余额表的信息
      */
-    private void saveAccountRemainder(AccountManagementDto accountManagementDto){
+    private void saveAccountRemainder(AccountManagementDto accountManagementDto) {
         List<AccountRemainder> accountRemainderList = accountManagementDto.getAccountRemainderList();
         accountRemainderList.forEach(accountRemainder -> {
             accountRemainder.setAccountManagementId(accountManagementDto.getId());

+ 10 - 4
hx-sale/src/main/java/com/fjhx/sale/service/contract/ContractService.java

@@ -82,6 +82,7 @@ public interface ContractService extends BaseService<Contract> {
 
     /**
      * 根据客户ID查询未包装的订单
+     *
      * @param customerId
      * @return
      */
@@ -99,18 +100,21 @@ public interface ContractService extends BaseService<Contract> {
 
     /**
      * 查询销售额(合同总金额)
+     *
      * @param id(买方公司ID)
      */
-    ContractVo  getSalesTotal(Long id);
+    ContractVo getSalesTotal(Long id);
 
     /**
      * 查询指定客户的每月合同总额
+     *
      * @param dto
      */
     List<ContractVo> getAmount(CustomerDto dto);
 
     /**
      * 查询成交单统计(合同)
+     *
      * @param query
      * @return
      */
@@ -118,6 +122,7 @@ public interface ContractService extends BaseService<Contract> {
 
     /**
      * 销售趋势(数据看板-产品分析页面)
+     *
      * @param productInfoDto
      */
     List<Map<String, Object>> saleTrend(ProductInfoSelectDto productInfoDto);
@@ -125,7 +130,7 @@ public interface ContractService extends BaseService<Contract> {
     /**
      * 销售统计(数据看板-销售分析页面开发)
      */
-    Map<String, Object>  salesStatistics(ContractDto dto);
+    Map<String, Object> salesStatistics(ContractDto dto);
 
     /**
      * 国家销售统计(数据看板-销售分析页面开发)
@@ -204,10 +209,11 @@ public interface ContractService extends BaseService<Contract> {
 
     /**
      * 中间合同打印PDF获取合同相关数据
+     *
      * @param newContractId 最新一条单证合同ID
-     * @param contractIds 所有单证合同ID集合
+     * @param contractIds   所有单证合同ID集合
      * @return
      */
-    Map<String,Object> getDocumentaryPdf(Long newContractId,List<Long> contractIds);
+    Map<String, Object> getDocumentaryPdf(Long newContractId, List<Long> contractIds);
 
 }

+ 58 - 48
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -13,10 +13,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.account.controller.utils.DateUtils;
-import com.fjhx.account.entity.account.po.AccountRunningWater;
 import com.fjhx.account.entity.account.vo.AccountRequestFundsDetailVo;
 import com.fjhx.account.entity.account.vo.AccountRunningWaterVo;
-import com.fjhx.account.entity.tax.po.TaxRefundDetails;
 import com.fjhx.account.service.account.AccountManagementService;
 import com.fjhx.account.service.account.AccountRequestFundsDetailService;
 import com.fjhx.account.service.tax.TaxRefundDetailsService;
@@ -42,8 +40,6 @@ import com.fjhx.flow.service.flow.FlowExampleService;
 import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.purchase.entity.arrival.po.ArrivalDetail;
-import com.fjhx.purchase.entity.pay.po.Pay;
-import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
 import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
 import com.fjhx.purchase.entity.purchase.vo.PurchaseDetailVo;
@@ -68,7 +64,6 @@ import com.fjhx.sale.entity.contract.vo.*;
 import com.fjhx.sale.entity.purchase.vo.EhsdPurchaseProductVo;
 import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
 import com.fjhx.sale.entity.statement.dto.ProfitSettlementDto;
-import com.fjhx.sale.entity.statement.vo.ProfitSettlementVo;
 import com.fjhx.sale.mapper.contract.ContractMapper;
 import com.fjhx.sale.service.claim.ClaimContractService;
 import com.fjhx.sale.service.contract.ContractProductService;
@@ -81,7 +76,6 @@ import com.fjhx.sale.service.statement.SaleStatementService;
 import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
 import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
 import com.fjhx.tenant.service.dict.DictTenantDataService;
-import com.github.pagehelper.util.StringUtil;
 import com.ruoyi.common.core.domain.BaseIdPo;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.core.domain.BaseSelectDto;
@@ -197,6 +191,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     @Autowired
     private SaleStatementService saleStatementService;
+
     /**
      * 分页
      *
@@ -220,6 +215,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     /**
      * 利润结算表分页
+     *
      * @param dto
      * @return
      */
@@ -230,34 +226,35 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         wrapper.orderByDesc("t1", Contract::getCreateTime);
         wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
-        if(ObjectUtil.isNotEmpty(dto.getSettlementStatus())){
-            wrapper.eq( "t1",Contract::getSettlementStatus, dto.getSettlementStatus());
+        if (ObjectUtil.isNotEmpty(dto.getSettlementStatus())) {
+            wrapper.eq("t1", Contract::getSettlementStatus, dto.getSettlementStatus());
         }
-        if(ObjectUtil.isNotEmpty(dto.getUserId())){
-            wrapper.eq( "t1",Contract::getCreateUser, dto.getUserId());
+        if (ObjectUtil.isNotEmpty(dto.getUserId())) {
+            wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
         }
         if (StringUtils.isNotEmpty(dto.getKeyword())) {
             wrapper.keyword(dto.getKeyword(), new SqlField("t1", Contract::getCode));
         }
-        if(StringUtils.isNotEmpty(dto.getIsArrival())){
-            if(StringUtils.equals(dto.getIsArrival(),"1")){//已到账----//预付比例等于0||到账认领金额 >= 合同金额 * 预付比例%
+        if (StringUtils.isNotEmpty(dto.getIsArrival())) {
+            if (StringUtils.equals(dto.getIsArrival(), "1")) {//已到账----//预付比例等于0||到账认领金额 >= 合同金额 * 预付比例%
                 wrapper.and(c -> {
                     c.eq(Contract::getAdvanceRatio, "0").or();
                     c.eq("t1.refundStatusNew", 20);
                 });
 
-            }else{
-                wrapper.ne("t1",Contract::getAdvanceRatio,"0");
-                wrapper.ne("t1.refundStatusNew",20);
+            } else {
+                wrapper.ne("t1", Contract::getAdvanceRatio, "0");
+                wrapper.ne("t1.refundStatusNew", 20);
             }
         }
-        Page<ContractVo> page = baseMapper.getProfitSettlement(dto.getPage(),wrapper);
+        Page<ContractVo> page = baseMapper.getProfitSettlement(dto.getPage(), wrapper);
 
         return page;
     }
 
     /**
      * 利润结算表分页
+     *
      * @param dto
      * @return
      */
@@ -267,24 +264,24 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         wrapper.orderByDesc("t1", Contract::getCreateTime);
         wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
-        if(ObjectUtil.isNotEmpty(dto.getSettlementStatus())){
-            wrapper.eq( "t1",Contract::getSettlementStatus, dto.getSettlementStatus());
+        if (ObjectUtil.isNotEmpty(dto.getSettlementStatus())) {
+            wrapper.eq("t1", Contract::getSettlementStatus, dto.getSettlementStatus());
         }
-        if(ObjectUtil.isNotEmpty(dto.getUserId())){
-            wrapper.eq( "t1",Contract::getCreateUser, dto.getUserId());
+        if (ObjectUtil.isNotEmpty(dto.getUserId())) {
+            wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
         }
         if (StringUtils.isNotEmpty(dto.getKeyword())) {
             wrapper.keyword(dto.getKeyword(), new SqlField("t1", Contract::getCode));
         }
-        if(StringUtils.isNotEmpty(dto.getIsArrival())){
-            if(StringUtils.equals(dto.getIsArrival(),"1")){//已到账----//预付比例等于0||到账认领金额 >= 合同金额 * 预付比例%
+        if (StringUtils.isNotEmpty(dto.getIsArrival())) {
+            if (StringUtils.equals(dto.getIsArrival(), "1")) {//已到账----//预付比例等于0||到账认领金额 >= 合同金额 * 预付比例%
                 wrapper.and(c -> {
                     c.eq(Contract::getAdvanceRatio, "0").or();
                     c.eq("t1.refundStatusNew", 20);
                 });
-            }else{
-                wrapper.ne("t1",Contract::getAdvanceRatio,"0");
-                wrapper.ne("t1.refundStatusNew",20);
+            } else {
+                wrapper.ne("t1", Contract::getAdvanceRatio, "0");
+                wrapper.ne("t1.refundStatusNew", 20);
             }
         }
         List<ContractVo> list = baseMapper.getProfitSettlementHead(wrapper);
@@ -307,7 +304,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     private Page<ContractVo> pageCommon(ContractSelectDto dto, IWrapper<Contract> wrapper) {
         wrapper.orderByDesc("t1", Contract::getCreateTime);
         wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
-        wrapper.ne("t1",Contract::getIsShow,1);
+        wrapper.ne("t1", Contract::getIsShow, 1);
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
         if (StringUtils.isNotEmpty(dto.getStatus())) {
             wrapper.eq("t1", Contract::getStatus, dto.getStatus());
@@ -580,6 +577,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     /**
      * 合同明细
+     *
      * @param id
      * @return
      */
@@ -616,12 +614,21 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     /**
      * 暂存合同
+     *
      * @param contract
      * @return
      */
     @DSTransactional
     @Override
     public long add(ContractDto contract) {
+        //禁止操作非暂存合同
+        if (ObjectUtil.isNotEmpty(contract.getId())) {
+            Contract byId = getById(contract.getId());
+            if (byId.getStatus() != FlowStatusEnum1.DRAFT.getKey()) {
+                throw new ServiceException("禁止操作非暂存合同");
+            }
+        }
+
         if (StringUtils.isEmpty(contract.getCurrency())) {
             throw new ServiceException("币种不能为空");
         }
@@ -638,11 +645,12 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         contract = commStart(contract);
         return contract.getId();
     }
+
     /**
      * 开始公共代码抽取
      */
     public ContractDto commStart(ContractDto contract) {
-        if(ObjectUtil.isEmpty(contract.getBuyCorporationId())){
+        if (ObjectUtil.isEmpty(contract.getBuyCorporationId())) {
             throw new ServiceException("客户不能为空");
         }
         // 赋值城市省份信息
@@ -684,6 +692,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         ObsFileUtil.saveFile(contract.getPackageFileList(), contract.getId(), 2);
         return contract;
     }
+
     @DSTransactional
     @Override
     public void edit(ContractDto contractDto) {
@@ -1735,15 +1744,16 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     /**
      * 头部统计客户金额
+     *
      * @return
      */
     @Override
     public Map<String, Object> getHeadCustomerStatistics(ContractSelectDto dto) {
-        Map<String,Object> map = new HashMap<>();
-        map.put("sumAmount",BigDecimal.ZERO);
-        map.put("sumArrivalAmount",BigDecimal.ZERO);
-        map.put("sumQuantity",BigDecimal.ZERO);
-        map.put("list",new ArrayList<>());
+        Map<String, Object> map = new HashMap<>();
+        map.put("sumAmount", BigDecimal.ZERO);
+        map.put("sumArrivalAmount", BigDecimal.ZERO);
+        map.put("sumQuantity", BigDecimal.ZERO);
+        map.put("list", new ArrayList<>());
 
         List<Long> authIdList = customerService.getAuthIdList();
         if (authIdList.size() == 0) {
@@ -1752,7 +1762,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         IWrapper<Contract> wrapper = getWrapper();
         wrapper.in("t1", Contract::getBuyCorporationId, authIdList);
         wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
-        wrapper.ne("t1",Contract::getIsShow,1);
+        wrapper.ne("t1", Contract::getIsShow, 1);
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
         if (StringUtils.isNotEmpty(dto.getStatus())) {
             wrapper.eq("t1", Contract::getStatus, dto.getStatus());
@@ -1783,25 +1793,25 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         wrapper.groupBy("t1.sell_corporation_id");
         List<ContractVo> list = baseMapper.getCustomerMoney(wrapper);
 
-        if(CollectionUtils.isNotEmpty(list)){
-            BigDecimal sumAmount = list.stream().map(ContractVo::getSumAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
-            BigDecimal sumQuantity = list.stream().map(ContractVo::getSumQuantity).reduce(BigDecimal.ZERO,BigDecimal::add);
-            BigDecimal sumClaimMoney = list.stream().map(ContractVo::getSumClaimMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
+        if (CollectionUtils.isNotEmpty(list)) {
+            BigDecimal sumAmount = list.stream().map(ContractVo::getSumAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal sumQuantity = list.stream().map(ContractVo::getSumQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal sumClaimMoney = list.stream().map(ContractVo::getSumClaimMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
             //赋值原卖方公司名称 多公司
             corporationService.attributeAssign(list, ContractVo::getSellCorporationId, (item, corporation) -> {
                 item.setSellCorporationName(corporation.getName());
             });
-            map.put("sumAmount",sumAmount);
-            map.put("sumArrivalAmount",sumClaimMoney);
-            map.put("sumQuantity",sumQuantity);
-            map.put("list",list);
+            map.put("sumAmount", sumAmount);
+            map.put("sumArrivalAmount", sumClaimMoney);
+            map.put("sumQuantity", sumQuantity);
+            map.put("list", list);
         }
         return map;
     }
 
     @Override
     public Map<String, Object> getDocumentaryPdf(Long newContractId, List<Long> contractIds) {
-        Map<String,Object> map = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
         if (ObjectUtil.isEmpty(newContractId)) {
             throw new ServiceException("销售合同id不能为空");
         }
@@ -1810,21 +1820,21 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             throw new ServiceException("没有找到销售合同");
         }
         contract.setCreateTimeEn(sdf.format(contract.getCreateTime()));
-        map.put("contract",contract);
+        map.put("contract", contract);
         QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
-        queryWrapper.select("IFNULL(SUM( amount ),0) AS amount").in("id",contractIds);
+        queryWrapper.select("IFNULL(SUM( amount ),0) AS amount").in("id", contractIds);
         contract.setAmount(contractService.getOne(queryWrapper).getAmount());
         //查询合同产品
-        List<ContractProduct> contractProductList = contractProductService.list(Wrappers.<ContractProduct>query().lambda().in(ContractProduct::getContractId,contractIds));
+        List<ContractProduct> contractProductList = contractProductService.list(Wrappers.<ContractProduct>query().lambda().in(ContractProduct::getContractId, contractIds));
         productInfoService.attributeAssign(contractProductList, ContractProduct::getProductId, (item, product) -> {
             item.setProductCnName(product.getName());
             item.setProductCode(product.getCode());
             item.setProductUnit(product.getUnit());
         });
         //查询合同其他收费项目
-        List<ContractProject> contractProjectList = contractProjectService.list(Wrappers.<ContractProject>query().lambda().in(ContractProject::getContractId,contractIds));
-        map.put("contractProductList",contractProductList);
-        map.put("contractProjectList",contractProjectList);
+        List<ContractProject> contractProjectList = contractProjectService.list(Wrappers.<ContractProject>query().lambda().in(ContractProject::getContractId, contractIds));
+        map.put("contractProductList", contractProductList);
+        map.put("contractProjectList", contractProjectList);
         return map;
     }
 }

+ 13 - 4
hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java

@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.account.controller.utils.DateUtils;
 import com.fjhx.area.utils.CustomizeAreaUtil;
 import com.fjhx.common.constant.SourceConstant;
-import com.fjhx.common.enums.CodingRuleEnum;
 import com.fjhx.common.enums.FlowStatusEnum1;
 import com.fjhx.common.service.coding.CodingRuleService;
 import com.fjhx.common.service.corporation.CorporationService;
@@ -92,6 +91,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
 
     @Autowired
     private CodingRuleService codingRuleService;
+
     /**
      * 报价表分页
      */
@@ -170,12 +170,21 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
 
     /**
      * 报价单暂存
+     *
      * @param saleQuotation
      */
     @DSTransactional
     @Override
     public long add(SaleQuotationDto saleQuotation) {
-        if(ObjectUtil.isEmpty(saleQuotation.getBuyCorporationId())){
+        //禁止操作非暂存合同
+        if (ObjectUtil.isNotEmpty(saleQuotation.getId())) {
+            SaleQuotation byId = getById(saleQuotation.getId());
+            if (!SaleQuotationEnum.DRAFT.getKey().equals(byId.getStatus())) {
+                throw new ServiceException("禁止操作非暂存报价单");
+            }
+        }
+
+        if (ObjectUtil.isEmpty(saleQuotation.getBuyCorporationId())) {
             throw new ServiceException("客户不能为空");
         }
         //赋值城市省份信息
@@ -193,12 +202,12 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         //添加报价单信息
         this.saveOrUpdate(saleQuotation);
         List<QuotationProduct> quotationProductList = saleQuotation.getQuotationProductList();
-        if(CollectionUtils.isNotEmpty(quotationProductList)){//保存报价产品信息
+        if (CollectionUtils.isNotEmpty(quotationProductList)) {//保存报价产品信息
             quotationProductList.forEach(quotationProduct -> quotationProduct.setSaleQuotationId(saleQuotation.getId()));
             quotationProductService.saveOrUpdateBatch(quotationProductList);
         }
         List<QuotationPay> quotationPayList = saleQuotation.getQuotationPayList();
-        if(CollectionUtils.isNotEmpty(quotationPayList)){//保存报价项目信息
+        if (CollectionUtils.isNotEmpty(quotationPayList)) {//保存报价项目信息
             quotationPayList.forEach(quotationPay -> quotationPay.setSaleQuotationId(saleQuotation.getId()));
             quotationPayService.saveOrUpdateBatch(quotationPayList);
         }