From 81af4cff627b7ec1e125b90f4fd57392c6d70588 Mon Sep 17 00:00:00 2001
From: wjli <591616088@qq.com>
Date: 星期三, 10 四月 2024 11:28:03 +0800
Subject: [PATCH] 修改签收出错bug
---
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java | 85 +++++++++++++++++++++++++++++++++++++++---
1 files changed, 79 insertions(+), 6 deletions(-)
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java
index bd68872..d8a0aa8 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java
@@ -5,6 +5,8 @@
import cn.exrick.xboot.core.common.vo.PageVo;
import cn.exrick.xboot.core.common.vo.Result;
import cn.exrick.xboot.your.entity.Customer;
+import cn.exrick.xboot.your.entity.CustomerReceive;
+import cn.exrick.xboot.your.service.ICustomerReceiveService;
import cn.exrick.xboot.your.service.ICustomerService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -30,12 +32,23 @@
@Autowired
private ICustomerService iCustomerService;
+ @Autowired
+ private ICustomerReceiveService iCustomerReceiveService;
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
@ApiOperation(value = "閫氳繃id鑾峰彇")
public Result<Customer> get(@PathVariable String id) {
-
Customer customer = iCustomerService.getById(id);
+ QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>();
+ wrapper.eq("customer_id",id);
+ wrapper.eq("status",1);
+ List<CustomerReceive> list = iCustomerReceiveService.list(wrapper);
+ for (CustomerReceive customerReceive : list) {
+ if(StrUtil.isBlank(customerReceive.getPhone())){
+ customerReceive.setPhone(" ");
+ }
+ }
+ customer.setReceives(list);
return new ResultUtil<Customer>().setData(customer);
}
@@ -48,14 +61,13 @@
}
@RequestMapping(value = "/getByPage", method = RequestMethod.GET)
- @ApiOperation(value = "" +
- "")
- public Result<IPage<Customer>> getByPage(String areaSectionId,String name,PageVo page) {
+ @ApiOperation(value = "鍒嗛〉鑾峰彇鏁版嵁")
+ public Result<IPage<Customer>> getByPage(String areaSectionId,String customerName,PageVo page) {
QueryWrapper<Customer> wrapper = new QueryWrapper<>();
if (!StrUtil.isEmpty(areaSectionId))
wrapper.eq("area_section_id",areaSectionId);
- if (!StrUtil.isEmpty(name))
- wrapper.like("name","%"+name+"%");
+ if (!StrUtil.isEmpty(customerName))
+ wrapper.like("name", "%" + customerName + "%");
IPage<Customer> data = iCustomerService.page(PageUtil.initMpPage(page),wrapper);
return new ResultUtil<IPage<Customer>>().setData(data);
}
@@ -65,6 +77,67 @@
public Result<Customer> saveOrUpdate(Customer customer) {
if (iCustomerService.saveOrUpdate(customer)) {
+
+ if(StrUtil.isNotEmpty(customer.getLinker())){
+ QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>();
+ wrapper.eq("customer_id",customer.getId());
+ wrapper.eq("name",customer.getLinker());
+ CustomerReceive one = iCustomerReceiveService.getOne(wrapper);
+ if(one==null){
+ one = new CustomerReceive();
+ one.setCustomerId(customer.getId());
+ one.setFstatus(0);
+ one.setStatus(1);
+ one.setName(customer.getLinker());
+ one.setPhone(customer.getPhone());
+ iCustomerReceiveService.saveOrUpdate(one);
+ }
+ }
+ return new ResultUtil<Customer>().setData(customer);
+ }
+ return new ResultUtil<Customer>().setErrorMsg("鎿嶄綔澶辫触");
+ }
+
+ @RequestMapping(value = "/update", method = RequestMethod.POST)
+ @ApiOperation(value = "鏇存柊鏁版嵁")
+ public Result<Customer> update(String customerId,String lng,String lat,String address,String headImg) {
+ Customer customer = iCustomerService.getById(customerId);
+ if(StrUtil.isNotEmpty(lng)){
+ customer.setLng(lng);
+ }else{
+ return ResultUtil.error("璇峰皢瀹氫綅淇℃伅濉啓瀹屾暣");
+ }
+ if(StrUtil.isNotEmpty(lat)){
+ customer.setLat(lat);
+ }else{
+ return ResultUtil.error("璇峰皢瀹氫綅淇℃伅濉啓瀹屾暣");
+ }
+
+ QueryWrapper<Customer> wrapper = new QueryWrapper<>();
+ wrapper.eq("lng",lng);
+ wrapper.eq("lat",lat);
+ List<Customer> list = iCustomerService.list(wrapper);
+ if(list.size()>0){
+ for(Customer c:list){
+ c.setLikeCusotmerId(customerId);
+ iCustomerService.saveOrUpdate(c);
+ }
+ //customer.setLikeCusotmerId(list.get(0).getId());
+ }
+
+
+ if(StrUtil.isNotEmpty(address)){
+ customer.setRegisteredAddress(address);
+ }else{
+ return ResultUtil.error("璇峰皢浣嶇疆淇℃伅濉啓瀹屾暣");
+ }
+ if(StrUtil.isNotEmpty(headImg)){
+ customer.setHeadImg(headImg);
+ }else{
+ return ResultUtil.error("璇峰皢闂ㄥご鐓т俊鎭~鍐欏畬鏁�");
+ }
+ customer.setKstatus(2);
+ if (iCustomerService.saveOrUpdate(customer)) {
return new ResultUtil<Customer>().setData(customer);
}
return new ResultUtil<Customer>().setErrorMsg("鎿嶄綔澶辫触");
--
Gitblit v1.9.1