Bläddra i källkod

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

Qchen 2 år sedan
förälder
incheckning
e365f379e7

+ 1 - 1
src/main/java/com/ydtech/modules/admin/model/dto/MyCollectInAdvanceDto.java

@@ -51,7 +51,7 @@ public class MyCollectInAdvanceDto {
     /***
      * 创建时间
      */
-    @ApiModelProperty(value = "创建时间")
+    @ApiModelProperty(value = "支出时间")
     private String   createTime;
 
     /***

+ 12 - 2
src/main/java/com/ydtech/modules/admin/service/impl/SysAmountAuditingServiceImpl.java

@@ -99,6 +99,7 @@ public class SysAmountAuditingServiceImpl extends ServiceImpl<SysAmountAuditingM
                 sysUserAccount.setSumAmountAccount((sysUserAccount.getSumAmountAccount()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountAccount()).add(amount));
                 //支付中的金额 = 原先的支付金额 -去提现的金额
                 sysUserAccount.setSumAmountPayment((sysUserAccount.getSumAmountPayment()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountPayment()).subtract(amount));
+
                 sysUserAccountService.updateById(sysUserAccount);
             }
             sysAmountAuditingVo.setAuditingStatus("3");
@@ -231,14 +232,23 @@ public class SysAmountAuditingServiceImpl extends ServiceImpl<SysAmountAuditingM
         //提现人
         String userId = sysAmountAuditingEntity.getUserId();
 //      用户回退金额
+        BigDecimal beforeAmount;
+        BigDecimal afterAmount;
         if (StringUtils.isNotEmpty(userId)) {
             //提现人账户
             SysUserAccount sysUserAccount = sysUserAccountService.getById(userId);
             if (ObjectUtils.isNotEmpty(sysUserAccount)) {
+                //提现前的金额
+                beforeAmount = sysUserAccount.getSumAmount()==null?BigDecimal.ZERO:sysUserAccount.getSumAmount();
+                //提现后的金额
+                afterAmount = beforeAmount.add(amount);
+                sysUserAccount.setSumAmount(afterAmount);
+                //提现的总金额 = 原先的提现总金额 - 提现的金额
+                sysUserAccount.setSumAmountWithdrawal((sysUserAccount.getSumAmountWithdrawal()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountWithdrawal().subtract(amount)));
+                //支付中的金额 = 原先的支付金额 -去提现的金额
+                sysUserAccount.setSumAmountPayment((sysUserAccount.getSumAmountPayment()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountPayment()).subtract(amount));
                 //已到账金额 =  原先的到账金额- 已到账的金额
                 sysUserAccount.setSumAmountAccount((sysUserAccount.getSumAmountAccount()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountAccount()).subtract(amount));
-                //支付中的金额 = 原先的支付金额 +去提现的金额
-                sysUserAccount.setSumAmountPayment((sysUserAccount.getSumAmountPayment()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountPayment()).add(amount));
                 sysUserAccountService.updateById(sysUserAccount);
             }
             sysAmountAuditingEntity.setAuditingStatus("4");

+ 46 - 17
src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java

@@ -129,6 +129,10 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
             sysUserAccountEntity.setPromotionAmountWithdrawal(zero);
             sysUserAccountEntity.setPromotionAmountAccount(zero);
             sysUserAccountEntity.setPromotionAmountPayment(zero);
+            sysUserAccountEntity.setSumAmount(zero);
+            sysUserAccountEntity.setSumAmountWithdrawal(zero);
+            sysUserAccountEntity.setSumAmountAccount(zero);
+            sysUserAccountEntity.setSumAmountPayment(zero);
             sysUserAccountEntity.setCreateTime(new Date());
             if (StringUtils.isNotEmpty(sysUserAccount.getDocumentaryStatus())) {
                 sysUserAccountEntity.setDocumentaryStatus(sysUserAccount.getDocumentaryStatus());
@@ -138,7 +142,11 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
             baseMapper.insert(sysUserAccountEntity);
         }
         StringBuilder commissionMessage = new StringBuilder();
+        BigDecimal beforeAmount;
+        BigDecimal afterAmount;
         if (StringUtils.isNotEmpty(sysUserAccount.getDocumentaryStatus())) {
+            //提现前的金额
+            beforeAmount = sysUserAccountEntity.getSumAmount()==null?BigDecimal.ZERO:sysUserAccountEntity.getSumAmount();
 //          判断是否是一级二级三级
             SysUserAccountHistory sysUserAccountHistory = new SysUserAccountHistory();
             sysUserAccountHistory.setUserId(sysUserAccount.getUserId());
@@ -176,25 +184,33 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
                 sysUserAccountHistory.setProperty(MoneyAttrConstants.M_3.getCode());
                 commissionMessage.append(MoneyAttrConstants.M_3.getDesc() + ":" + sysUserAccount.getPromotion() + "元    ");
                 if (WithdrawTypeConstants.WT_2.getCode().equals(sysUserAccount.getDocumentaryStatus())) { // 收入  相加
-                    sysUserAccountHistory.setSurplusAmount(sysUserAccountEntity.getPromotion());
+                    //提现后的金额
+                    afterAmount = beforeAmount.subtract(sysUserAccount.getPromotion());
+                    sysUserAccountHistory.setSurplusAmount(afterAmount); //改变后金额
+                    sysUserAccountHistory.setUserAmount(beforeAmount); //改变前金额
                 }
                 sysUserAccountHistory.setBusinessSegmentsType(1);
                 sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
 
             }
-            //历史记录表添加收费+跟单费用  add by hxl   2024-06-18
-            if(sysUserAccount.getDocumentary() != null && sysUserAccount.getDocumentary().compareTo(BigDecimal.ZERO) != 0  ||  sysUserAccount.getPromotion() != null && sysUserAccount.getPromotion().compareTo(BigDecimal.ZERO) != 0 ){
-                BigDecimal sum = (sysUserAccount.getDocumentary()==null?BigDecimal.ZERO:sysUserAccount.getDocumentary())
-                        .add(sysUserAccount.getPromotion()==null?BigDecimal.ZERO:sysUserAccount.getPromotion());
+            //手续费+跟单费用
+            BigDecimal amount_SX_GD=BigDecimal.ZERO;
+            amount_SX_GD= amount_SX_GD.add(sysUserAccount.getHandlingFee()==null?BigDecimal.ZERO:sysUserAccount.getHandlingFee())
+                    .add(sysUserAccount.getDocumentary()==null?BigDecimal.ZERO:sysUserAccount.getDocumentary());
+            //历史记录表添加手续费+跟单费用  add by hxl   2024-06-18
+            if(amount_SX_GD.compareTo(BigDecimal.ZERO) != 0){
                 sysUserAccountHistory.setId(null);
-                sysUserAccountHistory.setAmount(sum);
+                sysUserAccountHistory.setAmount(amount_SX_GD);
                 sysUserAccountHistory.setProperty(MoneyAttrConstants.M_4.getCode());
                 if (WithdrawTypeConstants.WT_2.getCode().equals(sysUserAccount.getDocumentaryStatus())) { // 收入  相加
-                    sysUserAccountHistory.setSurplusAmount(sum);
+
+                    afterAmount = beforeAmount.subtract(amount_SX_GD);
+                    sysUserAccountHistory.setSurplusAmount(afterAmount); //改变后金额
+                    sysUserAccountHistory.setUserAmount(beforeAmount); //改变前金额
+                    sysUserAccountHistory.setSurplusAmount(sysUserAccountEntity.getSumAmount());
                     sysUserAccountHistory.setBusinessSegmentsType(1);
                     sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
                 }
-
             }
         }
         //添加佣金消息
@@ -337,8 +353,10 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
 //       用户当前金额
         BigDecimal amount = sysUserAccountVo.getAmount();
         SysUserAccountHistory sysUserAccountHistory = new SysUserAccountHistory();  // 记录
-        sysUserAccountHistory.setDocumentary(1);  // 1提现
+        sysUserAccountHistory.setDocumentary(1);  // 1支出
         sysUserAccountHistory.setUserId(userId);
+        sysUserAccountHistory.setProperty(3); //3提现
+        sysUserAccountHistory.setBusinessSegmentsType(1);
         SysAmountAuditingEntity sysAmountAuditingEntity = new SysAmountAuditingEntity();//审核记录表
         sysAmountAuditingEntity.setUserId(userId);
         sysAmountAuditingEntity.setAmount(sysUserAccountVo.getAmount());
@@ -364,8 +382,8 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
             SysUserAccount sysUserAccount = baseMapper.getById(userId);
 
 
-            if (StringUtils.isNotEmpty(sysUserAccountVo.getAmountStatus())) {
-                sysUserAccountHistory.setProperty(Integer.valueOf(sysUserAccountVo.getAmountStatus()));   //金额类型
+            //if (StringUtils.isNotEmpty(sysUserAccountVo.getAmountStatus())) {
+                //sysUserAccountHistory.setProperty(Integer.valueOf(sysUserAccountVo.getAmountStatus()));   //金额类型
                 //注释掉类型提现,直接提现总金额
                 /**
                  if ("1".equals(sysUserAccountVo.getAmountStatus())) {
@@ -391,14 +409,14 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
                  }
                  **/
                 //提现前的金额
-                beforeAmount = sysUserAccount.getSumAmount();
+                beforeAmount = sysUserAccount.getSumAmount()==null?BigDecimal.ZERO:sysUserAccount.getSumAmount();
                 //提现后的金额
                 afterAmount = beforeAmount.subtract(amount);
                 sysUserAccount.setSumAmount(afterAmount);
                 //支付中总金额 = 原先的支付金额 + 提现的金额
-                sysUserAccount.setSumAmountPayment(sysUserAccount.getSumAmountPayment().add(amount));
+                sysUserAccount.setSumAmountPayment((sysUserAccount.getSumAmountPayment()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountPayment()).add(amount));
                 //提现的总金额 = 原先的提现总金额 + 提现的金额
-                sysUserAccount.setSumAmountWithdrawal(sysUserAccount.getSumAmountWithdrawal().add(amount));
+                sysUserAccount.setSumAmountWithdrawal((sysUserAccount.getSumAmountWithdrawal()==null?BigDecimal.ZERO:sysUserAccount.getSumAmountWithdrawal().add(amount)));
 
                 //              用户相差
                 if (beforeAmount.compareTo(zero) == 0 || afterAmount.compareTo(zero) < 0) {
@@ -415,7 +433,17 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
                 sysUserAccountHistory.setAuditiingId(sysAmountAuditingEntity.getId());
                 sysUserAccountService.updateById(sysUserAccount);
                 sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
-            }
+            //}
+            // 提现审核插入轨迹表   待审核数据 和审核处理中的数据
+
+            Calendar calendar = Calendar.getInstance();
+            Date date = calendar.getTime();
+            calendar.add(Calendar.MINUTE, 1);
+            Date afterDate = calendar.getTime();
+            SysAmountAuditingHistory sysAmountAuditingHistory =new SysAmountAuditingHistory(null, sysAmountAuditingEntity.getId(), amount, userId,date,"1", "1",sysUserAccountHistory.getId());
+            SysAmountAuditingHistory sysAmountAuditingHistoryTwo =new SysAmountAuditingHistory(null, sysAmountAuditingEntity.getId(), amount, userId,afterDate, "2", "1",sysUserAccountHistory.getId());
+            sysAmountAuditingHistoryService.save(sysAmountAuditingHistory);
+            sysAmountAuditingHistoryService.save(sysAmountAuditingHistoryTwo);
 
         }
         return HttpResult.ok("提现成功,等待审核");
