Browse Source

请款明细添加合同编号

yzc 2 years ago
parent
commit
7161d155b9

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

@@ -18,4 +18,9 @@ public class AccountRequestFundsDetailVo extends AccountRequestFundsDetail {
      * 币种
      */
     private String currency;
+
+    /**
+     * 合同编号
+     */
+    private String contractCode;
 }

+ 1 - 1
hx-account/src/main/java/com/fjhx/account/entity/account/vo/AccountRequestFundsVo.java

@@ -49,7 +49,7 @@ public class AccountRequestFundsVo extends AccountRequestFunds {
     private BigDecimal accountPaymentAmount;
 
     //请款详情表的信息
-    private List<AccountRequestFundsDetail> accountRequestFundsDetailList;
+    private List<AccountRequestFundsDetailVo> accountRequestFundsDetailList;
 
     /**
      * 附件信息

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/mapper/account/AccountRequestFundsDetailMapper.java

@@ -31,4 +31,9 @@ public interface AccountRequestFundsDetailMapper extends BaseMapper<AccountReque
      * @return
      */
     List<AccountRequestFundsDetailVo> getListByContractId(Long contractId);
+
+    /**
+     * 根据请款id获取请款明细列表
+     */
+    List<AccountRequestFundsDetailVo> listByAccountRequestFundsId(@Param("accountRequestFundsId") Long accountRequestFundsId);
 }

+ 4 - 0
hx-account/src/main/java/com/fjhx/account/service/account/AccountRequestFundsDetailService.java

@@ -52,4 +52,8 @@ public interface AccountRequestFundsDetailService extends BaseService<AccountReq
      */
     List<AccountRequestFundsDetailVo> getListByContractId(Long contractId);
 
+    /**
+     * 根据请款id获取请款明细列表
+     */
+    List<AccountRequestFundsDetailVo> listByAccountRequestFundsId(Long accountRequestFundsId);
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsDetailServiceImpl.java

@@ -66,4 +66,9 @@ public class AccountRequestFundsDetailServiceImpl extends ServiceImpl<AccountReq
         return baseMapper.getListByContractId(contractId);
     }
 
+    @Override
+    public List<AccountRequestFundsDetailVo> listByAccountRequestFundsId(Long accountRequestFundsId){
+        return baseMapper.listByAccountRequestFundsId(accountRequestFundsId);
+    }
+
 }

+ 25 - 25
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java

@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.account.entity.account.dto.AccountRequestFundsDto;
 import com.fjhx.account.entity.account.dto.AccountRequestFundsSelectDto;
 import com.fjhx.account.entity.account.po.AccountRequestFunds;
-import com.fjhx.account.entity.account.po.AccountRequestFundsDetail;
+import com.fjhx.account.entity.account.vo.AccountRequestFundsDetailVo;
 import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
 import com.fjhx.account.mapper.account.AccountRequestFundsMapper;
 import com.fjhx.account.service.account.AccountRequestFundsDetailService;
@@ -19,14 +19,11 @@ import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.entity.corporation.po.Corporation;
 import com.fjhx.common.service.corporation.CorporationService;
 import com.fjhx.flow.entity.flow.po.FlowExample;
-import com.fjhx.flow.entity.flow.po.FlowInfo;
 import com.fjhx.flow.service.flow.FlowExampleService;
-import com.fjhx.flow.service.flow.FlowInfoService;
 import com.obs.services.internal.ServiceException;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.system.service.ISysDeptService;
-import com.ruoyi.system.service.ISysUserService;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -56,29 +53,27 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
     private AccountRequestFundsDetailService accountRequestFundsDetailService;
 
     @Autowired
-    private ISysUserService sysUserService;
-
-    @Autowired
     private FlowExampleService flowExampleService;
 
     /**
      * 查询请款列表
+     *
      * @param dto
      * @return
      */
     @Override
     public Page<AccountRequestFundsVo> getPage(AccountRequestFundsSelectDto dto) {
         QueryWrapper<Object> wrapper = Wrappers.query();
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getType()),"arf.type",dto.getType());
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()),"arf.status",dto.getStatus());
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getPaymentStatus()),"ap.status",dto.getPaymentStatus());
-        wrapper.like(ObjectUtil.isNotEmpty(dto.getKeyword()),"arf.payment_remarks",dto.getKeyword());
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getWriteOffStatus()),"arf.write_off_status",dto.getWriteOffStatus());
-        wrapper.orderByDesc("ap.status","arf.payment_time","arf.create_time");
+        wrapper.eq(ObjectUtil.isNotEmpty(dto.getType()), "arf.type", dto.getType());
+        wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), "arf.status", dto.getStatus());
+        wrapper.eq(ObjectUtil.isNotEmpty(dto.getPaymentStatus()), "ap.status", dto.getPaymentStatus());
+        wrapper.like(ObjectUtil.isNotEmpty(dto.getKeyword()), "arf.payment_remarks", dto.getKeyword());
+        wrapper.eq(ObjectUtil.isNotEmpty(dto.getWriteOffStatus()), "arf.write_off_status", dto.getWriteOffStatus());
+        wrapper.orderByDesc("ap.status", "arf.payment_time", "arf.create_time");
         Page<AccountRequestFundsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         //赋值部门名称、归属公司名称
         List<AccountRequestFundsVo> records = page.getRecords();
