Browse Source

问题修改。

app/sale/listPages 未登录校验去掉
注册店铺出现了两个散客,两个欠款信息的问题修改;
分享页新增的客户,维护欠款等信息。
业绩管理sql取值改下;
cangku
wangfukang 2 years ago
parent
commit
4bbd9b3065
  1. 8
      hiver-admin/src/main/resources/application.yml
  2. 16
      hiver-admin/test-output/test-report.html
  3. 25
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
  4. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
  5. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
  6. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Customer.java
  7. 91
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
  8. 9
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/StockAndLogServiceImpl.java
  9. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java
  10. 2
      hiver-modules/hiver-mall/src/main/resources/mapper/ReturnSaleMapper.xml
  11. 4
      hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml

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

@ -25,8 +25,8 @@ spring:
timeout-per-shutdown-phase: 10S timeout-per-shutdown-phase: 10S
# 数据源 # 数据源
datasource: datasource:
# url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
url: jdbc:mysql://8.140.198.243:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true # url: jdbc:mysql://8.140.198.243:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: reddoor username: reddoor
# Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456 # Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456
password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe) password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe)
@ -67,8 +67,8 @@ spring:
ddl-auto: update ddl-auto: update
# Redis 若设有密码自行添加配置password # Redis 若设有密码自行添加配置password
redis: redis:
# host: 154.8.162.157 host: 154.8.162.157
host: 8.140.198.243 # host: 8.140.198.243
password: reddoor168 password: reddoor168
# 数据库索引 默认0 # 数据库索引 默认0
database: 1 database: 1

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

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a> <a href="#"><span class="badge badge-primary">Hiver</span></a>
</li> </li>
<li class="m-r-10"> <li class="m-r-10">
<a href="#"><span class="badge badge-primary">七月 07, 2024 14:20:12</span></a> <a href="#"><span class="badge badge-primary">七月 09, 2024 10:22:46</span></a>
</li> </li>
</ul> </ul>
</div> </div>
@ -84,7 +84,7 @@
<div class="test-detail"> <div class="test-detail">
<span class="meta text-white badge badge-sm"></span> <span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p> <p class="name">passTest</p>
<p class="text-sm"><span>14:20:12 下</span> / <span>0.015 secs</span></p> <p class="text-sm"><span>10:22:47 上</span> / <span>0.018 secs</span></p>
</div> </div>
<div class="test-contents d-none"> <div class="test-contents d-none">
<div class="detail-head"> <div class="detail-head">
@ -92,9 +92,9 @@
<div class="info"> <div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div> <div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5> <h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>07.07.2024 14:20:12</span> <span class='badge badge-success'>07.09.2024 10:22:47</span>
<span class='badge badge-danger'>07.07.2024 14:20:13</span> <span class='badge badge-danger'>07.09.2024 10:22:47</span>
<span class='badge badge-default'>0.015 secs</span> <span class='badge badge-default'>0.018 secs</span>
</div> </div>
<div class="m-t-10 m-l-5"></div> <div class="m-t-10 m-l-5"></div>
</div> </div>
@ -104,7 +104,7 @@
<tbody> <tbody>
<tr class="event-row"> <tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td> <td><span class="badge log pass-bg">Pass</span></td>
<td>14:20:13</td> <td>10:22:47</td>
<td> <td>
Test passed Test passed
</td> </td>
@ -128,13 +128,13 @@
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Started</p> <p class="m-b-0">Started</p>
<h3>七月 07, 2024 14:20:12</h3> <h3>七月 09, 2024 10:22:46</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Ended</p> <p class="m-b-0">Ended</p>
<h3>七月 07, 2024 14:20:13</h3> <h3>七月 09, 2024 10:22:47</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

25
hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java

