helixiao il y a 2 ans
Parent
commit
eea662bd6e

+ 2 - 2
src/main/java/com/ydtech/modules/admin/dao/SysAgencyLeaderMapper.java

@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.SysAgencyLeader;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
-import com.ydtech.modules.admin.model.dto.SysAgencyLeaderPageDto;
-import com.ydtech.modules.admin.model.vo.AgencyExtractFeeVo;
 import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -35,5 +33,7 @@ public interface SysAgencyLeaderMapper extends BaseMapper<SysAgencyLeader> {
 
 
     HashMap<String, BigDecimal> getBigDecimalNum(@Param("deptId") String deptId, @Param("createTime")  String createTime,@Param("beginTime") String beginTime,@Param("endTime") String endTime);
+
+    HashMap<String, Object> getAreaCompanyByUserId(@Param("orderNoList") List<String> orderNoList);
 }
 

+ 34 - 23
src/main/java/com/ydtech/modules/admin/service/impl/SysAgencyLeaderServiceImpl.java

@@ -797,18 +797,22 @@ public class SysAgencyLeaderServiceImpl extends ServiceImpl<SysAgencyLeaderMappe
 
                 if (insOrderList.size() > 0) {
                     List<String> collect = insOrderList.stream().map(InsOrders::getOrderno).collect(Collectors.toList());
-                    //查询订单下的所有子订单
-                    List<InsAreaCompany> insAreaCompanies = insAreaCompanyMapper.selectList(new LambdaQueryWrapper<InsAreaCompany>()
-                            .in(InsAreaCompany::getOrderno, collect)
-                            .eq(InsAreaCompany::getOrderstatus, 3));
-                    if (insAreaCompanies.size() > 0) {
-                        //累加每一个子订单的交强险费用+商业险费用+驾意险费用
-                        BigDecimal jqpremium = insAreaCompanies.stream().map(InsAreaCompany::getJqpremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-                        BigDecimal sypremium = insAreaCompanies.stream().map(InsAreaCompany::getSypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-                        BigDecimal jypremium = insAreaCompanies.stream().map(InsAreaCompany::getJypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                        bigDecimal = jqpremium.add(sypremium).add(jypremium);
+                    //查询订单下的所有子订单 保费和
+                    HashMap<String, Object> map = sysAgencyLeaderMapper.getAreaCompanyByUserId(collect);
+                    if (CollectionUtil.isNotEmpty(map)) {
+                        bigDecimal = bigDecimal.add(map.get("bigDecimal") == null ? BigDecimal.ZERO : (BigDecimal)map.get("bigDecimal"));
                     }
+//                    List<InsAreaCompany> insAreaCompanies = insAreaCompanyMapper.selectList(new LambdaQueryWrapper<InsAreaCompany>()
+//                            .in(InsAreaCompany::getOrderno, collect)
+//                            .eq(InsAreaCompany::getOrderstatus, 3));
+//                    if (insAreaCompanies.size() > 0) {
+//                        //累加每一个子订单的交强险费用+商业险费用+驾意险费用
+//                        BigDecimal jqpremium = insAreaCompanies.stream().map(InsAreaCompany::getJqpremium).reduce(BigDecimal.ZERO, BigDecimal::add);
+//                        BigDecimal sypremium = insAreaCompanies.stream().map(InsAreaCompany::getSypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
+//                        BigDecimal jypremium = insAreaCompanies.stream().map(InsAreaCompany::getJypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
+//
+//                        bigDecimal = jqpremium.add(sypremium).add(jypremium);
+//                    }
 
                 }
                 teamInformation.setSumpremium(bigDecimal);
@@ -1018,19 +1022,25 @@ public class SysAgencyLeaderServiceImpl extends ServiceImpl<SysAgencyLeaderMappe
             if (insOrderList.size() > 0) {
                 List<String> orderNoList = insOrderList.stream().map(InsOrders::getOrderno).collect(Collectors.toList());
                 //单个人员查询订单下的所有子订单总保费  '订单状态(0 报价 1 待核保 2 已核保待缴费 3 核保退回 4 核保不通过)',
-                List<InsAreaCompany> insAreaCompanies = insAreaCompanyMapper.selectList(new LambdaQueryWrapper<InsAreaCompany>()
-                        .in(InsAreaCompany::getOrderno, orderNoList)
-                        .eq(InsAreaCompany::getOrderstatus, 3));
-                if (insAreaCompanies.size() > 0) {
-                    //累加每一个子订单的交强险费用+商业险费用+驾意险费用
-                    BigDecimal jqpremium = insAreaCompanies.stream().map(InsAreaCompany::getJqpremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-                    BigDecimal sypremium = insAreaCompanies.stream().map(InsAreaCompany::getSypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-                    BigDecimal jypremium = insAreaCompanies.stream().map(InsAreaCompany::getJypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                    bigDecimal = jqpremium.add(sypremium).add(jypremium);
+                HashMap<String, Object> map = sysAgencyLeaderMapper.getAreaCompanyByUserId(orderNoList);
+                if (CollectionUtil.isNotEmpty(map)) {
+                    bigDecimal = bigDecimal.add(map.get("bigDecimal") == null ? BigDecimal.ZERO : (BigDecimal)map.get("bigDecimal"));
+                    Long issueNum = (Long)map.get("issueNum");
+                    teamUserInfoVo.setIssueNum(issueNum.intValue());
                 }
-                //出单笔数
-                teamUserInfoVo.setIssueNum(insAreaCompanies.size());
+//                List<InsAreaCompany> insAreaCompanies = insAreaCompanyMapper.selectList(new LambdaQueryWrapper<InsAreaCompany>()
+//                        .in(InsAreaCompany::getOrderno, orderNoList)
+//                        .eq(InsAreaCompany::getOrderstatus, 3));
+//                if (insAreaCompanies.size() > 0) {
+//                    //累加每一个子订单的交强险费用+商业险费用+驾意险费用
+//                    BigDecimal jqpremium = insAreaCompanies.stream().map(InsAreaCompany::getJqpremium).reduce(BigDecimal.ZERO, BigDecimal::add);
+//                    BigDecimal sypremium = insAreaCompanies.stream().map(InsAreaCompany::getSypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
+//                    BigDecimal jypremium = insAreaCompanies.stream().map(InsAreaCompany::getJypremium).reduce(BigDecimal.ZERO, BigDecimal::add);
+//
+//                    bigDecimal = jqpremium.add(sypremium).add(jypremium);
+//                }
+//                //出单笔数
+//                teamUserInfoVo.setIssueNum(insAreaCompanies.size());
                 teamUserInfoVo.setSumpremium(bigDecimal);
                 //报价笔数
                 Long quoteNum = insAreaCompanyMapper.selectCount(new LambdaQueryWrapper<InsAreaCompany>()
@@ -1041,6 +1051,7 @@ public class SysAgencyLeaderServiceImpl extends ServiceImpl<SysAgencyLeaderMappe
                 Long underwriteNum = insAreaCompanyMapper.selectCount(new LambdaQueryWrapper<InsAreaCompany>()
                         .in(InsAreaCompany::getOrderno, orderNoList)
                         .in(InsAreaCompany::getOrderstatus, integers));
+
                 teamUserInfoVo.setUnderwriteNum(underwriteNum);
                 teamUserInfoVoList.add(teamUserInfoVo);
             } else {

+ 17 - 0
src/main/resources/mapper/modules/admin/SysAgencyLeaderMapper.xml

@@ -90,5 +90,22 @@
 
     </select>
 
+    <select id="getAreaCompanyByUserId" resultType="java.util.HashMap">
+        SELECT
+        sum(IFNULL(jqpremium,0) + IFNULL(sypremium,0) + IFNULL(jypremium,0))  as bigDecimal,
+        count(id) as issueNum
+        FROM
+        ins_area_company
+        <where>
+            orderstatus ='3'
+            <if test="orderNoList.size>0">
+                and  orderno in
+                <foreach collection="orderNoList" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
 </mapper>