-        if(ObjectUtil.isEmpty(records)){
+        if (ObjectUtil.isEmpty(records)) {
             return page;
         }
 
@@ -105,51 +100,54 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
         for (AccountRequestFundsVo record : records) {
             //赋值部门信息
             List<SysDept> sysDepts = sysDeptMap.get(record.getDepartmentId());
-            if (ObjectUtil.isNotEmpty(sysDepts)){
+            if (ObjectUtil.isNotEmpty(sysDepts)) {
                 record.setDeptName(sysDepts.get(0).getDeptName());
             }
 
             //赋值公司信息
             List<Corporation> corporations = corporationMap.get(record.getCorporationId());
-            if (ObjectUtil.isNotEmpty(corporations)){
+            if (ObjectUtil.isNotEmpty(corporations)) {
                 record.setCorporationName(corporations.get(0).getName());
             }
 
             //赋值流程ID
             List<FlowExample> flowInfoList = flowInfoMap.get(record.getId());
-            if (ObjectUtil.isEmpty(flowInfoList)){
+            if (ObjectUtil.isEmpty(flowInfoList)) {
                 throw new ServiceException("数据有误:该请款没有找到流程详情信息信息");
             }
             record.setFlowInfoId(flowInfoList.get(0).getId());
         }
 
         // 赋值用户名称
-        UserUtil.assignmentNickName(records, BasePo::getCreateUser,AccountRequestFundsVo::setUserName);
+        UserUtil.assignmentNickName(records, BasePo::getCreateUser, AccountRequestFundsVo::setUserName);
         DynamicDataSourceContextHolder.poll();
         return page;
     }
 
     /**
      * 查询请款详情
+     *
      * @param id
      * @return
      */
     @Override
-    public AccountRequestFundsVo detail(Long id){
+    public AccountRequestFundsVo detail(Long id) {
         AccountRequestFunds accountRequestFunds = this.getById(id);
         AccountRequestFundsVo accountRequestFundsVo = BeanUtil.toBean(accountRequestFunds, AccountRequestFundsVo.class);
 
         //获取到请款明细信息
-        List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDetailService
-                .list(Wrappers.<AccountRequestFundsDetail>lambdaQuery()
-                        .eq(AccountRequestFundsDetail::getAccountRequestFundsId, accountRequestFunds.getId()));
-        accountRequestFundsVo.setAccountRequestFundsDetailList(accountRequestFundsDetailList);
+//        List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDetailService
+//                .list(Wrappers.<AccountRequestFundsDetail>lambdaQuery()
+//                        .eq(AccountRequestFundsDetail::getAccountRequestFundsId, accountRequestFunds.getId()));
+        List<AccountRequestFundsDetailVo> accountRequestFundsDetailVos =
+                accountRequestFundsDetailService.listByAccountRequestFundsId(accountRequestFunds.getId());
+        accountRequestFundsVo.setAccountRequestFundsDetailList(accountRequestFundsDetailVos);
 
         //切换数据源
         DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
         //查询归属公司的名称
         Corporation corporation = corporationService.getById(accountRequestFundsVo.getCorporationId());
-        if (ObjectUtil.isEmpty(corporation)){
+        if (ObjectUtil.isEmpty(corporation)) {
             throw new ServiceException("没有找到归属公司信息");
         }
         accountRequestFundsVo.setCorporationName(corporation.getName());
@@ -158,10 +156,12 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
         DynamicDataSourceContextHolder.push(SourceConstant.BASE);
         //查询部门名称信息
         SysDept sysDept = sysDeptService.getById(accountRequestFundsVo.getDepartmentId());
-        if (ObjectUtil.isEmpty(sysDept)){
+        if (ObjectUtil.isEmpty(sysDept)) {
             throw new ServiceException("没有找到归属部门信息");
         }
         accountRequestFundsVo.setDeptName(sysDept.getDeptName());
+        //赋值合同编号
+
         return accountRequestFundsVo;
     }
 

+ 10 - 0
hx-account/src/main/resources/mapper/account/AccountRequestFundsDetailMapper.xml

@@ -28,4 +28,14 @@
             t1.contract_id = #{contractId}
           AND t3.`status` = 20
     </select>
+    <select id="listByAccountRequestFundsId" resultType="com.fjhx.account.entity.account.vo.AccountRequestFundsDetailVo">
+        SELECT
+            arfd.*,
+            c.`code` contractCode
+        FROM
+            account_request_funds_detail arfd
+                LEFT JOIN bytesailing_sale.contract c ON arfd.contract_id
+        WHERE
+            arfd.account_request_funds_id = #{accountRequestFundsId}
+    </select>
 </mapper>