保险下单
This commit is contained in:
parent
d44591330a
commit
d5c1dda703
|
|
@ -39,6 +39,7 @@ import com.ghy.payment.service.OrderFineRecordService;
|
||||||
import com.ghy.system.domain.SysArea;
|
import com.ghy.system.domain.SysArea;
|
||||||
import com.ghy.system.service.ISysAreaService;
|
import com.ghy.system.service.ISysAreaService;
|
||||||
import com.ghy.web.pojo.vo.*;
|
import com.ghy.web.pojo.vo.*;
|
||||||
|
import com.ghy.web.service.InsuranceService;
|
||||||
import com.ghy.worker.domain.Worker;
|
import com.ghy.worker.domain.Worker;
|
||||||
import com.ghy.worker.domain.WorkerCertification;
|
import com.ghy.worker.domain.WorkerCertification;
|
||||||
import com.ghy.worker.service.IWorkerCertificationService;
|
import com.ghy.worker.service.IWorkerCertificationService;
|
||||||
|
|
@ -122,6 +123,9 @@ public class OrderMasterController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private CustomerAddressService customerAddressService;
|
private CustomerAddressService customerAddressService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InsuranceService insuranceService;
|
||||||
|
|
||||||
@GetMapping("/changePrice/{orderIds}")
|
@GetMapping("/changePrice/{orderIds}")
|
||||||
public String changePrice(@PathVariable("orderIds") String orderIds, ModelMap mmap)
|
public String changePrice(@PathVariable("orderIds") String orderIds, ModelMap mmap)
|
||||||
{
|
{
|
||||||
|
|
@ -1374,6 +1378,12 @@ public class OrderMasterController extends BaseController {
|
||||||
orderDetails.forEach(orderDetail -> {
|
orderDetails.forEach(orderDetail -> {
|
||||||
orderDetail.setOrderStatus(orderMaster.getOrderStatus());
|
orderDetail.setOrderStatus(orderMaster.getOrderStatus());
|
||||||
orderDetailService.updateOrderDetail(orderDetail);
|
orderDetailService.updateOrderDetail(orderDetail);
|
||||||
|
// 下单
|
||||||
|
if(OrderStatus.PLAIN.code() == orderMaster.getOrderStatus()){
|
||||||
|
OrderMaster model = orderMasterService.selectById(orderMaster.getId());
|
||||||
|
insuranceService.orderInsurance(model.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return AjaxResult.success("");
|
return AjaxResult.success("");
|
||||||
|
|
|
||||||
|
|
@ -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 Date orderStartat;
|
||||||
|
|
||||||
|
private Date orderEndat;
|
||||||
|
|
||||||
|
private String customerAddress;
|
||||||
|
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
private String workName;
|
||||||
|
|
||||||
|
private String workerID;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.ghy.web.service;
|
||||||
|
|
||||||
|
public interface InsuranceService {
|
||||||
|
|
||||||
|
public void orderInsurance(String orderCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.ghy.web.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateField;
|
||||||
|
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.offset(new Date(), DateField.SECOND, 30));
|
||||||
|
req.setOrderEndat(DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, 30));
|
||||||
|
log.info("调用保险请求url:{},内容:{}", baseUrl+"/platInterface/order", JSONUtil.toJsonStr(req));
|
||||||
|
String result = HttpUtil.post(baseUrl+"/platInterface/order", JSONUtil.toJsonStr(req));
|
||||||
|
log.info("调用保险返回内容:{}", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue