Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev' into dev

caozj 1 anno fa
parent
commit
a64736dea2
33 ha cambiato i file con 448 aggiunte e 52 eliminazioni
  1. 20 0
      hx-account/src/main/java/com/fjhx/account/controller/account/AccountPaymentRecordsController.java
  2. 1 2
      hx-account/src/main/java/com/fjhx/account/controller/transaction/TransactionDepartmentController.java
  3. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountPaymentDto.java
  4. 17 0
      hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountPaymentRecordsDto.java
  5. 17 0
      hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountPaymentRecordsSelectDto.java
  6. 1 0
      hx-account/src/main/java/com/fjhx/account/entity/account/enums/PaymentStatusEnum.java
  7. 34 0
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountPaymentRecords.java
  8. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRunningWater.java
  9. 8 0
      hx-account/src/main/java/com/fjhx/account/entity/account/vo/AccountManagementVo.java
  10. 17 0
      hx-account/src/main/java/com/fjhx/account/entity/account/vo/AccountPaymentRecordsVo.java
  11. 10 0
      hx-account/src/main/java/com/fjhx/account/entity/transaction/po/Transaction.java
  12. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/transaction/vo/TransactionDepartmentVo.java
  13. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/transaction/vo/TransactionVo.java
  14. 3 2
      hx-account/src/main/java/com/fjhx/account/flow/AccountRequestFundsFlow.java
  15. 17 0
      hx-account/src/main/java/com/fjhx/account/mapper/account/AccountPaymentRecordsMapper.java
  16. 17 0
      hx-account/src/main/java/com/fjhx/account/service/account/AccountPaymentRecordsService.java
  17. 30 17
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountManagementServiceImpl.java
  18. 21 0
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentRecordsServiceImpl.java
  19. 48 17
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentServiceImpl.java
  20. 63 0
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRunningWaterServiceImpl.java
  21. 1 1
      hx-account/src/main/java/com/fjhx/account/service/transaction/TransactionDepartmentService.java
  22. 19 2
      hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionDepartmentServiceImpl.java
  23. 7 0
      hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionServiceImpl.java
  24. 4 0
      hx-account/src/main/resources/mapper/account/AccountPaymentRecordsMapper.xml
  25. 2 1
      hx-account/src/main/resources/mapper/tax/TaxRefundDetailsMapper.xml
  26. 5 0
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerVo.java
  27. 14 2
      hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java
  28. 1 1
      hx-purchase/src/main/java/com/fjhx/purchase/flow/PayFlow.java
  29. 5 1
      hx-sale/src/main/java/com/fjhx/sale/entity/serviceContract/dto/ServiceContractDto.java
  30. 10 0
      hx-sale/src/main/java/com/fjhx/sale/flow/ServiceContractFlow.java
  31. 10 4
      hx-sale/src/main/java/com/fjhx/sale/service/contract/ContractService.java
  32. 6 1
      hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java
  33. 20 1
      hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

+ 20 - 0
hx-account/src/main/java/com/fjhx/account/controller/account/AccountPaymentRecordsController.java

@@ -0,0 +1,20 @@
+package com.fjhx.account.controller.account;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 打款记录 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-09-04
+ */
+@RestController
+@RequestMapping("/accountPaymentRecords")
+public class AccountPaymentRecordsController {
+
+
+}

+ 1 - 2
hx-account/src/main/java/com/fjhx/account/controller/transaction/TransactionDepartmentController.java

@@ -3,7 +3,6 @@ package com.fjhx.account.controller.transaction;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.account.entity.transaction.dto.TransactionDepartmentDto;
 import com.fjhx.account.entity.transaction.dto.TransactionDepartmentSelectDto;
-import com.fjhx.account.entity.transaction.po.TransactionDepartment;
 import com.fjhx.account.entity.transaction.vo.TransactionDepartmentVo;
 import com.fjhx.account.service.transaction.TransactionDepartmentService;
 import com.ruoyi.common.core.domain.BaseSelectDto;
