1.发单管理页面支持选择保险

2.发单管理页面支持批量发单
3.主单管理页面支持批量发单
4.商城-消费者管理页面,支持修改用户分销
5.商城-消费者管理页面,支持通过用户手机号模糊查询用户
6.保险增员时,身份二要素校验
7.发单账号可见的订单是他自己所发订单。发单账号主单上的订单也是见自己所发订单。(13386441744查一下)
This commit is contained in:
Yifei Kuang 2024-12-09 00:37:48 +08:00
parent e24cbde6f0
commit a0aefb4850
17 changed files with 365 additions and 130 deletions

View File

@ -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)

View File

@ -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));
}

View File

@ -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<InsuranceManager> 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<FinancialDetail> 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();
}

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改上级分销')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-change-insurance">
<input name="customerId" type="hidden" th:value="${customerId}" />
<div class="form-group">
<label class="col-sm-3 control-label">上级分销:</label>
<div class="col-sm-8">
<select id="customerPlace" name="customerPlace" class="form-control control-label" required>
<option th:each="customerPlace:${customerPlaces}" th:value="${customerPlace.customerId}" th:text="${customerPlace.phone} + ${customerPlace.placeName}" ></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
function submitHandler() {
if ($.validate.form()) {
$.operate.save(ctx + "customer/changePlace", $('#form-change-insurance').serialize());
}
}
</script>
</body>
</html>

View File

@ -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('<img class="img-circle" src="' + row.customerLogoUrl + '" alt="消费者头像" />');
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('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="changePlace(\'' + row.customerId + '\')"></i>修改上级分销</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.customerId + '\')"><i class="fa fa-remove"></i>删除</a> ');
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) {

View File

@ -42,9 +42,9 @@
<a class="btn btn-danger multiple disabled" onclick="auditStatus(1)" shiro:hasPermission="customer:place:remove">
<i class="fa fa-remove"></i> 拒绝
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="customer:place:edit">
<i class="fa fa-edit"></i> 修改
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="customer:place:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="customer:place:export">
<i class="fa fa-download"></i> 导出
</a>
@ -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('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('选择保险')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-change-insurance">
<input name="orderMasterIds" type="hidden" th:value="${orderIds}" />
<div class="form-group">
<label class="col-sm-3 control-label">保险:</label>
<div class="col-sm-8">
<select id="insuranceId" name="insuranceId" class="form-control control-label" required>
<option th:each="insurance:${insurances}" th:value="${insurance.id}" th:text="${insurance.insuranceName}" ></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
function submitHandler() {
if ($.validate.form()) {
$.operate.save(ctx + "order/master/pcOrderWorker/batchChangeInsurance", $('#form-change-insurance').serialize());
}
}
</script>
</body>
</html>

View File

@ -325,6 +325,9 @@
<a class="btn btn-default" onclick="batchChangePrice()">
<i class="fa fa-money"></i> 批量改价
</a>
<a class="btn btn-default" onclick="batchChangeInsurance()">
<i class="fa fa-money"></i> 批量选择保险
</a>
</div>
</div>
@ -717,7 +720,11 @@
if (row.payStatus == 0) {
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showPayQrcode(\'' + row.id + '\')"></i>付款</a> ');
}
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="pcOrderInsurance(\'' + row.id + '\')"></i>选择保险</a> ');
if (row.insuranceId){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)"></i>已投保险</a> ');
} else {
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="pcOrderInsurance(\'' + row.id + '\')"></i>选择保险</a> ');
}
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);

View File

@ -170,6 +170,9 @@
<a class="btn btn-default" onclick="mergePay()">
<i class="fa fa-money"></i> 付款
</a>
<a class="btn btn-default" onclick="batchChangeInsurance()">
<i class="fa fa-money"></i> 批量选择保险
</a>
<!-- <a class="btn btn-default" onclick="showOrderWorker()">-->
<!-- <i class="fa fa-money"></i> 指派-->
<!-- </a>-->
@ -471,6 +474,11 @@
if (row.payStatus == 0) {
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showPayQrcode(\'' + row.id + '\')"></i>付款</a> ');
}
if (row.insuranceId){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)"></i>已投保险</a> ');
} else {
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="pcOrderInsurance(\'' + row.id + '\')"></i>选择保险</a> ');
}
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');
}
</script>
</body>

View File

@ -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<Long> customerPlaces;
/*审核分销名*/
private String placeName;
/*上上级审核分销名*/
private String parentPlaceName;
}

View File

@ -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();
}
}

View File

@ -24,6 +24,9 @@ public interface CustomerService {
*/
List<Customer> getCustomerList(Customer customer);
// 查询可申请分销人员
List<Customer> getPlaceCustomerList();
/**
* @param customer 消费者筛选条件
* @return 符合结果消费者计数

View File

@ -30,6 +30,9 @@ public interface ICustomerPlaceService
*/
public List<CustomerPlace> selectCustomerPlaceList(CustomerPlace customerPlace);
public List<CustomerPlace> selectCustomerPlaceSimpleList(CustomerPlace customerPlace);
/**
* 新增分销申请
*

View File

@ -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<CustomerPlace> selectCustomerPlaceList(CustomerPlace customerPlace)
{
List<CustomerPlace> places = customerPlaceMapper.selectCustomerPlaceList(customerPlace);
places.forEach(model->{
Customer param = new Customer();
param.setCustomerId(model.getCustomerId());
List<Customer> 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<CustomerPlace> selectCustomerPlaceSimpleList(CustomerPlace customerPlace)
{
return customerPlaceMapper.selectCustomerPlaceList(customerPlace);
}

View File

@ -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<Customer> getCustomerList(Customer customer) {
return customerMapper.getCustomerList(customer);
List<Customer> 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<Customer> getPlaceCustomerList() {
Customer customer = new Customer();
customer.setPlaceStatus(2);
List<Customer> customerList = customerMapper.getCustomerList(customer);
customerList.forEach(model->{
CustomerPlace param = new CustomerPlace();
param.setCustomerId(model.getCustomerId());
List<CustomerPlace> place = customerPlaceService.selectCustomerPlaceSimpleList(param);
if(!CollectionUtils.isEmpty(place)){
model.setPlaceName(place.get(0).getName());
}
});
return customerList;
}
@Override

View File

@ -47,6 +47,9 @@
<if test="placeStatus != null">
AND place_status = #{placeStatus}
</if>
<if test="phone != null and phone != ''">
AND phone like concat('%', #{phone}, '%')
</if>
</where>
order by update_time desc
</select>

View File

@ -399,6 +399,7 @@
<if test="isCharge != null">is_charge = #{isCharge},</if>
<if test="isContact != null">is_contact = #{isContact},</if>
<if test="timeout != null">timeout_ = #{timeout},</if>
<if test="insuranceId != null">insurance_id = #{insuranceId},</if>
update_time = SYSDATE()
</set>
WHERE id = #{id}