@@ -944,7 +972,7 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
                 orderVoPage.setTotal(total);
 
                 sumAmountSR=sysUserAccountHistoryService.findSumAmount(myIncomeAndExpensesQueryDto);
-                sumAmountZC=sysUserAccountHistoryService.findSumAmountByUserId(myIncomeAndExpensesQueryDto.getUserId(),"2");
+                sumAmountZC=sysUserAccountHistoryService.findSumAmountByUserId(myIncomeAndExpensesQueryDto.getUserId(),"1");
                 List<MyCollectInAdvanceDto> recordsNew =new ArrayList<>();
                 if(orderVoPage.getRecords()!=null && orderVoPage.getRecords().size()>0){
                     for(MyCollectInAdvanceDto dto :orderVoPage.getRecords()){
@@ -982,7 +1010,8 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
                 myCollectInAdvanceDtoBasePageResult=new BasePageResult<>(myIncomeAndExpensesQueryDto.getPageNum(), myIncomeAndExpensesQueryDto.getPageSize(), orderVoPage.getTotal(),
                         orderVoPage.getPages()
                         , orderVoPage.getRecords());
-                sumAmountSR=sysUserAccountHistoryService.findSumAmountByUserId(myIncomeAndExpensesQueryDto.getUserId(),"1");
+                sumAmountSR=sysUserAccountHistoryService.findSumAmountByUserId(myIncomeAndExpensesQueryDto.getUserId(),"2");
+                sumAmountZC=sysUserAccountHistoryService.findSumAmount(myIncomeAndExpensesQueryDto);
             }
 
         } else {

+ 5 - 2
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -134,13 +134,14 @@ public class InsPlyIncomeController extends BaseController {
     @PutMapping("/batchInvoic")
     @ApiModelProperty(value = "开票跟单费")
     public HttpResult<Object> batchInvoic(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-
+        insPlyIncomeVo.setIsNotCar("0");  // 非车状态为1  保险为0
         return insPlyIncomeService.batchInvoic(insPlyIncomeVo);
     }
 
     @PutMapping("/singleInvoic")
     @ApiModelProperty(value = "批量开票跟单费")
     public HttpResult<Object> singleInvoic(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("0");  // 非车状态为1  保险为0
         return insPlyIncomeService.singleInvoic(insPlyIncomeVo);
     }
 
@@ -153,7 +154,7 @@ public class InsPlyIncomeController extends BaseController {
     @PutMapping("/batchSumBalance")
     @ApiModelProperty(value = "批次批量結算")
     public HttpResult<Object> batchSumBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-
+        insPlyIncomeVo.setIsNotCar("0");  // 非车状态为1  保险为0
         return insPlyIncomeService.batchSumBalance(insPlyIncomeVo);
     }
 
@@ -344,6 +345,7 @@ public class InsPlyIncomeController extends BaseController {
     @PutMapping("/batchInvoicing")
     @ApiModelProperty(value = "保险手续费批量开票")
     public HttpResult<Object> batchInvoicing(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("0");  // 保险手续费0
         return insPlyIncomeService.batchInvoicing(insPlyIncomeVo);
     }
 
@@ -362,6 +364,7 @@ public class InsPlyIncomeController extends BaseController {
     @PutMapping("/batchBxBalance")
     @ApiModelProperty(value = "保险批量结算")
     public HttpResult<Object> batchBxBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("0");  // 非车状态为1  保险为0
         return insPlyIncomeService.batchBxBalance(insPlyIncomeVo);
     }
 

+ 58 - 0
src/main/java/com/ydtech/modules/fnc/controller/InsPlyNoIncomeController.java

@@ -0,0 +1,58 @@
+package com.ydtech.modules.fnc.controller;
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.fnc.service.ImportAsyncService;
+import com.ydtech.modules.fnc.service.InsPlyIncomeService;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(tags = "非车保司费用")
+@RequestMapping("/fnc/noPlyFee")
+public class InsPlyNoIncomeController {
+
+    @Autowired
+    private InsPlyIncomeService insPlyIncomeService;
+
+    @PutMapping("/noBatchInvoicing")
+    @ApiModelProperty(value = "非车保险手续费批量开票")
+    public HttpResult<Object> batchInvoicing(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("1");  // 非车状态为1
+        return insPlyIncomeService.batchInvoicing(insPlyIncomeVo);
+    }
+
+    @PutMapping("/noBatchBxBalance")
+    @ApiModelProperty(value = "非车保险批量结算")
+    public HttpResult<Object> batchBxBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("1");  // 非车状态为1
+        return insPlyIncomeService.batchBxBalance(insPlyIncomeVo);
+    }
+    @PutMapping("/noBatchInvoic")
+    @ApiModelProperty(value = "非车开票跟单费")
+    public HttpResult<Object> batchInvoic(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("1");  // 非车状态为1
+        return insPlyIncomeService.batchInvoic(insPlyIncomeVo);
+    }
+
+    @PutMapping("/noSingleInvoic")
+    @ApiModelProperty(value = "批量开票跟单费")
+    public HttpResult<Object> singleInvoic(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("1");  // 非车状态为1
+        return insPlyIncomeService.singleInvoic(insPlyIncomeVo);
+    }
+
+    @PutMapping("/noBatchSumBalance")
+    @ApiModelProperty(value = "批次批量結算")
+    public HttpResult<Object> batchSumBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeVo.setIsNotCar("1");  // 非车状态为1
+        return insPlyIncomeService.batchSumBalance(insPlyIncomeVo);
+    }
+
+
+}

+ 3 - 5
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -166,15 +166,13 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                 BigDecimal totalOtherPremiumAmount = new BigDecimal(0);
                 totalOtherPremiumAmount =
                         totalOtherPremiumAmount.add(insFeeOrderNew.getJqExportOtherCostsPremiums()).add(insFeeOrderNew.getSyExportOtherCostsPremiums()).add(insFeeOrderNew.getNoExportOtherCostsPremiums());
-
-
                 //用戶
+                //算佣金
+                this.countUserAmount(insFeeOrderNew, insAreaCompany.getId());
                 sysUserAccount.setHandlingFee(totalPremiumAmount);
                 sysUserAccount.setDocumentary(totalOtherPremiumAmount);
-                //算佣金
-                this.countUserAmount(insFeeOrderNew, orderNo);
                 sysUserAccount.setDocumentaryStatus("2");  // 收入
-                sysUserAccount.setSuborderId(orderNo);  // 订单Id
+                sysUserAccount.setSuborderId(insAreaCompany.getId());  // 订单Id
                 sysUserAccountService.addOrUpdate(sysUserAccount);
                 if (insFeeOrderNew.getDistributionStatus() !=null) {
                     createInsFeeOrderNewDistribution(insFeeOrderNew, insAreaCompany, order, order.getUserid(),BigDecimal.ZERO, BigDecimal.ZERO, "0");

+ 3 - 11
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -1480,17 +1480,9 @@ handlingProportion,
                 }
             } else {
 //                因为跟单没有关联表 也无法关联到开票表所以只能按照 条件去进行判断
-                String partnerCompaniesId = insPlyIncome.getPartnerCompaniesId();   // 保司机构id
-                if (StringUtils.isEmpty(partnerCompaniesId)) {
-                    throw new SystemException("该单据没有保司机构id");
-                }
-                LambdaQueryWrapper<SettlementDocumentaryFeesEntity> queryWrapper = new LambdaQueryWrapper<>();
-                queryWrapper.eq(SettlementDocumentaryFeesEntity::getPartnerCompaniesId, partnerCompaniesId)
-                        .eq(SettlementDocumentaryFeesEntity::getSettlementStatus, "2");
-                List<SettlementDocumentaryFeesEntity> settlementDocumentaryFeesEntities = settlementDocumentaryFeesService.getBaseMapper().selectList(queryWrapper);
-                if (settlementDocumentaryFeesEntities.size() > 0) {
-                    throw new SystemException("已开票不能进行删除");
-                }
+               if(StringUtils.isNotEmpty( insPlyIncome.getSettleOtherStatus())  && "1".equals( insPlyIncome.getSettleOtherStatus())){
+                   throw new SystemException("已经对账不能进行删除");
+               }
             }
         }
         baseMapper.deleteById(insPlyIncomeVo.getId());   //删除 结算  然后删除结算表

