diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java index 9aad3f8d..9437a7bd 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java @@ -4,13 +4,16 @@ import com.ghy.common.adapay.model.AnalyseItemEnum; import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.page.TableDataInfo; +import com.ghy.common.enums.FinancialDetailType; import com.ghy.common.enums.PlaceStatus; import com.ghy.common.enums.UserStatus; import com.ghy.common.utils.ExceptionUtil; import com.ghy.customer.domain.Customer; import com.ghy.customer.service.CustomerService; +import com.ghy.goods.domain.InsuranceManager; import com.ghy.order.domain.OrderMaster; import com.ghy.order.service.OrderMasterService; +import com.ghy.payment.domain.FinancialDetail; import com.ghy.payment.domain.FinancialMaster; import com.ghy.payment.service.FinancialMasterService; import com.ghy.web.pojo.vo.AnalyseItem; @@ -19,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; @@ -242,6 +246,25 @@ public class CustomerController extends BaseController { return getDataTable(response); } + @GetMapping("/changePlace/{customerId}") + public String changePlace(@PathVariable("customerId") Long customerId, ModelMap mmap) + { + + mmap.put("customerId", customerId); + mmap.put("customerPlaces", customerService.getPlaceCustomerList()); + return prefix + "/changePlace"; + } + + @PostMapping("/changePlace") + @ResponseBody + @Transactional(rollbackFor = Exception.class) + public AjaxResult changePlace(Customer customer) { + Customer place = customerService.selectByCustomerId(customer.getCustomerPlace()); + customer.setParentCustomerPlace(place.getCustomerPlace()); + customerService.updateCustomer(customer); + return AjaxResult.success(); + } + @RequiresPermissions("customer:customer:resetPwd") @GetMapping("/resetPwd/{customerId}") public String resetPwd(@PathVariable("customerId") Long customerId, ModelMap mmap) diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailInsuranceUserController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailInsuranceUserController.java index dc14291d..483b0f86 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailInsuranceUserController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailInsuranceUserController.java @@ -1,6 +1,10 @@ package com.ghy.web.controller.order; import java.util.List; + +import com.ghy.web.pojo.vo.CertNoTwoElementReq; +import com.ghy.web.service.AliCloudService; +import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -21,6 +25,7 @@ import com.ghy.common.core.page.TableDataInfo; * @author clunt * @date 2024-10-21 */ +@Slf4j @Controller @RequestMapping("/insurance/user") public class OrderDetailInsuranceUserController extends BaseController @@ -30,6 +35,9 @@ public class OrderDetailInsuranceUserController extends BaseController @Autowired private IOrderDetailInsuranceUserService orderDetailInsuranceUserService; + @Autowired + private AliCloudService aliCloudService; + @RequiresPermissions("worker:user:view") @GetMapping() public String user() @@ -90,6 +98,16 @@ public class OrderDetailInsuranceUserController extends BaseController @ResponseBody public AjaxResult addSave(@RequestBody OrderDetailInsuranceUser orderDetailInsuranceUser) { + // 先校验身份证信息是否ok + CertNoTwoElementReq req = new CertNoTwoElementReq(); + req.setCertName(orderDetailInsuranceUser.getName()); + req.setCertNo(orderDetailInsuranceUser.getIdCardNum()); + try { + aliCloudService.certNoTwoElementVerification(req); + } catch (Exception e) { + log.error("身份证二要素校验失败:{}", e.getMessage(), e); + return AjaxResult.error(e.getMessage(), "身份证二要素校验失败!"); + } return toAjax(orderDetailInsuranceUserService.insertOrderDetailInsuranceUser(orderDetailInsuranceUser)); } diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java index 6de83d21..f018967f 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java @@ -194,6 +194,16 @@ public class OrderMasterController extends BaseController { return "order/pcOrderWorker"; } + @GetMapping("/batchChangeInsurance/{orderIds}") + public String batchChangeInsurance(@PathVariable(value = "orderIds") String orderIds, ModelMap mmap) { + // 不知道为啥参数可能会带上双引号 这里去掉再转Long + orderIds = orderIds.replace("\"", ""); + List insuranceManagers = insuranceManagerService.selectInsuranceManagerList(new InsuranceManager()); + mmap.put("orderIds", orderIds); + mmap.put("insurances", insuranceManagers); + return "order/batchPcOrderInsurance"; + } + @GetMapping("/pcOrderInsurance/{orderIds}") public String pcOrderInsurance(@PathVariable(value = "orderIds") String orderIds, ModelMap mmap) { // 不知道为啥参数可能会带上双引号 这里去掉再转Long @@ -204,8 +214,54 @@ public class OrderMasterController extends BaseController { return "order/pcOrderInsurance"; } + @PostMapping("/pcOrderWorker/batchChangeInsurance") + @ResponseBody + @Transactional(rollbackFor = Exception.class) + public AjaxResult batchChangeInsurance(OrderMaster orderMaster) { + String [] orderIdArr = orderMaster.getOrderMasterIds().split(","); + for (String id : orderIdArr) { + // 原单 + OrderMaster master = orderMasterService.selectById(Long.valueOf(id)); + if(master==null || master.getInsuranceId() != null){ + return AjaxResult.error(master.getCode() + "订单已经选择过保险了!"); + } + } + // 查询保险信息 + InsuranceManager insuranceManager = insuranceManagerService.selectInsuranceManagerById(orderMaster.getInsuranceId()); + if(insuranceManager == null){ + return AjaxResult.error("保险信息有误!"); + } + + for (String id : orderIdArr) { + // 原单 + OrderMaster master = orderMasterService.selectById(Long.valueOf(id)); + if(master==null || master.getInsuranceId() != null){ + return AjaxResult.error(master.getCode() + "订单已经选择过保险了!"); + } + // 修改主单金额 财务单总金额增加 平台金额增加 + FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId()); + financialMaster.setPayMoney(financialMaster.getPayMoney().add(insuranceManager.getInsuranceAmount())); + financialMaster.setTotalMoney(financialMaster.getTotalMoney().add(insuranceManager.getInsuranceAmount())); + financialMasterService.updateFinancialMaster(financialMaster); + // 修改子单 + List details = financialDetailService.selectByFinancialMasterIdAndType(financialMaster.getId(), FinancialDetailType.PLATFORM_FEE.getCode()); + if(CollectionUtils.isNotEmpty(details)){ + FinancialDetail detail = details.get(0); + detail.setPayMoney(detail.getPayMoney().add(insuranceManager.getInsuranceAmount())); + financialDetailService.updateFinancialDetail(detail); + } + // 修改主单保险内容 + OrderMaster param = new OrderMaster(); + param.setId(master.getId()); + param.setInsuranceId(orderMaster.getInsuranceId()); + orderMasterService.updateOrderMaster(param); + } + return AjaxResult.success(); + } + @PostMapping("/pcOrderWorker/changeInsurance") @ResponseBody + @Transactional(rollbackFor = Exception.class) public AjaxResult changeInsurance(OrderMaster orderMaster) { // 原单 OrderMaster master = orderMasterService.selectById(orderMaster.getId()); @@ -229,6 +285,8 @@ public class OrderMasterController extends BaseController { detail.setPayMoney(detail.getPayMoney().add(insuranceManager.getInsuranceAmount())); financialDetailService.updateFinancialDetail(detail); } + // 修改主单保险内容 + orderMasterService.updateOrderMaster(orderMaster); return AjaxResult.success(); } diff --git a/ghy-admin/src/main/resources/templates/customer/changePlace.html b/ghy-admin/src/main/resources/templates/customer/changePlace.html new file mode 100644 index 00000000..e0ee94e8 --- /dev/null +++ b/ghy-admin/src/main/resources/templates/customer/changePlace.html @@ -0,0 +1,30 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+
+ + + + + diff --git a/ghy-admin/src/main/resources/templates/customer/customer.html b/ghy-admin/src/main/resources/templates/customer/customer.html index 4cfb43c6..af205dff 100644 --- a/ghy-admin/src/main/resources/templates/customer/customer.html +++ b/ghy-admin/src/main/resources/templates/customer/customer.html @@ -118,6 +118,22 @@ field: 'phone', title: '手机号' }, + { + field: 'customerPlaceName', + title: '上级分销' + }, + { + field: 'customerPlacePhone', + title: '上级手机号' + }, + { + field: 'parentCustomerPlaceName', + title: '最上级分销' + }, + { + field: 'parentCustomerPlacePhone', + title: '最上级手机号' + }, { field: 'openId', title: '微信唯一id', @@ -130,7 +146,8 @@ var actions = []; actions.push('消费者头像'); return actions.join(''); - } + }, + visible: false }, { visible: editFlag == 'hidden' ? false : true, @@ -151,6 +168,7 @@ formatter: function(value, row, index) { if (row.customerId != 1) { var actions = []; + actions.push('修改上级分销 '); actions.push('删除 '); return actions.join(''); } else { @@ -162,6 +180,11 @@ $.table.init(options); } + function changePlace(customerId) { + var url = ctx + "customer/changePlace/" + customerId; + $.modal.open("修改上级分销", url, '600', '300'); + } + /* 用户管理-重置密码 */ function resetPwd(customerId) { diff --git a/ghy-admin/src/main/resources/templates/customer/place/place.html b/ghy-admin/src/main/resources/templates/customer/place/place.html index 992b1f8b..bd6f2179 100644 --- a/ghy-admin/src/main/resources/templates/customer/place/place.html +++ b/ghy-admin/src/main/resources/templates/customer/place/place.html @@ -42,9 +42,9 @@ 拒绝 - - 修改 - + + + 导出 @@ -79,17 +79,33 @@ field: 'name', title: '名字' }, - { - field: 'customerId', - title: '关联消费者id' - }, + // { + // field: 'customerId', + // title: '关联消费者id' + // }, { field: 'phone', title: '注册手机号' }, { - field: 'city', - title: '城市id' + field: 'customerPlaceName', + title: '上级分销' + }, + { + field: 'customerPlacePhone', + title: '上级手机号' + }, + { + field: 'parentCustomerPlaceName', + title: '最上级分销' + }, + { + field: 'parentCustomerPlacePhone', + title: '最上级手机号' + }, + { + field: 'cityName', + title: '城市名' }, { field: 'status', @@ -107,7 +123,7 @@ align: 'center', formatter: function(value, row, index) { var actions = []; - actions.push('编辑 '); + // actions.push('编辑 '); actions.push('删除'); return actions.join(''); } diff --git a/ghy-admin/src/main/resources/templates/order/batchPcOrderInsurance.html b/ghy-admin/src/main/resources/templates/order/batchPcOrderInsurance.html new file mode 100644 index 00000000..2708d8fb --- /dev/null +++ b/ghy-admin/src/main/resources/templates/order/batchPcOrderInsurance.html @@ -0,0 +1,30 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+
+ + + + + diff --git a/ghy-admin/src/main/resources/templates/order/orderManager.html b/ghy-admin/src/main/resources/templates/order/orderManager.html index 0c7454e9..bdb10df0 100644 --- a/ghy-admin/src/main/resources/templates/order/orderManager.html +++ b/ghy-admin/src/main/resources/templates/order/orderManager.html @@ -325,6 +325,9 @@ 批量改价 + + 批量选择保险 + @@ -717,7 +720,11 @@ if (row.payStatus == 0) { actions.push('付款 '); } - actions.push('选择保险 '); + if (row.insuranceId){ + actions.push('已投保险 '); + } else { + actions.push('选择保险 '); + } return actions.join(''); } }, @@ -991,21 +998,8 @@ function pcOrderInsurance(id) { - var url = prefix + "/pcOrderInsurance/" + id; + var url = ctx + "order/master/pcOrderInsurance/" + id; $.modal.open("选择保险", url, '600', '300'); - // var url = "pcOrderInsurance/" + id; - // layer.open({ - // type: 2, - // area: ['600px', '250px'], - // fix: false, - // //不固定 - // maxmin: true, - // shade: 0.3, - // title: '选择保险', - // content: url, - // // 弹层外区域关闭 - // shadeClose: true - // }); } function batchChangePrice() { @@ -1019,6 +1013,17 @@ $.modal.open("批量改价", url, '800', '300'); } + function batchChangeInsurance() { + table.set(); + var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId); + if (rows.length === 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + var url = ctx + "order/master/batchChangeInsurance/" + rows.join(","); + $.modal.open("批量选择保险", url, '600', '300'); + } + function mergePay() { table.set(); var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId); diff --git a/ghy-admin/src/main/resources/templates/order/pc-master.html b/ghy-admin/src/main/resources/templates/order/pc-master.html index a6dd23b3..03d2d4a9 100644 --- a/ghy-admin/src/main/resources/templates/order/pc-master.html +++ b/ghy-admin/src/main/resources/templates/order/pc-master.html @@ -170,6 +170,9 @@ 付款 + + 批量选择保险 + @@ -471,6 +474,11 @@ if (row.payStatus == 0) { actions.push('付款 '); } + if (row.insuranceId){ + actions.push('已投保险 '); + } else { + actions.push('选择保险 '); + } return actions.join(''); } }, @@ -679,6 +687,22 @@ }); } + function pcOrderInsurance(id) { + var url = ctx + "order/master/pcOrderInsurance/" + id; + $.modal.open("选择保险", url, '600', '300'); + } + + function batchChangeInsurance() { + table.set(); + var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId); + if (rows.length === 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + var url = ctx + "order/master/batchChangeInsurance/" + rows.join(","); + $.modal.open("批量选择保险", url, '600', '300'); + } + diff --git a/ghy-custom/src/main/java/com/ghy/customer/domain/Customer.java b/ghy-custom/src/main/java/com/ghy/customer/domain/Customer.java index 6b99ce3f..238c3e08 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/domain/Customer.java +++ b/ghy-custom/src/main/java/com/ghy/customer/domain/Customer.java @@ -42,13 +42,28 @@ public class Customer extends BaseEntity { @Excel(name = "上级分销人", cellType = Excel.ColumnType.NUMERIC) private Long customerPlace; + + private String customerPlaceName; + + private String customerPlacePhone; + @Excel(name = "祖级分销人", cellType = Excel.ColumnType.NUMERIC) private Long parentCustomerPlace; + private String parentCustomerPlaceName; + + private String parentCustomerPlacePhone; + private Integer placeStatus; // 是否为分销商 private Boolean isDistributor; private List customerPlaces; + + /*审核分销名*/ + private String placeName; + + /*上上级审核分销名*/ + private String parentPlaceName; } diff --git a/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java b/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java index a53b69c1..769e19eb 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java +++ b/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java @@ -1,5 +1,6 @@ package com.ghy.customer.domain; +import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ghy.common.annotation.Excel; @@ -11,6 +12,7 @@ import com.ghy.common.core.domain.BaseEntity; * @author clunt * @date 2022-08-11 */ +@Data public class CustomerPlace extends BaseEntity { private static final long serialVersionUID = 1L; @@ -26,6 +28,13 @@ public class CustomerPlace extends BaseEntity @Excel(name = "关联消费者id") private Long customerId; + private String customerPlaceName; + + private String customerPlacePhone; + + private String parentCustomerPlaceName; + + private String parentCustomerPlacePhone; /** 注册手机号 */ @Excel(name = "注册手机号") private String phone; @@ -34,6 +43,8 @@ public class CustomerPlace extends BaseEntity @Excel(name = "城市id") private Long city; + private String cityName; + public String code; public Integer status; @@ -44,107 +55,4 @@ public class CustomerPlace extends BaseEntity private String customerLogoUrl; - public String getCustomerLogoUrl() { - return customerLogoUrl; - } - - public void setCustomerLogoUrl(String customerLogoUrl) { - this.customerLogoUrl = customerLogoUrl; - } - - public void setId(String id) - { - this.id = id; - } - - public String getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCustomerId(Long customerId) - { - this.customerId = customerId; - } - - public Long getCustomerId() - { - return customerId; - } - public void setPhone(String phone) - { - this.phone = phone; - } - - public String getPhone() - { - return phone; - } - public void setCity(Long city) - { - this.city = city; - } - - public Long getCity() - { - return city; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getSubType() { - return subType; - } - - public void setSubType(String subType) { - this.subType = subType; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("customerId", getCustomerId()) - .append("phone", getPhone()) - .append("city", getCity()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .append("type", getType()) - .append("subType", getSubType()) - .toString(); - } } diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java b/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java index 2159f834..e3b0e585 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java @@ -24,6 +24,9 @@ public interface CustomerService { */ List getCustomerList(Customer customer); + // 查询可申请分销人员 + List getPlaceCustomerList(); + /** * @param customer 消费者筛选条件 * @return 符合结果消费者计数 diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java b/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java index a1f6e97b..53a75fee 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java @@ -30,6 +30,9 @@ public interface ICustomerPlaceService */ public List selectCustomerPlaceList(CustomerPlace customerPlace); + + public List selectCustomerPlaceSimpleList(CustomerPlace customerPlace); + /** * 新增分销申请 * diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java index 441e963f..6314556f 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java @@ -3,6 +3,9 @@ import java.util.List; import com.ghy.common.utils.DateUtils; import com.ghy.customer.domain.Customer; import com.ghy.customer.service.CustomerService; +import com.ghy.system.domain.SysArea; +import com.ghy.system.service.ISysAreaService; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ghy.customer.mapper.CustomerPlaceMapper; @@ -25,6 +28,8 @@ public class CustomerPlaceServiceImpl implements ICustomerPlaceService @Autowired private CustomerService customerService; + @Autowired + private ISysAreaService sysAreaService; /** * 查询分销申请 * @@ -55,6 +60,37 @@ public class CustomerPlaceServiceImpl implements ICustomerPlaceService */ @Override public List selectCustomerPlaceList(CustomerPlace customerPlace) + { + List places = customerPlaceMapper.selectCustomerPlaceList(customerPlace); + places.forEach(model->{ + Customer param = new Customer(); + param.setCustomerId(model.getCustomerId()); + List customerList = customerService.getCustomerList(param); + if(CollectionUtils.isNotEmpty(customerList)){ + model.setCustomerPlaceName(customerList.get(0).getCustomerPlaceName()); + model.setCustomerPlacePhone(customerList.get(0).getCustomerPlacePhone()); + model.setParentCustomerPlaceName(customerList.get(0).getParentCustomerPlaceName()); + model.setParentCustomerPlacePhone(customerList.get(0).getParentCustomerPlacePhone()); + } + // 城市 + if(model.getCity() != null){ + SysArea area = sysAreaService.selectById(model.getCity()); + if(area != null){ + model.setCityName(area.getAreaName()); + } + } + }); + return places; + } + + /** + * 查询分销申请列表 + * + * @param customerPlace 分销申请 + * @return 分销申请 + */ + @Override + public List selectCustomerPlaceSimpleList(CustomerPlace customerPlace) { return customerPlaceMapper.selectCustomerPlaceList(customerPlace); } diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java index 05f48b8e..ddb7218b 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java @@ -4,8 +4,11 @@ import com.ghy.common.core.text.Convert; import com.ghy.common.exception.ServiceException; import com.ghy.common.utils.StringUtils; import com.ghy.customer.domain.Customer; +import com.ghy.customer.domain.CustomerPlace; import com.ghy.customer.mapper.CustomerMapper; import com.ghy.customer.service.CustomerService; +import com.ghy.customer.service.ICustomerPlaceService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -22,6 +25,9 @@ public class CustomerServiceImpl implements CustomerService { @Resource private CustomerMapper customerMapper; + @Autowired + private ICustomerPlaceService customerPlaceService; + @Override public Customer selectByCustomerId(Long customerId) { return customerMapper.selectByCustomerId(customerId); @@ -29,7 +35,40 @@ public class CustomerServiceImpl implements CustomerService { @Override public List getCustomerList(Customer customer) { - return customerMapper.getCustomerList(customer); + List customerList = customerMapper.getCustomerList(customer); + customerList.forEach(model->{ + if(model.getCustomerPlace() != null){ + Customer place = selectByCustomerId(model.getCustomerPlace()); + if(place != null){ + model.setCustomerPlaceName(place.getName()); + model.setCustomerPlacePhone(place.getPhone()); + } + } + if(model.getParentCustomerPlace() != null){ + Customer parent = selectByCustomerId(model.getParentCustomerPlace()); + if(parent != null){ + model.setParentCustomerPlaceName(parent.getName()); + model.setParentCustomerPlacePhone(parent.getPhone()); + } + } + }); + return customerList; + } + + @Override + public List getPlaceCustomerList() { + Customer customer = new Customer(); + customer.setPlaceStatus(2); + List customerList = customerMapper.getCustomerList(customer); + customerList.forEach(model->{ + CustomerPlace param = new CustomerPlace(); + param.setCustomerId(model.getCustomerId()); + List place = customerPlaceService.selectCustomerPlaceSimpleList(param); + if(!CollectionUtils.isEmpty(place)){ + model.setPlaceName(place.get(0).getName()); + } + }); + return customerList; } @Override diff --git a/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml b/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml index 110a684f..f0b8f53a 100644 --- a/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml +++ b/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml @@ -47,6 +47,9 @@ AND place_status = #{placeStatus} + + AND phone like concat('%', #{phone}, '%') + order by update_time desc diff --git a/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml b/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml index df1acb0a..7403b10d 100644 --- a/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml +++ b/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml @@ -399,6 +399,7 @@ is_charge = #{isCharge}, is_contact = #{isContact}, timeout_ = #{timeout}, + insurance_id = #{insuranceId}, update_time = SYSDATE() WHERE id = #{id}