|
@@ -1,8 +1,11 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
|
+import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
import cn.dev33.satoken.session.SaSession;
|
|
import cn.dev33.satoken.session.SaSession;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -23,10 +26,16 @@ import com.ydtech.modules.esm.service.EsmUserReferrerService;
|
|
|
import com.ydtech.modules.fee.service.impl.FeeRuleSchemeServiceImpl;
|
|
import com.ydtech.modules.fee.service.impl.FeeRuleSchemeServiceImpl;
|
|
|
import com.ydtech.modules.fnc.entity.InsFeeAudit;
|
|
import com.ydtech.modules.fnc.entity.InsFeeAudit;
|
|
|
import com.ydtech.modules.fnc.service.InsFeeAuditService;
|
|
import com.ydtech.modules.fnc.service.InsFeeAuditService;
|
|
|
|
|
+import com.ydtech.modules.ins.dao.InsFileMapper;
|
|
|
|
|
+import com.ydtech.modules.ins.model.InsOrdersExcel;
|
|
|
|
|
+import com.ydtech.modules.ins.model.InsOrdersExcelVo;
|
|
|
import com.ydtech.modules.ins.model.vo.CarInfoVo;
|
|
import com.ydtech.modules.ins.model.vo.CarInfoVo;
|
|
|
import com.ydtech.modules.ins.model.ya.CarModelDTO;
|
|
import com.ydtech.modules.ins.model.ya.CarModelDTO;
|
|
|
import com.ydtech.modules.ins.model.ya.ExtendInfoDto;
|
|
import com.ydtech.modules.ins.model.ya.ExtendInfoDto;
|
|
|
import com.ydtech.modules.ins.model.ya.ResponseDataC2;
|
|
import com.ydtech.modules.ins.model.ya.ResponseDataC2;
|
|
|
|
|
+import com.ydtech.modules.ins.utils.EasyExcelUtils;
|
|
|
|
|
+import com.ydtech.modules.ins.utils.ExcelStyleUtil;
|
|
|
|
|
+import com.ydtech.modules.ins.utils.ExcelUtils2;
|
|
|
import com.ydtech.modules.order.convert.CarModelDTOConvert;
|
|
import com.ydtech.modules.order.convert.CarModelDTOConvert;
|
|
|
import com.ydtech.modules.order.convert.MapToYaExtendInfoDto;
|
|
import com.ydtech.modules.order.convert.MapToYaExtendInfoDto;
|
|
|
import com.ydtech.modules.order.dao.InsOrdersMapper;
|
|
import com.ydtech.modules.order.dao.InsOrdersMapper;
|
|
@@ -47,13 +56,18 @@ import com.ydtech.utils.SnowFlakeUtil;
|
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.constraints.NotBlank;
|
|
import javax.validation.constraints.NotBlank;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -90,13 +104,18 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
|
|
|
|
|
private final InsOrdersTrackService insOrdersTrackService;
|
|
private final InsOrdersTrackService insOrdersTrackService;
|
|
|
|
|
|
|
|
|
|
+ private final InsFileMapper insFileMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${upload.file.path}")
|
|
|
|
|
+ private String uploadFilePath;
|
|
|
|
|
+
|
|
|
public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService,
|
|
public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService,
|
|
|
SysUserRoleService sysUserRoleService, EsmUserReferrerService esmUserReferrerService,
|
|
SysUserRoleService sysUserRoleService, EsmUserReferrerService esmUserReferrerService,
|
|
|
SysDeptService sysDeptService, StringRedisTemplate redisTemplate,
|
|
SysDeptService sysDeptService, StringRedisTemplate redisTemplate,
|
|
|
@Lazy InsAreaCompanyService insAreaCompanyService,
|
|
@Lazy InsAreaCompanyService insAreaCompanyService,
|
|
|
PtlAgreementService ptlAgreementService,
|
|
PtlAgreementService ptlAgreementService,
|
|
|
@Lazy FeeRuleSchemeServiceImpl feeRuleSchemeService,
|
|
@Lazy FeeRuleSchemeServiceImpl feeRuleSchemeService,
|
|
|
- InsFeeAuditService insFeeAuditService, InsOrdersTrackService insOrdersTrackService) {
|
|
|
|
|
|
|
+ InsFeeAuditService insFeeAuditService, InsOrdersTrackService insOrdersTrackService, InsFileMapper insFileMapper) {
|
|
|
|
|
|
|
|
this.orderComponents = orderComponents;
|
|
this.orderComponents = orderComponents;
|
|
|
this.sysUserService = sysUserService;
|
|
this.sysUserService = sysUserService;
|
|
@@ -109,6 +128,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
this.feeRuleSchemeService = feeRuleSchemeService;
|
|
this.feeRuleSchemeService = feeRuleSchemeService;
|
|
|
this.insFeeAuditService = insFeeAuditService;
|
|
this.insFeeAuditService = insFeeAuditService;
|
|
|
this.insOrdersTrackService = insOrdersTrackService;
|
|
this.insOrdersTrackService = insOrdersTrackService;
|
|
|
|
|
+ this.insFileMapper = insFileMapper;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -382,6 +402,86 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
page.getPages(), insOrdersPage.getRecords());
|
|
page.getPages(), insOrdersPage.getRecords());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订单信息导出excel
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param insOrdersExcelVo
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<String> orderExportExcel(InsOrdersExcelVo insOrdersExcelVo) {
|
|
|
|
|
+ List<InsOrdersExcel> insOrdersExcels = baseMapper.queryOrderList(insOrdersExcelVo);
|
|
|
|
|
+
|
|
|
|
|
+ for (InsOrdersExcel insOrdersExcel : insOrdersExcels) {
|
|
|
|
|
+ // 设置车辆信息
|
|
|
|
|
+ JSONObject carInfo = insOrdersExcel.getCarInfo();
|
|
|
|
|
+ insOrdersExcel.setModelcName(carInfo.getString("modelcname"));
|
|
|
|
|
+ insOrdersExcel.setSeatCount(carInfo.getString("seatCount"));
|
|
|
|
|
+ insOrdersExcel.setTransferFlag(carInfo.getString("transferFlag").equals("true") ? "是" : "否");
|
|
|
|
|
+ insOrdersExcel.setTransferFlagBi(carInfo.getString("noLicenseFlag").equals("true") ? "是" : "否");
|
|
|
|
|
+
|
|
|
|
|
+ // 设置车主信息
|
|
|
|
|
+ JSONObject ownerInfo = insOrdersExcel.getOwnerInfo();
|
|
|
|
|
+ insOrdersExcel.setOwnerName(ownerInfo.getString("name"));
|
|
|
|
|
+ insOrdersExcel.setOwnerAge(ownerInfo.getString("age"));
|
|
|
|
|
+ insOrdersExcel.setOwnerMobile(ownerInfo.getString("mobile"));
|
|
|
|
|
+ insOrdersExcel.setOwnerIdentifyNumber(ownerInfo.getString("identifyNumber"));
|
|
|
|
|
+
|
|
|
|
|
+ // 设置申请人信息
|
|
|
|
|
+ JSONObject applyInfo = insOrdersExcel.getApplyInfo();
|
|
|
|
|
+ insOrdersExcel.setApplyName(applyInfo.getString("name"));
|
|
|
|
|
+ insOrdersExcel.setApplyAge(applyInfo.getString("age"));
|
|
|
|
|
+ insOrdersExcel.setApplyMobile(applyInfo.getString("mobile"));
|
|
|
|
|
+ insOrdersExcel.setApplyIdentifyNumber(applyInfo.getString("identifyNumber"));
|
|
|
|
|
+
|
|
|
|
|
+ // 设置被保险人信息
|
|
|
|
|
+ JSONObject insureInfo = insOrdersExcel.getInsureInfo();
|
|
|
|
|
+ insOrdersExcel.setInsureName(insureInfo.getString("name"));
|
|
|
|
|
+ insOrdersExcel.setInsureAge(insureInfo.getString("age"));
|
|
|
|
|
+ insOrdersExcel.setInsureMobile(insureInfo.getString("mobile"));
|
|
|
|
|
+ insOrdersExcel.setInsureIdentifyNumber(insureInfo.getString("identifyNumber"));
|
|
|
|
|
+
|
|
|
|
|
+ // 设置险种信息
|
|
|
|
|
+ JSONArray kindInfo = insOrdersExcel.getKindInfo();
|
|
|
|
|
+ if (kindInfo != null) {
|
|
|
|
|
+ for (int i = 0; i < kindInfo.size(); i++) {
|
|
|
|
|
+ String kindCode = kindInfo.getJSONObject(i).getString("kindCode");
|
|
|
|
|
+ String amount = kindInfo.getJSONObject(i).getString("amount");
|
|
|
|
|
+ if (kindCode != null) {
|
|
|
|
|
+ switch (kindCode) {
|
|
|
|
|
+ case "B":
|
|
|
|
|
+ insOrdersExcel.setThird(amount);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "D4":
|
|
|
|
|
+ insOrdersExcel.setSit(amount);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "D3":
|
|
|
|
|
+ insOrdersExcel.setDriver(amount);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String s = EasyExcelUtils.downExcel(uploadFilePath, InsOrdersExcel.class, insOrdersExcels);
|
|
|
|
|
+ return HttpResult.ok("",s);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// Date now = new Date();
|
|
|
|
|
+// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
|
|
+// String fileName = "orders";
|
|
|
|
|
+// // 导出
|
|
|
|
|
+// ExportParams exportParams = new ExportParams("订单信息表"+simpleDateFormat.format(now), null, ExcelType.HSSF);
|
|
|
|
|
+// // 设置
|
|
|
|
|
+// exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
|
|
+//
|
|
|
|
|
+// try {
|
|
|
|
|
+// ExcelUtils2.exportExcel(insOrdersExcels, InsOrdersExcel.class, fileName, exportParams, request, response);
|
|
|
|
|
+// } catch (IOException e) {
|
|
|
|
|
+// log.error(String.valueOf(e));
|
|
|
|
|
+// }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|