Преглед изворни кода

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

wks пре 1 година
родитељ
комит
a365dd253b

+ 5 - 0
src/main/java/com/ydtech/modules/admin/model/dto/QxFrontlineAgentExcel.java

@@ -4,6 +4,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
+
 @Data
 public class QxFrontlineAgentExcel implements Serializable {
     @ExcelProperty(value = "姓名",index = 0)
@@ -33,4 +35,7 @@ public class QxFrontlineAgentExcel implements Serializable {
     @ExcelProperty(value = "单均保费",index = 8)
     private String averagePremium;
 
+    @ExcelProperty(value = "毛利润",index = 9)
+    private BigDecimal estimatedProfit;
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/dto/TaskStatisticsDto.java

@@ -174,4 +174,7 @@ public class TaskStatisticsDto {
     @ApiModelProperty(value = "总保司")
     private String insuranceCompanyNumber;
 
+    @ApiModelProperty(value = "机构来源")
+    private String managementSource;
+
 }

+ 22 - 1
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -213,6 +213,17 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
         page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
 
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getDays())){
+            if("7".equals(taskStatisticsVo.getDays())){
+                taskStatisticsVo.setDays("2");
+            } else if ("30".equals(taskStatisticsVo.getDays())) {
+                taskStatisticsVo.setDays("3");
+            }
+        }
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDays(), taskStatisticsVo.getBeginDate(), taskStatisticsVo.getEndDate());
+        taskStatisticsVo.setBeginDate(dateMapByType.get("startDate"));
+        taskStatisticsVo.setEndDate(dateMapByType.get("endDate"));
+
         IPage<TaskStatisticsDto> list = this.insAreaCompanyMapper.agentStatisticsQueryPage(page,taskStatisticsVo);
         Long total = this.insAreaCompanyMapper.agentStatisticsQueryPageTotal(taskStatisticsVo);
         if (list != null && !list.getRecords().isEmpty()) {
@@ -340,6 +351,16 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getDays())){
+            if("7".equals(taskStatisticsVo.getDays())){
+                taskStatisticsVo.setDays("2");
+            } else if ("30".equals(taskStatisticsVo.getDays())) {
+                taskStatisticsVo.setDays("3");
+            }
+        }
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDays(), taskStatisticsVo.getBeginDate(), taskStatisticsVo.getEndDate());
+        taskStatisticsVo.setBeginDate(dateMapByType.get("startDate"));
+        taskStatisticsVo.setEndDate(dateMapByType.get("endDate"));
         IPage<TaskStatisticsDto> list = this.insAreaCompanyMapper.queryPageElectric(page,taskStatisticsVo);
         if (list != null && !list.getRecords().isEmpty()) {
             List<TaskStatisticsDto> records = list.getRecords();
@@ -833,7 +854,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
 
-        HashMap<String, String> dateMapByType = getDateMapByType(taskStatisticsVo.getDateType(), taskStatisticsVo.getBeginDate(), taskStatisticsVo.getEndDate());
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getBeginDate(), taskStatisticsVo.getEndDate());
         taskStatisticsVo.setBeginDate(dateMapByType.get("startDate"));
         taskStatisticsVo.setEndDate(dateMapByType.get("endDate"));
         IPage<TaskStatisticsDto> list = this.taskStatisticsMapper.channelAgentDetails(page,taskStatisticsVo);

+ 24 - 0
src/main/java/com/ydtech/modules/admin/service/impl/UserReportServiceImpl.java

