Browse Source

根据手机号和店铺id查客户

下游客户开单,如果前台传了客户id了,不要新增客户了
订单列表查询需要加一个是否有修改记录的筛选
站点落地费规则
dev
wangfukang 2 years ago
parent
commit
987d7b550c
  1. 2
      hiver-admin/src/main/resources/application.yml
  2. 16
      hiver-admin/test-output/test-report.html
  3. 23
      hiver-core/src/main/java/cc/hiver/core/common/utils/SecurityUtil.java
  4. 3
      hiver-core/src/main/java/cc/hiver/core/common/vo/TokenCompany.java
  5. 146
      hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/controller/LogisticsLandingFeeRulesController.java
  6. 41
      hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/entity/LogisticsLandingFeeRules.java
  7. 34
      hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/mapper/LogisticsLandingFeeRulesMapper.java
  8. 31
      hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/service/LogisticsLandingFeeRulesService.java
  9. 47
      hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/service/impl/LogisticsLandingFeeRulesServiceImpl.java
  10. 24
      hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/vo/LogisticsLandingFeeRulesQueryVo.java
  11. 12
      hiver-core/src/main/java/cc/hiver/core/logisticsorder/controller/LogisticsOrderController.java
  12. 46
      hiver-core/src/main/java/cc/hiver/core/logisticsorder/entity/LogisticsOrder.java
  13. 3
      hiver-core/src/main/java/cc/hiver/core/logisticsorder/vo/LogisticsOrderQueryVo.java
  14. 158
      hiver-core/src/main/resources/mapper/LogisticsLandingFeeRulesMapper.xml
  15. 8
      hiver-core/src/main/resources/mapper/LogisticsOrderMapper.xml
  16. 22
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java
  17. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java
  18. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleQueryDTO.java
  19. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java
  20. 10
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java
  21. 169
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
  22. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java
  23. 9
      hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml

2
hiver-admin/src/main/resources/application.yml

@ -336,11 +336,13 @@ ignored:
- /hiver/app/shop/getshopIconById
# 物流订单详情
- /hiver/app/logisticsOrder/getLogisticsOrderDetail
- /hiver/app/customer/findByUserPhoneAndShopId
# 临时增加
- /hiver/app/logisticsOrder/addLogisticsOrder
- /hiver/app/logisticsEntruckingLog/getDateLogisticsEntruckingLogPageList
- /hiver/app/logisticsEntruckingLog/batchAddLogisticsEntruckingLog
- /hiver/purchaseOcrPicture/getLogisticsOrderOfAi
# 限流及黑名单不拦截的路径
limitUrls:
- /**/*.js

16
hiver-admin/test-output/test-report.html

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a>
</li>
<li class="m-r-10">
<a href="#"><span class="badge badge-primary">九月 05, 2024 13:53:27</span></a>
<a href="#"><span class="badge badge-primary">九月 06, 2024 13:53:46</span></a>
</li>
</ul>
</div>
@ -84,7 +84,7 @@
<div class="test-detail">
<span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p>
<p class="text-sm"><span>13:53:28 下午</span> / <span>0.024 secs</span></p>
<p class="text-sm"><span>13:53:47 下午</span> / <span>0.017 secs</span></p>
</div>
<div class="test-contents d-none">
<div class="detail-head">
@ -92,9 +92,9 @@
<div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>09.05.2024 13:53:28</span>
<span class='badge badge-danger'>09.05.2024 13:53:28</span>
<span class='badge badge-default'>0.024 secs</span>
<span class='badge badge-success'>09.06.2024 13:53:47</span>
<span class='badge badge-danger'>09.06.2024 13:53:47</span>
<span class='badge badge-default'>0.017 secs</span>
</div>
<div class="m-t-10 m-l-5"></div>
</div>
@ -104,7 +104,7 @@
<tbody>
<tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td>
<td>13:53:28</td>
<td>13:53:47</td>
<td>
Test passed
</td>
@ -128,13 +128,13 @@
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Started</p>
<h3>九月 05, 2024 13:53:27</h3>
<h3>九月 06, 2024 13:53:46</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>九月 05, 2024 13:53:28</h3>
<h3>九月 06, 2024 13:53:47</h3>
</div></div>
</div>
<div class="col-md-3">

23
hiver-core/src/main/java/cc/hiver/core/common/utils/SecurityUtil.java

