Browse Source

1.bug及运营区域

cangku
wangfukang 2 years ago
parent
commit
6aaf48ead3
  1. 5
      hiver-admin/src/main/resources/application.yml
  2. 16
      hiver-admin/test-output/test-report.html
  3. 15
      hiver-core/src/main/java/cc/hiver/core/common/constant/LogiticsCompanyConstant.java
  4. 5
      hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java
  5. 16
      hiver-core/src/main/java/cc/hiver/core/common/utils/SecurityUtil.java
  6. 9
      hiver-core/src/main/java/cc/hiver/core/dao/LogiticsCompanyDao.java
  7. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/StockConstant.java
  8. 43
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PurchaseController.java
  9. 34
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnSaleController.java
  10. 97
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
  11. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Purchase.java
  12. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java
  13. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SaleDetail.java
  14. 158
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/controller/OperatingAreaController.java
  15. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/dao/OperatingAreaDao.java
  16. 51
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/entity/OperatingArea.java
  17. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/mapper/OperatingAreaMapper.java
  18. 61
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/pojo/OperatingAreaPageQuery.java
  19. 23
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/service/OperatingAreaService.java
  20. 47
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/service/impl/OperatingAreaServiceImpl.java
  21. 53
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/vo/OperatingAreaPageVO.java
  22. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleQueryDTO.java
  23. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java
  24. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/PurchaseVo.java
  25. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleNewVO.java
  26. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java
  27. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
  28. 20
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesCalculateServiceImpl.java
  29. 14
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java
  30. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java
  31. 9
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
  32. 204
      hiver-modules/hiver-mall/src/main/resources/mapper/OperatingAreaMapper.xml
  33. 7
      hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
  34. 38
      hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml
  35. 7
      hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml

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

@ -309,6 +309,11 @@ ignored:
- /hiver/app/sale/getShopWeek
- /hiver/app/purchase/getPurchaseList
- /hiver/app/stock/getShopStock
- /hiver/app/return/getWaitReturnCount
- /hiver/app/sale/getWaitAddProductCount
- /hiver/app/purchase/getWaitPutInCount
- /hiver/app/operatingArea/**
# 限流及黑名单不拦截的路径
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">七月 31, 2023 23:25:57</span></a>
<a href="#"><span class="badge badge-primary">十二月 18, 2023 11:51:47</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>23:25:57 下</span> / <span>0.01 secs</span></p>
<p class="text-sm"><span>11:51:48 上</span> / <span>0.016 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'>07.31.2023 23:25:57</span>
<span class='badge badge-danger'>07.31.2023 23:25:57</span>
<span class='badge badge-default'>0.01 secs</span>
<span class='badge badge-success'>12.18.2023 11:51:48</span>
<span class='badge badge-danger'>12.18.2023 11:51:48</span>
<span class='badge badge-default'>0.016 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>23:25:57</td>
<td>11:51:48</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>七月 31, 2023 23:25:57</h3>
<h3>十二月 18, 2023 11:51:47</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>七月 31, 2023 23:25:57</h3>
<h3>十二月 18, 2023 11:51:48</h3>
</div></div>
</div>
<div class="col-md-3">

15
hiver-core/src/main/java/cc/hiver/core/common/constant/LogiticsCompanyConstant.java

@ -0,0 +1,15 @@
package cc.hiver.core.common.constant;
/**
* 订单常量类
* @author 王富康
* @date 2023/10/21
*/
public interface LogiticsCompanyConstant {
/**
1物流
2快递
3送车
*/
String[] SIGN_COMPANY = {"0", "1", "2", "3"};
}

5
hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java

@ -31,4 +31,9 @@ public interface SaleConstant {
* 物流类别 0-物流 1-快递 2-自提 3-拼单 4-送车
*/
String[] TRANSPORT_TYPE = {"0","1","2","3","4"};
/**
* 收款状态 0-未收款 1-已收款 2-部分收款
*/
String[] PAY_STATUS = {"0","1","2"};
}

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

