Compare commits

...

2 Commits

Author SHA1 Message Date
kuang.yife e398ad7e25 保险业务 2024-09-11 15:54:25 +08:00
kuang.yife d5c1dda703 保险下单 2024-09-09 15:37:45 +08:00
4 changed files with 115 additions and 0 deletions

View File

@ -39,6 +39,7 @@ import com.ghy.payment.service.OrderFineRecordService;
import com.ghy.system.domain.SysArea;
import com.ghy.system.service.ISysAreaService;
import com.ghy.web.pojo.vo.*;
import com.ghy.web.service.InsuranceService;
import com.ghy.worker.domain.Worker;
import com.ghy.worker.domain.WorkerCertification;
import com.ghy.worker.service.IWorkerCertificationService;
@ -122,6 +123,9 @@ public class OrderMasterController extends BaseController {
@Resource
private CustomerAddressService customerAddressService;
@Resource
private InsuranceService insuranceService;
@GetMapping("/changePrice/{orderIds}")
public String changePrice(@PathVariable("orderIds") String orderIds, ModelMap mmap)
{
@ -1376,6 +1380,11 @@ public class OrderMasterController extends BaseController {
orderDetailService.updateOrderDetail(orderDetail);
});
}
// 下单
if(OrderStatus.PLAIN.code() == orderMaster.getOrderStatus()){
OrderMaster model = orderMasterService.selectById(orderMaster.getId());
insuranceService.orderInsurance(model.getCode());
}
return AjaxResult.success("");
} catch (Exception e) {
e.printStackTrace();

View File

@ -0,0 +1,36 @@
package com.ghy.web.pojo.vo;
import lombok.Data;
import java.util.Date;
@Data
public class InsuranceOrderReq {
private String requestNo;
private String channelCode = "NNDD0806QH";
private String sign;
private String orderNumber;
private String orderProductType = "0002";
private String orderStatus = "1";
private String orderStartat;
private String orderEndat;
private String customerAddress;
private String customerPhone;
private String workName;
private String workerID;
}

View File

@ -0,0 +1,9 @@
package com.ghy.web.service;
public interface InsuranceService {
public void orderInsurance(String orderCode);
}

View File

@ -0,0 +1,61 @@
package com.ghy.web.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.ghy.common.utils.security.Md5Utils;
import com.ghy.customer.domain.CustomerAddress;
import com.ghy.customer.service.CustomerAddressService;
import com.ghy.order.domain.OrderMaster;
import com.ghy.order.service.OrderMasterService;
import com.ghy.web.pojo.vo.InsuranceOrderReq;
import com.ghy.web.service.InsuranceService;
import com.ghy.worker.domain.WorkerCertification;
import com.ghy.worker.service.IWorkerCertificationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Slf4j
@Service
public class InsuranceServiceImpl implements InsuranceService {
private final static String Key = "96ndsd26k25jm";
private final static String baseUrl = "https://pre-hbhp-xianding.hzins.com/api/external/";
@Autowired
private OrderMasterService orderMasterService;
@Autowired
private CustomerAddressService customerAddressService;
@Autowired
private IWorkerCertificationService workerCertificationService;
@Override
public void orderInsurance(String orderCode) {
InsuranceOrderReq req = new InsuranceOrderReq();
OrderMaster master = orderMasterService.selectByCode(orderCode);
req.setOrderNumber(master.getCode());
req.setRequestNo(master.getCode() + System.currentTimeMillis());
req.setSign(Md5Utils.hash(req.getRequestNo() + req.getChannelCode() + Key));
// 查询客户地址信息
CustomerAddress customerAddress = customerAddressService.selectByCustomerAddressId(master.getAddressId());
req.setCustomerAddress(customerAddress.getAddress());
req.setCustomerPhone(customerAddress.getPhone());
// 查询师傅信息
WorkerCertification workerCertification = workerCertificationService.selectByWorkerId(master.getWorkerId());
req.setWorkerID(workerCertification.getIdCardNum());
req.setWorkName(workerCertification.getLegalPersionName());
req.setOrderStartat(DateUtil.format(DateUtil.offset(new Date(), DateField.SECOND, 30), DatePattern.NORM_DATETIME_PATTERN));
req.setOrderEndat(DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, 30),DatePattern.NORM_DATETIME_PATTERN));
log.info("调用保险请求url:{},内容:{}", baseUrl+"/platInterface/order", JSONUtil.toJsonStr(req));
String result = HttpUtil.post(baseUrl+"/platInterface/order", JSONUtil.toJsonStr(req));
log.info("调用保险返回内容:{}", result);
}
}