+ 2 - 1
src/main/resources/mapper/modules/admin/SysUserAccountHistoryMapper.xml

@@ -111,7 +111,8 @@
             his.amount as "amount",
             business_eegments_type  as "businessSegmentsType",
             his.documentary as "incomeAndExpensesType",
-            his.property  as  "transactionType"
+            his.property  as  "transactionType",
+            his.create_time  as "createTime"
         FROM
             sys_user_account_history  his
             left join ins_area_company ins  on  his.suborder=ins.id

+ 14 - 6
src/main/resources/mapper/modules/admin/SysUserAccountMapper.xml

@@ -22,7 +22,11 @@
             <result property="promotionAmountWithdrawal" column="promotion_amount_withdrawal" jdbcType="DECIMAL"/>
             <result property="promotionAmountAccount" column="promotion_amount_account" jdbcType="DECIMAL"/>
             <result property="promotionAmountPayment" column="promotion_amount_payment" jdbcType="DECIMAL"/>
-            <collection property="sysUserAccountCardList" ofType="com.ydtech.modules.admin.model.po.SysUserBankCard"
+            <result property="sumAmount" column="sum_amount" jdbcType="DECIMAL"/>
+            <result property="sumAmountWithdrawal" column="sum_amount_withdrawal" jdbcType="DECIMAL"/>
+            <result property="sumAmountAccount" column="sum_amount_account" jdbcType="DECIMAL"/>
+            <result property="sumAmountPayment" column="sum_amount_payment" jdbcType="DECIMAL"/>
+        <collection property="sysUserAccountCardList" ofType="com.ydtech.modules.admin.model.po.SysUserBankCard"
                     resultMap="sysUserAccountCardList"/>
     </resultMap>
 
