Просмотр исходного кода

账户管理--A-B-C数据展示

ZhangWenQiang 5 лет назад
Родитель
Сommit
fdb91ca0cf

+ 2 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgaccount/mapper/HlgAccountDetailMapper.java

@@ -44,4 +44,6 @@ public interface HlgAccountDetailMapper extends BaseMapper<HlgAccountDetail> {
     List<HlgAccountDetail> findRechargeExportList(@Param("hlgAccountDetail") HlgAccountDetailExport hlgAccountDetailExport, @Param(Constants.WRAPPER) QueryWrapper<HlgAccountDetailExport> queryWrapper);
 
     List<HlgAccountDetail> findPaymentExportList(@Param("hlgAccountDetail") HlgAccountDetailExport hlgAccountDetailExport, @Param(Constants.WRAPPER) QueryWrapper<HlgAccountDetailExport> queryWrapper);
+
+    List<HlgAccountDetail> findManagerListA_B(Page<HlgAccountDetail> pageList, @Param("hlgAccountDetail") HlgAccountDetail hlgAccountDetail, @Param(Constants.WRAPPER) QueryWrapper<HlgAccountDetail> queryWrapper);
 }

+ 31 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgaccount/mapper/xml/HlgAccountDetailMapper.xml

@@ -588,4 +588,35 @@
         ORDER BY a.generate_time DESC, a.id ASC
     </select>
 
+
+    <select id="findManagerListA_B" resultType="org.jeecg.modules.hlgaccount.entity.HlgAccountDetail" >
+        SELECT
+        a.id AS "id",
+        a.cp_account_id AS "accountId",
+        a.payment_id AS "paymentId",
+        a.type AS "type",
+        a.total_amount AS "totalAmount",
+        a.amount AS "amount",
+        a.service_rate AS "serviceRate",
+        a.service_fee AS "serviceFee",
+        1 AS "isThroughPlatform",
+        a.is_drawback AS "isDrawback",
+        a.sys_org_code AS "sysOrgCode",
+        a.is_display AS "isDisplay",
+        a.generate_time AS "generateTime",
+        a.generate_by AS "generateBy",
+        p.payment_code AS "paymentCode"
+        FROM hlg_cp_account_detail a
+        LEFT JOIN hlg_payment p ON p.id = a.payment_id
+        <where>
+            1=1
+            and a.is_display = '1'
+            and a.generate_time > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
+            <if test="hlgAccountDetail.accountId != null ">
+                and a.cp_account_id = #{hlgAccountDetail.accountId}
+            </if>
+
+        </where>
+        ORDER BY a.generate_time DESC,a.id ASC
+    </select>
 </mapper>

+ 27 - 5
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgaccount/service/impl/HlgAccountDetailServiceImpl.java

