Ver código fonte

1.平台结算bug修改1.0

wuhp 2 anos atrás
pai
commit
e7e766c6b8

+ 8 - 3
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -15,6 +15,7 @@ import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -82,9 +83,13 @@ public class InsPlyIncomeController extends BaseController {
     }
     @PostMapping("/totalAmount")
     @ApiModelProperty(value = "平台手续费合计金额")
-    public HttpResult<InsPlyIncome>totalAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo){
-        InsPlyIncome  result = insPlyIncomeService.totalAmount(insPlyIncomeVo);
-        return  HttpResult.ok(result);
+    public HttpResult<HashMap<String,Object>>totalAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo){
+        if(!CollectionUtils.isEmpty(insPlyIncomeVo.getSelectIds())){
+            HashMap<String,Object>  result = insPlyIncomeService.totalAmount(insPlyIncomeVo.getSelectIds());
+            return  HttpResult.ok(result);
+        }else {
+            return HttpResult.ok();
+        }
     }
     @PostMapping("/totalPinAmount")
     @ApiModelProperty(value = "平台结算未结算接口")

+ 1 - 1
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -85,7 +85,7 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
 
     List<InsPlyIncome> NonSettlementQuery(HashMap<String, Object> params);
 
-    InsPlyIncome totalAmount(HashMap<String, Object> params);
+    HashMap<String,Object> totalAmount(HashMap<String,Object> params);
 
     List<InsPlyIncome> totalPinAmount(HashMap<String, Object> params);
 

+ 5 - 0
src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java

@@ -296,6 +296,11 @@ public class InsPlyIncome implements Serializable {
     private String partnerCompaniesName;
 
 
+    @ApiModelProperty("被保人名称")
+    @TableField("insured_name")
+    private String insuredName;
+
+
     @ApiModelProperty("总单数")
     @TableField(exist = false)
     private String totalorders;

+ 1 - 1
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -55,7 +55,7 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
 
     HttpResult<InsPlyIncome> insertByEntity(InsPlyIncomeVo insPlyIncomeVo);
 
-    InsPlyIncome totalAmount(InsPlyIncomeVo insPlyIncomeVo);
+    HashMap<String,Object> totalAmount(List<String> selectIds);
 
     HttpResult<Object> batchPinBalance(InsPlyIncomeVo insPlyIncomeVo);
 

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

@@ -213,6 +213,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setIsNotDocumentary("0");
         insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoSuperviseCostsPremiums());
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
+        insPlyIncome.setInsuredName(order.getInsuredname());
         insPlyIncome.setNoPremium(insFeeOrderNew.getNoPremium()); //非车保费
         insPlyIncome.setNoNoTaxPremium(insFeeOrderNew.getNoNoTaxPremium());  //非车不含税保费
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
@@ -260,6 +261,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setSyOtherCostsPremium(insFeeOrderNew.getSyOtherCostsPremiums());
         insPlyIncome.setJqOtherCostsPremium(insFeeOrderNew.getJqOtherCostsPremiums());
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
+        insPlyIncome.setInsuredName(order.getInsuredname());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
 
         baseMapper.insert(insPlyIncome);
@@ -284,6 +286,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         this.saveRiskCode(order.getProductid(),insPlyIncome);
         insPlyIncome.setTaxPremium(allTaxPremium);
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
+        insPlyIncome.setInsuredName(order.getInsuredname());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
         baseMapper.insert(insPlyIncome);
     }
@@ -347,6 +350,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setSyOtherCostsProportion(insFeeOrderNew.getSyOtherCostsProportion());  //商业跟单费比例
         insPlyIncome.setNoOtherCostsProportion(insFeeOrderNew.getNoOtherCostsProportion());  //非车跟单费比例
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
+        insPlyIncome.setInsuredName(order.getInsuredname());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
         baseMapper.insert(insPlyIncome);
     }
@@ -426,36 +430,30 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }
     }
     @Override
-    public InsPlyIncome totalAmount(InsPlyIncomeVo insPlyIncomeVo) {
+    public HashMap<String,Object> totalAmount(List<String> selectIds) {
         HashMap<String, Object> params = new HashMap<>();
-        params = this.saveParams(insPlyIncomeVo, params);
-        InsPlyIncome totalledAmount =baseMapper.totalAmount(params);  //总金额
-        params.put("handlingFeesStatus","0");
-        InsPlyIncome noTotalAmount =baseMapper.totalAmount(params);
-        if(ObjectUtils.isNotEmpty(totalledAmount) && ObjectUtils.isNotEmpty(noTotalAmount)){
-            totalledAmount.setReadyTotalFeevalue(noTotalAmount.getTotalFeevalue());
-            totalledAmount.setReadyCommissionFeevalue(noTotalAmount.getCommissionFeevalue());
-            totalledAmount.setReadyOtherFeevalue(noTotalAmount.getOtherFeevalue());
-            return totalledAmount;
-        }
-
-        return  new InsPlyIncome();
+        params.put("selectIds",selectIds);
+        HashMap<String,Object>  resultMap  =baseMapper.totalAmount(params);
+        return  resultMap;
     }
 
     @Override
     @Transactional
     public HttpResult<Object> batchPinBalance(InsPlyIncomeVo insPlyIncomeVo) {
 
-            HashMap<String, Object> params = new HashMap<>();
-            List<InsPlyIncome> list= this.baseMapper.queryNew(params);
-            for (InsPlyIncome item : list) {
-                item.setHandlingFeesStatus("1");
-                item.setSettlementTime(LocalDate.now());
-                baseMapper.updateById(item);
+        if(!CollectionUtils.isEmpty(insPlyIncomeVo.getSelectIds())){
+            List<String> selectIds = insPlyIncomeVo.getSelectIds();
+            for(String  id: selectIds){
+                InsPlyIncome insPlyIncome = new InsPlyIncome();
+                insPlyIncome.setHandlingFeesStatus("1");
+                insPlyIncome.setSettlementTime(LocalDate.now());
+                insPlyIncome.setId(id);
+                baseMapper.updateById(insPlyIncome);
             }
+        }
             SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
             settlementDocumentaryLogEntity.setIds(insPlyIncomeVo.getIds());
-            settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
+//          settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
             settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue());  //跟单费金额
             settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getCommissionFeevalue());  //手续费金额
             settlementDocumentaryLogEntity.setCreateTime(new Date());
@@ -523,7 +521,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             params.put("handlingFeesStatus",insPlyIncomeVo.getHandlingFeesStatus());
         }
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getPartnerCompaniesId())){
-            params.put("partnerCompaniesId",insPlyIncomeVo.getHandlingFeesStatus());
+            params.put("partnerCompaniesId",insPlyIncomeVo.getPartnerCompaniesId());
         }
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
             params.put("year",insPlyIncomeVo.getYear());