@ -1,9 +1,6 @@
package cc.hiver.core.common.utils;
import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.SecurityConstant;
import cc.hiver.core.common.constant.UserConstant;
import cc.hiver.core.common.constant.WorkerConstant;
import cc.hiver.core.common.constant.*;
import cc.hiver.core.common.exception.HiverException;
import cc.hiver.core.common.redis.RedisTemplateHelper;
import cc.hiver.core.common.vo.TokenCompany;
@ -22,6 +19,7 @@ import cc.hiver.core.vo.RoleDTO;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
@ -95,7 +93,8 @@ public class SecurityUtil {
}
final User user = userToDTO(userDao.findByUsername(username));
// 缓存
redisTemplate.set(key, new Gson().toJson(user), 15L, TimeUnit.DAYS);
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd hh:mm:ss").create();
redisTemplate.set(key, gson.toJson(user), 15L, TimeUnit.DAYS);
return user;
}
@ -134,7 +133,8 @@ public class SecurityUtil {
}
public LogiticsCompany findCompanyByMobile(String mobile) {
return logiticsCompanyDao.findByMobile(mobile);
// 现在只有物流公司登录,暂时写死
return logiticsCompanyDao.findByMobileAndSignCompany(mobile, LogiticsCompanyConstant.SIGN_COMPANY[1]);
}
public User findUserByEmail(String email) {
@ -271,6 +271,10 @@ public class SecurityUtil {
// 缓存
redisTemplate.set(userTypeKey, user.getType(), tokenProperties.getTokenExpireTime(), TimeUnit.MINUTES);
}
// 更新当前登录人的角色
final String key = "username::" + user.getUsername();
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd hh:mm:ss").create();
redisTemplate.set(key, gson.toJson(user), 15L, TimeUnit.DAYS);
} else {
// JWT 不缓存权限 避免JWT长度过长
tokenUser = new TokenUser(user, false, null);

9
hiver-core/src/main/java/cc/hiver/core/dao/LogiticsCompanyDao.java

@ -33,4 +33,13 @@ public interface LogiticsCompanyDao extends HiverBaseDao<LogiticsCompany, String
LogiticsCompany findByUsername(String username);
LogiticsCompany findByMobile(String mobile);
/**
* 根据手机号及类型查询物流公司信息
* @author 王富康
* @date 2023/12/17
* @param mobile
* @return LogiticsCompany
*/
LogiticsCompany findByMobileAndSignCompany(String mobile, String signCompany);
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/StockConstant.java

@ -8,7 +8,7 @@ package cc.hiver.mall.common.constant;
public interface StockConstant {
/**
* 用户正常状态
* 入库状态 0待入库1已入库
*/
Integer[] IN_STORAGE_STATUS = {0,1};

43
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PurchaseController.java

@ -4,6 +4,7 @@ import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.utils.StringUtils;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.common.constant.StockConstant;
import cc.hiver.mall.entity.Purchase;
import cc.hiver.mall.entity.PurchaseDetail;
import cc.hiver.mall.pojo.dto.DebtSupplier;
@ -110,7 +111,7 @@ public class PurchaseController {
if (!StringUtils.isEmpty(purchaseQueryVo.getId())) {
queryWrapper.eq("id", purchaseQueryVo.getId());
}
if (purchaseQueryVo.getInStorageStatus() != null ) {
if (purchaseQueryVo.getInStorageStatus() != null) {
queryWrapper.eq("in_storage_status", purchaseQueryVo.getInStorageStatus());
}
if (!StringUtils.isEmpty(purchaseQueryVo.getSupplierName())) {
@ -119,8 +120,8 @@ public class PurchaseController {
if (!StringUtils.isEmpty(purchaseQueryVo.getSupplierId())) {
queryWrapper.eq("supplier_id", purchaseQueryVo.getSupplierId());
}
if (purchaseQueryVo.getStartDate() != null && purchaseQueryVo.getEndDate() != null ) {
queryWrapper.between("create_time", purchaseQueryVo.getStartDate(),purchaseQueryVo.getEndDate());
if (purchaseQueryVo.getStartDate() != null && purchaseQueryVo.getEndDate() != null) {
queryWrapper.between("create_time", purchaseQueryVo.getStartDate(), purchaseQueryVo.getEndDate());
}
}
final List<Purchase> list = purchaseService.list(queryWrapper);
@ -129,15 +130,16 @@ public class PurchaseController {
/**
* 查询采购单列表
* @author 王富康
* @date 2023/11/20
*
* @param purchaseQueryVo
* @return Result
* @author 王富康
* @date 2023/11/20
*/
@RequestMapping(value = "/getPurchaseList", method = RequestMethod.POST)
@ApiOperation("查询采购单列表")
public Result getPurchaseList(@RequestBody(required=false) PurchaseQueryVo purchaseQueryVo) {
if(purchaseQueryVo == null ){
public Result getPurchaseList(@RequestBody(required = false) PurchaseQueryVo purchaseQueryVo) {
if (purchaseQueryVo == null) {
purchaseQueryVo = new PurchaseQueryVo();
}
// shopId从缓存中设置
@ -187,15 +189,16 @@ public class PurchaseController {
/**
* 根据采购单id获取采购单详情
* @author 王富康
* @date 2023/11/6
*
* @param id 采购单id
* @return Result
* @author 王富康
* @date 2023/11/6
*/
@RequestMapping(value = "/getPurchaseAllData", method = RequestMethod.POST)
@ApiOperation("根据采购单id获取采购单及详细商品信息")
public Result getPurchaseAllData(String id) {
if(StringUtils.isEmpty(id)){
if (StringUtils.isEmpty(id)) {
return ResultUtil.error("采购单id不能为空!");
}
final PurchaseVo purchaseVo = purchaseService.getPurchaseAllData(id);
@ -213,7 +216,7 @@ public class PurchaseController {
*/
@RequestMapping(value = "/editPayPrice", method = RequestMethod.POST)
@ApiOperation("回款")
public Result editPayPrice(String id, BigDecimal price,String dealingsWay) {
public Result editPayPrice(String id, BigDecimal price, String dealingsWay) {
if (StringUtils.isEmpty(id)) {
return ResultUtil.error("采购单id不能为空!");
}
@ -221,4 +224,22 @@ public class PurchaseController {
return ResultUtil.success("回款成功!");
}
/**
* 获取待入库数量-首页
*
* @return Result
* @author 王富康
* @date 2023/11/22
*/
@RequestMapping(value = "/getWaitPutInCount", method = RequestMethod.POST)
@ApiOperation("获取待入库数量-首页")
public Result getWaitPutInCount() {
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
final QueryWrapper<Purchase> querySaleWrapper = new QueryWrapper<>();
querySaleWrapper.eq("shop_id", shopId)
.eq("in_storage_status", StockConstant.IN_STORAGE_STATUS[0]);
final long waitReturnCount = purchaseService.count(querySaleWrapper);
return ResultUtil.data(waitReturnCount);
}
}

34
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnSaleController.java

@ -190,7 +190,7 @@ public class ReturnSaleController {
}
}
}else{
} else {
// 不需要平台取货,直接处理库存信息
final QueryWrapper<ReturnDetail> queryReturnDetailWrapper = new QueryWrapper<>();
queryWrapper.eq("return_sale_id", returnSale.getSaleId());
@ -213,7 +213,7 @@ public class ReturnSaleController {
* 1.确认退货的前提是如果存在拉包工那么拉包工必须已完成送达才可以退否则可以直接退货
* 2.确认退货后根据库存直接扣减入库明细
* */
final ReturnSale returnSale = returnSaleService.getBySaleId(id);
final ReturnSale returnSale = returnSaleService.getById(id);
if (returnSale == null) {
return ResultUtil.error("查询退货单信息失败!");
}
@ -225,7 +225,7 @@ public class ReturnSaleController {
// 订单id 不能为空
return ResultUtil.error("物流订单中订单信息有误!");
}
if (!SaleConstant.SALE_STATUS[10].equals(orderXd.getOrderStatus())) {
if (!SaleConstant.SALE_STATUS[4].equals(orderXd.getOrderStatus())) {
return ResultUtil.error("当前退货订单还未送达,不能点击确认退货!");
}
//处理库存模块
@ -264,9 +264,9 @@ public class ReturnSaleController {
final String remark = saleComVO.getRemark();
if (!StringUtils.isEmpty(remark)) {
if ("1".equals(remark)) {
queryWrapper.ne("status", "5");
queryWrapper.eq("status", SaleConstant.SALE_STATUS[10]);
} else if ("2".equals(remark)) {
queryWrapper.eq("status", "5");
queryWrapper.eq("status", SaleConstant.SALE_STATUS[4]);
}
} else {
return ResultUtil.error("退货标识参数缺失,请确认!");
@ -307,16 +307,16 @@ public class ReturnSaleController {
if (!StringUtils.isEmpty(saleComVO.getSaleId())) {
queryWrapper.eq("sale_id", saleComVO.getSaleId());
}
/*final String remark = saleComVO.getRemark();
final String remark = saleComVO.getRemark();
if (!StringUtils.isEmpty(remark)) {
if ("1".equals(remark)) {
queryWrapper.ne("status", SaleConstant.SALE_STATUS[4]);
queryWrapper.eq("status", SaleConstant.SALE_STATUS[10]);
} else if ("2".equals(remark)) {
queryWrapper.eq("status", SaleConstant.SALE_STATUS[4]);
}
} else {
return ResultUtil.error("退货标识参数缺失,请确认!");
}*/
}
final SearchDateVo searchDateVo = saleComVO.getSearchDateVo();
if (!ObjectUtils.isEmpty(searchDateVo) && !searchDateVo.isAnyFieldEmpty()) {
final Date endDate = searchDateVo.getEndDate();
@ -353,4 +353,22 @@ public class ReturnSaleController {
return ResultUtil.error("修改失败");
}
/**
* 获取待退货数量-首页
*
* @return Result
* @author 王富康
* @date 2023/11/22
*/
@RequestMapping(value = "/getWaitReturnCount", method = RequestMethod.POST)
@ApiOperation("获取待退货数量-首页")
public Result getWaitReturnCount() {
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
final QueryWrapper<ReturnSale> querySaleWrapper = new QueryWrapper<>();
querySaleWrapper.eq("shop_id", shopId)
.eq("status", SaleConstant.SALE_STATUS[10]);
long waitReturnCount = returnSaleService.count(querySaleWrapper);
return ResultUtil.data(waitReturnCount);
}
}

97
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java

@ -8,10 +8,13 @@ import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.utils.StringUtils;
import cc.hiver.core.common.vo.Result;
import cc.hiver.core.common.vo.SearchDateVo;
import cc.hiver.core.entity.LogiticsCompany;
import cc.hiver.core.entity.User;
import cc.hiver.core.entity.Worker;
import cc.hiver.core.service.LogiticsCompanyService;
import cc.hiver.core.service.WorkerService;
import cc.hiver.core.vo.WorkerQueryVO;
import cc.hiver.mall.common.constant.StockConstant;
import cc.hiver.mall.entity.*;
import cc.hiver.mall.pojo.dto.*;
import cc.hiver.mall.pojo.vo.*;
@ -79,6 +82,12 @@ public class SaleController {
@Autowired
private ProductService productService;
@Autowired
private PurchaseService purchaseService;
@Autowired
private LogiticsCompanyService logiticsCompanyService;
@RequestMapping(value = "/buy", method = RequestMethod.POST)
@ApiOperation("下单操作")
@Transactional
@ -183,11 +192,11 @@ public class SaleController {
@RequestMapping(value = "/delById", method = RequestMethod.POST)
@ApiOperation("根据id删除订单")
public Result delete(@RequestBody Sale sale) {
final boolean result = saleService.removeById(sale);
public Result delete(String id) {
final boolean result = saleService.deleteById(id);
if (result) {
final QueryWrapper<SaleDetail> deleteWrapper = new QueryWrapper<>();
deleteWrapper.eq("sale_id", sale.getId());
deleteWrapper.eq("sale_id", id);
final boolean removeBatchByIds = saleDetailService.remove(deleteWrapper);
if (removeBatchByIds) {
return ResultUtil.success("删除成功");
@ -240,7 +249,7 @@ public class SaleController {
@ApiOperation("下游客户查询全部订单列表")
public Result<SaleReturnListVO> querySRAll(@RequestBody SaleVO saleVO) {
final QueryWrapper<Sale> queryWrapper = new QueryWrapper<>();
User user = securityUtil.getCurrUser();
final User user = securityUtil.getCurrUser();
queryWrapper.eq("user_id", user.getId());
if (!ObjectUtils.isEmpty(saleVO)) {
if (!StringUtils.isEmpty(saleVO.getPayStatus())) {
@ -444,7 +453,7 @@ public class SaleController {
saleDetailDTO.setDiscount(saleDetail.getDiscount());
saleDetailDTO.setDiscountAmount(saleDetail.getDiscountAmount());
saleDetailDTO.setRealPrice(saleDetail.getRealPrice());
saleDetailDTO.setProductPicture(saleDetail.getProductPicture());
final SaleDetailQueryDTO saleDetailQueryDTO = new SaleDetailQueryDTO();
saleDetailQueryDTO.setAttributeList(saleDetail.getAttributeList());
saleDetailQueryDTO.setProductCount(saleDetail.getProductCount());
@ -458,10 +467,20 @@ public class SaleController {
final String customerId = sale.getUserId();
final Customer customer = customerService.getById(customerId);
saleNewVO.setCustomer(customer);
// 增加物流公司信息
final String transCompanyId = sale.getTransCompany();
if(StringUtils.isNotEmpty(transCompanyId)){
final LogiticsCompany logiticsCompany = logiticsCompanyService.get(transCompanyId);
saleNewVO.setLogiticsCompany(logiticsCompany);
}
// 获取配送详情,主要是想要完成后的图片和备注信息
final OrderXd orderXd = orderService.findByOrderId(id);
saleNewVO.setOrderXd(orderXd);
// 拉包工,配送详情中取
// 添加店铺信息
final String shopId = sale.getShopId();
final Shop shop = shopService.get(shopId);
saleNewVO.setShop(shop);
return new ResultUtil<SaleNewVO>().setData(saleNewVO);
}
@ -698,8 +717,11 @@ public class SaleController {
@ApiOperation("分享页及挂单去开单操作")
@Transactional
public Result shareToBuyNew(@RequestBody SaleQueryDTO saleQueryDTO) {
if (StringUtils.isEmpty(saleQueryDTO.getOldSaleId())) {
return ResultUtil.error("订单id不能为空!");
}
// 删除之前的分享页下的单或者挂单
delete(saleQueryDTO.getSale());
delete(saleQueryDTO.getOldSaleId());
// 下单
return buyNew(saleQueryDTO);
}
@ -730,20 +752,75 @@ public class SaleController {
/**
* 回款
* @author 王富康
* @date 2023/11/15
*
* @param id 销售单id
* @param price 回款金额
* @param dealingsWay 交易方式/附言
* @return Result
* @author 王富康
* @date 2023/11/15
*/
@RequestMapping(value = "/editPayPrice", method = RequestMethod.POST)
@ApiOperation("回款")
public Result editPayPrice(String id, BigDecimal price,String dealingsWay) {
public Result editPayPrice(String id, BigDecimal price, String dealingsWay) {
if (StringUtils.isEmpty(id)) {
return ResultUtil.error("销售单id不能为空!");
}
saleService.editPayPrice(id, price, dealingsWay);
return ResultUtil.success("回款成功!");
}
/**
* 获取配货数量-首页
*
* @return Result
* @author 王富康
* @date 2023/11/22
*/
@RequestMapping(value = "/getWaitAddProductCount", method = RequestMethod.POST)
@ApiOperation("获取配货数量-首页")
public Result getWaitAddProductCount() {
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
final QueryWrapper<Sale> querySaleWrapper = new QueryWrapper<>();
querySaleWrapper.eq("shop_id", shopId)
.eq("status", SaleConstant.SALE_STATUS[11]);
final long waitAddProductCount = saleService.count(querySaleWrapper);
return ResultUtil.data(waitAddProductCount);
}
/**
* 获取配货数量-首页
*
* @return Result
* @author 王富康
* @date 2023/11/22
*/
@RequestMapping(value = "/getWaitCount", method = RequestMethod.POST)
@ApiOperation("获待配货、待入库、待入库数量-首页")
public Result getWaitCount() {
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
final QueryWrapper<Sale> querySaleWrapper = new QueryWrapper<>();
querySaleWrapper.eq("shop_id", shopId)
.eq("status", SaleConstant.SALE_STATUS[11]);
final long waitAddProductCount = saleService.count(querySaleWrapper);
final QueryWrapper<ReturnSale> queryReturnSaleWrapper = new QueryWrapper<>();
queryReturnSaleWrapper.eq("shop_id", shopId)
.eq("status", SaleConstant.SALE_STATUS[10]);
final long waitReturnCount = returnSaleService.count(queryReturnSaleWrapper);
final QueryWrapper<Purchase> queryPurchaseWrapper = new QueryWrapper<>();
queryPurchaseWrapper.eq("shop_id", shopId)
.eq("in_storage_status", StockConstant.IN_STORAGE_STATUS[0]);
final long waitPurchaseCount = purchaseService.count(queryPurchaseWrapper);
final Map<String, Long> countMap = new HashMap<>();
countMap.put("waitAddProductCount", waitAddProductCount);
countMap.put("waitReturnCount", waitReturnCount);
countMap.put("waitPurchaseCount", waitPurchaseCount);
return ResultUtil.data(countMap);
}
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Purchase.java

@ -26,6 +26,8 @@ public class Purchase implements Serializable {
private String createBy;
private String createByName;
private Date createTime;
private Integer delFlag;

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java

@ -112,7 +112,7 @@ public class Sale implements Serializable {
private String saleName;
@ApiModelProperty(value="其他费用")
private String otherExpense;
private BigDecimal otherExpense;
@Transient
@TableField(exist = false)

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SaleDetail.java

@ -73,5 +73,8 @@ public class SaleDetail implements Serializable {
@ApiModelProperty(value = "实际价格")
private BigDecimal realPrice;
@ApiModelProperty(value = "商品图片")
private String productPicture;
private static final long serialVersionUID = 1L;
}

158
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/controller/OperatingAreaController.java

@ -0,0 +1,158 @@
package cc.hiver.mall.operatingarea.controller;
import cc.hiver.core.common.utils.PoiUtil;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.operatingarea.entity.OperatingArea;
import cc.hiver.mall.operatingarea.pojo.OperatingAreaPageQuery;
import cc.hiver.mall.operatingarea.service.OperatingAreaService;
import cc.hiver.mall.operatingarea.vo.OperatingAreaPageVO;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 运营区域 控制层
*
* @author 王富康
* @date 2023/12/16
*/
@Slf4j
@RestController
@Api(tags = "运营区域接口")
@RequestMapping("/hiver/app/operatingArea/")
@Transactional
public class OperatingAreaController {
@Autowired
private OperatingAreaService operatingAreaService;
/**
* 新增或者修改运营区域信息
*
* @param operatingArea 实体对象
* @return Result
* @author 王富康
* @date 2023/12/17
*/
@RequestMapping(value = "/saveOrUpdateOperatingArea", method = RequestMethod.POST)
@ApiOperation("新增或者修改运营区域信息")
public Result saveOrUpdateOperatingArea(OperatingArea operatingArea) {
final boolean b = operatingAreaService.saveOrUpdate(operatingArea);
if (b) {
return ResultUtil.success("保存成功!");
} else {
return ResultUtil.error("保存失败!");
}
}
/**
* 根据id查询运营区域信息
* @author 王富康
* @date 2023/12/18
* @param id
* @return Result
*/
@RequestMapping(value = "/getOperatingAreaById", method = RequestMethod.POST)
@ApiOperation("根据id查询运营区域信息")
public Result getOperatingAreaById(String id) {
if (StringUtils.isEmpty(id)) {
return ResultUtil.error("主键id不能为空!");
}
OperatingArea operatingArea = operatingAreaService.getById(id);
if (operatingArea != null) {
return ResultUtil.data(operatingArea);
} else {
return ResultUtil.error("查询失败!");
}
}
/**
* 删除
*
* @param id 主键id
* @return Result
* @author 王富康
* @date 2023/12/17
*/
@RequestMapping(value = "/deleteOperatingArea", method = RequestMethod.POST)
@ApiOperation("根据id删除运营区域信息")
public Result deleteOperatingArea(String id) {
final boolean b = operatingAreaService.deleteOperatingArea(id);
if (b) {
return ResultUtil.success("删除成功!");
} else {
return ResultUtil.error("删除失败!");
}
}
/**
* 导入excel
*
* @param file excel文件
* @param shippingType 类型0物流名称1快递名称2送车
* @return Result
* @author 王富康
* @date 2023/12/17
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
@ApiOperation("excel导入")
public Result importExcel(MultipartFile file, String shippingType) {
final List<OperatingArea> operatingAreas = PoiUtil.importExcel(file, 1, 1, OperatingArea.class);
final boolean b = operatingAreaService.saveBatch(operatingAreas);
if (b) {
return ResultUtil.success("导入成功!");
} else {
return ResultUtil.error("导入失败!");
}
}
/**
* 根据省市县获取物流/快递/送车信息
*
* @param province
* @param city
* @param area
* @param shippingType 类型
* @return Result
* @author 王富康
* @date 2023/12/17
*/
@RequestMapping(value = "/getByArea", method = RequestMethod.POST)
@ApiOperation("根据省市县获取物流/快递/送车信息")
public Result getByArea(String province, String city, String area, String shippingType) {
if (StringUtils.isEmpty(province) || StringUtils.isEmpty(city) || StringUtils.isEmpty(area)) {
return ResultUtil.error("省市县不能为空!");
}
if (StringUtils.isEmpty(shippingType)) {
return ResultUtil.error("类型不能为空!");
}
final List<OperatingArea> operatingAreas = operatingAreaService.getByArea(province, city, area, shippingType);
return ResultUtil.data(operatingAreas);
}
/**
* 运营区域列表分页
* @author 王富康
* @date 2023/12/18
* @param operatingAreaPageQuery
* @return Result<IPage<OperatingArea>>
*/
@RequestMapping(value = "/getOperatingAreaList", method = RequestMethod.POST)
@ApiOperation(value = "分页获取运营区域列表")
public Result<IPage<OperatingAreaPageVO>> getOperatingAreaList(@RequestBody(required = false) OperatingAreaPageQuery operatingAreaPageQuery) {
final IPage<OperatingAreaPageVO> result = operatingAreaService.getOperatingAreaList(operatingAreaPageQuery);
return new ResultUtil<IPage<OperatingAreaPageVO>>().setData(result);
}
}

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/dao/OperatingAreaDao.java

@ -0,0 +1,4 @@
package cc.hiver.mall.operatingarea.dao;
public class OperatingAreaDao {
}

51
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/entity/OperatingArea.java

@ -0,0 +1,51 @@
package cc.hiver.mall.operatingarea.entity;
import cc.hiver.core.base.HiverBaseEntity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 运营区域实体类
*
* @author 王富康
* @date 2023/12/16
*/
@Data
@ApiModel(value = "运营区域表")
@TableName(value = "t_operating_area", autoResultMap = true)
@ExcelTarget("OperatingArea")
public class OperatingArea extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name="类型",needMerge = true)
@ApiModelProperty(value = "类型:0:物流名称;1:快递名称;2:送车")
private String shippingType;
@Excel(name="名称",needMerge = true)
@ApiModelProperty(value = "物流名称/快递名称/车牌号")
private String shippingMethod;
@ApiModelProperty(value = "物流公司id/快递公司id/车牌号id")
private String shippingMethodId;
@Excel(name="省")
@ApiModelProperty(value = "省")
private String province;
@Excel(name="市")
@ApiModelProperty(value = "市")
private String city;
@Excel(name="县")
@ApiModelProperty(value = "县")
private String area;
@Excel(name="收费标准")
@ApiModelProperty(value = "收费标准")
private String chargingStandard;
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/mapper/OperatingAreaMapper.java

@ -0,0 +1,19 @@
package cc.hiver.mall.operatingarea.mapper;
import cc.hiver.mall.operatingarea.entity.OperatingArea;
import cc.hiver.mall.operatingarea.pojo.OperatingAreaPageQuery;
import cc.hiver.mall.operatingarea.vo.OperatingAreaPageVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface OperatingAreaMapper extends BaseMapper<OperatingArea> {
List<OperatingArea> getByArea(@Param("province") String province, @Param("city") String city, @Param("area") String area, @Param("shippingType") String shippingType);
List<OperatingAreaPageVO> getOperatingAreaList(Page<OperatingAreaPageVO> page, @Param("queryParams") OperatingAreaPageQuery operatingAreaPageQuery);
}

61
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/pojo/OperatingAreaPageQuery.java

@ -0,0 +1,61 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.operatingarea.pojo;
import cc.hiver.core.base.HiverBasePageQuery;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 商品分页查询对象
*
* @author 王富康
* @date 2023/10/14
*/
@ApiModel("运营区域分页查询对象")
@Data
public class OperatingAreaPageQuery extends HiverBasePageQuery {
private static final long serialVersionUID = 1L;
@ApiModelProperty("类型:0:物流名称;1:快递名称;2:送车")
private String shippingType;
@ApiModelProperty("物流名称/快递名称/车牌号")
private String shippingMethod;
@ApiModelProperty("物流公司id/快递公司id/车牌号id")
private String shippingMethodId;
@ApiModelProperty("省")
private String province;
@ApiModelProperty("市")
private String city;
@ApiModelProperty("县")
private String area;
@ApiModelProperty("收费标准")
private String chargingStandard;
@ApiModelProperty("排序字段名")
private String sortField;
@ApiModelProperty("排序规则(asc:升序;desc:降序)")
private String sort;
}

23
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/service/OperatingAreaService.java

@ -0,0 +1,23 @@
package cc.hiver.mall.operatingarea.service;
import cc.hiver.mall.operatingarea.entity.OperatingArea;
import cc.hiver.mall.operatingarea.pojo.OperatingAreaPageQuery;
import cc.hiver.mall.operatingarea.vo.OperatingAreaPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 运营区域 接口层
* @author 王富康
* @date 2023/12/16
*/
public interface OperatingAreaService extends IService<OperatingArea> {
boolean deleteOperatingArea(String id);
List<OperatingArea> getByArea(String province, String city, String area,String shippingType);
IPage<OperatingAreaPageVO> getOperatingAreaList(OperatingAreaPageQuery operatingAreaPageQuery);
}

47
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/service/impl/OperatingAreaServiceImpl.java

@ -0,0 +1,47 @@
package cc.hiver.mall.operatingarea.service.impl;
import cc.hiver.mall.operatingarea.entity.OperatingArea;
import cc.hiver.mall.operatingarea.mapper.OperatingAreaMapper;
import cc.hiver.mall.operatingarea.pojo.OperatingAreaPageQuery;
import cc.hiver.mall.operatingarea.service.OperatingAreaService;
import cc.hiver.mall.operatingarea.vo.OperatingAreaPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 运营区域 实现层
* @author 王富康
* @date 2023/12/16
*/
@Slf4j
@Service
public class OperatingAreaServiceImpl extends ServiceImpl<OperatingAreaMapper, OperatingArea> implements OperatingAreaService {
@Autowired
private OperatingAreaMapper operatingAreaMapper;
@Override
public boolean deleteOperatingArea(String id) {
final int i = operatingAreaMapper.deleteById(id);
return i > 0;
}
@Override
public List<OperatingArea> getByArea(String province, String city, String area, String shippingType) {
return operatingAreaMapper.getByArea(province, city, area, shippingType);
}
@Override
public IPage<OperatingAreaPageVO> getOperatingAreaList(OperatingAreaPageQuery operatingAreaPageQuery) {
final Page<OperatingAreaPageVO> page = new Page<>(operatingAreaPageQuery.getPageNum(), operatingAreaPageQuery.getPageSize());
final List<OperatingAreaPageVO> list = operatingAreaMapper.getOperatingAreaList(page, operatingAreaPageQuery);
page.setRecords(list);
return page;
}
}

53
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/operatingarea/vo/OperatingAreaPageVO.java

@ -0,0 +1,53 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.operatingarea.vo;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 商品分页查询对应Vo
*
* @author 王富康
* @date 2023/10/14
*/
@Data
@Accessors(chain = true)
@TableName(autoResultMap = true)
public class OperatingAreaPageVO {
@ApiModelProperty("类型:0:物流名称;1:快递名称;2:送车")
private String shippingType;
@ApiModelProperty("物流名称/快递名称/车牌号")
private String shippingMethod;
@ApiModelProperty("物流公司id/快递公司id/车牌号id")
private String shippingMethodId;
@ApiModelProperty("省")
private String province;
@ApiModelProperty("市")
private String city;
@ApiModelProperty("县")
private String area;
@ApiModelProperty("收费标准")
private String chargingStandard;
}

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

@ -1,7 +1,6 @@
package cc.hiver.mall.pojo.dto;
import cc.hiver.mall.entity.Sale;
import cc.hiver.mall.entity.SaleDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -31,4 +30,6 @@ public class SaleQueryDTO implements Serializable {
@ApiModelProperty(value = "客户名称")
private String username;
@ApiModelProperty(value = "挂单及分享单的id")
private String oldSaleId;
}

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java

@ -60,4 +60,7 @@ public class ProductPageQuery extends HiverBasePageQuery {
@ApiModelProperty("排序规则(asc:升序;desc:降序)")
private String sort;
@ApiModelProperty("查询条件")
private String searchStr;
}

8
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/PurchaseVo.java

@ -1,6 +1,8 @@
package cc.hiver.mall.pojo.vo;
import cc.hiver.mall.entity.*;
import cc.hiver.mall.entity.Purchase;
import cc.hiver.mall.entity.PurchaseDetail;
import cc.hiver.mall.entity.Supplier;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@ -10,6 +12,10 @@ import java.util.List;
@Data
@Accessors(chain = true)
public class PurchaseVo {
@ApiModelProperty(value = "供应商信息")
private Supplier supplier;
@ApiModelProperty(value = "采购单主表")
private Purchase purchase;

8
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleNewVO.java

@ -1,8 +1,10 @@
package cc.hiver.mall.pojo.vo;
import cc.hiver.core.entity.LogiticsCompany;
import cc.hiver.mall.entity.Customer;
import cc.hiver.mall.entity.OrderXd;
import cc.hiver.mall.entity.Sale;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.pojo.dto.SaleDetailDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -24,7 +26,13 @@ public class SaleNewVO implements Serializable {
@ApiModelProperty(value = "客户明细")
private Customer customer;
@ApiModelProperty(value = "物流公司信息")
private LogiticsCompany logiticsCompany;
@ApiModelProperty(value = "配送详情")
private OrderXd orderXd;
@ApiModelProperty(value = "店铺信息")
private Shop shop;
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java

@ -7,4 +7,6 @@ import java.math.BigDecimal;
public interface SaleService extends IService<Sale> {
void editPayPrice(String id, BigDecimal price, String dealingsWay);
boolean deleteById(String id);
}

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

@ -210,7 +210,7 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
Product product;
final List<SaleDetailDTO> saleDetailList = saleDTO.getSaleDetailList();
final List<SaleDetail> saleDetailList2 = new ArrayList<SaleDetail>();
final List<SaleDetail> saleDetailList2 = new ArrayList<>();
int productCount = 0;
@ -225,6 +225,7 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
saleDetailDTO.setPrice(product.getPrice());
saleDetailDTO.setWholesalePrice(product.getWholesalePrice());
saleDetailDTO.setPurchasePrice(product.getPurchasePrice());
saleDetailDTO.setProductPicture(product.getProductPicture());
for(SaleDetailQueryDTO saleDetailQueryDTO : saleDetailDTO.getStockLogList1()){
final SaleDetail saleDetail = new SaleDetail();
saleDetailDTO.setAttributeList(saleDetailQueryDTO.getAttributeList());

20
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesCalculateServiceImpl.java

@ -134,12 +134,14 @@ public class SalesCalculateServiceImpl implements SalesCalculateService {
//获取当日门店利润(当日总营收-当日总成本+(退货总营收-退货总成本))
final QueryWrapper<SaleDetail> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("shop_id", shopId)
// 只查销售单的,
.like("sale_id", "XD")
.between("create_time", startDate, endDate);
BigDecimal totalPurchasePrice = new BigDecimal("0.0");
final List<SaleDetail> list = saleDetailService.list(queryWrapper);
for (SaleDetail saleDetail : list) {
final BigDecimal purchasePrice = saleDetail.getPurchasePrice();
final int productCount = saleDetail.getProductCount();
final BigDecimal purchasePrice = saleDetail.getPurchasePrice() == null ? BigDecimal.valueOf(0) :saleDetail.getPurchasePrice();
final int productCount = saleDetail.getProductCount() == null ? 0 : saleDetail.getProductCount();
totalPurchasePrice = totalPurchasePrice.add(purchasePrice.multiply(new BigDecimal(productCount)));
}
/*final QueryWrapper<ReturnDetail> returnDetailQueryWrapper = new QueryWrapper<>();
@ -157,7 +159,7 @@ public class SalesCalculateServiceImpl implements SalesCalculateService {
//获取当日门店下单客户数
final QueryWrapper<Sale> querySaleWrapper = new QueryWrapper<>();
querySaleWrapper.select("count(user_id)")
querySaleWrapper.select("user_id")
.eq("shop_id", shopId)
.ne("status",SaleConstant.SALE_STATUS[2])
.ne("status",SaleConstant.SALE_STATUS[12])
@ -166,13 +168,11 @@ public class SalesCalculateServiceImpl implements SalesCalculateService {
.groupBy("user_id");
final List<Object> countCus = saleService.listObjs(querySaleWrapper);
if (!ObjectUtils.isEmpty(countCus) && !countCus.isEmpty()) {
final int countCustomer = ((Long) countCus.get(0)).intValue();
final int countCustomer = countCus.size();
saleAllVO.setTotalCCount(countCustomer);
} else {
saleAllVO.setTotalCCount(0);
}
return saleAllVO;
}
@ -193,7 +193,7 @@ public class SalesCalculateServiceImpl implements SalesCalculateService {
final Date endDate = DateUtil.COMMON_FULL.getTextDate(searchDate + " 23:59:59");
BigDecimal totalAmount1 = new BigDecimal(0);
//获取当日门店销售总额 销售笔数 销售总件数
//获取当日门店销售总额
final SaleExample saleExample = new SaleExample();
saleExample.createCriteria()
.andCreateTimeBetween(startDate, endDate)
@ -206,7 +206,7 @@ public class SalesCalculateServiceImpl implements SalesCalculateService {
}
//获取当日门店利润(当日总营收-当日总成本+(退货总营收-退货总成本))
final QueryWrapper<SaleDetail> queryWrapper = new QueryWrapper<>();
/*final QueryWrapper<SaleDetail> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("shop_id", shopId)
.between("create_time", startDate, endDate);
BigDecimal totalPurchasePrice = new BigDecimal("0.0");
@ -217,9 +217,9 @@ public class SalesCalculateServiceImpl implements SalesCalculateService {
totalPurchasePrice = totalPurchasePrice.add(purchasePrice.multiply(new BigDecimal(productCount)));
}
// 利润= 销售总金额-成本
final BigDecimal subtract = totalAmount1.subtract(totalPurchasePrice);
final BigDecimal subtract = totalAmount1.subtract(totalPurchasePrice);*/
thisWeekSale.add(subtract);
thisWeekSale.add(totalAmount1);
}

14
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java

@ -4,13 +4,11 @@ import cc.hiver.core.common.constant.DealingsRecordConstant;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.entity.User;
import cc.hiver.mall.dao.mapper.PurchaseMapper;
import cc.hiver.mall.entity.DealingsRecord;
import cc.hiver.mall.entity.Purchase;
import cc.hiver.mall.entity.PurchaseDetail;
import cc.hiver.mall.entity.StockLog;
import cc.hiver.mall.entity.*;
import cc.hiver.mall.pojo.dto.DebtSupplier;
import cc.hiver.mall.pojo.vo.PurchaseQueryVo;
import cc.hiver.mall.pojo.vo.PurchaseVo;
import cc.hiver.mall.service.SupplierService;
import cc.hiver.mall.service.mybatis.DealingsRecordService;
import cc.hiver.mall.service.mybatis.PurchaseDetailService;
import cc.hiver.mall.service.mybatis.PurchaseService;
@ -43,6 +41,10 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
@Autowired
private SecurityUtil securityUtil;
@Autowired
private SupplierService supplierService;
@Override
public List<DebtSupplier> getDebtByShopId(String shopId) {
return purchaseMapper.selectDebtByShopId(shopId);
@ -60,6 +62,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
// 计算已付
final BigDecimal newAlreadPay = alreadyPay.add(price);
oldPurchase.setAlreadyPay(newAlreadPay);
//
purchaseService.saveOrUpdate(oldPurchase);
// 保存记录表
final DealingsRecord dealingsRecord = new DealingsRecord();
@ -97,6 +100,9 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
// 获取采购单信息
final Purchase purchase = purchaseService.getById(id);
purchaseVo.setPurchase(purchase);
// 获取供应商信息
final Supplier supplier = supplierService.get(purchase.getSupplierId());
purchaseVo.setSupplier(supplier);
// 获取商品信息
final List<PurchaseDetail> purchaseDetails = purchaseDetailService.getByPurchaseId(id);
// 获取规格信息

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java

@ -1,6 +1,7 @@
package cc.hiver.mall.serviceimpl.mybatis;
import cc.hiver.core.common.constant.DealingsRecordConstant;
import cc.hiver.core.common.constant.SaleConstant;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.entity.User;
import cc.hiver.mall.dao.mapper.SaleMapper;
@ -27,6 +28,9 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
@Autowired
private SecurityUtil securityUtil;
@Autowired
private SaleMapper saleMapper;
@Override
public void editPayPrice(String id, BigDecimal price, String dealingsWay) {
// 修改采购单、实付、未付金额
@ -39,6 +43,9 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
// 计算已付
final BigDecimal newAlreadPay = alreadyPay.add(price);
oldSale.setAlreadyEarn(newAlreadPay);
if(newNoPay.compareTo(BigDecimal.ZERO) < 0){
oldSale.setPayStatus(SaleConstant.PAY_STATUS[1]);
}
saleService.saveOrUpdate(oldSale);
// 保存记录表
final DealingsRecord dealingsRecord = new DealingsRecord();
@ -61,4 +68,13 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
dealingsRecord.setDealingsWay(dealingsWay);
dealingsRecordService.save(dealingsRecord);
}
@Override
public boolean deleteById(String id) {
final int deleteCount = saleMapper.deleteByPrimaryKey(id);
if(deleteCount>0){
return true;
}
return false;
}
}

9
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java

@ -157,6 +157,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
final Purchase purchase = purchaseVo.getPurchase();
purchase.setShopId(shopId);
purchase.setCreateBy(user.getId());
purchase.setCreateByName(user.getNickname());
purchase.setCreateTime(new Date());
// 先保存一遍,因为后边用到了入库单的id
purchaseService.save(purchase);
@ -506,9 +507,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
/**
* 获取某店铺的库存管理顶部信息
*
* @return ShopStockVo
* @author 王富康
* @date 2023/11/21
* @return ShopStockVo
*/
@Override
public ShopStockVo getShopStock() {
@ -554,7 +556,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
stockCost = stockCost.add(thisStockCost);
}
// 计算库存数
stockCount += thisStockCount;
stockCount += thisStockCount > 0 ? thisStockCount : 0;
// 计算达到库存预警的规格数量
if (tailWarn > thisStockCount) {
tailWarnCount++;
@ -568,9 +570,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
/**
* 获取该店的库存信息
*
* @return List<Stock>
* @author 王富康
* @date 2023/11/21
* @return List<Stock>
*/
@Override
public List<Stock> stockListOfShop() {

204
hiver-modules/hiver-mall/src/main/resources/mapper/OperatingAreaMapper.xml

@ -0,0 +1,204 @@
<?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.mall.operatingarea.mapper.OperatingAreaMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.operatingarea.entity.OperatingArea">
<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="shipping_type" jdbcType="VARCHAR" property="shippingType" />
<result column="shipping_method" jdbcType="VARCHAR" property="shippingMethod" />
<result column="shipping_method_id" jdbcType="VARCHAR" property="shippingMethodId" />
<result column="province" jdbcType="VARCHAR" property="province" />
<result column="city" jdbcType="VARCHAR" property="city" />
<result column="area" jdbcType="VARCHAR" property="area" />
<result column="charging_standard" jdbcType="VARCHAR" property="chargingStandard" />
</resultMap>
<sql id="Base_Column_List">
id, create_by, create_time, del_flag, update_by, update_time, shipping_type, shipping_method, shipping_method_id,
province, city, area, charging_standard
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_operating_area
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from t_operating_area
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="cc.hiver.mall.operatingarea.entity.OperatingArea">
insert into t_operating_area
(id, create_by, create_time, del_flag, update_by, update_time,shipping_type, shipping_method, shipping_method_id,
province, city, area, charging_standard)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{shippingType,jdbcType=VARCHAR},#{shippingMethod,jdbcType=VARCHAR}, #{shippingMethodId,jdbcType=VARCHAR},
#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{area,jdbcType=VARCHAR},
#{chargingStandard,jdbcType=VARCHAR})
</insert>
<update id="updateByExampleSelective" parameterType="map">
update t_operating_area
<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.shippingType != null">
shipping_type = #{record.shippingType,jdbcType=VARCHAR},
</if>
<if test="record.shippingMethod != null">
shipping_method = #{record.shippingMethod,jdbcType=VARCHAR},
</if>
<if test="record.shippingMethodId != null">
shipping_method_id = #{record.shippingMethodId,jdbcType=VARCHAR},
</if>
<if test="record.province != null">
province = #{record.province,jdbcType=VARCHAR},
</if>
<if test="record.city != null">
city = #{record.city,jdbcType=VARCHAR},
</if>
<if test="record.area != null">
area = #{record.area,jdbcType=VARCHAR},
</if>
<if test="record.chargingStandard != null">
charging_standard = #{record.chargingStandard,jdbcType=VARCHAR},
</if>
</set>
</update>
<update id="updateByExample" parameterType="map">
update t_operating_area
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},
shipping_type = #{record.shippingType,jdbcType=VARCHAR},
shipping_method = #{record.shippingMethod,jdbcType=VARCHAR},
shipping_method_id = #{record.shippingMethodId,jdbcType=VARCHAR},
province = #{record.province,jdbcType=VARCHAR},
city = #{record.city,jdbcType=VARCHAR},
area = #{record.area,jdbcType=VARCHAR},
charging_standard = #{record.chargingStandard,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.operatingarea.entity.OperatingArea">
update t_operating_area
<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="shippingType != null">
shipping_type = #{shippingType,jdbcType=VARCHAR},
</if>
<if test="shippingMethod != null">
shipping_method = #{shippingMethod,jdbcType=VARCHAR},
</if>
<if test="shippingMethodId != null">
shipping_method_id = #{shippingMethodId,jdbcType=VARCHAR},
</if>
<if test="province != null">
province = #{province,jdbcType=VARCHAR},
</if>
<if test="city != null">
city = #{city,jdbcType=VARCHAR},
</if>
<if test="area != null">
area = #{area,jdbcType=VARCHAR},
</if>
<if test="chargingStandard != null">
charging_standard = #{chargingStandard,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.operatingarea.entity.OperatingArea">
update t_operating_area
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},
shipping_type = #{shippingType,jdbcType=VARCHAR},
shipping_method = #{shippingMethod,jdbcType=VARCHAR},
shipping_method_id = #{shippingMethodId,jdbcType=VARCHAR},
province = #{province,jdbcType=VARCHAR},
city = #{city,jdbcType=VARCHAR},
area = #{area,jdbcType=VARCHAR},
charging_standard = #{chargingStandard,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="getByArea" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_operating_area
where province = #{province,jdbcType=VARCHAR}
and city = #{city,jdbcType=VARCHAR}
and area = #{area,jdbcType=VARCHAR}
and shipping_type = #{shippingType,jdbcType=VARCHAR}
</select>
<!--管理商品分页列表-->
<select id="getOperatingAreaList" resultType="cc.hiver.mall.operatingarea.vo.OperatingAreaPageVO">
select
<include refid="Base_Column_List" />
from t_operating_area t
<where>
<!--类型:0:物流;1:快递;2:送车-->
<if test='queryParams.shippingType!=null and queryParams.shippingType.trim() neq ""'>
AND t.shipping_type = #{queryParams.shippingType}
</if>
<!--物流公司id/快递公司id/车牌号id-->
<if test='queryParams.shippingMethodId!=null and queryParams.shippingMethodId.trim() neq ""'>
AND t.shipping_method_id =#{queryParams.shippingMethodId}
</if>
<!--物流名称/快递名称/车牌号-->
<if test='queryParams.shippingMethod!=null and queryParams.shippingMethod.trim() neq ""'>
AND t.shipping_method like concat('%',#{queryParams.shippingMethod},'%')
</if>
</where>
ORDER BY
<if test='queryParams.sortField!=null and queryParams.sortField.trim() neq "" and queryParams.sortField !=null and queryParams.sort.trim() neq ""'>
#{queryParams.sortField} #{queryParams.sort} ,
</if>
t.shipping_type,shipping_method asc
</select>
</mapper>

7
hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml

@ -586,6 +586,13 @@
#{item}
</foreach>
</if>
<if test="queryParams.searchStr != null and queryParams.searchStr != ''">
and (
t.product_name like concat('%',#{queryParams.productName},'%')
or t.product_sn like concat('%',#{queryParams.productSn},'%')
or t.supplier_name like concat('%',#{queryParams.supplierName},'%')
)
</if>
</where>
ORDER BY
<if test='queryParams.sortField!=null and queryParams.sortField.trim() neq "" and queryParams.sortField !=null and queryParams.sort.trim() neq ""'>

38
hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.Purchase">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
@ -85,7 +86,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, create_by, create_time, del_flag, update_by, update_time, supplier_id,supplier_name, shop_id,
id, create_by,create_by_name, create_time, del_flag, update_by, update_time, supplier_id,supplier_name, shop_id,
total_amount, should_pay, already_pay, no_pay,other_pay, in_storage_status,remark
</sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.PurchaseExample" resultMap="BaseResultMap">
@ -119,12 +120,12 @@
</if>
</delete>
<insert id="insert" parameterType="cc.hiver.mall.entity.Purchase">
insert into t_purchase (id, create_by, create_time,
insert into t_purchase (id, create_by, create_by_name, create_time,
del_flag, update_by, update_time,
supplier_id,supplier_name, shop_id, total_amount,
should_pay, already_pay, no_pay,other_pay, in_storage_status,remark
)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createByName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{supplierId,jdbcType=VARCHAR},#{supplierName,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL},
#{shouldPay,jdbcType=DECIMAL}, #{alreadyPay,jdbcType=DECIMAL}, #{noPay,jdbcType=DECIMAL}, #{otherPay,jdbcType=DECIMAL}, #{inStorageStatus,jdbcType=INTEGER},
@ -140,6 +141,9 @@
<if test="createBy != null">
create_by,
</if>
<if test="createByName != null">
create_by_name,
</if>
<if test="createTime != null">
create_time,
</if>
@ -190,6 +194,9 @@
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createByName != null">
#{createByName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
@ -240,6 +247,9 @@
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.createByName != null">
create_by_name = #{record.createByName,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
@ -291,6 +301,7 @@
update t_purchase
set id = #{record.id,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_by_name = #{record.createByName,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
del_flag = #{record.delFlag,jdbcType=INTEGER},
update_by = #{record.updateBy,jdbcType=VARCHAR},
@ -315,6 +326,9 @@
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createByName != null">
create_by_name = #{createByName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
@ -363,6 +377,7 @@
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.Purchase">
update t_purchase
set create_by = #{createBy,jdbcType=VARCHAR},
create_by_name = #{createByName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=VARCHAR},
@ -392,24 +407,21 @@
<select id="getPurchaseList" parameterType="cc.hiver.mall.pojo.vo.PurchaseQueryVo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from t_purchase
where id in(
where shop_id = #{shopId,jdbcType=VARCHAR}
<if test="searchStr != null and searchStr != ''">
and (id in(
select purchase_id from t_purchase_detail
where product_id in (
select id from t_product
<if test="searchStr != null">
where (
product_name like concat('%',#{searchStr,jdbcType=VARCHAR},'%')
where product_name like concat('%',#{searchStr,jdbcType=VARCHAR},'%')
or product_sn like concat('%',#{searchStr,jdbcType=VARCHAR},'%')
)
</if>
)
group by purchase_id
)
and shop_id = #{shopId,jdbcType=VARCHAR}
<if test="searchStr != null">
or supplier_name like concat('%',#{searchStr},'%')
or supplier_name like concat('%',#{searchStr,jdbcType=VARCHAR},'%')
)
</if>
</select>

7
hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml

@ -526,5 +526,12 @@
group by DATE_FORMAT(create_time, '%Y-%m-%d')
</select>
<!--获取当前的销售单-->
<select id="getSaleId" parameterType="java.lang.String" resultType="java.lang.String">
select
sale_id
from t_sale
where sale_id = #{id,jdbcType=VARCHAR}
</select>
</mapper>
Loading…
Cancel
Save