|
@@ -0,0 +1,159 @@
|
|
|
|
|
+package com.ydtech.modules.order.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
|
|
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
|
|
+import com.ydtech.modules.order.dao.InsOrderPushMsgMapper;
|
|
|
|
|
+import com.ydtech.modules.order.dao.InsTaskImagesMapper;
|
|
|
|
|
+import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
|
|
+import com.ydtech.modules.order.entity.InsOrders;
|
|
|
|
|
+import com.ydtech.modules.order.entity.dto.InsTaskImagesDto;
|
|
|
|
|
+import com.ydtech.modules.order.entity.po.InsOrderPushMsg;
|
|
|
|
|
+import com.ydtech.modules.order.entity.vo.PushDataVo;
|
|
|
|
|
+import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
|
|
+import com.ydtech.modules.order.service.InsOrderPushMsgService;
|
|
|
|
|
+import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
|
|
+import com.ydtech.utils.OrderUtils;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @author Administrator
|
|
|
|
|
+ * @description 针对表【ins_order_push_msg(子订单推送数据表)】的数据库操作Service实现
|
|
|
|
|
+ * @createDate 2024-11-05 11:45:52
|
|
|
|
|
+ */
|
|
|
|
|
+@Service
|
|
|
|
|
+public class InsOrderPushMsgServiceImpl extends ServiceImpl<InsOrderPushMsgMapper, InsOrderPushMsg>
|
|
|
|
|
+ implements InsOrderPushMsgService {
|
|
|
|
|
+
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(InsOrderPushMsgServiceImpl.class);
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsOrderPushMsgMapper insOrderPushMsgMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsAreaCompanyService insAreaCompanyService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsOrdersService insOrdersService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsTaskImagesMapper insTaskImagesMapper;
|
|
|
|
|
+
|
|
|
|
|
+ //@Autowired
|
|
|
|
|
+ //private RabbitTemplate rabbitTemplate;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/11/5 14:50
|
|
|
|
|
+ * @Description: 推送历史的订单信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void getPushInsAreaCompanyList() {
|
|
|
|
|
+ List<String> dateList = insOrderPushMsgMapper.getPushInsAreaCompanyDateList();
|
|
|
|
|
+ // List<String> dateList =new ArrayList<String>();
|
|
|
|
|
+ // dateList.add("2024-10");
|
|
|
|
|
+ if(dateList!=null && !dateList.isEmpty()){
|
|
|
|
|
+ //启动线程池
|
|
|
|
|
+ dateList.forEach(item ->{
|
|
|
|
|
+ String benginTime = SliceUpDateUtil.getStartOfMonth(Integer.parseInt(item.split("-")[0]), Integer.parseInt(item.split("-")[1]));
|
|
|
|
|
+ String endTime = SliceUpDateUtil.getEndOfMonth(Integer.parseInt(item.split("-")[0]), Integer.parseInt(item.split("-")[1]));
|
|
|
|
|
+ List<String> orderList = insOrderPushMsgMapper.getPushInsAreaCompanyList(benginTime,endTime);
|
|
|
|
|
+ ArrayList<String> pushDataList =new ArrayList<String>();
|
|
|
|
|
+ if(orderList!=null && !orderList.isEmpty()){
|
|
|
|
|
+ orderList.forEach(orderId ->{
|
|
|
|
|
+ pushDataList.add(getPushDataJsonString(orderId));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ if(pushDataList!=null && !pushDataList.isEmpty()){
|
|
|
|
|
+ // Thread thread = new Thread(new OrderRunnableThread(rabbitTemplate, pushDataList,this));
|
|
|
|
|
+ //thread.start();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/11/11 8:39
|
|
|
|
|
+ * @Description: 查询补偿的订单数据并推送
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void getPushCompensateInsAreaCompanyList() {
|
|
|
|
|
+ List<String> orderList = insOrderPushMsgMapper.getPushCompensateInsAreaCompanyList();
|
|
|
|
|
+ ArrayList<String> pushDataList =new ArrayList<String>();
|
|
|
|
|
+ if(orderList!=null && !orderList.isEmpty()){
|
|
|
|
|
+ //通过
|
|
|
|
|
+ orderList.forEach(orderId ->{
|
|
|
|
|
+ pushDataList.add(getPushDataJsonString(orderId));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ if(pushDataList!=null && !pushDataList.isEmpty()){
|
|
|
|
|
+ //Thread thread = new Thread(new OrderRunnableThread(rabbitTemplate, pushDataList,this));
|
|
|
|
|
+ //thread.start();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/11/11 8:39
|
|
|
|
|
+ * @Description: 承保数据推送
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void getPushSignInsAreaCompanyList(String item) {
|
|
|
|
|
+ try{
|
|
|
|
|
+ ArrayList<String> pushDataList =new ArrayList<String>();
|
|
|
|
|
+ pushDataList.add(getPushDataJsonString(item));
|
|
|
|
|
+ //Thread thread = new Thread(new OrderRunnableThread(rabbitTemplate, pushDataList,this));
|
|
|
|
|
+ //thread.start();
|
|
|
|
|
+ }catch(Exception e){
|
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/11/11 8:45
|
|
|
|
|
+ * @Description: 通过订单id查询订单数据
|
|
|
|
|
+ */
|
|
|
|
|
+ public String getPushDataJsonString(String orderId) {
|
|
|
|
|
+ //小订单的数据
|
|
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getById(orderId);
|
|
|
|
|
+ //大订单数据
|
|
|
|
|
+ InsOrders orders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
|
|
+ String jyPolicyNo="";
|
|
|
|
|
+ String apiType = insAreaCompany.getApiType() == null ? null : insAreaCompany.getApiType() + "";
|
|
|
|
|
+ if (insAreaCompany.getCrossInsurance() != null) {
|
|
|
|
|
+ jyPolicyNo = OrderUtils.getJyPolicyNo(insAreaCompany.getCompanyId(), apiType, insAreaCompany.getCrossInsurance().toString(), String.valueOf(orders.getIsExternal()));
|
|
|
|
|
+ }
|
|
|
|
|
+ insAreaCompany.setJyPolicyNo(jyPolicyNo);
|
|
|
|
|
+ //影像数据
|
|
|
|
|
+ List<InsTaskImagesDto> taskImagesList = insTaskImagesMapper.getTaskImagesList(insAreaCompany.getOrderno());
|
|
|
|
|
+ PushDataVo pushDataVo =new PushDataVo(insAreaCompany,orders,taskImagesList);
|
|
|
|
|
+ String json = JSONObject.toJSONString(pushDataVo);
|
|
|
|
|
+ return json;
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/11/11 9:04
|
|
|
|
|
+ * @Description: 测试承保推送
|
|
|
|
|
+ */
|
|
|
|
|
+ public void testSignData(String orderId) {
|
|
|
|
|
+ //小订单的数据
|
|
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getById(orderId);
|
|
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
|
|
+ insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|