@ -21,6 +21,8 @@ import cc.hiver.core.entity.UserRole;
import cc.hiver.core.service.RoleService; import cc.hiver.core.service.RoleService;
import cc.hiver.core.service.UserRoleService; import cc.hiver.core.service.UserRoleService;
import cc.hiver.core.service.UserService; import cc.hiver.core.service.UserService;
import cc.hiver.mall.debt.service.DebtService;
import cc.hiver.mall.entity.Customer;
import cc.hiver.mall.entity.Shop; import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.ShopUser; import cc.hiver.mall.entity.ShopUser;
import cc.hiver.mall.entity.Supplier; import cc.hiver.mall.entity.Supplier;
@ -31,6 +33,8 @@ import cc.hiver.mall.pojo.vo.ShopVo;
import cc.hiver.mall.service.ShopService; import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopUserService; import cc.hiver.mall.service.ShopUserService;
import cc.hiver.mall.service.SupplierService; import cc.hiver.mall.service.SupplierService;
import cc.hiver.mall.service.mybatis.CustomerService;
import cc.hiver.mall.service.mybatis.DealingsRecordService;
import cc.hiver.mall.service.mybatis.ProductCategoryService; import cc.hiver.mall.service.mybatis.ProductCategoryService;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
@ -111,6 +115,15 @@ public class AuthController {
@Autowired @Autowired
private SupplierService supplierService; private SupplierService supplierService;
@Autowired
private CustomerService customerService;
@Autowired
private DebtService debtService;
@Autowired
private DealingsRecordService dealingsRecordService;
@RequestMapping(value = "/login", method = RequestMethod.POST) @RequestMapping(value = "/login", method = RequestMethod.POST)
@SystemLog(description = "账号登录", type = LogType.LOGIN) @SystemLog(description = "账号登录", type = LogType.LOGIN)
@ApiOperation("账号/手机/邮箱登录") @ApiOperation("账号/手机/邮箱登录")
@ -432,6 +445,18 @@ public class AuthController {
supplier.setConsigneeMobile(""); supplier.setConsigneeMobile("");
supplier.setDelFlag(CommonConstant.DEL_FLAG_FALSE); supplier.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
supplierService.save(supplier); supplierService.save(supplier);
// 启用店铺的时候需要给该店铺新增一个散客的客户;
Customer customer = new Customer();
customer.setCreateBy(user.getId());
customer.setCreateByName(user.getNickname());
customer.setName("散客");
customer.setPhone("13111111111");
customer.setProvince("暂无");
customer.setCity("暂无");
customer.setArea("暂无");
customer.setUserName("sanke");
customer.setShopId(shop.getId());
customerService.addCustomer(customer);
return ResultUtil.data(user); return ResultUtil.data(user);
} }

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