@@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -134,9 +135,9 @@ public class HlgAccountDetailServiceImpl extends ServiceImpl<HlgAccountDetailMap
         Double paymentMoney = 0.00;
         for (HlgAccountDetail hlgAccountDetail2 : allList2) {
             //打回的付款单做减法处理
-            if(hlgAccountDetail2.getType() == 2){
+            if (hlgAccountDetail2.getType() == 2) {
                 paymentMoney = businessAccountUtils.sub(paymentMoney, hlgAccountDetail2.getAmount());
-            }else{
+            } else {
                 paymentMoney = businessAccountUtils.add(paymentMoney, hlgAccountDetail2.getAmount());
             }
         }
@@ -175,9 +176,9 @@ public class HlgAccountDetailServiceImpl extends ServiceImpl<HlgAccountDetailMap
         Double paymentMoney = 0.00;
         for (HlgAccountDetail hlgAccountDetail2 : allList2) {
             //打回的付款单做减法处理
-            if(hlgAccountDetail2.getType() == 2){
+            if (hlgAccountDetail2.getType() == 2) {
                 paymentMoney = businessAccountUtils.sub(paymentMoney, hlgAccountDetail2.getAmount());
-            }else{
+            } else {
                 paymentMoney = businessAccountUtils.add(paymentMoney, hlgAccountDetail2.getAmount());
             }
         }
@@ -334,7 +335,28 @@ public class HlgAccountDetailServiceImpl extends ServiceImpl<HlgAccountDetailMap
      */
     @Override
     public Page<HlgAccountDetail> pageManagerList(Page<HlgAccountDetail> pageList, HlgAccountDetail hlgAccountDetail, QueryWrapper<HlgAccountDetail> queryWrapper) {
-        return pageList.setRecords(baseMapper.findManagerList(pageList, hlgAccountDetail, queryWrapper));
+        List<HlgAccountDetail> list = new ArrayList<>();
+        //判断是否是平台服务商(A-B)
+        if (hlgAccountDetail.getAccountId() == 0) {
+            //获取当前登录用户
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            QueryWrapper<HlgCompany> queryWrapper1 = new QueryWrapper<>();
+            queryWrapper1.eq("sys_org_code", sysUser.getOrgCode());
+            HlgCompany hlgCompany = hlgCompanyService.getOne(queryWrapper1);
+            //A-B账户
+            QueryWrapper<HlgCpAccount> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("company_id", hlgCompany.getId());
+            HlgCpAccount hlgCpAccount = hlgCpAccountService.getOne(queryWrapper2);
+            hlgAccountDetail.setAccountId(hlgCpAccount.getId());
+            list = baseMapper.findManagerListA_B(pageList, hlgAccountDetail, queryWrapper);
+        } else {
+            list = baseMapper.findManagerList(pageList, hlgAccountDetail, queryWrapper);
+        }
+        for (HlgAccountDetail hlgAccountDetail1 : list) {
+            String remark = switchRemark(hlgAccountDetail1);
+            hlgAccountDetail1.setRemark(remark);
+        }
+        return pageList.setRecords(list);
     }
 
 

+ 43 - 1
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgaccount/service/impl/HlgAccountServiceImpl.java

@@ -9,8 +9,14 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.hlgaccount.entity.HlgAccount;
 import org.jeecg.modules.hlgaccount.mapper.HlgAccountMapper;
 import org.jeecg.modules.hlgaccount.service.IHlgAccountService;
+import org.jeecg.modules.hlgcompany.entity.HlgCompany;
 import org.jeecg.modules.hlgcompany.entity.HlgCompanySubcontractor;
+import org.jeecg.modules.hlgcompany.service.IHlgCompanyService;
 import org.jeecg.modules.hlgcompany.service.IHlgCompanySubcontractorService;
+import org.jeecg.modules.hlgcpmanager.entity.HlgCpAccount;
+import org.jeecg.modules.hlgcpmanager.entity.HlgCpSetting;
+import org.jeecg.modules.hlgcpmanager.service.IHlgCpAccountService;
+import org.jeecg.modules.hlgcpmanager.service.IHlgCpSettingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -28,6 +34,12 @@ public class HlgAccountServiceImpl extends ServiceImpl<HlgAccountMapper, HlgAcco
 
     @Autowired
     private IHlgCompanySubcontractorService hlgCompanySubcontractorService;
+    @Autowired
+    private IHlgCompanyService hlgCompanyService;
+    @Autowired
+    private IHlgCpAccountService hlgCpAccountService;
+    @Autowired
+    private IHlgCpSettingService hlgCpSettingService;
 
 
     @Override
@@ -79,7 +91,37 @@ public class HlgAccountServiceImpl extends ServiceImpl<HlgAccountMapper, HlgAcco
     public List<HlgAccount> myCompanyList(HlgAccount hlgAccount) {
         //获取当前登录用户
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        /**
+         * 1、A-C的企业
+         */
         hlgAccount.setSysOrgCode(sysUser.getOrgCode());
-        return baseMapper.findMyCompanyList(hlgAccount);
+        List<HlgAccount> list = baseMapper.findMyCompanyList(hlgAccount);
+        /**
+         * 企业通过平台的,添加A-B的企业
+         */
+        QueryWrapper<HlgCompany> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("sys_org_code", sysUser.getOrgCode());
+        HlgCompany hlgCompany = hlgCompanyService.getOne(queryWrapper);
+        if (hlgCompany.getIsCpOn() == 1) {
+            //A-B账户
+            QueryWrapper<HlgCpAccount> queryWrapper1 = new QueryWrapper<>();
+            queryWrapper1.eq("company_id", hlgCompany.getId());
+            HlgCpAccount hlgCpAccount = hlgCpAccountService.getOne(queryWrapper1);
+            //平台服务商信息
+            HlgCompany hlgCompanyB = hlgCompanyService.getById(hlgCpAccount.getCpCompanyId());
+            //new一个账户对象,用于存放A-B数据
+            HlgAccount hlgAccount1 = new HlgAccount();
+            //区别于A-C的account表
+            hlgAccount1.setId(0);
+            hlgAccount1.setSubcontractorName(hlgCompanyB.getCompanyName());
+            hlgAccount1.setBalance(hlgCpAccount.getBalance());
+            hlgAccount1.setIsLock(hlgCompanyB.getIsLock() == 0 ? 1 : 0);
+            hlgAccount1.setServiceRate(hlgCompany.getCpServiceRate());
+            //区别于A-C的account表
+            hlgAccount1.setSubcontractorId(hlgCompanyB.getId());
+            hlgAccount1.setCompanyId(hlgCompany.getId());
+            list.add(hlgAccount1);
+        }
+        return list;
     }
 }

+ 2 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/service/impl/HlgPaymentServiceImpl.java

@@ -465,6 +465,7 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
         hlgAccountDetail.setAmount(hlgPayment.getTotalPayment());
         hlgAccountDetail.setIsDisplay(1);
         hlgAccountDetail.setIsDrawback(0);
+        hlgAccountDetail.setIsThroughPlatform(1);
         hlgAccountDetail.setGenerateTime(new Date());
         hlgAccountDetail.setGenerateBy(sysUser.getUsername());
         hlgAccountDetailService.save(hlgAccountDetail);
@@ -1162,6 +1163,7 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
         hlgAccountDetail.setAmount(hlgPaymentDetail.getPayment());
         hlgAccountDetail.setIsDisplay(1);
         hlgAccountDetail.setIsDrawback(0);
+        hlgAccountDetail.setIsThroughPlatform(1);
         hlgAccountDetail.setGenerateTime(new Date());
         hlgAccountDetail.setGenerateBy(sysUser.getUsername());
         hlgAccountDetailService.save(hlgAccountDetail);