@@ -85,10 +89,10 @@
             a.promotion_amount_withdrawal as "promotionAmountWithdrawal",
             a.promotion_amount_account as "promotionAmountAccount",
             a.promotion_amount_payment as "promotionAmountPayment",
-            a.sum_amount  as "sumAmount",
-            a.sum_amount_withdrawal  as "sumAmountWithdrawal",
-            a.sum_amount_account  as  "sumAmountAccount",
-            a.sum_amount_payment  as  "sumAmountPayment"
+            ifnull(a.sum_amount,0)  as "sumAmount",
+            ifnull(a.sum_amount_withdrawal,0)  as "sumAmountWithdrawal",
+            ifnull(a.sum_amount_account,0) as  "sumAmountAccount",
+            ifnull(a.sum_amount_payment,0)  as  "sumAmountPayment"
         from  sys_user_account a
         <where>
             <if test="userId != null and userId != ''">
@@ -118,7 +122,11 @@
         sd.name  as  deptName,
         c.bank_number,
         c.bank_account,
-        c.bank_address
+        c.bank_address,
+        a.sum_amount,
+        a.sum_amount_withdrawal,
+        a.sum_amount_account,
+        a.sum_amount_payment
         from
         sys_user_account a
         left join   sys_user  b  on  a.user_id  = b.id

