Compare commits

..

2 Commits

Author SHA1 Message Date
Yifei Kuang ec5fcacf64 feat: 保险增员问题 2024-12-12 15:13:31 +08:00
Yifei Kuang d798bf8f26 1.后台下单备注问题 2024-12-09 16:49:23 +08:00
6 changed files with 98 additions and 7 deletions

View File

@ -267,6 +267,7 @@ public class OrderController extends BaseController {
orderMaster.setGoodsBrand(request.getGoodsBrand()); orderMaster.setGoodsBrand(request.getGoodsBrand());
orderMaster.setGoodsSpecification(request.getGoodsSpecification()); orderMaster.setGoodsSpecification(request.getGoodsSpecification());
orderMaster.setConsultMode(request.getConsultMode()); orderMaster.setConsultMode(request.getConsultMode());
orderMaster.setRemark(request.getRemark());
if("01".equalsIgnoreCase(orderMaster.getConsultMode())){ if("01".equalsIgnoreCase(orderMaster.getConsultMode())){
orderMaster.setOrderMode("02"); orderMaster.setOrderMode("02");
orderMaster.setPayMode("01"); orderMaster.setPayMode("01");
@ -1548,9 +1549,9 @@ public class OrderController extends BaseController {
List<OrderGoods> orderStandardList = orderGoodsService.selectByOrderDetailId(detail.getId()); List<OrderGoods> orderStandardList = orderGoodsService.selectByOrderDetailId(detail.getId());
// 商品信息 // 商品信息
GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId()); // GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId());
Goods goods = goodsService.selectById(goodsStandard.getGoodsId()); Goods goods = goodsService.selectById(orderMaster.getGoodsId());
// 填充商品三级类目 // 填充商品三级类目
if(goods.getDeptGoodsCategoryId() != null){ if(goods.getDeptGoodsCategoryId() != null){
Long categoryId = null; Long categoryId = null;

View File

@ -338,7 +338,7 @@ public class OrderDetailController extends BaseController {
List<OrderGoods> orderStandardList = orderGoodsService.selectByOrderDetailId(detail.getId()); List<OrderGoods> orderStandardList = orderGoodsService.selectByOrderDetailId(detail.getId());
// 商品信息 // 商品信息
GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId()); // GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId());
Goods goods = goodsService.selectById(orderMaster.getGoodsId()); Goods goods = goodsService.selectById(orderMaster.getGoodsId());
if (goods != null) { if (goods != null) {

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.ghy.web.pojo.vo.CertNoTwoElementReq; import com.ghy.web.pojo.vo.CertNoTwoElementReq;
import com.ghy.web.service.AliCloudService; import com.ghy.web.service.AliCloudService;
import com.ghy.web.service.InsuranceService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -38,6 +39,9 @@ public class OrderDetailInsuranceUserController extends BaseController
@Autowired @Autowired
private AliCloudService aliCloudService; private AliCloudService aliCloudService;
@Autowired
private InsuranceService insuranceService;
@RequiresPermissions("worker:user:view") @RequiresPermissions("worker:user:view")
@GetMapping() @GetMapping()
public String user() public String user()
@ -108,6 +112,13 @@ public class OrderDetailInsuranceUserController extends BaseController
log.error("身份证二要素校验失败:{}", e.getMessage(), e); log.error("身份证二要素校验失败:{}", e.getMessage(), e);
return AjaxResult.error(e.getMessage(), "身份证二要素校验失败!"); return AjaxResult.error(e.getMessage(), "身份证二要素校验失败!");
} }
// 将保险人员增员到原保险订单上去
try {
insuranceService.editInsurance(orderDetailInsuranceUser);
}catch (Exception e){
log.error("保险增员失败:{}", e.getMessage(), e);
return AjaxResult.error(e.getMessage(), "保险增员失败!");
}
return toAjax(orderDetailInsuranceUserService.insertOrderDetailInsuranceUser(orderDetailInsuranceUser)); return toAjax(orderDetailInsuranceUserService.insertOrderDetailInsuranceUser(orderDetailInsuranceUser));
} }

View File

@ -0,0 +1,22 @@
package com.ghy.web.pojo.vo;
import lombok.Data;
@Data
public class InsuranceOrderEditReq {
private String requestNo;
private String channelCode = "NNDD0806QH";
private String sign;
private String orderNumber;
private String workName;
private String workerID;
}

View File

@ -1,9 +1,11 @@
package com.ghy.web.service; package com.ghy.web.service;
import com.ghy.order.domain.OrderDetailInsuranceUser;
public interface InsuranceService { public interface InsuranceService {
public void orderInsurance(String orderCode) throws Exception; void orderInsurance(String orderCode) throws Exception;
void editInsurance(OrderDetailInsuranceUser orderDetailInsuranceUser) throws Exception ;
} }

View File

@ -9,9 +9,14 @@ import com.alibaba.fastjson.JSONObject;
import com.ghy.common.utils.security.Md5Utils; import com.ghy.common.utils.security.Md5Utils;
import com.ghy.customer.domain.CustomerAddress; import com.ghy.customer.domain.CustomerAddress;
import com.ghy.customer.service.CustomerAddressService; import com.ghy.customer.service.CustomerAddressService;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderDetailInsuranceUser;
import com.ghy.order.domain.OrderMaster; import com.ghy.order.domain.OrderMaster;
import com.ghy.order.service.IOrderDetailInsuranceUserService;
import com.ghy.order.service.OrderDetailService;
import com.ghy.order.service.OrderMasterService; import com.ghy.order.service.OrderMasterService;
import com.ghy.web.pojo.vo.CertNoTwoElementReq; import com.ghy.web.pojo.vo.CertNoTwoElementReq;
import com.ghy.web.pojo.vo.InsuranceOrderEditReq;
import com.ghy.web.pojo.vo.InsuranceOrderReq; import com.ghy.web.pojo.vo.InsuranceOrderReq;
import com.ghy.web.service.InsuranceService; import com.ghy.web.service.InsuranceService;
import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.Worker;
@ -21,8 +26,10 @@ import com.ghy.worker.service.WorkerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date; import java.util.Date;
import java.util.List;
@Slf4j @Slf4j
@Service @Service
@ -39,10 +46,13 @@ public class InsuranceServiceImpl implements InsuranceService {
private CustomerAddressService customerAddressService; private CustomerAddressService customerAddressService;
@Autowired @Autowired
private IWorkerCertificationService workerCertificationService; private WorkerService workerService;
@Autowired @Autowired
private WorkerService workerService; private OrderDetailService orderDetailService;
@Autowired
private IOrderDetailInsuranceUserService orderDetailInsuranceUserService;
@Override @Override
public void orderInsurance(String orderCode) throws Exception{ public void orderInsurance(String orderCode) throws Exception{
@ -69,4 +79,49 @@ public class InsuranceServiceImpl implements InsuranceService {
throw new Exception(JSONObject.parseObject(result).getString("msg")); throw new Exception(JSONObject.parseObject(result).getString("msg"));
} }
} }
@Override
public void editInsurance(OrderDetailInsuranceUser orderDetailInsuranceUser) throws Exception {
// 查询子单
OrderDetail detail = orderDetailService.selectById(orderDetailInsuranceUser.getOrderDetailId());
// 查询主单
OrderMaster master = orderMasterService.selectById(detail.getOrderMasterId());
// 查师傅信息
Worker worker = workerService.selectById(master.getWorkerId());
CertNoTwoElementReq certNoTwoElementReq = JSONUtil.toBean(worker.getRemark(), CertNoTwoElementReq.class);
// 查询主单下的所有子单
List<OrderDetail> detailList = orderDetailService.selectByOrderMasterId(detail.getOrderMasterId());
StringBuilder workerName = new StringBuilder();
StringBuilder workerId = new StringBuilder();
// 拼上主单信息
workerName.append(certNoTwoElementReq.getCertName());
workerId.append(certNoTwoElementReq.getCertNo());
detailList.forEach(model->{
OrderDetailInsuranceUser param = new OrderDetailInsuranceUser();
param.setOrderDetailId(model.getId());
List<OrderDetailInsuranceUser> users = orderDetailInsuranceUserService.selectOrderDetailInsuranceUserList(param);
if(!CollectionUtils.isEmpty(users)){
users.forEach(user->{
workerName.append(",").append(user.getName());
workerId.append(",").append(user.getIdCardNum());
});
}
});
// 再拼上 现在要加入的师傅的信息
workerName.append(",").append(orderDetailInsuranceUser.getName());
workerId.append(",").append(orderDetailInsuranceUser.getIdCardNum());
InsuranceOrderEditReq editReq = new InsuranceOrderEditReq();
editReq.setOrderNumber(master.getCode());
editReq.setRequestNo(master.getCode() + System.currentTimeMillis());
editReq.setSign(Md5Utils.hash(editReq.getRequestNo() + editReq.getChannelCode() + Key));
editReq.setOrderNumber(master.getCode());
editReq.setWorkName(workerName.toString());
editReq.setWorkerID(workerId.toString());
log.info("调用保险请求url:{},内容:{}", baseUrl+"/platInterface/updateOrder", JSONUtil.toJsonStr(editReq));
String result = HttpUtil.post(baseUrl+"/platInterface/updateOrder", JSONUtil.toJsonStr(editReq));
log.info("调用保险返回内容:{}", result);
if(!"1".equals(JSONObject.parseObject(result).getString("code"))){
throw new Exception(JSONObject.parseObject(result).getString("msg"));
}
}
} }