@ -127,7 +127,21 @@ public class SecurityUtil {
if (CharSequenceUtil.isNotBlank(res)) {
return new Gson().fromJson(res, LogiticsCompany.class);
}
final LogiticsCompany logiticsCompany = logiticsCompanyDao.findByUsername(username);
LogiticsCompany logiticsCompany = logiticsCompanyDao.findByUsername(username);
// 如果没有获取到,那么去搜索公司员工信息
if (logiticsCompany == null ) {
logiticsCompany = new LogiticsCompany();
// 物流公司主表中没有查询到信息,查询物流公司员工信息
final LogisticsUser logisticsUser = logisticsUserService.findByMobile(username);
if(logisticsUser == null){
return null;
}else{
// 覆盖物流公司id为当前登录的物流公司员工id
logiticsCompany.setId(logisticsUser.getId());
logiticsCompany.setUsername(logisticsUser.getMobile());
logiticsCompany.setPassword(logisticsUser.getPassword());
}
}
// 缓存
redisTemplate.set(key, new Gson().toJson(logiticsCompany), tokenProperties.getSaveLoginTime(), TimeUnit.DAYS);
return logiticsCompany;
@ -352,10 +366,6 @@ public class SecurityUtil {
public LogiticsCompany getCurrCompany() {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
final boolean authenticated = authentication.isAuthenticated();
final boolean aa = authentication instanceof AnonymousAuthenticationToken;
final String name = authentication.getName();
final boolean bb = authentication == null;
if (authentication == null || !authentication.isAuthenticated() || authentication.getName() == null
|| authentication instanceof AnonymousAuthenticationToken) {
throw new HiverException("未检测到登录用户");
@ -670,6 +680,9 @@ public class SecurityUtil {
}else{
// 覆盖物流公司id为当前登录的物流公司员工id
logiticsCompany.setId(logisticsUser.getId());
logiticsCompany.setContacts(logisticsUser.getNickName());
logiticsCompany.setUsername(logisticsUser.getMobile());
logiticsCompany.setPassword(logisticsUser.getPassword());
}
}
Boolean saved = false;

3
hiver-core/src/main/java/cc/hiver/core/common/vo/TokenCompany.java

@ -22,6 +22,8 @@ public class TokenCompany implements UserDetails, Serializable {
private String username;
private String nickName;
private String password;
private Boolean platform;
@ -30,6 +32,7 @@ public class TokenCompany implements UserDetails, Serializable {
this.id = logiticsCompany.getId();
this.companyName = logiticsCompany.getCompanyName();
this.username = logiticsCompany.getUsername();
this.nickName = logiticsCompany.getContacts();
this.password = logiticsCompany.getPassword();
this.platform = platform;
}

146
hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/controller/LogisticsLandingFeeRulesController.java

@ -0,0 +1,146 @@
package cc.hiver.core.logisticslandingfeerules.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules;
import cc.hiver.core.logisticslandingfeerules.service.LogisticsLandingFeeRulesService;
import cc.hiver.core.logisticslandingfeerules.vo.LogisticsLandingFeeRulesQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 站点落地费规则控制器
*
* @author 王富康
* @date 2024/8/24
*/
@Slf4j
@RestController
@Api(tags = "站点落地费规则接口")
@RequestMapping("/hiver/app/logisticsLandingFeeRules/")
@Transactional
public class LogisticsLandingFeeRulesController {
@Autowired
private LogisticsLandingFeeRulesService logisticsLandingFeeRulesService;
/**
* 新增物流站点落地费规则
*
* @param logisticsLandingFeeRules
* @return Result
* @author 王富康
* @date 2024/8/24
*/
@PostMapping(value = "/addLogisticsLandingFeeRules")
@ApiOperation("新增物流站点落地费规则")
public Result addLogisticsLandingFeeRules(@RequestBody LogisticsLandingFeeRules logisticsLandingFeeRules) {
final boolean b = logisticsLandingFeeRulesService.saveOrUpdate(logisticsLandingFeeRules);
if (b) {
return ResultUtil.success("保存成功!");
} else {
return ResultUtil.error("保存失败!");
}
}
/**
* 更新物流站点落地费规则
*
* @param logisticsLandingFeeRules
* @return Result
* @author 王富康
* @date 2024/8/24
*/
@PostMapping(value = "/updateLogisticsLandingFeeRules")
@ApiOperation("更新物流站点落地费规则")
public Result updateLogisticsLandingFeeRules(@RequestBody LogisticsLandingFeeRules logisticsLandingFeeRules) {
final boolean b = logisticsLandingFeeRulesService.saveOrUpdate(logisticsLandingFeeRules);
if (b) {
return ResultUtil.success("保存成功!");
} else {
return ResultUtil.error("保存失败!");
}
}
/**
* 删除物流站点落地费规则
*
* @param id
* @return Result
* @author 王富康
* @date 2024/8/24
*/
@PostMapping(value = "/deleteLogisticsLandingFeeRules")
@ApiOperation("删除物流站点落地费规则")
public Result deleteLogisticsLandingFeeRules(String id) {
final boolean b = logisticsLandingFeeRulesService.removeById(id);
if (b) {
return ResultUtil.success("删除成功!");
} else {
return ResultUtil.error("删除失败!");
}
}
/**
* 分页查询物流站点落地费规则
*
* @param logisticsRouteQueryVo
* @return Result<IPage < LogisticsLandingFeeRules>>
* @author 王富康
* @date 2024/8/24
*/
@RequestMapping(value = "/getLogisticsLandingFeeRulesPageList", method = RequestMethod.POST)
@ApiOperation(value = "分页查询物流站点落地费规则")
public Result<IPage<LogisticsLandingFeeRules>> getLogisticsLandingFeeRulesPageList(@RequestBody(required = false) LogisticsLandingFeeRulesQueryVo logisticsRouteQueryVo) {
final IPage<LogisticsLandingFeeRules> result = logisticsLandingFeeRulesService.getLogisticsLandingFeeRulesPageList(logisticsRouteQueryVo);
return new ResultUtil<IPage<LogisticsLandingFeeRules>>().setData(result);
}
/**
* 根据站点id查询所有站点信息
*
* @param stationId
* @return Result<List < LogisticsLandingFeeRules>>
* @author 王富康
* @date 2024/8/28
*/
@RequestMapping(value = "/getLogisticsLandingFeeRulesListByStationId", method = RequestMethod.POST)
@ApiOperation(value = "根据站点id查询所有落地费规则")
public Result<List<LogisticsLandingFeeRules>> getLogisticsLandingFeeRulesListByStationId(String stationId) {
if (StringUtils.isEmpty(stationId)) {
return ResultUtil.error("站点信息不能为空!");
}
final List<LogisticsLandingFeeRules> result = logisticsLandingFeeRulesService.getLogisticsLandingFeeRulesListByStationId(stationId);
return new ResultUtil<List<LogisticsLandingFeeRules>>().setData(result);
}
/**
* 批量新增物流站点落地费规则
* @author 王富康
* @date 2024/9/6
* @param logisticsLandingFeeRulesList
* @return Result
*/
@PostMapping(value = "/addLogisticsLandingFeeRulesList")
@ApiOperation("批量新增物流站点落地费规则")
public Result addLogisticsLandingFeeRulesList(@RequestBody List<LogisticsLandingFeeRules> logisticsLandingFeeRulesList) {
final boolean b = logisticsLandingFeeRulesService.saveBatch(logisticsLandingFeeRulesList);
if (b) {
return ResultUtil.success("保存成功!");
} else {
return ResultUtil.error("保存失败!");
}
}
}

41
hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/entity/LogisticsLandingFeeRules.java

@ -0,0 +1,41 @@
package cc.hiver.core.logisticslandingfeerules.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 物流站点落地费规则实体
*
* @author 王富康
* @date 2024/8/24
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(value = "物流站点落地费规则表")
@TableName(value = "t_logistics_landing_fee_rules", autoResultMap = true)
public class LogisticsLandingFeeRules extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "站点id")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "起收点")
private BigDecimal minWeight;
@ApiModelProperty(value = "终收点")
private BigDecimal maxWeight;
@ApiModelProperty(value = "收费金额")
private BigDecimal price;
}

34
hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/mapper/LogisticsLandingFeeRulesMapper.java

@ -0,0 +1,34 @@
package cc.hiver.core.logisticslandingfeerules.mapper;
import cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules;
import cc.hiver.core.logisticslandingfeerules.vo.LogisticsLandingFeeRulesQueryVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface LogisticsLandingFeeRulesMapper extends BaseMapper<LogisticsLandingFeeRules> {
/**
* 分页查询物流站点落地费规则
*
* @param page
* @param logisticsRouteQueryVo
* @return IPage<LogisticsLandingFeeRules>
* @author 王富康
* @date 2024/8/24
*/
IPage<LogisticsLandingFeeRules> getLogisticsLandingFeeRulesPageList(Page<LogisticsLandingFeeRules> page, @Param("queryParams") LogisticsLandingFeeRulesQueryVo logisticsRouteQueryVo);
/**
* 根据站点id查询所有落地费规则
*
* @param stationId
* @return List<LogisticsLandingFeeRules>
* @author 王富康
* @date 2024/8/28
*/
List<LogisticsLandingFeeRules> getLogisticsLandingFeeRulesListByStationId(@Param("stationId")String stationId);
}

31
hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/service/LogisticsLandingFeeRulesService.java

@ -0,0 +1,31 @@
package cc.hiver.core.logisticslandingfeerules.service;
import cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules;
import cc.hiver.core.logisticslandingfeerules.vo.LogisticsLandingFeeRulesQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface LogisticsLandingFeeRulesService extends IService<LogisticsLandingFeeRules> {
/**
* 分页查询物流站点落地费规则
*
* @param logisticsRouteQueryVo
* @return IPage<LogisticsLandingFeeRules>
* @author 王富康
* @date 2024/8/24
*/
IPage<LogisticsLandingFeeRules> getLogisticsLandingFeeRulesPageList(LogisticsLandingFeeRulesQueryVo logisticsRouteQueryVo);
/**
* 根据站点id查询所有落地费规则
*
* @param stationId
* @return List<LogisticsLandingFeeRules>
* @author 王富康
* @date 2024/8/28
*/
List<LogisticsLandingFeeRules> getLogisticsLandingFeeRulesListByStationId(String stationId);
}

47
hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/service/impl/LogisticsLandingFeeRulesServiceImpl.java

@ -0,0 +1,47 @@
package cc.hiver.core.logisticslandingfeerules.service.impl;
import cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules;
import cc.hiver.core.logisticslandingfeerules.mapper.LogisticsLandingFeeRulesMapper;
import cc.hiver.core.logisticslandingfeerules.service.LogisticsLandingFeeRulesService;
import cc.hiver.core.logisticslandingfeerules.vo.LogisticsLandingFeeRulesQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class LogisticsLandingFeeRulesServiceImpl extends ServiceImpl<LogisticsLandingFeeRulesMapper, LogisticsLandingFeeRules> implements LogisticsLandingFeeRulesService {
@Autowired
private LogisticsLandingFeeRulesMapper logisticsLandingFeeRulesMapper;
/**
* 分页查询物流站点落地费规则
*
* @param logisticsRouteQueryVo
* @return IPage<LogisticsLandingFeeRules>
* @author 王富康
* @date 2024/8/24
*/
@Override
public IPage<LogisticsLandingFeeRules> getLogisticsLandingFeeRulesPageList(LogisticsLandingFeeRulesQueryVo logisticsRouteQueryVo) {
final Page<LogisticsLandingFeeRules> page = new Page<>(logisticsRouteQueryVo.getPageNum(), logisticsRouteQueryVo.getPageSize());
return logisticsLandingFeeRulesMapper.getLogisticsLandingFeeRulesPageList(page, logisticsRouteQueryVo);
}
/**
* 根据站点id查询所有落地费规则
*
* @param String stationId
* @return List<LogisticsLandingFeeRules>
* @author 王富康
* @date 2024/8/28
*/
@Override
public List<LogisticsLandingFeeRules> getLogisticsLandingFeeRulesListByStationId(String stationId) {
return logisticsLandingFeeRulesMapper.getLogisticsLandingFeeRulesListByStationId(stationId);
}
}

24
hiver-core/src/main/java/cc/hiver/core/logisticslandingfeerules/vo/LogisticsLandingFeeRulesQueryVo.java

@ -0,0 +1,24 @@
package cc.hiver.core.logisticslandingfeerules.vo;
import cc.hiver.core.base.HiverBasePageQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 物流站点落地费规则查询参数
* @author 王富康
* @date 2024/8/24
*/
@Data
public class LogisticsLandingFeeRulesQueryVo extends HiverBasePageQuery {
@ApiModelProperty(value = "站点id")
private String stationId;
@ApiModelProperty(value = "线路id")
private String circuitId;
@ApiModelProperty(value = "站点名称")
private String stationName;
}

12
hiver-core/src/main/java/cc/hiver/core/logisticsorder/controller/LogisticsOrderController.java

@ -2,7 +2,9 @@ package cc.hiver.core.logisticsorder.controller;
import cc.hiver.core.common.utils.PinYinUtils;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.core.entity.LogiticsCompany;
import cc.hiver.core.logisticsaddressbook.service.LogisticsAddressBookService;
import cc.hiver.core.logisticsorder.entity.LogisticsOrder;
import cc.hiver.core.logisticsorder.entity.LogisticsOrderChangeLog;
@ -42,6 +44,9 @@ public class LogisticsOrderController {
@Autowired
private LogisticsAddressBookService logisticsAddressBookService;
@Autowired
private SecurityUtil securityUtil;
@PostMapping(value = "/addLogisticsOrder")
@ApiOperation("新增物流订单")
public Result addLogisticsOrder(@RequestBody LogisticsOrder logisticsOrder) {
@ -57,7 +62,9 @@ public class LogisticsOrderController {
}
logisticsOrder.setOrderNumber(orderNumber);
// 设置创建人姓名
// logisticsOrder.setCreateByName();
final LogiticsCompany logiticsCompany = securityUtil.getCurrCompany();
logisticsOrder.setCreateBy(logiticsCompany.getId());
logisticsOrder.setCreateByName(logiticsCompany.getContacts());
final boolean b = logisticsOrderService.saveOrUpdate(logisticsOrder);
if (b) {
//保存收发货人地址簿
@ -84,6 +91,9 @@ public class LogisticsOrderController {
}
//先查询出旧的数据
LogisticsOrder oldLogisticsOrder = logisticsOrderService.getById(logisticsOrder.getId());
// 设置创建人姓名
final LogiticsCompany logiticsCompany = securityUtil.getCurrCompany();
logisticsOrder.setUpdateBy(logiticsCompany.getId());
final boolean b = logisticsOrderService.saveOrUpdate(logisticsOrder);
if (b) {
//如果更新成功,把修改记录保存一下

46
hiver-core/src/main/java/cc/hiver/core/logisticsorder/entity/LogisticsOrder.java

@ -1,14 +1,23 @@
package cc.hiver.core.logisticsorder.entity;
import cc.hiver.core.base.HiverBaseEntity;
import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.utils.SnowFlakeUtil;
import cc.hiver.core.logisticsorder.vo.CompareField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.util.Date;
/**
* 物流中转实体
@ -16,14 +25,43 @@ import java.math.BigDecimal;
* @author 王富康
* @date 2024/8/24
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(value = "物流订单表")
@TableName(value = "t_logistics_order", autoResultMap = true)
public class LogisticsOrder extends HiverBaseEntity {
public class LogisticsOrder{
private static final long serialVersionUID = 1L;
@Id
@TableId
@ApiModelProperty(value = "唯一标识")
private String id = SnowFlakeUtil.nextId().toString();
@ApiModelProperty(value = "创建者")
@TableField(fill = FieldFill.INSERT)
private String createBy;
@CreatedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新者")
@TableField(fill = FieldFill.UPDATE)
private String updateBy;
@LastModifiedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private Date updateTime;
@ApiModelProperty(value = "删除标志 默认0")
private Integer delFlag = CommonConstant.STATUS_NORMAL;
@CompareField(name = "操作人姓名")
@ApiModelProperty(value = "操作人姓名")
private String createByName;

3
hiver-core/src/main/java/cc/hiver/core/logisticsorder/vo/LogisticsOrderQueryVo.java

@ -75,5 +75,8 @@ public class LogisticsOrderQueryVo extends HiverBasePageQuery {
@ApiModelProperty(value = "搜索字段")
private String searchStr;
@ApiModelProperty(value = "是否有修改记录的筛选")
private String isUpdate;
}

158
hiver-core/src/main/resources/mapper/LogisticsLandingFeeRulesMapper.xml

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.core.logisticslandingfeerules.mapper.LogisticsLandingFeeRulesMapper">
<resultMap id="BaseResultMap" type="cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="station_id" jdbcType="VARCHAR" property="stationId" />
<result column="station_name" jdbcType="VARCHAR" property="stationName" />
<result column="min_weight" jdbcType="DECIMAL" property="minWeight" />
<result column="max_weight" jdbcType="DECIMAL" property="maxWeight" />
<result column="price" jdbcType="DECIMAL" property="price" />
</resultMap>
<sql id="Base_Column_List">
id, create_by, create_time, del_flag, update_by, update_time, station_id, station_name, min_weight, max_weight, price
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_logistics_landing_fee_rules
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from t_logistics_landing_fee_rules
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules">
insert into t_logistics_landing_fee_rules
(id, create_by, create_time, del_flag, update_by, update_time, station_id, station_name, min_weight, max_weight, price)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{record.stationId,jdbcType=VARCHAR}, #{record.stationName,jdbcType=VARCHAR}, #{record.minWeight,jdbcType=DECIMAL},
#{record.maxWeight,jdbcType=DECIMAL}, #{record.price,jdbcType=DECIMAL})
</insert>
<update id="updateByExampleSelective" parameterType="map">
update t_logistics_landing_fee_rules
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.delFlag != null">
del_flag = #{record.delFlag,jdbcType=INTEGER},
</if>
<if test="record.updateBy != null">
update_by = #{record.updateBy,jdbcType=VARCHAR},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.stationId != null">
station_id = #{record.stationId,jdbcType=VARCHAR},
</if>
<if test="record.stationName != null">
station_name = #{record.stationName,jdbcType=VARCHAR},
</if>
<if test="record.minWeight != null">
min_weight = #{record.minWeight,jdbcType=DECIMAL},
</if>
<if test="record.maxWeight != null">
max_weight = #{record.maxWeight,jdbcType=DECIMAL},
</if>
<if test="record.price != null">
price = #{record.price,jdbcType=DECIMAL},
</if>
</set>
</update>
<update id="updateByExample" parameterType="map">
update t_logistics_landing_fee_rules
set id = #{record.id,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
del_flag = #{record.delFlag,jdbcType=INTEGER},
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
station_id = #{record.stationId,jdbcType=VARCHAR},
station_name = #{record.stationName,jdbcType=VARCHAR},
min_weight = #{record.minWeight,jdbcType=DECIMAL},
max_weight = #{record.maxWeight,jdbcType=DECIMAL},
price = #{record.price,jdbcType=DECIMAL}
where id = #{record.id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules">
update t_logistics_landing_fee_rules
<set>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="stationId != null">
station_id = #{stationId,jdbcType=VARCHAR},
</if>
<if test="stationName != null">
station_name = #{stationName,jdbcType=VARCHAR},
</if>
<if test="minWeight != null">
min_weight = #{minWeight,jdbcType=DECIMAL},
</if>
<if test="maxWeight != null">
max_weight = #{maxWeight,jdbcType=DECIMAL},
</if>
<if test="price != null">
price = #{price,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cc.hiver.core.logisticslandingfeerules.entity.LogisticsLandingFeeRules">
update t_logistics_landing_fee_rules
set create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
station_id = #{stationId,jdbcType=VARCHAR},
station_name = #{stationName,jdbcType=VARCHAR},
min_weight = #{minWeight,jdbcType=DECIMAL},
max_weight = #{maxWeight,jdbcType=DECIMAL},
price = #{price,jdbcType=DECIMAL}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="getLogisticsLandingFeeRulesListByStationId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_logistics_landing_fee_rules t
where station_id = #{stationId}
ORDER BY
t.create_time desc
</select>
</mapper>

8
hiver-core/src/main/resources/mapper/LogisticsOrderMapper.xml

@ -145,6 +145,14 @@
or receiver_mobile like concat('%',#{queryParams.searchStr},'%')
)
</if>
<!--是否有修改记录的筛选-->
<if test='queryParams.isUpdate!=null and queryParams.isUpdate.trim() neq ""'>
and exists (
select 1
from t_logistics_order_change_log tloc
where id = tloc.order_id
)
</if>
</where>
ORDER BY
create_time desc

22
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java

@ -227,4 +227,26 @@ public class CustomerController {
return new ResultUtil<List<Customer>>().setData(list);
}
/**
* 根据客户手机号及店铺id精准查询查询客户列表
* @author 王富康
* @date 2024/9/6
* @param userPhone
* @param shopId
* @return Result
*/
@RequestMapping(value = "/findByUserPhoneAndShopId", method = RequestMethod.POST)
@ApiOperation("根据客户手机号及店铺id精准查询查询客户列表")
public Result findByUserPhoneAndShopId(String userPhone, String shopId) {
if(StringUtils.isEmpty(userPhone)){
return ResultUtil.error("用户手机号不能为空");
}
if(StringUtils.isEmpty(userPhone)){
return ResultUtil.error("店铺id不能为空");
}
// shopId从缓存中设置
final List<Customer> list = customerService.findByUserPhoneAndShopId(userPhone, shopId);
return new ResultUtil<List<Customer>>().setData(list);
}
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java

@ -48,4 +48,6 @@ public interface CustomerMapper extends BaseMapper<Customer> {
boolean batchDeleteCustomer(@Param("idList") List<String> idList);
List<Customer> findByUserName(@Param("userName") String userName,@Param("shopId") String shopId);
List<Customer> findByUserPhoneAndShopId(@Param("userPhone") String userPhone,@Param("shopId") String shopId);
}

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleQueryDTO.java

@ -30,6 +30,9 @@ public class SaleQueryDTO implements Serializable {
@ApiModelProperty(value = "客户手机号")
private String mobile;
@ApiModelProperty(value = "客户id")
private String userId;
@ApiModelProperty(value = "客户名称")
private String username;

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java

@ -24,7 +24,7 @@ import java.util.List;
@Slf4j
@RestController
@Api(tags = "问题反馈接口")
@Api(tags = "入库AI接口")
@RequestMapping("/hiver/purchaseOcrPicture/")
@Transactional
public class PurchaseOcrPictureController {

10
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java

@ -24,4 +24,14 @@ public interface CustomerService extends IService<Customer> {
boolean batchDeleteCustomer(String ids);
List<Customer> findByUserName(String userName);
/**
* 根据客户手机号及店铺id精准查询查询客户列表
* @author 王富康
* @date 2024/9/6
* @param userPhone
* @param shopId
* @return List<Customer>
*/
List<Customer> findByUserPhoneAndShopId(String userPhone, String shopId);
}

169
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java

@ -451,92 +451,95 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
User byMobile;
String customerId = "";
if (StringUtils.isNotEmpty(saleQueryDTO.getMobile())) {
byMobile = userService.findByMobile(saleQueryDTO.getMobile());
if (byMobile == null) {
//默认密码
final String encryptPass = new BCryptPasswordEncoder().encode("123456");
final User user = new User();
user.setUsername(saleQueryDTO.getMobile());
user.setNickname(saleQueryDTO.getUsername());
user.setAddress(saleQueryDTO.getSale().getReceiveAddress());
//客户
user.setType(UserConstant.USER_TYPE_CUSTOM);
user.setMobile(saleQueryDTO.getMobile());
user.setPassword(encryptPass);
byMobile = userService.save(user);
// 保存用户id
saleQueryDTO.getSale().setUserId(byMobile.getId());
// 保存用户角色
final UserRole userRole = new UserRole();
final PageVo pageVo = new PageVo();
pageVo.setPageNumber(1);
pageVo.setPageSize(1);
final Page<Role> rolePage = roleService.findByCondition("ROLE_CUSTOMER", PageUtil.initPage(pageVo));
final Role role = rolePage.getContent().get(0);
//客户角色
userRole.setRoleId(role.getId());
userRole.setRoleName("客户");
userRole.setUserId(byMobile.getId());
userRoleService.save(userRole);
} else {
// 该手机号已存在
if (!byMobile.getType().contains(UserConstant.USER_TYPE_CUSTOM)) {
//没有客户权限,那么添加客户权限
final String type = byMobile.getType();
if (StringUtils.isEmpty(type)) {
byMobile.setType(UserConstant.USER_TYPE_CUSTOM);
} else {
byMobile.setType(byMobile.getType() + ',' + UserConstant.USER_TYPE_CUSTOM);
// 20240906如果前台传了客户id了,不要新增客户了就
if(StringUtils.isEmpty(saleQueryDTO.getUserId())){
byMobile = userService.findByMobile(saleQueryDTO.getMobile());
if (byMobile == null) {
//默认密码
final String encryptPass = new BCryptPasswordEncoder().encode("123456");
final User user = new User();
user.setUsername(saleQueryDTO.getMobile());
user.setNickname(saleQueryDTO.getUsername());
user.setAddress(saleQueryDTO.getSale().getReceiveAddress());
//客户
user.setType(UserConstant.USER_TYPE_CUSTOM);
user.setMobile(saleQueryDTO.getMobile());
user.setPassword(encryptPass);
byMobile = userService.save(user);
// 保存用户id
saleQueryDTO.getSale().setUserId(byMobile.getId());
// 保存用户角色
final UserRole userRole = new UserRole();
final PageVo pageVo = new PageVo();
pageVo.setPageNumber(1);
pageVo.setPageSize(1);
final Page<Role> rolePage = roleService.findByCondition("ROLE_CUSTOMER", PageUtil.initPage(pageVo));
final Role role = rolePage.getContent().get(0);
//客户角色
userRole.setRoleId(role.getId());
userRole.setRoleName("客户");
userRole.setUserId(byMobile.getId());
userRoleService.save(userRole);
} else {
// 该手机号已存在
if (!byMobile.getType().contains(UserConstant.USER_TYPE_CUSTOM)) {
//没有客户权限,那么添加客户权限
final String type = byMobile.getType();
if (StringUtils.isEmpty(type)) {
byMobile.setType(UserConstant.USER_TYPE_CUSTOM);
} else {
byMobile.setType(byMobile.getType() + ',' + UserConstant.USER_TYPE_CUSTOM);
}
byMobile = userService.save(byMobile);
}
byMobile = userService.save(byMobile);
}
}
customer.setUserId(byMobile.getId());
customer.setCreateTime(new Date());
customer.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
customer.setName(saleQueryDTO.getUsername());
customer.setPhone(saleQueryDTO.getMobile());
customer.setAddress(saleQueryDTO.getSale().getReceiveAddress());
customer.setProvince(saleQueryDTO.getSale().getProvince());
customer.setCity(saleQueryDTO.getSale().getCity());
customer.setArea(saleQueryDTO.getSale().getArea());
customer.setShopId(saleQueryDTO.getSale().getShopId());
customerService.save(customer);
// 获取新增的客户id
customerId = customer.getId();
// 客户欠款信息
final BigDecimal amountOwed = customer.getAmountOwed() == null ? BigDecimal.ZERO : customer.getAmountOwed();
debt.setCreateTime(new Date());
debt.setUserId(customer.getId());
debt.setShopId(saleQueryDTO.getSale().getShopId());
debt.setUserPhone(customer.getPhone());
debt.setUserAdress(customer.getAddress());
debt.setUserName(customer.getName());
debt.setAmountOwed(amountOwed);
debt.setUserType(DebtConstant.USER_TYPE[0]);
debtService.save(debt);
// 新增交易记录
dealingsRecord.setCreateTime(new Date());
dealingsRecord.setDealingsUserId(customer.getId());
dealingsRecord.setDealingsUserName(customer.getName());
dealingsRecord.setUserType(DealingsRecordConstant.TYPE[1]);
dealingsRecord.setDealingsWay("新增客户");
dealingsRecord.setShopId(saleQueryDTO.getSale().getShopId());
// 销售金额
dealingsRecord.setSaleAmount(BigDecimal.ZERO);
// 退货金额
dealingsRecord.setReturnAmount(BigDecimal.ZERO);
// 上次欠款
dealingsRecord.setLastDebtAmount(BigDecimal.ZERO);
// 最新欠款
dealingsRecord.setBalanceDue(amountOwed);
dealingsRecord.setAmount(amountOwed);
dealingsRecord.setDealingsType(DealingsRecordConstant.DEALINGS_TYPE[3]);
dealingsRecordService.save(dealingsRecord);
customer.setUserId(byMobile.getId());
customer.setCreateTime(new Date());
customer.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
customer.setName(saleQueryDTO.getUsername());
customer.setPhone(saleQueryDTO.getMobile());
customer.setAddress(saleQueryDTO.getSale().getReceiveAddress());
customer.setProvince(saleQueryDTO.getSale().getProvince());
customer.setCity(saleQueryDTO.getSale().getCity());
customer.setArea(saleQueryDTO.getSale().getArea());
customer.setShopId(saleQueryDTO.getSale().getShopId());
customerService.save(customer);
// 客户id拿新增的
customerId = customer.getId();
// 客户欠款信息
final BigDecimal amountOwed = customer.getAmountOwed() == null ? BigDecimal.ZERO : customer.getAmountOwed();
debt.setCreateTime(new Date());
debt.setUserId(customer.getId());
debt.setShopId(saleQueryDTO.getSale().getShopId());
debt.setUserPhone(customer.getPhone());
debt.setUserAdress(customer.getAddress());
debt.setUserName(customer.getName());
debt.setAmountOwed(amountOwed);
debt.setUserType(DebtConstant.USER_TYPE[0]);
debtService.save(debt);
// 新增交易记录
dealingsRecord.setCreateTime(new Date());
dealingsRecord.setDealingsUserId(customer.getId());
dealingsRecord.setDealingsUserName(customer.getName());
dealingsRecord.setUserType(DealingsRecordConstant.TYPE[1]);
dealingsRecord.setDealingsWay("新增客户");
dealingsRecord.setShopId(saleQueryDTO.getSale().getShopId());
// 销售金额
dealingsRecord.setSaleAmount(BigDecimal.ZERO);
// 退货金额
dealingsRecord.setReturnAmount(BigDecimal.ZERO);
// 上次欠款
dealingsRecord.setLastDebtAmount(BigDecimal.ZERO);
// 最新欠款
dealingsRecord.setBalanceDue(amountOwed);
dealingsRecord.setAmount(amountOwed);
dealingsRecord.setDealingsType(DealingsRecordConstant.DEALINGS_TYPE[3]);
dealingsRecordService.save(dealingsRecord);
}else{
// 客户id拿前台传的
customerId = saleQueryDTO.getUserId();
}
} else {
log.error("下游客户未填写手机号!");
return null;

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java

@ -214,4 +214,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
String shopId = securityUtil.getShopId();
return customerMapper.findByUserName(userName,shopId);
}
@Override
public List<Customer> findByUserPhoneAndShopId(String userPhone, String shopId) {
return customerMapper.findByUserPhoneAndShopId(userPhone,shopId);
}
}

9
hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml

@ -459,4 +459,13 @@
and a.shop_id = #{shopId,jdbcType=VARCHAR}
and a.name = #{userName,jdbcType=VARCHAR}
</select>
<select id="findByUserPhoneAndShopId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_customer a
where del_flag = '0'
and a.shop_id = #{shopId,jdbcType=VARCHAR}
and a.phone = #{userPhone,jdbcType=VARCHAR}
</select>
</mapper>
Loading…
Cancel
Save