@@ -31,7 +30,7 @@ public class TransactionDepartmentController {
      * 往来单位列表
      */
     @GetMapping("/list")
-    public List<TransactionDepartment> list() {
+    public List<TransactionDepartmentVo> list() {
         return transactionDepartmentService.getList();
     }
 

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountPaymentDto.java

@@ -48,4 +48,9 @@ public class AccountPaymentDto extends AccountPayment {
      */
     private Long transactionDeptId;
 
+    /**
+     * 往来单位类型 0往来单位 1多公司
+     */
+    private Integer deptType;
+
 }

+ 17 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountPaymentRecordsDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.account.entity.account.dto;
+
+import com.fjhx.account.entity.account.po.AccountPaymentRecords;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 打款记录新增编辑入参实体
+ *
+ * @author
+ * @since 2023-09-04
+ */
+@Getter
+@Setter
+public class AccountPaymentRecordsDto extends AccountPaymentRecords {
+
+}

+ 17 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountPaymentRecordsSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.account.entity.account.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 打款记录列表查询入参实体
+ *
+ * @author
+ * @since 2023-09-04
+ */
+@Getter
+@Setter
+public class AccountPaymentRecordsSelectDto extends BaseSelectDto {
+
+}

+ 1 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/enums/PaymentStatusEnum.java

@@ -8,6 +8,7 @@ import java.util.Map;
 //打款状态
 public enum PaymentStatusEnum {
     UNDER_REVIEW("20", "未打款"),
+    PARTIAL("15", "部分打款"),
     REJECT("10", "已打款"),
     ;
     private String key;

+ 34 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountPaymentRecords.java

@@ -0,0 +1,34 @@
+package com.fjhx.account.entity.account.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 打款记录
+ * </p>
+ *
+ * @author
+ * @since 2023-09-04
+ */
+@Getter
+@Setter
+@TableName("account_payment_records")
+public class AccountPaymentRecords extends BasePo {
+
+    /**
+     * 打款id
+     */
+    private Long accountPaymentId;
+
+    /**
+     * 打款金额
+     */
+    private BigDecimal
+            amount;
+
+}

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRunningWater.java

@@ -115,4 +115,9 @@ public class AccountRunningWater extends BasePo {
      */
     private Long transactionDeptId;
 
+    /**
+     * 往来单位类型 0往来单位 1多公司
+     */
+    private Integer deptType;
+
 }

+ 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;
+
 }

+ 17 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/vo/AccountPaymentRecordsVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.account.entity.account.vo;
+
+import com.fjhx.account.entity.account.po.AccountPaymentRecords;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 打款记录列表查询返回值实体
+ *
+ * @author
+ * @since 2023-09-04
+ */
+@Getter
+@Setter
+public class AccountPaymentRecordsVo extends AccountPaymentRecords {
+
+}

+ 10 - 0
hx-account/src/main/java/com/fjhx/account/entity/transaction/po/Transaction.java

@@ -57,4 +57,14 @@ public class Transaction extends BasePo {
 
     private Long accountRunningWaterId;
 
+    /**
+     * 归属公司
+     */
+    private Long corporationId;
+
+    /**
+     * 往来单位类型 0往来单位 1多公司
+     */
+    private Integer deptType;
+
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/transaction/vo/TransactionDepartmentVo.java

@@ -14,4 +14,9 @@ import lombok.Setter;
 @Setter
 public class TransactionDepartmentVo extends TransactionDepartment {
 
+    /**
+     * 单位类型 0往来单位 1多公司
+     */
+    private Integer deptType;
+
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/transaction/vo/TransactionVo.java

@@ -24,4 +24,9 @@ public class TransactionVo extends Transaction {
      */
     private String accountName;
 
+    /**
+     * 归属公司 名称
+     */
+    private String corporationName;
+
 }

+ 3 - 2
hx-account/src/main/java/com/fjhx/account/flow/AccountRequestFundsFlow.java

@@ -198,16 +198,17 @@ public class AccountRequestFundsFlow extends FlowDelegate {
         accountPayment.setInterbankNumber(accountRequestFunds.getInterbankNumber());
         accountPayment.setDataUser(accountRequestFunds.getCreateUser());
         accountPayment.setApplyForTime(accountRequestFunds.getCreateTime());
+        accountPayment.setAmount(BigDecimal.ZERO);
 
         // 如果是核销 核销数据审批通过后,根据“核销总额 - 预支总额”生成“待打款”数据
         if ("3".equals(accountRequestFunds.getType())) {
             BigDecimal subtract = accountRequestFunds.getTotal().subtract(accountRequestFunds.getAdvanceAmounts());
-            accountPayment.setAmount(subtract);
+            accountPayment.setIncomeAmount(subtract);
             if (subtract.compareTo(BigDecimal.ZERO) <= 0) {//不生成打款数据
                 return;
             }
         } else {
-            accountPayment.setAmount(accountRequestFunds.getTotal());
+            accountPayment.setIncomeAmount(accountRequestFunds.getTotal());
         }
 
         accountPaymentService.save(accountPayment);

+ 17 - 0
hx-account/src/main/java/com/fjhx/account/mapper/account/AccountPaymentRecordsMapper.java

@@ -0,0 +1,17 @@
+package com.fjhx.account.mapper.account;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.account.entity.account.po.AccountPaymentRecords;
+
+
+/**
+ * <p>
+ * 打款记录 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-09-04
+ */
+public interface AccountPaymentRecordsMapper extends BaseMapper<AccountPaymentRecords> {
+
+}

+ 17 - 0
hx-account/src/main/java/com/fjhx/account/service/account/AccountPaymentRecordsService.java

@@ -0,0 +1,17 @@
+package com.fjhx.account.service.account;
+
+import com.fjhx.account.entity.account.po.AccountPaymentRecords;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 打款记录 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-09-04
+ */
+public interface AccountPaymentRecordsService extends BaseService<AccountPaymentRecords> {
+
+}

+ 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());

+ 21 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentRecordsServiceImpl.java

@@ -0,0 +1,21 @@
+package com.fjhx.account.service.account.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.account.entity.account.po.AccountPaymentRecords;
+import com.fjhx.account.mapper.account.AccountPaymentRecordsMapper;
+import com.fjhx.account.service.account.AccountPaymentRecordsService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 打款记录 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-09-04
+ */
+@Service
+public class AccountPaymentRecordsServiceImpl extends ServiceImpl<AccountPaymentRecordsMapper, AccountPaymentRecords> implements AccountPaymentRecordsService {
+
+}

+ 48 - 17
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentServiceImpl.java

@@ -11,20 +11,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.account.entity.account.dto.AccountPaymentDto;
 import com.fjhx.account.entity.account.dto.AccountRequestFundsSelectDto;
 import com.fjhx.account.entity.account.enums.PaymentStatusEnum;
-import com.fjhx.account.entity.account.po.AccountManagement;
-import com.fjhx.account.entity.account.po.AccountPayment;
-import com.fjhx.account.entity.account.po.AccountRemainder;
-import com.fjhx.account.entity.account.po.AccountRunningWater;
+import com.fjhx.account.entity.account.po.*;
 import com.fjhx.account.entity.account.vo.AccountPaymentVo;
 import com.fjhx.account.entity.transaction.po.Transaction;
 import com.fjhx.account.mapper.account.AccountPaymentMapper;
-import com.fjhx.account.service.account.AccountManagementService;
-import com.fjhx.account.service.account.AccountPaymentService;
-import com.fjhx.account.service.account.AccountRemainderService;
-import com.fjhx.account.service.account.AccountRunningWaterService;
+import com.fjhx.account.service.account.*;
 import com.fjhx.account.service.transaction.TransactionService;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.service.corporation.CorporationService;
+import com.fjhx.common.utils.Assert;
 import com.fjhx.file.utils.ObsFileUtil;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.exception.ServiceException;
@@ -33,6 +28,7 @@ import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -66,6 +62,8 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
 
     @Autowired
     private TransactionService transactionService;
+    @Autowired
+    private AccountPaymentRecordsService accountPaymentRecordsService;
 
     @Override
     public Page<AccountPaymentVo> getPage(AccountRequestFundsSelectDto dto) {
@@ -139,19 +137,19 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
         AccountPayment AccountPayment = baseMapper.detail(id);
         AccountPaymentVo result = BeanUtil.toBean(AccountPayment, AccountPaymentVo.class);
 
-        if (ObjectUtil.isNotEmpty(result.getAccountManagementId())){
+        if (ObjectUtil.isNotEmpty(result.getAccountManagementId())) {
             //查询实际打款的付款账户名称;
             AccountManagement accountManagement = accountManagementService.getById(result.getAccountManagementId());
-            if (ObjectUtil.isNotEmpty(accountManagement)){
+            if (ObjectUtil.isNotEmpty(accountManagement)) {
                 result.setAccountManagementName(accountManagement.getName());
             }
 
         }
 
-        if (ObjectUtil.isNotEmpty(result.getBusinessManagementId())){
+        if (ObjectUtil.isNotEmpty(result.getBusinessManagementId())) {
             //查询业务中选中的付款账户名称;
             AccountManagement accountManagement = accountManagementService.getById(result.getBusinessManagementId());
-            if (ObjectUtil.isNotEmpty(accountManagement)){
+            if (ObjectUtil.isNotEmpty(accountManagement)) {
                 result.setBusinessManagementName(accountManagement.getName());
             }
 
@@ -161,11 +159,13 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
 
     /**
      * 打款功能
+     *
      * @param accountPaymentDto
      */
     @Override
     @DSTransactional
-    public void add(AccountPaymentDto accountPaymentDto) {
+    public synchronized void add(AccountPaymentDto accountPaymentDto) {
+        Assert.notEmpty(accountPaymentDto.getId(), "打款id不能为空");
 
         AccountRemainder accountRemainder = accountRemainderService.getOne(Wrappers.<AccountRemainder>lambdaQuery()
                 .eq(AccountRemainder::getAccountManagementId, accountPaymentDto.getAccountManagementId())
@@ -181,9 +181,31 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
             throw new ServiceException("账户余额不足");
         }
 
-        // TODO 只要发起就是已打款(后期可能要修改)
-        accountPaymentDto.setStatus(PaymentStatusEnum.REJECT.getKey());
-        updateById(accountPaymentDto);
+        //刷新打款信息
+        AccountPayment oldAccountPayment = this.getById(accountPaymentDto.getId());
+        //如果是未打款把已打款金额改成0(修复旧数据)
+        if (oldAccountPayment.getStatus().equals(PaymentStatusEnum.UNDER_REVIEW.getKey())) {
+            oldAccountPayment.setAmount(BigDecimal.ZERO);
+        }
+        BigDecimal add = oldAccountPayment.getAmount().add(accountPaymentDto.getAmount());
+        if (add.compareTo(oldAccountPayment.getIncomeAmount()) > 0) {
+            throw new ServiceException("打款金额不能大于待打款金额");
+        }
+        //修改打款状态
+        if (add.compareTo(oldAccountPayment.getIncomeAmount()) >= 0) {
+            oldAccountPayment.setStatus(PaymentStatusEnum.REJECT.getKey());
+        } else {
+            oldAccountPayment.setStatus(PaymentStatusEnum.PARTIAL.getKey());
+        }
+        //赋值已打款金额
+        oldAccountPayment.setAmount(add);
+        updateById(oldAccountPayment);
+
+        //创建打款记录
+        AccountPaymentRecords accountPaymentRecords = new AccountPaymentRecords();
+        accountPaymentRecords.setAccountPaymentId(accountPaymentDto.getId());
+        accountPaymentRecords.setAmount(accountPaymentDto.getAmount());
+        accountPaymentRecordsService.save(accountPaymentRecords);
 
         // 赋值变更金额
         accountRemainder.setChangeRemainder(accountPaymentDto.getAmount());
@@ -213,7 +235,7 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
     /**
      * 添加资金流水表的数据
      */
-    private void  addAccountRunningWater(AccountPaymentDto accountPaymentDto){
+    private void addAccountRunningWater(AccountPaymentDto accountPaymentDto) {
 
         AccountRunningWater accountRunningWater = new AccountRunningWater();
         accountRunningWater.setAccountManagementId(accountPaymentDto.getAccountManagementId());
@@ -232,6 +254,7 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
         //赋值是否往来
         accountRunningWater.setIsTransaction(accountPaymentDto.getIsTransaction());
         accountRunningWater.setTransactionDeptId(accountPaymentDto.getTransactionDeptId());
+        accountRunningWater.setDeptType(accountRunningWater.getDeptType());
         accountRunningWaterService.save(accountRunningWater);
 
         //如果是往来
@@ -246,6 +269,14 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
             transaction.setAccountId(accountRunningWater.getAccountManagementId());
             transaction.setRemark(accountRunningWater.getRemarks());
             transaction.setAccountRunningWaterId(accountRunningWater.getId());
+
+            Assert.notEmpty(accountPaymentDto.getDeptType(), "往来单位类型不能为空");
+            transaction.setDeptType(accountPaymentDto.getDeptType());
+
+            //赋值归属公司
+            AccountManagement accountManagement = accountManagementService.getById(accountPaymentDto.getAccountManagementId());
+            transaction.setCorporationId(accountManagement.getCorporationId());
+
             transactionService.save(transaction);
         }
 

+ 63 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRunningWaterServiceImpl.java

@@ -250,6 +250,14 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
             transaction.setAccountId(dto.getAccountManagementId());
             transaction.setRemark(dto.getRemarks());
             transaction.setAccountRunningWaterId(dto.getId());
+
+            Assert.notEmpty(dto.getDeptType(), "往来单位类型不能为空");
+            transaction.setDeptType(dto.getDeptType());
+
+            //赋值归属公司
+            AccountManagement accountManagement = accountManagementService.getById(dto.getAccountManagementId());
+            transaction.setCorporationId(accountManagement.getCorporationId());
+
             transactionService.save(transaction);
         }
 
@@ -459,11 +467,15 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
     @DSTransactional
     @Override
     public void internalTransfer(AccountRunningWaterDto dto) {
+        AccountManagement outAccountManagement = accountManagementService.getById(dto.getAccountManagementId());
+        AccountManagement inAccountManagement = accountManagementService.getById(dto.getInAccountManagementId());
+
         //生成转出流水
         dto.setStatus("20");//支出
         dto.setType("50");//内部转账
         //操作余额
         changeRemainder(dto);
+
         this.save(dto);
 
         //如果手续费不为0生成手续费
@@ -497,7 +509,58 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
         inAccountRunningWater.setCurrency(dto.getInCurrency());
         //操作余额
         changeRemainder(inAccountRunningWater);
+
         this.save(inAccountRunningWater);
+
+        //如果是往来
+        if (ObjectUtil.isNotEmpty(dto.getIsTransaction()) && 1 == dto.getIsTransaction()) {
+            dto.setDeptType(1);
+            dto.setTransactionDeptId(inAccountManagement.getCorporationId());
+            this.updateById(dto);
+            inAccountRunningWater.setDeptType(1);
+            inAccountRunningWater.setTransactionDeptId(outAccountManagement.getCorporationId());
+            this.updateById(inAccountRunningWater);
+
+            //转入转出归属公司不同生成往来记录
+            if (inAccountManagement.getCorporationId() != outAccountManagement.getCorporationId()) {
+                //创建转入往来数据
+                Transaction transaction = new Transaction();
+                transaction.setType(1);//支出
+                transaction.setCurrency(dto.getCurrency());
+                transaction.setAmount(dto.getAmount());
+                transaction.setIsFlowingWater(1);
+                transaction.setAccountId(dto.getAccountManagementId());
+                transaction.setRemark(dto.getRemarks());
+                transaction.setAccountRunningWaterId(dto.getId());
+                transaction.setDeptType(1);
+
+                //赋值归属公司(转出账户归属公司)
+                transaction.setCorporationId(outAccountManagement.getCorporationId());
+                //赋值往来单位(转入账户归属公司)
+                transaction.setDepartmentId(inAccountManagement.getCorporationId());
+
+                transactionService.save(transaction);
+
+                //创建转出往来数据
+                Transaction transaction1 = new Transaction();
+                transaction1.setType(0);//收入
+                transaction1.setCurrency(inAccountRunningWater.getCurrency());
+                transaction1.setAmount(inAccountRunningWater.getAmount());
+                transaction1.setIsFlowingWater(1);
+                transaction1.setAccountId(inAccountRunningWater.getAccountManagementId());
+                transaction1.setRemark(inAccountRunningWater.getRemarks());
+                transaction1.setAccountRunningWaterId(inAccountRunningWater.getId());
+                transaction1.setDeptType(1);
+
+                //赋值归属公司(转入账户归属公司)
+                transaction1.setCorporationId(inAccountManagement.getCorporationId());
+                //赋值往来单位(转出账户归属公司)
+                transaction1.setDepartmentId(outAccountManagement.getCorporationId());
+
+                transactionService.save(transaction1);
+            }
+        }
+
     }
 
     /**

+ 1 - 1
hx-account/src/main/java/com/fjhx/account/service/transaction/TransactionDepartmentService.java

@@ -22,7 +22,7 @@ public interface TransactionDepartmentService extends BaseService<TransactionDep
     /**
      * 往来单位列表
      */
-    List<TransactionDepartment> getList();
+    List<TransactionDepartmentVo> getList();
 
     /**
      * 往来单位分页

+ 19 - 2
hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionDepartmentServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fjhx.account.service.transaction.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.account.entity.transaction.dto.TransactionDepartmentDto;
@@ -8,7 +9,10 @@ import com.fjhx.account.entity.transaction.po.TransactionDepartment;
 import com.fjhx.account.entity.transaction.vo.TransactionDepartmentVo;
 import com.fjhx.account.mapper.transaction.TransactionDepartmentMapper;
 import com.fjhx.account.service.transaction.TransactionDepartmentService;
+import com.fjhx.common.entity.corporation.po.Corporation;
+import com.fjhx.common.service.corporation.CorporationService;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -24,10 +28,23 @@ import java.util.List;
 @Service
 public class TransactionDepartmentServiceImpl extends ServiceImpl<TransactionDepartmentMapper, TransactionDepartment> implements TransactionDepartmentService {
 
+    @Autowired
+    private CorporationService corporationService;
+
     @Override
-    public List<TransactionDepartment> getList() {
+    public List<TransactionDepartmentVo> getList() {
         List<TransactionDepartment> list = this.list();
-        return list;
+        List<TransactionDepartmentVo> transactionDepartmentVos = BeanUtil.copyToList(list, TransactionDepartmentVo.class);
+        transactionDepartmentVos.forEach(item -> item.setDeptType(0));
+        List<Corporation> corporationList = corporationService.list();
+        for (Corporation corporation : corporationList) {
+            TransactionDepartmentVo transactionDepartmentVo = new TransactionDepartmentVo();
+            transactionDepartmentVo.setId(corporation.getId());
+            transactionDepartmentVo.setName(corporation.getName());
+            transactionDepartmentVo.setDeptType(1);
+            transactionDepartmentVos.add(transactionDepartmentVo);
+        }
+        return transactionDepartmentVos;
     }
 
     @Override

+ 7 - 0
hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionServiceImpl.java

@@ -15,6 +15,7 @@ import com.fjhx.account.service.account.AccountManagementService;
 import com.fjhx.account.service.account.AccountRunningWaterService;
 import com.fjhx.account.service.transaction.TransactionDepartmentService;
 import com.fjhx.account.service.transaction.TransactionService;
+import com.fjhx.common.service.corporation.CorporationService;
 import com.fjhx.common.utils.ExchangeRateUtil;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,6 +42,8 @@ public class TransactionServiceImpl extends ServiceImpl<TransactionMapper, Trans
     private TransactionDepartmentService transactionDepartmentService;
     @Autowired
     private AccountRunningWaterService accountRunningWaterService;
+    @Autowired
+    private CorporationService corporationService;
 
     @Override
     public Page<TransactionVo> getPage(TransactionSelectDto dto) {
@@ -71,6 +74,10 @@ public class TransactionServiceImpl extends ServiceImpl<TransactionMapper, Trans
         accountManagementService.attributeAssign(records, TransactionVo::getAccountId, (item, account) -> {
             item.setAccountName(account.getName());
         });
+        //赋值归属公司名称
+        corporationService.attributeAssign(records, TransactionVo::getCorporationId, (item, corporation) -> {
+            item.setCorporationName(corporation.getName());
+        });
         return page;
     }
 

+ 4 - 0
hx-account/src/main/resources/mapper/account/AccountPaymentRecordsMapper.xml

@@ -0,0 +1,4 @@
+<?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.fjhx.account.mapper.account.AccountPaymentRecordsMapper">
+</mapper>

+ 2 - 1
hx-account/src/main/resources/mapper/tax/TaxRefundDetailsMapper.xml

@@ -17,7 +17,8 @@
     <select id="getSumMoneyByContractIds" resultType="com.fjhx.account.entity.tax.po.TaxRefundDetails">
         SELECT
             t1.*,
-            t2.rate AS rate
+            t2.rate AS rate,
+            t2.currency AS currency
         FROM
             tax_refund_details t1
         LEFT JOIN account_running_water t2 ON t1.account_running_water_id = t2.id

+ 5 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerVo.java

@@ -56,4 +56,9 @@ public class CustomerVo extends Customer implements SetCustomizeAreaName {
      * 客户状态 字典值
      */
     private String statusVal;
+
+    /**
+     * 国旗
+     */
+    private String countryIcon;
 }

+ 14 - 2
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java

@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.area.entity.po.CustomizeArea;
+import com.fjhx.area.service.CustomizeAreaService;
 import com.fjhx.area.utils.CustomizeAreaUtil;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.entity.coding.bo.CustomerCodeAndCountryId;
@@ -67,6 +69,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
 
     @Autowired
     private DictTenantDataService dictTenantDataService;
+    @Autowired
+    private CustomizeAreaService customizeAreaService;
 
 
     /**
@@ -177,8 +181,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
     @Override
     public CustomerVo detail(Long id) {
         //查询客户表的信息
-        Customer Customer = this.getById(id);
-        CustomerVo result = BeanUtil.toBean(Customer, CustomerVo.class);
+        Customer customer = this.getById(id);
+        CustomerVo result = BeanUtil.toBean(customer, CustomerVo.class);
         if (ObjectUtil.isEmpty(result)) {
             throw new ServiceException("没有找到该用户信息");
         }
@@ -186,7 +190,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
         List<CustomerUser> customerUserList = customerUserService.list(Wrappers.<CustomerUser>lambdaQuery()
                 .eq(CustomerUser::getCustomerId, result.getId()));
         result.setCustomerUserList(customerUserList);
+        //赋值国省市信息
         CustomizeAreaUtil.setAreaName(result);
+        //赋值国旗信息
+        DynamicDataSourceContextHolder.push(SourceConstant.BASE);
+        CustomizeArea country = customizeAreaService.getById(result.getCountryId());
+        DynamicDataSourceContextHolder.poll();
+        if (ObjectUtil.isNotEmpty(country)) {
+            result.setCountryIcon(country.getIcon());
+        }
         return result;
     }
 

+ 1 - 1
hx-purchase/src/main/java/com/fjhx/purchase/flow/PayFlow.java

@@ -156,7 +156,7 @@ public class PayFlow extends FlowDelegate {
             payment.setType(PaymentTypeEnum.REJECT.getKey());
             payment.setStatus(PaymentStatusEnum.UNDER_REVIEW.getKey());
             payment.setCorporationId(pay.getCorporationId());
-            payment.setAmount(pay.getAmount());
+            payment.setAmount(BigDecimal.ZERO);
             payment.setIncomeAmount(pay.getAmount());
             payment.setName(pay.getName());
             payment.setDataUser(pay.getCreateUser());

+ 5 - 1
hx-sale/src/main/java/com/fjhx/sale/entity/serviceContract/dto/ServiceContractDto.java

@@ -1,6 +1,7 @@
 package com.fjhx.sale.entity.serviceContract.dto;
 
 import com.fjhx.area.service.SetCustomizeAreaId;
+import com.fjhx.file.entity.ObsFile;
 import com.fjhx.sale.entity.serviceContract.po.ServiceContract;
 import com.fjhx.sale.entity.serviceContract.po.ServiceContractPay;
 import com.fjhx.sale.entity.serviceContract.po.ServiceContractProduct;
@@ -55,5 +56,8 @@ public class ServiceContractDto extends ServiceContract  implements SetCustomize
      */
     private Long countryId;
 
-
+    /**
+     * 文件列表
+     */
+    private List<ObsFile> fileList;
 }

+ 10 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/ServiceContractFlow.java

@@ -11,6 +11,7 @@ import com.fjhx.common.enums.CodingRuleEnum;
 import com.fjhx.common.enums.FlowStatusEnum1;
 import com.fjhx.common.service.coding.CodingRuleService;
 import com.fjhx.common.utils.Assert;
+import com.fjhx.file.utils.ObsFileUtil;
 import com.fjhx.flow.core.FlowDelegate;
 import com.fjhx.flow.enums.FlowStatusEnum;
 import com.fjhx.sale.entity.serviceContract.dto.ServiceContractDto;
@@ -162,6 +163,15 @@ public class ServiceContractFlow extends FlowDelegate {
             serviceContractPayList.forEach(contractPay -> contractPay.setServiceContractId(contract.getId()));
             serviceContractPayService.saveOrUpdateBatch(serviceContractPayList);
         }
+        if (opType == 1) {
+            //重新发起编辑
+            // 交接单附件列表
+            ObsFileUtil.editFile(contract.getFileList(), contract.getId(), 1);
+        } else {
+            //普通提交新增
+            // 交接单附件列表
+            ObsFileUtil.saveFile(contract.getFileList(), contract.getId(), 1);
+        }
 
         return contract;
     }

+ 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);
 
 }

+ 6 - 1
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -1816,7 +1816,12 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         contract.setAmount(contractService.getOne(queryWrapper).getAmount());
         //查询合同产品
         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);

+ 20 - 1
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -252,7 +252,7 @@
                arw.create_time,
                30                 type,
                arw.currency,
-               clc.money,
+               clc.money          amount,
                arw.remarks,
                am.`name`          accountManagementName,
                am.account_opening accountManagementOpening,
@@ -266,6 +266,25 @@
                            ON arw.account_management_id = am.id AND am.del_flag = 0
         WHERE arw.del_flag = 0
           AND c.id = #{contractId}
+        UNION ALL
+        SELECT arw.id,
+               arw.create_time,
+               40 AS              type,
+               arw.currency,
+               trd.amount,
+               arw.remarks,
+               am.`name`          accountManagementName,
+               am.account_opening accountManagementOpening,
+               arw.`name`,
+               arw.STATUS
+        FROM contract c
+                 JOIN bytesailing_account.tax_refund_details trd ON trd.contract_id = c.id
+            AND trd.del_flag = 0
+                 JOIN bytesailing_account.account_running_water arw ON trd.account_running_water_id = arw.id
+            AND arw.del_flag = 0
+                 LEFT JOIN bytesailing_account.account_management am ON arw.account_management_id = am.id
+            AND am.del_flag = 0
+        WHERE c.id = #{contractId}
     </select>
 
     <select id="getCustomerMoney" resultType="com.fjhx.sale.entity.contract.vo.ContractVo">