Explorar el Código

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

wks hace 1 año
padre
commit
837cc60773

+ 11 - 0
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -84,6 +84,17 @@ public class TaskStatisticsController {
         }
     }
 
+    /**
+     * @description:   任务统计-电销导出
+     * @author: whp
+     * @date: 2024/10/29
+     **/
+    @PostMapping("/electricExcel")
+    @ApiOperation(value = "任务统计-电销导出")
+    public HttpResult electricExcel(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+        return this.taskStatisticsService.electricExcel(taskStatisticsVo);
+    }
+
     /**
      * @description:   保险公司统计查询
      * @author: whp

+ 8 - 1
src/main/java/com/ydtech/modules/admin/dao/DeptBalanceMapper.java

@@ -9,8 +9,8 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
-import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 
 @Mapper
 public interface DeptBalanceMapper {
@@ -44,4 +44,11 @@ public interface DeptBalanceMapper {
      * @return  获取代理人 总收入
      */
     HashMap<String, BigDecimal> getWalletAgentAmount(@Param("userId") String userId,@Param("beginDate") String beginDate,@Param("endDate") String endDate);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/28 18:26
+     *  @Description: 查询电销组长的收入
+     */
+    BigDecimal getDxWalletAgentAmount(@Param("ids") List<String> userList, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
 }

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

