Parcourir la source

添加子订单没有险种信息的数据更新险种信息接口
添加子订单部分数据未更新险种信息的接口
添加任务管理添加产品费用信息

hxl13994548489 il y a 2 ans
Parent
commit
672dad8b75

+ 3 - 3
src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java

@@ -276,9 +276,9 @@ public class InsOrdersController extends BaseController {
      *  @Date: 2024/5/13 8:41
      *  @Description: 批量更新子订单的险种信息
      */
-    @PostMapping("/updateBatchPruductById")
+    @GetMapping("/updateBatchPruductById")
     @ApiOperation(value = "批量更新子订单的险种信息")
-    public HttpResult updateBatchPruductById() {
-        return this.insAreaCompanyService.updateBatchPruductById();
+    public HttpResult updateBatchPruductById( String subOrderId) {
+        return this.insAreaCompanyService.updateBatchPruductById(subOrderId);
     }
 }

+ 14 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -62,6 +62,20 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
     InsOrders selectSecondPromotionBy(HashMap<String, Object> params);
 
     InsOrders selectThirdPromotionBy(HashMap<String, Object> params);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/14 11:50
+     *  @Description:  更具日期查询数据
+     */
+    List<InsAreaCompany> selectListByDateStr(@Param("dateStr") String dateStr);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/14 19:13
+     *  @Description: 通过子订单查询订单id
+     */
+    List<InsAreaCompany> selectListById(@Param("id") String id);
 }
 
 

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/vo/OrderVo.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ydtech.modules.protocols.entity.vo.AgreementProductCostsSave;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -435,4 +436,9 @@ public class OrderVo implements Serializable {
 
     @TableField(exist = false)
     private String partnerCompaniesName;   //合作公司简称
+
+
+    @TableField(exist = false)
+    private AgreementProductCostsSave agreementProductCostsSave;   //产品费用
+
 }

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java

@@ -119,5 +119,5 @@ public interface InsAreaCompanyService extends IService<InsAreaCompany> {
     *  @Date: 2024/5/13 8:42
     *  @Description: 批量更新险种状态
     */
-    HttpResult updateBatchPruductById();
+    HttpResult updateBatchPruductById(String subOrderId);
 }

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

@@ -1,5 +1,6 @@
 package com.ydtech.modules.order.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -15,10 +16,7 @@ import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.modules.order.entity.vo.OrderVo;