+ 24 - 19
src/main/resources/mapper/modules/ins/InsFeeOrderNewMapper.xml

@@ -551,14 +551,16 @@
         fee.licenseno,
         fee.amount,
         "1" as businessSegmentsType,
-        "2" as  transactionType
+        "2" as  transactionType,
+        fee.createtime
         FROM
         (
         SELECT
         a.ins_order_no as "subOrderNo",
         iac.signing_time as "signingTime",
         o.licenseno as "licenseno",
-        a.first_detail_premiums as "amount"
+        a.first_detail_premiums as "amount",
+        iac.createtime as ".createTime"
         FROM
         ins_fee_order_new a
         LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
@@ -571,7 +573,7 @@
                 AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         UNION
@@ -579,7 +581,8 @@
         a.ins_order_no as "subOrderNo",
         iac.signing_time as "signingTime",
         o.licenseno as "licenseno",
-        a.third_detail_premiums as "amount"
+        a.third_detail_premiums as "amount",
+        iac.createtime as ".createTime"
         FROM
         ins_fee_order_new a
         LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
@@ -592,7 +595,7 @@
                 AND a.three_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         UNION
@@ -600,7 +603,8 @@
         a.ins_order_no as "subOrderNo",
         iac.signing_time as "signingTime",
         o.licenseno as "licenseno",
-        a.second_detail_premiums as "amount"
+        a.second_detail_premiums as "amount",
+        iac.createtime as ".createTime"
         FROM
         ins_fee_order_new a
         LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
@@ -610,10 +614,10 @@
             iff.auditstatus=0
             and iac.orderstatus = '3'
             <if test="myCollectInAdvanceQueryDto.userId!=null and  myCollectInAdvanceQueryDto.userId!= ''">
-                AND a.two_level_user_id = #{userId}
+                AND a.two_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         ) AS fee
@@ -629,7 +633,8 @@
         (ifnull(a.jq_export_other_costs_premiums,0)+ifnull(a.sy_export_other_costs_premiums,0)+ifnull(a.no_export_other_costs_premiums,0))
         as "amount",
         "1" as businessSegmentsType,