@ -433,17 +433,17 @@ public class SaleController {
@RequestMapping(value = "/listPages", method = RequestMethod.POST) @RequestMapping(value = "/listPages", method = RequestMethod.POST)
@ApiOperation("根据条件获得分页") @ApiOperation("根据条件获得分页")
public Result queryPage(@RequestBody SaleVO saleVO) { public Result queryPage(@RequestBody SaleVO saleVO) {
String shopId = ""; /*String shopId = "";
try { try {
// 获取请求token // 获取请求token
shopId = securityUtil.getShopId(); shopId = securityUtil.getShopId();
} catch (Exception e) { } catch (Exception e) {
return ResultUtil.error(500, e.getMessage()); return ResultUtil.error(500, e.getMessage());
} }*/
if (ObjectUtils.isEmpty(saleVO)) { if (ObjectUtils.isEmpty(saleVO)) {
return new ResultUtil().setErrorMsg("请输入查询条件后再查询!"); return new ResultUtil().setErrorMsg("请输入查询条件后再查询!");
} }
saleVO.setShopId(shopId); // saleVO.setShopId(shopId);
final Page<Sale> saleList = saleService.queryPage(saleVO); final Page<Sale> saleList = saleService.queryPage(saleVO);
return new ResultUtil<Page<Sale>>().setData(saleList); return new ResultUtil<Page<Sale>>().setData(saleList);
} }

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java

@ -26,7 +26,6 @@ import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.vo.Result; import cc.hiver.core.common.vo.Result;
import cc.hiver.core.entity.User; import cc.hiver.core.entity.User;
import cc.hiver.core.service.UserService; import cc.hiver.core.service.UserService;
import cc.hiver.mall.entity.Customer;
import cc.hiver.mall.entity.Shop; import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.ShopArea; import cc.hiver.mall.entity.ShopArea;
import cc.hiver.mall.entity.ShopUser; import cc.hiver.mall.entity.ShopUser;
@ -36,7 +35,6 @@ import cc.hiver.mall.pojo.vo.QueryShopRevenueVO;
import cc.hiver.mall.service.ShopAreaService; import cc.hiver.mall.service.ShopAreaService;
import cc.hiver.mall.service.ShopService; import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopUserService; import cc.hiver.mall.service.ShopUserService;
import cc.hiver.mall.service.mybatis.CustomerService;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -78,9 +76,6 @@ public class ShopController {
@Autowired @Autowired
private InviteLogService inviteLogService; private InviteLogService inviteLogService;
@Autowired
private CustomerService customerService;
@RequestMapping(value = "/getAll", method = RequestMethod.GET) @RequestMapping(value = "/getAll", method = RequestMethod.GET)
@ApiOperation("获取全部数据") @ApiOperation("获取全部数据")
public Result<List<Shop>> getAll() { public Result<List<Shop>> getAll() {
@ -215,17 +210,6 @@ public class ShopController {
final Shop shop = shopService.get(id); final Shop shop = shopService.get(id);
shop.setStatus(ShopConstant.SHOP_STATUS_NORMAL); shop.setStatus(ShopConstant.SHOP_STATUS_NORMAL);
shopService.update(shop); shopService.update(shop);
// 启用店铺的时候需要给该店铺新增一个散客的客户;
Customer customer = new Customer();
customer.setName("散客");
customer.setPhone("13111111111");
customer.setProvince("暂无");
customer.setCity("暂无");
customer.setArea("暂无");
customer.setUserName("sanke");
customer.setShopId(id);
customerService.addCustomer(customer);
return ResultUtil.success("操作成功"); return ResultUtil.success("操作成功");
} }

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Customer.java

@ -22,6 +22,10 @@ public class Customer implements Serializable {
private String createBy; private String createBy;
@TableField(exist = false)
@ApiModelProperty(value = "创建人")
private String createByName;
private Date createTime; private Date createTime;
private Integer delFlag; private Integer delFlag;

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

@ -1,6 +1,7 @@
package cc.hiver.mall.serviceimpl; package cc.hiver.mall.serviceimpl;
import cc.hiver.core.common.constant.CommonConstant; import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.DealingsRecordConstant;
import cc.hiver.core.common.constant.SaleConstant; import cc.hiver.core.common.constant.SaleConstant;
import cc.hiver.core.common.constant.UserConstant; import cc.hiver.core.common.constant.UserConstant;
import cc.hiver.core.common.sms.SmsUtil; import cc.hiver.core.common.sms.SmsUtil;
@ -14,6 +15,8 @@ import cc.hiver.core.service.LogiticsCompanyService;
import cc.hiver.core.service.RoleService; import cc.hiver.core.service.RoleService;
import cc.hiver.core.service.UserRoleService; import cc.hiver.core.service.UserRoleService;
import cc.hiver.core.service.UserService; import cc.hiver.core.service.UserService;
import cc.hiver.mall.debt.constant.DebtConstant;
import cc.hiver.mall.debt.entity.Debt;
import cc.hiver.mall.debt.service.DebtService; import cc.hiver.mall.debt.service.DebtService;
import cc.hiver.mall.deductlog.service.DeductLogService; import cc.hiver.mall.deductlog.service.DeductLogService;
import cc.hiver.mall.entity.*; import cc.hiver.mall.entity.*;
@ -92,6 +95,9 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
@Autowired @Autowired
private DebtService debtService; private DebtService debtService;
@Autowired
private DealingsRecordService dealingsRecordService;
@Override @Override
public Sale handleSalesAndDetails(SaleDTO saleDTO) { public Sale handleSalesAndDetails(SaleDTO saleDTO) {
@ -404,6 +410,37 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
@Override @Override
public Sale savePresale(SaleQueryDTO saleQueryDTO) { public Sale savePresale(SaleQueryDTO saleQueryDTO) {
/**
* 1.处理Sale总订单
* 处理订单状态/收款状态
* */
final Sale sale = saleQueryDTO.getSale();
// 查询分享单的创建人(销售员id)
// 获取分享单的id
String oldSaleId = saleQueryDTO.getOldSaleId();
// 新增下游客户信息
final Customer customer = new Customer();
// 欠款信息
final Debt debt = new Debt();
// 2. 新增欠款记录
final DealingsRecord dealingsRecord = new DealingsRecord();
if (StringUtils.isNotEmpty(oldSaleId)) {
//
Map<String, String> userData = productShareService.getCreByUserData(oldSaleId);
if (userData != null) {
// 分享的人员设置为销售单的销售员
sale.setCreateBy(String.valueOf(userData.get("id")));
sale.setCreateByName(userData.get("nickname"));
// 欠款信息创建人
debt.setCreateBy(String.valueOf(userData.get("id")));
// 欠款记录信息创建人
dealingsRecord.setCreateBy(String.valueOf(userData.get("id")));
dealingsRecord.setCreateByName(userData.get("nickname"));
}
}
// 分享页提交订单的时候,根据手机号查询下游客户信息,如果查不到,则新增下游客户 // 分享页提交订单的时候,根据手机号查询下游客户信息,如果查不到,则新增下游客户
User byMobile; User byMobile;
String customerId = ""; String customerId = "";
@ -448,8 +485,7 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
byMobile = userService.save(byMobile); byMobile = userService.save(byMobile);
} }
} }
// 新增下游客户信息
final Customer customer = new Customer();
customer.setUserId(byMobile.getId()); customer.setUserId(byMobile.getId());
customer.setCreateTime(new Date()); customer.setCreateTime(new Date());
customer.setDelFlag(CommonConstant.DEL_FLAG_FALSE); customer.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
@ -463,29 +499,43 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
customerService.save(customer); customerService.save(customer);
// 获取新增的客户id // 获取新增的客户id
customerId = customer.getId(); 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 { } else {
log.error("下游客户未填写手机号!"); log.error("下游客户未填写手机号!");
return null; return null;
} }
/**
* 1.处理Sale总订单
* 处理订单状态/收款状态
* */
final Sale sale = saleQueryDTO.getSale();
// 查询分享单的创建人(销售员id)
// 获取分享单的id
String oldSaleId = saleQueryDTO.getOldSaleId();
if(StringUtils.isNotEmpty(oldSaleId)){
//
Map<String,String> userData = productShareService.getCreByUserData(oldSaleId);
if(userData != null){
// 分享的人员设置为销售单的销售员
sale.setCreateBy(String.valueOf(userData.get("id")));
sale.setCreateByName(userData.get("nickname"));
}
}
// 分享页提交订单这里肯定是:未收款 // 分享页提交订单这里肯定是:未收款
sale.setPayStatus("0"); sale.setPayStatus("0");
// 分享页提交订单:6:待配货 // 分享页提交订单:6:待配货
@ -547,9 +597,10 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
/** /**
* 保存挂单商品信息 * 保存挂单商品信息
*
* @param saleDetailDTOList
* @author 王富康 * @author 王富康
* @date 2023/10/28 * @date 2023/10/28
* @param saleDetailDTOList
*/ */
@Override @Override
public void setSaleDetail(List<SaleDetailDTO> saleDetailDTOList, String saleId) { public void setSaleDetail(List<SaleDetailDTO> saleDetailDTOList, String saleId) {

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

@ -1,5 +1,6 @@
package cc.hiver.mall.serviceimpl; package cc.hiver.mall.serviceimpl;
import cc.hiver.mall.common.constant.StockLogConstant;
import cc.hiver.mall.entity.Product; import cc.hiver.mall.entity.Product;
import cc.hiver.mall.entity.SaleDetail; import cc.hiver.mall.entity.SaleDetail;
import cc.hiver.mall.entity.Stock; import cc.hiver.mall.entity.Stock;
@ -138,7 +139,7 @@ public class StockAndLogServiceImpl implements StockAndLogService {
//2.记录库存履历 //2.记录库存履历
final StockLog stockLog = new StockLog(); final StockLog stockLog = new StockLog();
//以商品维度,如果没有库存反向插入一条负库存入库 //以商品维度,如果没有库存反向插入一条负库存入库
stockLog.setChangeType("0"); stockLog.setChangeType(StockLogConstant.CHANGE_TYPE[1]);
stockLog.setOrderId(saleId); stockLog.setOrderId(saleId);
stockLog.setDetailId(saleDetailDTO.getDetailId()); stockLog.setDetailId(saleDetailDTO.getDetailId());
stockLog.setProductId(productId); stockLog.setProductId(productId);
@ -158,7 +159,7 @@ public class StockAndLogServiceImpl implements StockAndLogService {
//2.记录库存履历 //2.记录库存履历
final StockLog stockLog = new StockLog(); final StockLog stockLog = new StockLog();
//出库 //出库
stockLog.setChangeType("1"); stockLog.setChangeType(StockLogConstant.CHANGE_TYPE[1]);
stockLog.setOrderId(saleId); stockLog.setOrderId(saleId);
stockLog.setDetailId(saleDetailDTO.getDetailId()); stockLog.setDetailId(saleDetailDTO.getDetailId());
stockLog.setProductId(productId); stockLog.setProductId(productId);
@ -221,7 +222,7 @@ public class StockAndLogServiceImpl implements StockAndLogService {
//2.记录库存履历 //2.记录库存履历
final StockLog stockLog = new StockLog(); final StockLog stockLog = new StockLog();
stockLog.setOrderId(saleDetailDTO.getSaleId()); stockLog.setOrderId(saleDetailDTO.getSaleId());
stockLog.setChangeType("0");//以商品维度,如果没有库存反向插入一条正库存入库 stockLog.setChangeType(StockLogConstant.CHANGE_TYPE[0]);//以商品维度,如果没有库存反向插入一条正库存入库
stockLog.setProductId(productId); stockLog.setProductId(productId);
stockLog.setAttributeList(saleDetailQueryDTO.getAttributeList()); stockLog.setAttributeList(saleDetailQueryDTO.getAttributeList());
stockLog.setStock(0);//入库前数量 stockLog.setStock(0);//入库前数量
@ -240,7 +241,7 @@ public class StockAndLogServiceImpl implements StockAndLogService {
//2.记录库存履历 //2.记录库存履历
final StockLog stockLog = new StockLog(); final StockLog stockLog = new StockLog();
stockLog.setOrderId(saleDetailDTO.getSaleId()); stockLog.setOrderId(saleDetailDTO.getSaleId());
stockLog.setChangeType("0");//出 stockLog.setChangeType(StockLogConstant.CHANGE_TYPE[0]);//入
stockLog.setProductId(productId); stockLog.setProductId(productId);
stockLog.setAttributeList(saleDetailQueryDTO.getAttributeList()); stockLog.setAttributeList(saleDetailQueryDTO.getAttributeList());
stockLog.setStock(stockCount);//入库前数量 stockLog.setStock(stockCount);//入库前数量

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

@ -127,12 +127,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
userRole.setUserId(saveUser.getId()); userRole.setUserId(saveUser.getId());
userRoleService.save(userRole); userRoleService.save(userRole);
} }
String shopId = securityUtil.getShopId(); final String shopId;
final String createBy;
final String createByName;
// shopId从缓存中设置 // shopId从缓存中设置
if(StringUtils.isEmpty(customer.getShopId())){ if(StringUtils.isEmpty(customer.getShopId())){
shopId = securityUtil.getShopId(); shopId = securityUtil.getShopId();
final User user = securityUtil.getCurrUser();
createBy = user.getId();
createByName = user.getNickname();
}else{ }else{
shopId = customer.getShopId(); shopId = customer.getShopId();
createBy = customer.getCreateBy();
createByName = customer.getCreateByName();
} }
// 这里是后台管理系统启用时增加散客增加的这个操作 // 这里是后台管理系统启用时增加散客增加的这个操作
if (StringUtils.isEmpty(customer.getShopId())) { if (StringUtils.isEmpty(customer.getShopId())) {
@ -141,11 +148,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
} }
customer.setDelFlag(CommonConstant.DEL_FLAG_FALSE); customer.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
final int insert = customerMapper.insert(customer); final int insert = customerMapper.insert(customer);
final User user = securityUtil.getCurrUser();
// 客户欠款信息 // 客户欠款信息
final BigDecimal amountOwed = customer.getAmountOwed() == null ? BigDecimal.ZERO : customer.getAmountOwed(); final BigDecimal amountOwed = customer.getAmountOwed() == null ? BigDecimal.ZERO : customer.getAmountOwed();
final Debt debt = new Debt(); final Debt debt = new Debt();
debt.setCreateBy(user.getId()); debt.setCreateBy(createBy);
debt.setCreateTime(new Date()); debt.setCreateTime(new Date());
debt.setUserId(customer.getId()); debt.setUserId(customer.getId());
debt.setShopId(shopId); debt.setShopId(shopId);
@ -158,8 +164,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
// 新增交易记录 // 新增交易记录
// 2. 新增欠款记录 // 2. 新增欠款记录
final DealingsRecord dealingsRecord = new DealingsRecord(); final DealingsRecord dealingsRecord = new DealingsRecord();
dealingsRecord.setCreateBy(user.getId()); dealingsRecord.setCreateBy(createBy);
dealingsRecord.setCreateByName(user.getNickname()); dealingsRecord.setCreateByName(createByName);
dealingsRecord.setCreateTime(new Date()); dealingsRecord.setCreateTime(new Date());
dealingsRecord.setDealingsUserId(customer.getId()); dealingsRecord.setDealingsUserId(customer.getId());
dealingsRecord.setDealingsUserName(customer.getName()); dealingsRecord.setDealingsUserName(customer.getName());

2
hiver-modules/hiver-mall/src/main/resources/mapper/ReturnSaleMapper.xml

@ -631,7 +631,7 @@
<select id="returnTotalAmountDetail" resultType="cc.hiver.mall.pojo.vo.ReturnTotalAmountDetailVo"> <select id="returnTotalAmountDetail" resultType="cc.hiver.mall.pojo.vo.ReturnTotalAmountDetailVo">
select select
id as return_sale_id, id as return_sale_id,
sale_id trs.sale_id,
create_by, create_by,
create_by_name, create_by_name,
user_id, user_id,

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

@ -779,7 +779,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<select id="getSalesRankingByShopId" resultType="cc.hiver.mall.pojo.vo.SalesRankingVo"> <select id="getSalesRankingByShopId" resultType="cc.hiver.mall.pojo.vo.SalesRankingVo">
SELECT SELECT
create_by_name,count(*) as totalCount,sum( real_amount ) as totalPrice create_by_name,count(*) as totalCount,sum( total_amount ) as totalPrice
FROM FROM
t_sale t_sale
<where> <where>
@ -889,7 +889,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<select id="getCustomerBuyProductLog" resultType="cc.hiver.mall.pojo.vo.CustomerBuyProductLogVo"> <select id="getCustomerBuyProductLog" resultType="cc.hiver.mall.pojo.vo.CustomerBuyProductLogVo">
SELECT SELECT
product_id,product_name,product_sn, product_id,product_name,product_sn,
MAX(ts.create_time) AS latest_create_time MAX(create_time) AS latest_create_time
FROM FROM
t_sale_detail t_sale_detail
WHERE WHERE

Loading…
Cancel
Save