-import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
-import com.ydtech.modules.order.service.InsAreaCompanyService;
-import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.modules.order.service.InsOrdersTrackService;
+import com.ydtech.modules.order.service.*;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.apache.commons.lang3.StringUtils;
@@ -95,6 +93,8 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
 
     @Override
     public void insertCompanyAndOrders(InsAreaCompany insAreaCompany, InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving) {
+        //add by hxl   解决部分数据更新不了险种信息
+        insAreaCompany = updateEntityPruductAndPruductid(insAreaCompany);
         baseMapper.insert(insAreaCompany);
         //保存驾意险信息
         insAreaCompanyAccidentalDriving.setCompanyId(insAreaCompany.getId());
@@ -106,10 +106,13 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
 
     @Override
     public void insertCompanyAndOrders(InsAreaCompany insAreaCompany, List<InsAreaCompanyAccidentalDriving> insAreaCompanyAccidentalDriving) {
+        //add by hxl   解决部分数据更新不了险种信息
+        insAreaCompany = updateEntityPruductAndPruductid(insAreaCompany);
         baseMapper.insert(insAreaCompany);
         //保存驾意险信息
+        InsAreaCompany finalInsAreaCompany = insAreaCompany;
         insAreaCompanyAccidentalDriving.forEach(item -> {
-            item.setCompanyId(insAreaCompany.getId());
+            item.setCompanyId(finalInsAreaCompany.getId());
             item.setId(IdGenerate.nextId());
         });
         insAreaCompanyAccidentalDrivingService.saveBatch(insAreaCompanyAccidentalDriving);
@@ -119,6 +122,8 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
 
     @Override
     public void insertCompanyAndOrders(InsAreaCompany insAreaCompany) {
+        //add by hxl   解决部分数据更新不了险种信息
+        insAreaCompany = updateEntityPruductAndPruductid(insAreaCompany);
         baseMapper.insert(insAreaCompany);
         insOrdersTrackService.addingTrajectories(insAreaCompany);
         insOrdersService.updateByOrderStatus(insAreaCompany);
@@ -262,14 +267,15 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
      *  @Description:  批量更新险种信息
      */
     @Override
-    public HttpResult updateBatchPruductById() {
+    public HttpResult updateBatchPruductById(String id) {
         try{
-            List<InsAreaCompany> insAreaCompanies = baseMapper.selectList(new LambdaQueryWrapper<>());
+            //List<InsAreaCompanyNew> insAreaCompanies = baseMapper.selectListByDateStr(dateStr);
+            List<InsAreaCompany> insAreaCompanies =baseMapper.selectListById(id);
             if(insAreaCompanies!=null && insAreaCompanies.size()>0){
                 for(InsAreaCompany company :  insAreaCompanies) {
                     //通过主订单的信息判断
-                    List<RiskInfoVo> risks = company.getRiskinfo().toJavaList(RiskInfoVo.class);
-                    List<KindInfoVo> kinds = company.getKindinfo().toJavaList(KindInfoVo.class);
+                    List<RiskInfoVo> risks = company.getRiskinfo()==null?new JSONArray().toJavaList(RiskInfoVo.class):company.getRiskinfo().toJavaList(RiskInfoVo.class);
+                    List<KindInfoVo> kinds = company.getKindinfo()==null?new JSONArray().toJavaList(KindInfoVo.class):company.getKindinfo().toJavaList(KindInfoVo.class);
                     //获取订单的险种信息
                     InsOrders insOrders = new InsOrders();
                     insOrders.productInformation(risks, kinds);
@@ -277,6 +283,9 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
                     company.setProduct(insOrders.getProduct());
                 }
                 this.updateBatchById(insAreaCompanies);
+                if(StringUtils.isNotEmpty(id)){
+                    return HttpResult.ok(insAreaCompanies);
+                }
             }
         }catch(Exception e){
             return HttpResult.error("逻辑异常");
@@ -284,6 +293,23 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
 
         return HttpResult.ok();
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/5/15 9:17
+     *  @Description: 赋值险种信息
+     */
+    public InsAreaCompany updateEntityPruductAndPruductid(InsAreaCompany company) {
+        //通过主订单的信息判断
+        List<RiskInfoVo> risks = company.getRiskinfo()==null?new JSONArray().toJavaList(RiskInfoVo.class):company.getRiskinfo().toJavaList(RiskInfoVo.class);
+        List<KindInfoVo> kinds = company.getKindinfo()==null?new JSONArray().toJavaList(KindInfoVo.class):company.getKindinfo().toJavaList(KindInfoVo.class);
+        //获取订单的险种信息
+        InsOrders insOrders = new InsOrders();
+        insOrders.productInformation(risks, kinds);
+        company.setProductid(insOrders.getProductid());
+        company.setProduct(insOrders.getProduct());
+        return company;
+    }
 }
 
 

+ 13 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -64,8 +64,11 @@ import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.ydtech.modules.protocols.entity.vo.AgreementProductCostsSave;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService;
 import com.ydtech.utils.SnowFlakeUtil;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.apache.commons.lang3.StringUtils;
@@ -145,6 +148,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     @Autowired
     private CostsCalcService costsCalcService;
 
+    @Autowired
+    private PtlAgreementUndwrtRulesAttrService ptlAgreementUndwrtRulesAttrService;
+
 
     public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService,
                                 SysUserRoleService sysUserRoleService,
@@ -1015,7 +1021,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 orderAndAreaCompany.setReferrerName(referrerUser.getName());
                 orderAndAreaCompany.setReferrerDeptId(referrerUser.getDeptId());
                 SysDept sysDept = sysDeptService.getById(referrerUser.getDeptId());
-                orderAndAreaCompany.setReferrerDeptName(sysDept.getName());
+                orderAndAreaCompany.setReferrerDeptName(sysDept!=null?sysDept.getName():null);
                 orderAndAreaCompany.setReferrerDeptAreaInfo(sysDeptService.queryBelongArea(referrerUser.getDeptId()));
             }
 
@@ -1104,6 +1110,12 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             orderAndAreaCompany.setSumFee(sum.toString());
             List<DistributionLevelVo> distributionLevelVoList = feeRuleSchemeService.converDistrbutionData(insFeeOrderNew);
             orderAndAreaCompany.setDistributionLevelVoList(distributionLevelVoList);
+            if(ptlAgreementProductCostsNew!=null){
+                // add by  hxl  2024-05-14  显示费用信息
+                List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
+                AgreementProductCostsSave agreementProductCosts = ptlAgreementProductCostsNewService.costsGet(ptlAgreementProductCostsNew.getId(),undwrtRulesAttrList);
+                orderAndAreaCompany.setAgreementProductCostsSave(agreementProductCosts);
+            }
         }
         //查询费用审核状态
         List<InsFeeAudit> feeAuditList = insFeeAuditService.query().eq("ins_order_no", companyId).list();

+ 26 - 0
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -414,4 +414,30 @@
             AND createtime BETWEEN #{params.startDateStr} and #{params.endDateStr}
         </if>
     </select>
+
+    <select id="selectListByDateStr" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
+        -- 查询订单信息
+        SELECT
+           iac.*
+        FROM
+           ins_area_company iac
+        JOIN ins_orders AS io  ON io.orderno = iac.orderno
+        WHERE
+        1=1
+        <if test="dateStr != null and dateStr != ''">
+            AND DATE_FORMAT(io.createtime, '%Y-%m') =#{dateStr}
+        </if>
+    </select>
+
+    <select id="selectListById" resultMap="BaseResultMap">
+        SELECT
+        iac.*
+        FROM
+        ins_area_company iac
+        WHERE
+        1=1
+        <if test="id != null and id != ''">
+            AND iac.id =#{id}
+        </if>
+    </select>
 </mapper>