@@ -319,6 +319,30 @@ public class UserReportServiceImpl implements UserReportService {
         List<QxFrontlineAgentExcel> resultList = new ArrayList<>();
 
         for (QxFrontlineAgentDto dto : getQxFrontlineAgentList) {
+            String deptId = dto.getDeptId();
+            if(StringUtils.isNotEmpty(deptId)){
+                int length = deptId.length();
+                if (length > 0) {
+                    if (length > 10) {
+                        String substring = deptId.substring(0, 6);
+                        String substring1 = deptId.substring(0, 8);
+                        String province = deptId.substring(0, 4);
+                        String storeDept = deptId.substring(0, 11);
+                        SysDept cityName = sysDeptService.getById(substring);
+                        SysDept districtName = sysDeptService.getById(substring1);
+                        SysDept provinceName = sysDeptService.getById(province);
+                        SysDept storeDeptEntity = sysDeptService.getById(storeDept);
+                        String deptName = dto.getDeptName();
+                        String a = provinceName.getName()+"-"+cityName.getName()+"-"+districtName.getName()+"-"+storeDeptEntity.getName()+"-"+deptName;
+                        dto.setDeptName(a);
+                    }
+                }
+            }
+            qxFrontlineAgentVo.setUserId(dto.getUserId());
+            //预期净利润
+            BigDecimal ExpectNetProfit = insAreaCompanyService.getExpectNetProfit(qxFrontlineAgentVo);
+            dto.setEstimatedProfit(ExpectNetProfit);
+
             QxFrontlineAgentExcel qxFrontlineAgentExcel = new QxFrontlineAgentExcel();
             BeanUtils.copyProperties(dto,qxFrontlineAgentExcel);
             resultList.add(qxFrontlineAgentExcel);

+ 9 - 0
src/main/java/com/ydtech/modules/ins/model/guoren/PremiumReq.java

@@ -80,6 +80,15 @@ public class PremiumReq {
         PremiumReq quoteReq = new PremiumReq();
         VehicleAndVesselTax vehicleAndVesselTax = yaQuoteInfoVo.getVehicleAndVesselTax();
 
+        //处理车主约定特约
+        specialAgreementVo.forEach(item->{
+            if("T0028".equals(item.getClauseCode())){
+                String replace = item.getClausesContext().replaceFirst("_", yaQuoteInfoVo.getInsuredPersonInfo().getName());
+                replace = replace.replaceFirst("_",yaQuoteInfoVo.getOwnerInfo().getName());
+                item.setClausesContext(replace);
+            }
+        });
+
         riskList.forEach(a -> {
             if (a.getRiskCode().equals(InsuranceRisk.TRAFFIC_CODE)) {
                 List<GuoRenSpecialAgreementVo> trafficSpecialAgreement =

+ 4 - 0
src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java

@@ -567,6 +567,10 @@ public class InsAreaCompany implements Serializable {
     @TableField(exist = false)
     private BigDecimal exportAllFee;
 
+    //毛利润
+    @TableField(exist = false)
+    private BigDecimal distributionAmount;
+
 
     /***
      *  驾意险编号  add by  hxl 2024-10-21

+ 11 - 9
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java

@@ -1124,15 +1124,17 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         if(!ObjectUtils.isEmpty(insAreaCompany)){
             BigDecimal entranceAllFee = insAreaCompany.getEntranceAllFee();// 入口金额
             BigDecimal exportAllFee = insAreaCompany.getExportAllFee(); // 出口金额
-            // 计算三级分销金额
-            HashMap<String,BigDecimal> distribution  =baseMapper.getDistributionAllAmount(qxFrontlineAgentVo);
-            if(!distribution.isEmpty()){
-                BigDecimal bigDecimal = distribution.get("distributionAmount");
-                // 利润= 入口- 出口 - 分销
-                return entranceAllFee.subtract(exportAllFee).subtract(bigDecimal);
-            }else {
-                return entranceAllFee.subtract(exportAllFee) ;
-            }
+            BigDecimal distributionAmount = insAreaCompany.getDistributionAmount(); // 毛利润
+//            // 计算三级分销金额
+//            HashMap<String,BigDecimal> distribution  =baseMapper.getDistributionAllAmount(qxFrontlineAgentVo);
+//            if(!distribution.isEmpty()){
+//                BigDecimal bigDecimal = distribution.get("distributionAmount");
+//                // 利润= 入口- 出口 - 分销
+//                return entranceAllFee.subtract(exportAllFee).subtract(bigDecimal);
+//            }else {
+//                return entranceAllFee.subtract(exportAllFee) ;
+//            }
+            entranceAllFee.subtract(exportAllFee).subtract(distributionAmount);
         }
         return BigDecimal.ZERO;
     }

+ 1 - 1
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -2410,7 +2410,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
         queryWrapper.gt(PtlAgreementProductCostsNew::getCostsEndDate, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
 
         queryWrapper.eq(PtlAgreementProductCostsNew::getIsAudit, "1");
-        queryWrapper.eq(PtlAgreementProductCostsNew::getIsInquiryNow, "0");
+        queryWrapper.eq(PtlAgreementProductCostsNew::getIsInquiryNow, "1");
 
         queryWrapper.eq(PtlAgreementProductCostsNew::getAgreementId, agreementId);
         queryWrapper.eq(PtlAgreementProductCostsNew::getProductId, productCode);

+ 16 - 4
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -1335,10 +1335,22 @@
             IFNULL(sum(case when info.is_speciality ='0'  THEN 1 ELSE 0 END),0) as "otherSpecialityPersion",
             IFNULL(sum(case when info.is_speciality ='1'  THEN 1 ELSE 0 END) / (sum(case when info.is_speciality ='1'  THEN 1 ELSE 0 END) + sum(case when info.is_speciality ='0'  THEN 1 ELSE 0 END)),0) as "computerSpecialityProportion",
             IFNULL(sum(case when info.is_speciality ='0'  THEN 1 ELSE 0 END) / (sum(case when info.is_speciality ='1'  THEN 1 ELSE 0 END) + sum(case when info.is_speciality ='0'  THEN 1 ELSE 0 END)),0)  as "otherSpecialityProportion",
-            IFNULL(sum(case when su.status ='1' THEN 1 Else 0 END),0)  as " onJobUser",
-            IFNULL(sum(case when su.status ='0' THEN 1 Else 0 END),0)  as " departUser",
-            IFNULL(sum(case when su.status ='1' THEN 1 Else 0 END),0)  / (IFNULL(sum(case when su.status ='1' THEN 1 Else 0 END),0) +IFNULL(sum(case when su.status ='0' THEN 1 Else 0 END),0)) as "onJobUserProportion",
-            IFNULL(sum(case when su.status ='0' THEN 1 Else 0 END),0)  / (IFNULL(sum(case when su.status ='1' THEN 1 Else 0 END),0) +IFNULL(sum(case when su.status ='0' THEN 1 Else 0 END),0)) as "departUserProportion"
+            IFNULL(sum(case when su.status ='1' THEN 1 Else 0 END),0) as "onJobUser",
+            IFNULL(sum(case when su.status ='0' THEN 1 Else 0 END),0) as "departUser",
+            IFNULL(sum(case when su.status ='6' THEN 1 Else 0 END),0) as "pendingApproval",
+            IFNULL(sum(case when su.status ='7' THEN 1 Else 0 END),0) as "reviewRejected",
+            IFNULL(sum(case when su.status ='2' THEN 1 Else 0 END),0) as "companyReview",
+            IFNULL(sum(case when su.status ='3' THEN 1 Else 0 END),0) as "entryReview",
+            IFNULL(sum(case when su.status ='4' THEN 1 Else 0 END),0) as "leavingCompanyReview",
+            IFNULL(sum(case when su.status ='5' THEN 1 Else 0 END),0) as "departureReviewRejected",
+            IFNULL(sum(case when su.status ='1' THEN 1 Else 0 END),0) / count(su.id) as "onJobUserProportion",
+            IFNULL(sum(case when su.status ='0' THEN 1 Else 0 END),0) / count(su.id) as "departUserProportion",
+            IFNULL(sum(case when su.status ='6' THEN 1 Else 0 END),0) / count(su.id) as "pendingApprovalProportion",
+            IFNULL(sum(case when su.status ='7' THEN 1 Else 0 END),0) / count(su.id) as "reviewRejectedProportion",
+            IFNULL(sum(case when su.status ='2' THEN 1 Else 0 END),0) / count(su.id) as "companyReviewProportion",
+            IFNULL(sum(case when su.status ='3' THEN 1 Else 0 END),0) / count(su.id) as "entryReviewProportion",
+            IFNULL(sum(case when su.status ='4' THEN 1 Else 0 END),0) / count(su.id) as "leavingCompanyReviewProportion",
+            IFNULL(sum(case when su.status ='5' THEN 1 Else 0 END),0) / count(su.id) as "departureReviewRejectedProportion"
         FROM
             sys_user su
                 LEFT JOIN sys_dept sd ON su.dept_id = sd.id

+ 2 - 21
src/main/resources/mapper/modules/admin/TaskStatisticsMapper.xml

@@ -362,32 +362,13 @@
             </if>
 
             <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
-                AND DATE_FORMAT( io.createtime, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND
+                AND DATE_FORMAT( ica.signing_time, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND
                 #{taskStatisticsVo.createtimeEnd}
             </if>
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
-                AND DATE_FORMAT( iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{taskStatisticsVo.beginDate},
+                AND DATE_FORMAT( iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{taskStatisticsVo.beginDate},
                 '%Y-%m-%d') AND DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
             </if>
-            <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
-                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
-            </if>
-
-            <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
-                <choose>
-                    <when test="taskStatisticsVo.days =='1'">
-                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 1 DAY)
-                    </when>
-
-                    <when test="taskStatisticsVo.days =='7'">
-                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 7 DAY)
-                    </when>
-
-                    <when test="taskStatisticsVo.days =='30'">
-                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 30 DAY)
-                    </when>
-                </choose>
-            </if>
         </where>
         GROUP BY
         iac.inscompany

+ 88 - 8
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -2407,7 +2407,8 @@
             </foreach>
         </if>
         group  by
-        agree.insurance_company
+        agree.insurance_company,
+        agree.partner_companies_id
         )  a
 
     </select>
@@ -3292,10 +3293,85 @@
         select
         IFNULL(ifon.jq_costs_premiums,0) + IFNULL(ifon.sy_costs_premiums,0) + IFNULL (ifon.no_costs_premiums,0) as "entranceAllFee",
         IFNULL(jq_export_other_costs_premiums,0) + IFNULL(jq_export_supervise_costs_premiums,0) +IFNULL(sy_export_other_costs_premiums,0) +IFNULL(sy_export_supervise_costs_premiums,0)
-        +IFNULL(no_export_supervise_costs_premiums,0)+IFNULL(no_export_supervise_costs_premiums,0)  as "exportAllFee"
+        +IFNULL(no_export_supervise_costs_premiums,0)+IFNULL(no_export_supervise_costs_premiums,0)  as "exportAllFee",
+        IFNULL(b.distributionAmount,0)
         from ins_area_company iac
         left join ins_orders io on io.orderno = iac.orderno
         LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
+        LEFT JOIN (
+            select  IFNULL(a.firstDetailPremiums,0) + IFNULL(b.secondDetailPremiums,0) +IFNULL(c.thirdDetailPremiums,0) as "distributionAmount",
+            a.firstLevelUserId
+            from  (
+            select
+            sum(ifon.first_detail_premiums) as "firstDetailPremiums",
+            ifon.first_level_user_id as "firstLevelUserId"
+            from ins_area_company iac
+            left join ins_orders io on io.orderno = iac.orderno
+            LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
+            <where>
+                <if test="vo.userId !=null  and  vo.userId  !=''">
+                    ifon.first_level_user_id  =#{vo.userId}
+                </if>
+                <if test="vo.ids  != null  and  vo.ids.size()>0 ">
+                    AND io.userid IN
+                    <foreach item="item"  collection="vo.ids" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
+                    AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
+                </if>
+            </where>
+            group  by   ifon.first_level_user_id
+            ) a
+            left join  (
+            select
+            sum(IFNULL(second_detail_premiums,0)) as "secondDetailPremiums",
+            ifon.two_level_user_id as "twoLevelUserId"
+            from ins_area_company iac
+            left join ins_orders io on io.orderno = iac.orderno
+            LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
+            <where>
+                <if test="vo.userId !=null  and  vo.userId  !=''">
+                    ifon.two_level_user_id  =#{vo.userId}
+                </if>
+                <if test="vo.ids  != null  and  vo.ids.size()>0 ">
+                    AND io.userid IN
+                    <foreach item="item"  collection="vo.ids" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
+                    AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
+                </if>
+            </where>
+
+            group  by   ifon.two_level_user_id
+            )  b  on b.twoLevelUserId  =a.firstLevelUserId
+            left  join  (
+            select
+            sum(IFNULL(third_detail_premiums,0)) as "thirdDetailPremiums",
+            ifon.three_level_user_id as "threeLevelUserId"
+            from ins_area_company iac
+            left join ins_orders io on io.orderno = iac.orderno
+            LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
+            <where>
+                <if test="vo.userId !=null  and  vo.userId  !=''">
+                    ifon.three_level_user_id  =#{vo.userId}
+                </if>
+                <if test="vo.ids  != null  and  vo.ids.size()>0 ">
+                    AND io.userid IN
+                    <foreach item="item"  collection="vo.ids" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
+                    AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
+                </if>
+            </where>
+            group  by   ifon.three_level_user_id
+            ) c on  c.threeLevelUserId = a.firstLevelUserId
+        ) b   on b.firstLevelUserId =iac.leader_id
         <where>
             <if test="vo.userId !=null  and  vo.userId  !=''">
                 iac.leader_id  =#{vo.userId}
@@ -3314,8 +3390,12 @@
     </select>
 
     <select id="getDistributionAllAmount" resultType="java.util.HashMap">
+        select  IFNULL(a.firstDetailPremiums,0) + IFNULL(b.secondDetailPremiums,0) +IFNULL(c.thirdDetailPremiums,0) as "distributionAmount",
+        a.firstLevelUserId
+        from  (
         select
-        IFNULL(sum(IFNULL(first_detail_premiums,0)),0) + IFNULL(b.secondDetailPremiums,0) +IFNULL(c.thirdDetailPremiums,0) as "distributionAmount"
+        sum(ifon.first_detail_premiums) as "firstDetailPremiums",
+        ifon.first_level_user_id as "firstLevelUserId"
         from ins_area_company iac
         left join ins_orders io on io.orderno = iac.orderno
         LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
@@ -3334,10 +3414,11 @@
             </if>
         </where>
         group  by   ifon.first_level_user_id
+        ) a
         left join  (
         select
         sum(IFNULL(second_detail_premiums,0)) as "secondDetailPremiums",
-        ifon.two_level_user_id as "twoLevelUserId",
+        ifon.two_level_user_id as "twoLevelUserId"
         from ins_area_company iac
         left join ins_orders io on io.orderno = iac.orderno
         LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
@@ -3357,11 +3438,11 @@
         </where>
 
         group  by   ifon.two_level_user_id
-        )  b  on b.twoLevelUserId  =ifon.first_level_user_id
+        )  b  on b.twoLevelUserId  =a.firstLevelUserId
         left  join  (
         select
         sum(IFNULL(third_detail_premiums,0)) as "thirdDetailPremiums",
-        ifon.three_level_user_id as "threeLevelUserId",
+        ifon.three_level_user_id as "threeLevelUserId"
         from ins_area_company iac
         left join ins_orders io on io.orderno = iac.orderno
         LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
@@ -3380,8 +3461,7 @@
             </if>
         </where>
         group  by   ifon.three_level_user_id
-        ) c on  c.threeLevelUserId = ifon.first_level_user_id
-
+        ) c on  c.threeLevelUserId = a.firstLevelUserId
     </select>
 
 </mapper>