Sfoglia il codice sorgente

1.控制台 钱包管理总收入 变成收支明细金额
2.后线人员去掉合伙人
3.合伙人按照时间过滤总保费

wuhp 1 anno fa
parent
commit
80fa902aec

+ 7 - 0
src/main/java/com/ydtech/modules/admin/dao/DeptBalanceMapper.java

@@ -51,4 +51,11 @@ public interface DeptBalanceMapper {
      *  @Description: 查询电销组长的收入
      */
     BigDecimal getDxWalletAgentAmount(@Param("ids") List<String> userList, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+    /**
+     *
+     * @param deptBalanceVo
+     * @return  获取钱包总收入
+     */
+    HashMap<String, BigDecimal> getIncomeIndication(DeptBalanceVo deptBalanceVo);
 }

+ 6 - 0
src/main/java/com/ydtech/modules/admin/dao/SysPremiumDetailsMapper.java

@@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.SysPremiumDetails;
 import com.ydtech.modules.admin.model.dto.AgencyUserInsAreaDto;
 import com.ydtech.modules.admin.model.dto.CommissionInfoDto;
+import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.vo.AgencyUserInsAreaVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -23,4 +26,7 @@ public interface SysPremiumDetailsMapper extends BaseMapper<SysPremiumDetails> {
     List<Map<String, Object>> queryInfoPage(@Param("userId") String userId,  @Param("dto") CommissionInfoDto commissionInfoDto);
 
     Page<Map<String, Object>> queryInfoPages(Page page,  @Param("dto") CommissionInfoDto commissionInfoDto);
+
+    HashMap<String, BigDecimal> getTotalAmount(DeptBalanceDto itemLeader);
+
 }

+ 22 - 5
src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java

@@ -21,6 +21,7 @@ import com.ydtech.modules.esm.dao.EsmUserReferrerMapper;
 import com.ydtech.modules.esm.model.EsmUserReferrer;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.utils.BigDecimalUtils;
 import com.ydtech.utils.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -105,10 +106,11 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
                     itemLeader.setBeginDate(deptBalanceVo.getBeginDate());
                     itemLeader.setEndDate(deptBalanceVo.getEndDate());
 
-                    SysPartnerAccount sysPartnerAccount =sysPartnerAccountMapper.getByDeptBalanceDto(itemLeader);
-                    if (sysPartnerAccount != null) {
-                        BigDecimal sumPremium = sysPartnerAccount.getSumPremium();
-                        BigDecimal extractFee = sysPartnerAccount.getExtractFee();
+                    HashMap<String,BigDecimal>totalAmountMap =sysPremiumDetailsMapper.getTotalAmount(itemLeader);
+//                    SysPartnerAccount sysPartnerAccount =sysPartnerAccountMapper.getByDeptBalanceDto(itemLeader);
+                    if (totalAmountMap != null) {
+                        BigDecimal sumPremium = totalAmountMap.get("totalAmount");
+                        BigDecimal extractFee = totalAmountMap.get("extractFeeAmount");
                         itemLeader.setTotalIncome(sumPremium);
                         itemLeader.setDeptManagementFee(extractFee);
 
@@ -164,6 +166,8 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
                 String userId = item.getUserId();
                 item.setLoginUserId(userId);
                 SysPartnerAccount sysPartnerAccount = sysPartnerAccountMapper.selectOne(new LambdaQueryWrapper<SysPartnerAccount>()
+                        .between(StringUtils.isNotEmpty(deptBalanceVo.getBeginDate()) && StringUtils.isNotEmpty(deptBalanceVo.getEndDate()),
+                                SysPartnerAccount::getCreateTime, deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate())
                         .eq(SysPartnerAccount::getUserId, item.getUserId()));
                 if(ObjectUtils.isNotEmpty(sysPartnerAccount)){
                     if(sysPartnerAccount.getSumPremium() !=null ){
@@ -394,9 +398,22 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
                     ssKTAmount = sysUserAccountEntity.getSumAmount()==null?BigDecimal.ZERO: sysUserAccountEntity.getSumAmount();
                 }
                 BigDecimal sumAmount=ysTXAmount.add(ssKTAmount).add(txzTXAmount);
+
+                //2025-1-8  需求 总收入 = 当天审核订单收入   收支明细
+                deptBalanceVo.setUserId(record.getUserId());
+                HashMap<String, BigDecimal> incomeIndication = deptBalanceMapper.getIncomeIndication(deptBalanceVo);
                 record.setWithdrawn(ysTXAmount);
                 record.setNotWithdrawn(ssKTAmount);
-                record.setTotalIncome(sumAmount);
+                if(incomeIndication!=null){
+                    if(deptBalanceVo.getManagementSource().equals("2")){
+                        record.setTotalIncome(incomeIndication.get("totalAmount"));
+                    }else {
+                        record.setTotalIncome(BigDecimalUtils.nullToZero(incomeIndication.get("totalAmount")).divide(new BigDecimal(10)));
+
+                    }
+                }else {
+                    record.setTotalIncome(BigDecimal.ZERO);
+                }
                 record.setWithdrawingAmount(txzTXAmount);
             }
         }

+ 6 - 3
src/main/java/com/ydtech/modules/admin/service/impl/ProfitAnalysisServiceImpl.java

@@ -83,9 +83,12 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
      */
     @Override
     public List<ProfitAnalysisDto> getProfitAnalysisQueryList(ProfitAnalysisQueryDto profitAnalysisQueryDto) {
-        HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
-        profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
-        profitAnalysisQueryDto.setEndDate(dateMapByType.get("endDate"));
+        if(StringUtils.isNotEmpty(profitAnalysisQueryDto.getDateType())){
+            profitAnalysisQueryDto.setYear(null);
+            HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
+            profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
+            profitAnalysisQueryDto.setEndDate(dateMapByType.get("endDate"));
+        }
         List<ProfitAnalysisDto> profitAnalysisQueryList = insPlyIncomeMapper.getProfitAnalysisQueryList(profitAnalysisQueryDto);
         if(!profitAnalysisQueryList.isEmpty()){
             for (ProfitAnalysisDto profitAnalysisDto : profitAnalysisQueryList) {

+ 33 - 1
src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml

@@ -184,7 +184,7 @@
              and   io.userid =#{userId}
             </if>
             <if test="beginDate !=null and beginDate != '' and endDate !=null and endDate != ''">
-                AND  iac.signing_time  BETWEEN  #{beginDate}  AND  #{endDate}
+                AND  DATE_FORMAT( iac.createtime, '%Y-%m-%d')  BETWEEN DATE_FORMAT( #{beginDate}, '%Y-%m-%d')    AND   DATE_FORMAT( #{endDate}, '%Y-%m-%d')
             </if>
         </where>
     </select>
@@ -207,4 +207,36 @@
             </if>
         </where>
     </select>
+
+    <select id="getIncomeIndication" resultType="java.util.HashMap">
+        select ifnull(sum(a.amount) ,0) as "totalAmount"
+        from (
+        SELECT
+        his.amount as "amount"
+        FROM
+        sys_user_account_history his
+        LEFT JOIN ins_area_company ins ON his.suborder = ins.id
+        LEFT JOIN ins_orders o ON o.orderno = ins.orderno
+        left join sys_amount_auditing saa on saa.id =his.auditiing_id
+        left join sys_user su on su.id =his.user_id
+        WHERE
+        his.property !=1
+        and his.property !=2
+        AND his.documentary = '2'
+        <if test="beginDate !=null and beginDate != '' and endDate !=null and endDate != '' ">
+            AND date(his.create_time) BETWEEN #{beginDate} AND #{endDate}
+        </if>
+        <if test="userId !=null and userId!=''">
+            AND his.user_id =#{userId}
+        </if>
+        <if test="name !=null and name !=''">
+            and su.name like concat('%',#{name},'%')
+        </if>
+
+        <if test="phoneNumber !=null and phoneNumber !=''">
+            and su.mobile =#{phoneNumber}
+        </if>
+        order by his.create_time desc
+        ) a
+    </select>
 </mapper>

+ 21 - 0
src/main/resources/mapper/modules/admin/SysPremiumDetailsMapper.xml

@@ -49,6 +49,25 @@
     <sql id="setGroupConcatMaxLen">
         SET SESSION group_concat_max_len = 100000;
     </sql>
+    <select id="getTotalAmount" resultType="java.util.HashMap">
+        SELECT
+        sum(a.sumpremium) as "totalAmount",
+        sum(a.extract_fee) as "extractFeeAmount"
+        from
+        sys_premium_details a
+        <where>
+            a.status ='1'
+            <if test="beginDate !=null and beginDate != '' and endDate !=null and endDate != ''">
+                AND DATE_FORMAT( a.create_time, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{beginDate}, '%Y-%m-%d') AND
+                DATE_FORMAT( #{endDate}, '%Y-%m-%d')
+            </if>
+            <if test="userId !=null  and  userId !=''">
+                and a.user_id = #{userId}
+            </if>
+        </where>
+
+
+    </select>
     <select id="queryInfoPage" resultType="java.util.Map">
         <include refid="setGroupConcatMaxLen"/>
         SELECT
@@ -97,6 +116,8 @@
             company_id ASC
         LIMIT #{dto.pageSize} OFFSET #{dto.pageNum};
     </select>
+
+    
     <select id="queryInfoPages" resultType="java.util.Map">
         SELECT
         company_id as companyId,

+ 1 - 0
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -1387,6 +1387,7 @@
         <where>
             info.id is not null
             and su.id NOT LIKE '%M%'
+            AND ( su.type != '1' and  su.type != '2' )
             <if test="vo.provinceId != null and vo.provinceId != ''">
                 and sd.id like concat('%',#{vo.provinceId},'%')
             </if>