@@ -543,6 +541,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyName())){
             params.put("companyName",insPlyIncomeVo.getCompanyName());
         }
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getInsuredName())){
+            params.put("insuredName",insPlyIncomeVo.getInsuredName());
+        }
         return params;
     }
 
@@ -1033,10 +1034,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Transactional
     public void uodateBalance(InsPlyIncomeVo insPlyIncomeVo) {
         InsPlyIncome insPlyIncome = new InsPlyIncome();
-        insPlyIncomeVo.setHandlingFeesStatus("1");
+            insPlyIncomeVo.setHandlingFeesStatus("1");
         insPlyIncomeVo.setSettlementTime(LocalDate.now());
         BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
-        baseMapper.uopdateByOrderno(insPlyIncome);
+        baseMapper.updateById(insPlyIncome);
 
 //        生成记录
         SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
@@ -1328,7 +1329,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     public InsPlyIncome bxTotalAmount(InsPlyIncomeVo insPlyIncomeVo) {
         HashMap<String, Object> params = new HashMap<>();
         params = this.saveParams(insPlyIncomeVo, params);
-        params.remove("handlingFeesStatus");
         InsPlyIncome totalledAmount =baseMapper.bxTotalAmount(params);  //总金额
         return totalledAmount;
     }

+ 8 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -18,6 +18,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  * <p>
@@ -253,4 +254,11 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty("非车跟单比例")
     private BigDecimal noOtherCostsProportion;
 
+
+    @ApiModelProperty("被保人名称")
+    private String insuredName;
+
+    @ApiModelProperty("选择ids")
+    private List<String> selectIds;
+
 }

+ 17 - 6
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -67,6 +67,7 @@
         <result column="partner_companies_id" property="partnerCompaniesId"/>
         <result column="partner_companies_name" property="partnerCompaniesName"/>
         <result column="receivable_amount" property="receivableAmount"/>
+        <result column="insured_name" property="insuredName"/>
     </resultMap>
     <sql id="income_com">
                 a.id      as  "id",
@@ -130,6 +131,7 @@
                 a.company_name  as  "companyName",
                 a.receivable_amount  as  "receivableAmount",
                 a.invoic_time  as  "invoicTime",
+                a.insured_name  as  "insuredName",
                 a.user_id  as  "userId",
                 a.create_time  as  "createTime"
     </sql>
@@ -181,7 +183,6 @@
                 </if>
                 <if test="licenseno != null and licenseno != ''">
                     and a.licenseno  =#{licenseno}
-
                 </if>
 
                 <if test="policyno != null and policyno != ''  and policyno.length > 0">
@@ -236,6 +237,9 @@
                 <if test="day !=null  and  day !=''">
                     AND day(a.signdate) =#{day}
                 </if>
+                <if test="insuredName !=null  and  insuredName !=''">
+                    a.insured_name =#{insuredName}
+                </if>
             </where>
     </select>
 
@@ -388,12 +392,12 @@
         </where>
     </select>
 
-    <select id="totalAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+    <select id="totalAmount" resultType="java.util.HashMap">
             select
-                sum(a.commission_feevalue) as "commissionFeevalue",
-                sum(a.other_feevalue)  as "otherFeevalue",
-                SUM(a.commission_feevalue + a.other_feevalue) as "totalFeevalue"
-            from  ins_ply_income a
+                COALESCE( sum(a.commission_feevalue),0) as "commissionFeevalue",
+                COALESCE(sum(a.other_feevalue),0)   as "otherFeevalue",
+                COALESCE(SUM(COALESCE(a.commission_feevalue, 0) + COALESCE(a.other_feevalue, 0)), 0) AS "totalFeevalue"
+        from  ins_ply_income a
             LEFT JOIN   ptl_agreement  pa  on pa.id= a.agreement_id
             <where>
                 1=1
@@ -421,6 +425,13 @@
                     and a.documentary_fees_status =#{documentaryFeesStatus}
                 </if>
 
+                <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
+                    and a.id in
+                    <foreach collection="selectIds" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+
                 <if test="isNotCar !=null  and  isNotCar  !=''">
                     and a.is_not_car =#{isNotCar}
                 </if>

BIN
src/main/resources/template/handlingFeeTemplate.xlsx


BIN
src/main/resources/template/noHandlingFeeTemplate.xlsx