-        "1" as  transactionType
+        "1" as  transactionType,
+        ins.createtime as ".createTime"
         from
         ins_fee_order_new a  left join ins_area_company ins  on  a.ins_order_no=ins.id
         left join  ins_orders o ON o.orderno=ins.orderno
@@ -639,7 +644,7 @@
             and  a.user_id = #{myCollectInAdvanceQueryDto.userId}
             and  iff.auditstatus=0
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND ins.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND ins.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
     </select>
@@ -665,7 +670,7 @@
                 AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         UNION
@@ -686,7 +691,7 @@
                 AND a.three_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         UNION
@@ -704,10 +709,10 @@
             iff.auditstatus=0
             and iac.orderstatus = '3'
             <if test="myCollectInAdvanceQueryDto.userId!=null and  myCollectInAdvanceQueryDto.userId!= ''">
-                AND a.two_level_user_id = #{userId}
+                AND a.two_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         ) AS fee
@@ -724,7 +729,7 @@
             and  a.user_id = #{myCollectInAdvanceQueryDto.userId}
             and  iff.auditstatus=0
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND ins.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND ins.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
     </select>
@@ -749,7 +754,7 @@
                 AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         UNION
@@ -766,7 +771,7 @@
                 AND a.three_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         UNION
@@ -783,7 +788,7 @@
                 AND a.two_level_user_id = #{myCollectInAdvanceQueryDto.userId}
             </if>
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and  myCollectInAdvanceQueryDto.endDate  !=''">
-                AND iac.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND iac.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
         ) AS fee
@@ -806,7 +811,7 @@
             and  a.user_id = #{myCollectInAdvanceQueryDto.userId}
             and  iff.auditstatus=0
             <if test="myCollectInAdvanceQueryDto.startDate!= null  and  myCollectInAdvanceQueryDto.startDate  !='' and myCollectInAdvanceQueryDto.endDate!= null  and myCollectInAdvanceQueryDto.endDate  !=''">
-                AND ins.signing_time  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
+                AND ins.createtime  BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
             </if>
         </where>
     </select>