@@ -22,7 +22,7 @@ public class InsuranceCompanyExcel {
 
 
     @ExcelProperty(value = "已核保待缴费",index = 4)
-    private BigDecimal underwritingCountRate;
+    private BigDecimal underwritingCount;
 
     @ExcelProperty(value = "已承保",index = 5)
     private BigDecimal qutationInsureCount;

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

@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.lang.reflect.Type;
 import java.math.BigDecimal;
 import java.util.List;
 
@@ -71,4 +70,13 @@ public class SysPartnerConsoleDto implements Serializable {
 
     @ApiModelProperty(value = "提现中")
     private BigDecimal withdrawingAmount;
+
+    /***
+     * 角色id
+     */
+    private  String roleId;
+    /***
+     * 机构来源
+     */
+    private String managementSource;
 }

+ 7 - 0
src/main/java/com/ydtech/modules/admin/service/TaskStatisticsService.java

@@ -135,4 +135,11 @@ public interface TaskStatisticsService {
      * @date: 2024/10/12
      **/
     TaskStatisticsDto getCountBusinessData(TaskStatisticsVo taskStatisticsVo);
+    /**
+     * @description:   任务统计-电销导出
+     * @author: whp
+     * @date: 2024/10/29
+     **/
+    HttpResult electricExcel(TaskStatisticsVo taskStatisticsVo);
+
 }

+ 34 - 26
src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java

@@ -2,25 +2,24 @@ package com.ydtech.modules.admin.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.dao.*;
-import com.ydtech.modules.admin.model.*;
+import com.ydtech.modules.admin.model.SysAgencyFeeApproval;
+import com.ydtech.modules.admin.model.SysAgencyLeader;
+import com.ydtech.modules.admin.model.SysRelationPerson;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.dto.MySumAmountQueryDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
-import com.ydtech.modules.admin.model.vo.*;
+import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
+import com.ydtech.modules.admin.model.vo.PartnerBalanceVo;
 import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.base.model.vo.PageVo;
-import com.ydtech.modules.order.entity.InsAreaCompany;
-import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.utils.StringUtils;
-import io.swagger.annotations.ApiModelProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -28,7 +27,10 @@ import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
 import java.util.stream.Collectors;
 
 @Service
@@ -282,28 +284,34 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
         if (!records.isEmpty()) {
             for (SysPartnerConsoleDto record : records) {
                 String userId = record.getUserId();
-                HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getWalletAgentAmount(userId,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
-//              总金额
-                if (orderAmount != null && !orderAmount.isEmpty()) {
-                    record.setTotalIncome(orderAmount.get("totalIncome"));
-                }
-//                          已提现
-                BigDecimal ysTXAmount= insFeeOrderNewService.findMyAmountYTXmountByDate(record.getUserId(),"3",deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
-//                          未提现
+                //总收入
+                BigDecimal sumAmount =BigDecimal.ZERO;
+                //已提现
+                BigDecimal ytxAmount =BigDecimal.ZERO;
+                //提现中
+                BigDecimal sxAmount =BigDecimal.ZERO;
+                //未提现
+                BigDecimal wtxAmount =BigDecimal.ZERO;
                 MySumAmountQueryDto mySumAmountQueryDto = new MySumAmountQueryDto();
-                mySumAmountQueryDto.setAuditstatus("1");
-                SysUserAccount sysUserAccountEntity = sysUserAccountService.getById(record.getUserId());
-                BigDecimal ssKTAmount =BigDecimal.ZERO;
-                BigDecimal txzTXAmount= insFeeOrderNewService.findMyAmountYTXmountByDate(record.getUserId(),"2",deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
-
-                if(sysUserAccountEntity!=null){
-                    ssKTAmount = sysUserAccountEntity.getSumAmount()==null?BigDecimal.ZERO: sysUserAccountEntity.getSumAmount();
+                //如果是电销组长,将组员的数据算进来
+                if ("72".equals(record.getRoleId()) && "3".equals(record.getManagementSource())) {
+                    mySumAmountQueryDto.setGroupFlag(true);
+                    List<String> userList = sysUserService.getGroupByUserId(userId);
+                    //sumAmount= deptBalanceMapper.getDxWalletAgentAmount(userList,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+                    SysUserAccount sysUserAccountEntity = sysUserAccountService.getById(record.getUserId());
+                    // 已提现金额   查询历史表中的审核状态为3的数据
+                    ytxAmount = insFeeOrderNewService.findMyAmountYTXmountByDates(record.getUserId(), "3",true,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+                    // 提现中
+                    sxAmount = insFeeOrderNewService.findMyAmountYTXmountByDates(record.getUserId(), "2",true,deptBalanceVo.getBeginDate(),deptBalanceVo.getEndDate());
+                    // 可提现
+                    wtxAmount= (sysUserAccountEntity==null || sysUserAccountEntity.getSumAmount()==null)?BigDecimal.ZERO:sysUserAccountEntity.getSumAmount();
+                    //总的 =  已提现金额+  可提现金额 +  提现中
+                    sumAmount = wtxAmount.add(sxAmount).add(ytxAmount);
                 }
-                BigDecimal sumAmount=ysTXAmount.add(ssKTAmount).add(txzTXAmount);
-                record.setWithdrawn(ysTXAmount);
-                record.setNotWithdrawn(ssKTAmount);
+                record.setWithdrawn(ytxAmount);
+                record.setNotWithdrawn(wtxAmount);
                 record.setTotalIncome(sumAmount);
-                record.setWithdrawingAmount(txzTXAmount);
+                record.setWithdrawingAmount(sxAmount);
             }
         }
         return sysUserListPage;

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

@@ -488,6 +488,8 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
 
         return result;
     }
+
+
     /**
      * @description:   控制台-业务数据 - 保险分布
      * @author: whp
@@ -555,7 +557,15 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
                 e.printStackTrace();
             }
         }
-        String fileName = EasyExcelUtils.downExcel(uploadPath, taskStatisticsVo.getManagementSource() .equals("1") ? "渠道导出":"代理人导出", TaskStatisticsExcel.class, list);
+        String  name ="";
+        if(taskStatisticsVo.getManagementSource().equals("1")){
+            name="渠道导出";
+        } else if (taskStatisticsVo.getManagementSource().equals("2")) {
+            name="代理人导出";
+        }else {
+            name="电销导出";
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, name, TaskStatisticsExcel.class, list);
         return HttpResult.ok("", uploadUrl + "excel/" + fileName);
     }
 
@@ -782,6 +792,18 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         return getHttpResult(taskStatisticsVo);
     }
 
+    /**
+     * @description:   任务统计-电销导出
+     * @author: whp
+     * @date: 2024/10/29
+     **/
+    @Override
+    public HttpResult electricExcel(TaskStatisticsVo taskStatisticsVo) {
+        taskStatisticsVo.setManagementSource("3");
+
+        return getHttpResult(taskStatisticsVo);
+    }
+
 
     /**
      * @description:   任务统计-保险公司-导出

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

@@ -3555,7 +3555,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         List<FinancialReceivablesMonthVo> otherList = baseMapper.queryDateByTypeByMonthOtherList(financialReceivablesQueryVo);
 
         Map<String, FinancialReceivablesMonthVo> otherCollect = otherList.stream().collect(Collectors.toMap(FinancialReceivablesMonthVo::getPartnerCompaniesId, Function.identity()));
-        Map<String, FinancialReceivablesMonthVo>  commCollect= list.stream().collect(Collectors.toMap(FinancialReceivablesMonthVo::getPartnerCompaniesId, Function.identity()));
+//        Map<String, FinancialReceivablesMonthVo>  commCollect= list.stream().collect(Collectors.toMap(FinancialReceivablesMonthVo::getPartnerCompaniesId, Function.identity()));
         list.forEach(item -> {
                             if(otherCollect.containsKey(item.getPartnerCompaniesId())){
                                 FinancialReceivablesMonthVo otherItem = otherCollect.get(item.getPartnerCompaniesId());

+ 9 - 0
src/main/java/com/ydtech/modules/protocols/dao/InsFeeOrderNewMapper.java

@@ -177,6 +177,15 @@ public interface InsFeeOrderNewMapper extends BaseMapper<InsFeeOrderNew> {
      *  @Description:  按时间统计数据
      */
     BigDecimal findMyAmountYTXmountByDate(@Param("userId") String userId, @Param("status") String status, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/30 19:59
+     *  @Description:  查询可提现的金额
+     */
+    BigDecimal findMyAmountYTXmountByDates(@Param("userId") String userId,@Param("status") String status,@Param("groupFlag")  boolean groupFlag, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
 }
 
 

+ 7 - 0
src/main/java/com/ydtech/modules/protocols/service/InsFeeOrderNewService.java

@@ -211,4 +211,11 @@ public interface InsFeeOrderNewService extends IService<InsFeeOrderNew> {
      *  @Description:  按时间检索
      */
     BigDecimal findMyAmountYTXmountByDate(String userId, String number, String beginDate, String endDate);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/28 18:43
+     *  @Description:  按时间检索
+     */
+    BigDecimal findMyAmountYTXmountByDates(String userId, String number, boolean b, String beginDate, String endDate);
 }

+ 5 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/InsFeeOrderNewServiceImpl.java

@@ -211,4 +211,9 @@ public class InsFeeOrderNewServiceImpl extends ServiceImpl<InsFeeOrderNewMapper,
     public BigDecimal findMyAmountYTXmountByDate(String userId, String type, String beginDate, String endDate) {
         return baseMapper.findMyAmountYTXmountByDate(userId,type,beginDate,endDate);
     }
+
+    @Override
+    public BigDecimal findMyAmountYTXmountByDates(String userId, String type, boolean b, String beginDate, String endDate) {
+        return baseMapper.findMyAmountYTXmountByDates(userId,type,b,beginDate,endDate);
+    }
 }

+ 23 - 3
src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml

@@ -119,7 +119,9 @@
         sd.id as "deptId",
         sd.name as "deptName",
         inf.url  as "filePath",
-        suif.sex as "sex"
+        suif.sex as "sex",
+        sur.role_id  as "roleId",
+        sd.management_source as managementSource
         from sys_user su
         left join sys_dept sd on sd.id=su.dept_id
         LEFT JOIN  ins_upload_files   inf on  su.head_sculpture  =inf.id
@@ -177,8 +179,7 @@
         ins_orders io
         left join ins_area_company iac on iac.orderno =io.orderno
         <where>
-            io.orderstatus ='3'
-            and iac.orderstatus ='3'
+             iac.orderstatus ='3'
             <if test="userId  != null  and  userId !=''">
              and   io.userid =#{userId}
             </if>
@@ -187,4 +188,23 @@
             </if>
         </where>
     </select>
+    <select id="getDxWalletAgentAmount" resultType="java.math.BigDecimal">
+        SELECT
+        sum(IFNULL(iac.jqpremium,0) + IFNULL(iac.sypremium,0) + IFNULL(iac.jypremium,0)) as "totalIncome"
+        FROM
+        ins_orders io
+        left join ins_area_company iac on iac.orderno =io.orderno
+        <where>
+            iac.orderstatus ='3'
+            <if test="ids != null and ids.size()>0 != null">
+                and io.userid IN
+                <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="beginDate !=null and beginDate != '' and endDate !=null and endDate != ''">
+                AND  iac.signing_time  BETWEEN  #{beginDate}  AND  #{endDate}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 20 - 0
src/main/resources/mapper/modules/ins/InsFeeOrderNewMapper.xml

@@ -1480,4 +1480,24 @@
             </if>
         </where>
     </select>
+
+    <select id="findMyAmountYTXmountByDates" resultType="java.math.BigDecimal">
+        SELECT
+        ifnull( sum( au.amount ), 0 )
+        FROM
+        sys_amount_auditing au
+        WHERE
+        <choose>
+            <when test="groupFlag">
+                au.user_id in ( select id from  sys_user  where manager_id = #{userId}   or id = #{userId}  )
+            </when>
+            <otherwise>
+                au.user_id = #{userId}
+            </otherwise>
+        </choose>
+        AND auditing_status = #{status}
+        <if test="beginDate !=null and  beginDate != '' and endDate !=null and  endDate != ''">
+            AND au.create_time  BETWEEN #{beginDate}  AND #{endDate}
+        </if>
+    </select>
 </mapper>