This commit is contained in:
cookiemy 2024-07-19 09:19:55 +08:00
commit 7a5bbfa4bf
25 changed files with 300 additions and 120 deletions

View File

@ -6539,3 +6539,13 @@ SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `jjjerp_bill_head`
MODIFY COLUMN `file_urls` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '附件内容' AFTER `print_remark`;
ALTER TABLE `jjjerp_product_extend`
CHANGE COLUMN `id` `product_extend_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键' FIRST,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`product_extend_id`) USING BTREE;
ALTER TABLE `jjjerp_bill_item`
CHANGE COLUMN `id` `bill_item_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键' FIRST,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`bill_item_id`) USING BTREE;

View File

@ -5,9 +5,9 @@ spring-boot-jjj:
# 是否启用ansi控制台输出有颜色的字体dev环境建议开启服务器环境设置为false
enable-ansi: false
# 当前环境服务IP地址/域名
server-ip: https://erp.jjjshop.net
server-ip: https://erp-java.jiujiujia.net
# 文件上传下载配置
upload-path: /www/wwwroot/java/uploads
upload-path: /www/wwwroot/erp-java.jiujiujia.net/uploads
# AOP配置
aop:
# Aop日志配置
@ -37,4 +37,4 @@ mybatis-plus:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
file:
path: /www/wwwroot/erp.jjjerp.net/logs
path: /www/wwwroot/erp-java.jiujiujia.net/logs

View File

@ -5,9 +5,9 @@ spring-boot-jjj:
# 是否启用ansi控制台输出有颜色的字体dev环境建议开启服务器环境设置为false
enable-ansi: false
# 当前环境服务IP地址/域名
server-ip: http://150.158.154.41
server-ip: http://erp3.huadeng.fun
# 文件上传下载配置
upload-path: /www/wwwroot/jjj_erp.com/uploads
upload-path: /www/wwwroot/erp3.huadeng.fun/uploads
# AOP配置
aop:
# Aop日志配置
@ -17,17 +17,12 @@ spring-boot-jjj:
# LINE方法执行结束时连续分开打印请求和响应日志
# MERGE方法执行结束时合并请求和响应日志同时打印
log-print-type: NONE
# logback.xml中有详细的日志配置
logging:
path: /www/wwwroot/jjj_erp.com/logs
################################ spring config end #################################
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/jjj_erp?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: jjj_erp
password: 2STCfnf2WRSGfRn3
url: jdbc:mysql://127.0.0.1:3306/jjj_erp_java?autoReconnect=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: cLGfTNk3sBRmRBnw
# Redis配置
redis:
@ -40,3 +35,6 @@ spring:
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
file:
path: /www/wwwroot/erp3.huadeng.fun/logs

View File

@ -5,9 +5,9 @@ spring-boot-jjj:
# 是否启用ansi控制台输出有颜色的字体dev环境建议开启服务器环境设置为false
enable-ansi: false
# 当前环境服务IP地址/域名
server-ip: http://demo-erp.jjjerp.net
server-ip: http://demo-erp-java.jiujiujia.net
# 文件上传下载配置
upload-path: /www/wwwroot/demo-erp.jjjerp.net/uploads
upload-path: /www/wwwroot/demo-erp-java.jiujiujia.net/uploads
# AOP配置
aop:
# Aop日志配置
@ -20,14 +20,14 @@ spring-boot-jjj:
# logback.xml中有详细的日志配置
logging:
path: /www/wwwroot/demo-erp.jjjerp.net/logs
path: /www/wwwroot/demo-erp-java.jiujiujia.net/logs
################################ spring config end #################################
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/demo_erp?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: demo_erp
password: znJ5J3j7nzwA45cx
url: jdbc:mysql://127.0.0.1:3306/demo_erp_java?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: cLGfTNk3sBRmRBnw
# Redis配置
redis:

View File

@ -50,6 +50,7 @@ public class MarketOrderController {
head.setBillType(BillTypeEnum.XSDD.getValue());
//业务类型,1直接采购入库,2订单采购入库,3直接出库,4采购入库单退货,5实际调拨,6虚拟调拨,7销售单原路退回,8线下销售订单,9线上销售订单,10预售销售订单
head.setBusinessType(BusinessTypeEnum.XXXSDD.getValue());
//单据状态0未开始1完成2进行中(已配货),3已关闭,4异常,5待配货,6已发货
if(billHeadService.addOrder(head)) {
return ApiResult.ok(null, "新增成功");
}else{

View File

@ -49,7 +49,7 @@ public class PurchaseStorageController {
@RequiresPermissions("/purchase/purchase/storage/add")
@OperationLog(name = "add")
@ApiOperation(value = "add", response = String.class)
public ApiResult<String> addStorage(@RequestBody @Validated BillHead head) {
public ApiResult<String> addStorage(@RequestBody BillHead head) {
head.setBillType(BillTypeEnum.CGRKD.getValue());
if(billHeadService.addOrder(head)) {
return ApiResult.ok(null, "新增成功");

View File

@ -33,6 +33,9 @@ public class ShopUserParam implements Serializable {
@ApiModelProperty("姓名")
private String realName;
@ApiModelProperty("是否为业务员0不是,1是")
private Integer isSales;
@ApiModelProperty("用户角色")
private List<Integer> roleId;
}

View File

@ -40,6 +40,7 @@ import net.jjjerp.admin.service.shop.ShopUserService;
import net.jjjerp.admin.service.store.StoreService;
import net.jjjerp.admin.service.supplier.SupplierService;
import net.jjjerp.common.util.CodeUtils;
import net.jjjerp.common.util.OrderUtils;
import net.jjjerp.common.util.ProductUtils;
import net.jjjerp.common.vo.product.ProductStockVo;
import net.jjjerp.common.vo.statement.BacklogVo;
@ -64,6 +65,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@ -641,8 +643,10 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
if(extend != null){
extend = productExtendService.transVo(extend);
//获取商品绑定货位
DepotStorage storage = storageStockService.getStorage(extend.getId());
DepotStorage storage = storageStockService.getStorage(extend.getProductExtendId());
item.setStorage(storage);
//规格条码
item.setBarCode(extend.getBarCode());
}
item.setProductExtend(extend);
item.setCodeNum(head.getCodeNum());
@ -763,6 +767,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
head.setStoreName(store.getStoreName());
}
}
head.setBusinessTimeStr(DateUtil.getDateString(head.getBusinessTime()));
return head;
}
@ -801,10 +806,10 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//支付金额
BigDecimal depositMoney = sketch.getDepositMoney();
//支付客户数
BigDecimal customerNum = sketch.getCustomerNum();
BigDecimal customerNum = BigDecimal.valueOf(sketch.getCustomerNum());
//平均客单价
BigDecimal customerMoney = BigDecimal.ZERO;
if(depositMoney != null && customerNum != null && customerNum.compareTo(BigDecimal.ZERO) > 0){
if(depositMoney != null && customerNum.compareTo(BigDecimal.ZERO) > 0){
customerMoney = depositMoney.divide(customerNum, 2, RoundingMode.DOWN);
}
sketch.setCustomerMoney(customerMoney);
@ -982,10 +987,10 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//支付金额
BigDecimal depositMoney = dealVo.getDepositMoney();
//支付客户数
BigDecimal customerNum = dealVo.getCustomerNum();
BigDecimal customerNum = BigDecimal.valueOf(dealVo.getCustomerNum());
//平均客单价
BigDecimal customerMoney = BigDecimal.ZERO;
if(depositMoney != null && customerNum != null && customerNum.compareTo(BigDecimal.ZERO) > 0){
if(depositMoney != null && customerNum.compareTo(BigDecimal.ZERO) > 0){
customerMoney = depositMoney.divide(customerNum, 2, RoundingMode.DOWN);
}
dealVo.setCustomerMoney(customerMoney);
@ -1006,10 +1011,10 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//支付金额
BigDecimal depositMoney = dealVo.getDepositMoney();
//支付客户数
BigDecimal customerNum = dealVo.getCustomerNum();
BigDecimal customerNum = BigDecimal.valueOf(dealVo.getCustomerNum());
//平均客单价
BigDecimal customerMoney = BigDecimal.ZERO;
if(depositMoney != null && customerNum != null && customerNum.compareTo(BigDecimal.ZERO) > 0){
if(depositMoney != null && customerNum.compareTo(BigDecimal.ZERO) > 0){
customerMoney = depositMoney.divide(customerNum, 2, RoundingMode.DOWN);
}
dealVo.setCustomerMoney(customerMoney);
@ -1043,7 +1048,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
if(head.getPurchaseStatus() == 3){
return "已关闭";
}
return "";
return "进行中";
}
//确认发货
@ -1091,6 +1096,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
this.addOrder(head);
//出库操作
this.outStock(head);
this.updateById(head);
//出入库时间
oldHead.setOperTime(new Date());
return this.updateById(oldHead);
@ -1153,7 +1159,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
item.setBillType(head.getBillType());
item.setSupplierId(head.getSupplierId());
item.setDepotId(head.getDepotId());
item.setId(null);
item.setBillItemId(null);
item.setIsExchange(head.getIsExchange());
//检查商品属性
this.checkItem(item);
@ -1170,29 +1176,27 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
head.setTypeName("线下出库单");
}
this.save(head);
if(head.getCustomerAddressId() != null && head.getCustomerAddressId() > 0) {
CustomerAddress customerAddress = customerAddressService.getById(head.getCustomerAddressId());
BillAddress billAddress = new BillAddress();
BeanUtils.copyProperties(customerAddress, billAddress);
//销售订单,售后申请单,线下出库单,其他出库单
if(BillTypeEnum.XSDD.getValue().equals(head.getBillType()) || BillTypeEnum.SHSQD.getValue().equals(head.getBillType())
|| (head.getBusinessType() != null && BusinessTypeEnum.XXCKD.getValue().equals(head.getBusinessType()))
|| BillTypeEnum.QTCKD.getValue().equals(head.getBillType())
) {
BillAddress billAddress = head.getBillAddress();
if(billAddress == null){
throw new BusinessException("收货地址不能为空");
}
billAddress.setBillId(head.getBillId());
if(StringUtils.isNotBlank(head.getName())){
billAddress.setName((head.getName()));
}
//手机
if(StringUtils.isNotBlank(head.getPhone())){
billAddress.setPhone(head.getPhone());
}
//固话
if(StringUtils.isNotBlank(head.getFixPhone())){
billAddress.setFixPhone(head.getFixPhone());
}
//邮编
if(StringUtils.isNotBlank(head.getZip())){
billAddress.setZip(head.getZip());
if(StringUtils.isBlank(billAddress.getPhone()) && StringUtils.isBlank(billAddress.getFixPhone())){
throw new BusinessException("手机或固话至少填一个");
}
//详细地址
if(StringUtils.isNotBlank(head.getDetail())){
billAddress.setDetail(head.getDetail());
if(StringUtils.isBlank(billAddress.getDetail())){
throw new BusinessException("详细地址不能为空");
}
//省市区不能为空
if(billAddress.getProvinceId() == null || billAddress.getCityId() ==null || billAddress.getRegionId() == null){
throw new BusinessException("省市区不能为空");
}
billAddress.setCreateTime(new Date());
billAddressService.save(billAddress);
@ -1218,7 +1222,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
if((BillTypeEnum.KCDBD.getValue().equals(head.getBillType()) && BusinessTypeEnum.XNDB.getValue().equals(head.getBusinessType()))){
for(BillItem item : billItemList){
//关联的订单子单号
item.setLinkItemId(item.getId());
item.setLinkItemId(item.getBillItemId());
}
head.setLinkBillId(head.getBillId().toString());
head.setLinkBillNum(head.getCodeNum());
@ -1275,10 +1279,16 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//检查单据属性
private void checkHead(BillHead head) {
//售后类型(0无售后 10退货退款 20换货 30仅退款 40补发 50 维修 60 其他)
if(BillTypeEnum.SHSQD.getValue().equals(head.getBillType()) && head.getRefundType() == 30){
head.setDepotId(0L);
if(BillTypeEnum.SHSQD.getValue().equals(head.getBillType())){
if(head.getRefundType() == null){
throw new RuntimeException("售后类型不能为空");
}
if(head.getRefundType() == 30){
head.setDepotId(0L);
}
}
if(head.getDepotId() == null){
//销售订单新增时非必填,审核时必填
if(head.getDepotId() == null && !BillTypeEnum.XSDD.getValue().equals(head.getBillType())){
throw new BusinessException("仓库不能为空");
}
if(head.getBusinessTime() == null){
@ -1295,9 +1305,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
if( StringUtils.isBlank(head.getProblemCause())){
throw new BusinessException("问题原因不能为空");
}
if(head.getCustomerAddressId() == null ){
throw new BusinessException("客户地址不能为空");
}
if(head.getCustomerId() == null ){
throw new BusinessException("客户不能为空");
}
@ -1376,11 +1383,9 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
if(head.getOrderTime() == null ){
head.setOrderTime(new Date());
}
if(head.getCustomerAddressId() == null ){
throw new BusinessException("客户地址不能为空");
}
if(StringUtils.isBlank(head.getLinkBillNum())){
throw new BusinessException("订单号不能为空");
//自动生成订单号
head.setLinkBillNum(OrderUtils.geneOrderNo(ShopLoginUtil.getUserId()));
}
}
if(head.getCustomerId() == null ){
@ -1401,7 +1406,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
throw new BusinessException("优惠金额不能为空");
}
if(head.getDeposit() == null){
throw new BusinessException("本次收款金额不能为空");
throw new BusinessException("实收金额不能为空");
}
if(head.getTotalPrice() == null){
throw new BusinessException("合计金额不能为空");
@ -1424,9 +1429,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
throw new BusinessException("经手人不能为空");
}
if (BillTypeEnum.QTCKD.getValue().equals(head.getBillType())) {
if (head.getCustomerAddressId() == null) {
throw new BusinessException("收货人地址不能为空");
}
if(head.getCustomerId() == null ){
throw new BusinessException("收货人不能为空");
}
@ -1448,6 +1450,10 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
if(item.getBasicNumber() == 0){
throw new BusinessException("操作总数量不能为0");
}
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
if(extend == null){
throw new BusinessException("商品规格id"+item.getProductExtendId()+"不存在");
}
//可操作总数量
item.setAvailableAllNumber(item.getBasicNumber());
//16期初库存单 15盘盈盘亏单 纯库存操作不验证
@ -1481,7 +1487,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
item.setAllPrice(BigDecimal.ZERO);
}
}else if(BillTypeEnum.QCKCD.getValue().equals(item.getBillType())){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
//是否可以修改期初成本价,0否,1是
if(extend != null && extend.getInitialStatus() == 0){
throw new BusinessException("规格编码:" + extend.getProductCode() + "的期初库存不能修改");
@ -1495,7 +1500,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//关联采购订单子单
BillItem billItem = billItemService.getById(item.getLinkItemId());
if(item.getBasicNumber() > billItem.getAvailableAllNumber()){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
throw new BusinessException("不能超收,规格编码:" + extend.getProductCode() + ",可入库总数:" + billItem.getAvailableAllNumber() + ",实收总数:" + item.getBasicNumber());
}
//未到货数量 = 可入库数 - 实收数
@ -1513,7 +1517,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//可操作总数量
Long availableAllNumber = billItem.getAvailableAllNumber();
if(item.getBasicNumber() > availableAllNumber){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
throw new BusinessException("不能超出,规格编码:" + extend.getProductCode() + ",可操作总数:" + availableAllNumber + ",操作总数:" + item.getBasicNumber());
}
}
@ -1527,7 +1530,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//待入库总数量
Long noArrivalAllNumber = billItem.getNoArrivalAllNumber();
if(item.getBasicNumber() > noArrivalAllNumber){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
throw new BusinessException("不能超入,规格编码:" + extend.getProductCode() + ",可操作总数:" + noArrivalAllNumber + ",操作总数:" + item.getBasicNumber());
}
}
@ -1540,7 +1542,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
BillItem billItem = billItemService.getById(item.getLinkItemId());
//可退数量
if(item.getBasicNumber() > billItem.getAvailableAllNumber() ){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
throw new BusinessException("实退数量不能大于可退数量,商品编码:" + extend.getProductCode() + ",可退数量:" + billItem.getAvailableAllNumber() + ",实退数量:" + item.getBasicNumber());
}
}
@ -1552,7 +1553,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
BillItem billItem = billItemService.getById(item.getLinkItemId());
//可退数量
if(item.getBasicNumber() > billItem.getAvailableAllNumber()){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
if(extend == null){
throw new BusinessException("商品规格ID"+item.getProductExtendId()+"不存在");
}
@ -1567,7 +1567,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
BillItem billItem = billItemService.getById(item.getLinkItemId());
//可退数量
if(item.getBasicNumber() > billItem.getAvailableAllNumber()){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
throw new BusinessException("入库数量不能大于可入库数量,商品编码:" + extend.getProductCode() + ",可入库数量:" + billItem.getAvailableAllNumber() + ",入库数量:" + item.getBasicNumber());
}
}
@ -1580,7 +1579,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
BillItem billItem = billItemService.getById(item.getLinkItemId());
//可下单数量
if(item.getBasicNumber() > billItem.getAvailableAllNumber()){
ProductExtend extend = productExtendService.getById(item.getProductExtendId());
throw new BusinessException("下单数量不能大于可下单数量,商品编码:" + extend.getProductCode() + ",可下单数量:" + billItem.getAvailableAllNumber() + ",下单数量:" + item.getBasicNumber());
}
//减少可下单数量
@ -1677,7 +1675,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
//保存单据商品
for(BillItem item : billItemList){
item.setBillId(head.getBillId());
if(item.getId() != null){
if(item.getBillItemId() != null){
billItemService.updateById(item);
}else {
item.setSupplierId(head.getSupplierId());
@ -1750,6 +1748,10 @@ public class BillHeadServiceImpl extends BaseServiceImpl<BillHeadMapper, BillHea
if(oldHead.getAuditStatus() != 10){
throw new BusinessException("只有待审核订单才能审核");
}
if(oldHead.getDepotId() == null){
throw new BusinessException("审核销售订单时仓库不能为空");
}
oldHead.setAuditId(adminUser.getShopUserId());
//审核状态10待审核20通过30拒绝
oldHead.setAuditStatus(20);

View File

@ -137,6 +137,12 @@ public class DepotStorageServiceImpl extends BaseServiceImpl<DepotStorageMapper,
}
}
storage.setStockStr(stockStr.toString());
if(storage.getReservoirId() != null && storage.getReservoirId() > 0){
DepotReservoir reservoir = reservoirService.getById(storage.getReservoirId());
if(reservoir != null){
storage.setReservoirName(reservoir.getReservoirName());
}
}
return storage;
}

View File

@ -135,7 +135,7 @@ public class AccountMoneyLogServiceImpl extends BaseServiceImpl<AccountMoneyLogM
//账户名称
Account account = accountService.getById(accountMoneyLog.getAccountId());
if(account != null){
accountMoneyLog.setAccountName(account.getOrganName());
accountMoneyLog.setAccountName(account.getAccountName());
}
//单据类型名称
accountMoneyLog.setTypeName(BillTypeEnum.getName(accountMoneyLog.getBillType()));

View File

@ -42,8 +42,8 @@ public class ProductAttributeServiceImpl extends BaseServiceImpl<ProductAttribut
LambdaQueryWrapper<ProductAttribute> wrapper = new LambdaQueryWrapper<>();
//删除标记0未删除1删除"
wrapper.eq(ProductAttribute::getDeleteFlag, 0);
if (StringUtils.isNotEmpty(commonPageParam.getSearch())) {
wrapper.like(ProductAttribute::getAttributeName, commonPageParam.getSearch());
if (StringUtils.isNotEmpty(commonPageParam.getAttributeName())) {
wrapper.like(ProductAttribute::getAttributeName, commonPageParam.getAttributeName());
}
wrapper.orderByDesc(ProductAttribute::getId);
IPage<ProductAttribute> iPage = this.page(page, wrapper);

View File

@ -115,6 +115,22 @@ public class ProductExtendServiceImpl extends BaseServiceImpl<ProductExtendMappe
wrapper.and(i -> i.or().in(ProductExtend::getProductId, productIds)
.or().like(ProductExtend::getProductCode, productPageParam.getProductCode()));
}
LambdaQueryWrapper<Product> wrapperProduct = new LambdaQueryWrapper<>();
//删除标记0未删除1删除
wrapperProduct.eq(Product::getDeleteFlag, 0);
// 启用 0-禁用 1-启用
wrapperProduct.eq(Product::getEnabled, 1);
//商品分类搜索
if(productPageParam.getCategoryId() != null && productPageParam.getCategoryId() > 0){
//查询商品分类ID以及所有子分类ID
List<Integer> subCategoryIds = productCategoryService.getSubCategoryId(productPageParam.getCategoryId());
wrapperProduct.in(Product::getCategoryId, subCategoryIds);
}
List<Long> productIds = productService.list(wrapperProduct).stream().map(Product::getProductId).collect(Collectors.toList());
if(CollectionUtils.isEmpty(productIds)){
productIds.add(0L);
}
wrapper.in(ProductExtend::getProductId, productIds);
wrapper.orderByDesc(ProductExtend::getCreateTime);
IPage<ProductExtend> iPage = this.page(page, wrapper);
// 最终返回分页对象
@ -266,7 +282,7 @@ public class ProductExtendServiceImpl extends BaseServiceImpl<ProductExtendMappe
);
for(ProductExtend extend : extendList){
param.setProductId(null);
Long totalStock = productUtils.getExtendStock(extend.getId(), param.getDepotId());
Long totalStock = productUtils.getExtendStock(extend.getProductExtendId(), param.getDepotId());
extend.setTotalStock(totalStock);
vo.setTotalStock(vo.getTotalStock() + extend.getTotalStock());
}
@ -317,7 +333,7 @@ public class ProductExtendServiceImpl extends BaseServiceImpl<ProductExtendMappe
//商品规格期初库存转换
private ProductExtend transExtendOpenning(ProductExtend extend, CommonPageParam param) {
param.setProductExtendId(extend.getId());
param.setProductExtendId(extend.getProductExtendId());
//获取期初库存子单据
List<BillItem> openningList = billHeadService.getOpenningList(param);
//期初库存
@ -374,10 +390,16 @@ public class ProductExtendServiceImpl extends BaseServiceImpl<ProductExtendMappe
Product product = productService.getById(extend.getProductId());
if(product != null){
extend.setName(product.getName());
//商品编码
extend.setProductParentCode(product.getProductCode());
extend.setAccountNum(product.getAccountNum());
extend.setStorage(storageStockService.getStorage(extend.getId()));
extend.setWeight(product.getWeight());
extend.setVolume(product.getVolume());
extend.setStorage(storageStockService.getStorage(extend.getProductExtendId()));
extend.setMfrsName(productUtils.getMfrsName(product.getMfrs()));
extend.setCategoryName(productUtils.getCategoryName(product.getCategoryId()));
}
param.setProductExtendId(extend.getId());
param.setProductExtendId(extend.getProductExtendId());
//获取出库入库类型子单据
List<BillItem> itemStockList = billHeadService.getStockitemList(param);
//获取锁定类型子单据
@ -408,7 +430,7 @@ public class ProductExtendServiceImpl extends BaseServiceImpl<ProductExtendMappe
}
extend.setName(product.getName());
extend.setAccountNum(product.getAccountNum());
extend.setStorage(storageStockService.getStorage(extend.getId()));
extend.setStorage(storageStockService.getStorage(extend.getProductExtendId()));
ProductUnit productUnit = productUnitService.getById(product.getUnitId());
if(productUnit != null){
productUnit = productUnitService.transVo(productUnit);

View File

@ -291,14 +291,14 @@ public class ProductServiceImpl extends BaseServiceImpl<ProductMapper, Product>
throw new BusinessException("规格编码只能是数字");
}
//校验规格编码是否重复
if(checkIsProductCodeExist(item.getId(),item.getProductCode()) > 0){
if(checkIsProductCodeExist(item.getProductExtendId(),item.getProductCode()) > 0){
throw new BusinessException(item.getProductCode() + "规格编码已存在");
}
}
// 更新模式
if(isUpdate){
for(ProductExtend extend : sku){
if(extend.getId() != null && extend.getId() > 0){
if(extend.getProductExtendId() != null && extend.getProductExtendId() > 0){
//修改
productExtendService.updateById(extend);
}else {
@ -312,7 +312,7 @@ public class ProductServiceImpl extends BaseServiceImpl<ProductMapper, Product>
}
for(ProductExtend item : sku){
//校验规格编码是否重复
if(checkIsProductCodeExist(item.getId(),item.getProductCode()) > 0){
if(checkIsProductCodeExist(item.getProductExtendId(),item.getProductCode()) > 0){
throw new BusinessException(item.getProductCode() + "规格编码已存在");
}
}
@ -321,7 +321,7 @@ public class ProductServiceImpl extends BaseServiceImpl<ProductMapper, Product>
public int checkIsProductCodeExist(Long id, String productCode) {
LambdaQueryWrapper<ProductExtend> wrapper = new LambdaQueryWrapper<>();
if(id != null){
wrapper.ne(ProductExtend::getId, id);
wrapper.ne(ProductExtend::getProductExtendId, id);
}
wrapper.eq(ProductExtend::getProductCode, productCode);
//删除标记0未删除1删除

View File

@ -333,6 +333,7 @@ public class ShopUserServiceImpl extends BaseServiceImpl<ShopUserMapper, AdminUs
AdminUser user = new AdminUser();
user.setUserName(shopUserParam.getUserName());
user.setRealName(shopUserParam.getRealName());
user.setIsSales(shopUserParam.getIsSales());
// 盐值
String salt = SaltUtil.generateSalt();
// 密码加密
@ -367,6 +368,7 @@ public class ShopUserServiceImpl extends BaseServiceImpl<ShopUserMapper, AdminUs
user.setShopUserId(shopUserParam.getShopUserId());
user.setUserName(shopUserParam.getUserName());
user.setRealName(shopUserParam.getRealName());
user.setIsSales(shopUserParam.getIsSales());
if(StringUtils.isNotEmpty(shopUserParam.getPassword())){
// 盐值
String salt = SaltUtil.generateSalt();

View File

@ -45,25 +45,9 @@ public class BillHead implements Serializable {
@TableField(exist = false)
private String stateText;
@ApiModelProperty("收货人姓名")
@ApiModelProperty("用户地址")
@TableField(exist = false)
private String name;
@ApiModelProperty("手机")
@TableField(exist = false)
private String phone;
@ApiModelProperty("固话")
@TableField(exist = false)
private String fixPhone;
@ApiModelProperty("邮编")
@TableField(exist = false)
private String zip;
@ApiModelProperty("详细地址")
@TableField(exist = false)
private String detail;
private BillAddress billAddress;
@ApiModelProperty("结算状态文本内容")
@TableField(exist = false)
@ -171,6 +155,10 @@ public class BillHead implements Serializable {
@ApiModelProperty("业务时间")
private Date businessTime;
@ApiModelProperty("业务时间")
@TableField(exist = false)
private String businessTimeStr;
@ApiModelProperty("供应商id")
private Long supplierId;
@ -198,9 +186,6 @@ public class BillHead implements Serializable {
@ApiModelProperty("客户id")
private Integer customerId;
@ApiModelProperty("客户地址id")
private Integer customerAddressId;
@ApiModelProperty("配送方式(10快递发货 20上门自提 30无需物流 40多包裹)")
private Integer deliveryType;

View File

@ -31,8 +31,8 @@ public class BillItem implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@TableId(value = "bill_item_id", type = IdType.AUTO)
private Long billItemId;
@ApiModelProperty("表头Id")
private Long billId;
@ -124,6 +124,10 @@ public class BillItem implements Serializable {
@TableField(exist = false)
private DepotStorage storage;
@ApiModelProperty("规格条码")
@TableField(exist = false)
private String barCode;
@ApiModelProperty("业务类型,1直接采购入库,2订单采购入库,3直接出库,4采购入库单退货,5实际调拨,6虚拟调拨")
private Integer businessType;

View File

@ -65,6 +65,10 @@ public class DepotStorage implements Serializable {
@TableField(exist = false)
private String stockStr;
@ApiModelProperty("库区名称")
@TableField(exist = false)
private String reservoirName;
@ApiModelProperty("应用id")
private Integer appId;

View File

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDate;
import java.util.Date;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;

View File

@ -16,6 +16,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.jjjerp.common.entity.depot.DepotStorage;
import net.jjjerp.framework.core.validator.groups.Update;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@ -35,8 +36,8 @@ public class ProductExtend implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@TableId(value = "product_extend_id", type = IdType.AUTO)
private Long productExtendId;
@ApiModelProperty("商品id")
private Long productId;
@ -103,6 +104,22 @@ public class ProductExtend implements Serializable {
@TableField(exist = false)
private String accountNum;
@ApiModelProperty("商品编码")
@TableField(exist = false)
private String productParentCode;
@ApiModelProperty("品牌名称")
@TableField(exist = false)
private String mfrsName;
@ApiModelProperty("基础重量(kg)")
@TableField(exist = false)
private BigDecimal weight;
@ApiModelProperty("基础体积(立方米)")
@TableField(exist = false)
private BigDecimal volume;
@ApiModelProperty("单位")
@TableField(exist = false)
private ProductUnit productUnit;

View File

@ -24,6 +24,9 @@ public class CommonPageParam extends BasePageOrderParam {
@ApiModelProperty("搜索条件")
private String search;
@ApiModelProperty("属性名")
private String attributeName;
@ApiModelProperty("名称")
private String name;

View File

@ -5,15 +5,19 @@ import lombok.extern.slf4j.Slf4j;
import net.jjjerp.common.entity.bill.BillItem;
import net.jjjerp.common.entity.depot.DepotStorage;
import net.jjjerp.common.entity.depot.DepotStorageStock;
import net.jjjerp.common.entity.product.ProductCategory;
import net.jjjerp.common.entity.product.ProductExtend;
import net.jjjerp.common.entity.product.ProductImage;
import net.jjjerp.common.entity.product.ProductMfrs;
import net.jjjerp.common.enums.BillTypeEnum;
import net.jjjerp.common.enums.BusinessTypeEnum;
import net.jjjerp.common.service.bill.BillItemService;
import net.jjjerp.common.service.depot.DepotStorageService;
import net.jjjerp.common.service.depot.DepotStorageStockService;
import net.jjjerp.common.service.product.ProductCategoryService;
import net.jjjerp.common.service.product.ProductExtendService;
import net.jjjerp.common.service.product.ProductImageService;
import net.jjjerp.common.service.product.ProductMfrsService;
import net.jjjerp.common.vo.product.ProductImageVo;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
@ -41,6 +45,10 @@ public class ProductUtils {
private BillItemService billItemService;
@Autowired
private DepotStorageService depotStorageService;
@Autowired
private ProductMfrsService mfrsService;
@Autowired
private ProductCategoryService productCategoryService;
/**
* 库存到货,累积库存
@ -65,12 +73,12 @@ public class ProductUtils {
productExtendService.updateById(extend);
}
//商品库存余量
item.setStockNum(getExtendStock(extend.getId(), item.getDepotId()) + num);
item.setStockNum(getExtendStock(extend.getProductExtendId(), item.getDepotId()) + num);
//库存变化数量
item.setDifferenceNum(num);
billItemService.updateById(item);
//获取商品绑定货位
DepotStorage storage = this.getStorage(extend.getId());
DepotStorage storage = this.getStorage(extend.getProductExtendId());
//如果是本仓库货位,则新增货位库存
if(storage != null && storage.getDepotId().equals(item.getDepotId())){
DepotStorageStock stock = storage.getStock();
@ -153,12 +161,12 @@ public class ProductUtils {
productExtendService.updateById(extend);
}
//商品库存余量
item.setStockNum(getExtendStock(extend.getId(), item.getDepotId()) - num);
item.setStockNum(getExtendStock(extend.getProductExtendId(), item.getDepotId()) - num);
//库存变化数量
item.setDifferenceNum(item.getDifferenceNum() - num);
billItemService.updateById(item);
//获取商品绑定货位
DepotStorage storage = this.getStorage(extend.getId());
DepotStorage storage = this.getStorage(extend.getProductExtendId());
//如果是本仓库货位,则新增货位库存
if(storage != null && storage.getDepotId().equals(item.getDepotId())){
DepotStorageStock stock = storage.getStock();
@ -271,4 +279,22 @@ public class ProductUtils {
return productImageVo;
}).collect(Collectors.toList());
}
//查询商品品牌名称
public String getMfrsName(Integer id) {
ProductMfrs mfrs = mfrsService.getById(id);
if(mfrs != null){
return mfrs.getName();
}
return "";
}
//查询商品分类名称
public String getCategoryName(Integer categoryId) {
ProductCategory category = productCategoryService.getById(categoryId);
if(category != null){
return category.getName();
}
return "";
}
}

View File

@ -14,19 +14,19 @@ public class DealVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("支付笔数")
private BigDecimal depositNum;
private int depositNum;
@ApiModelProperty("支付金额")
private BigDecimal depositMoney;
@ApiModelProperty("支付客户数")
private BigDecimal customerNum;
private int customerNum;
@ApiModelProperty("平均客单价")
private BigDecimal customerMoney;
@ApiModelProperty("发货笔数")
private BigDecimal deliverNum;
private int deliverNum;
@ApiModelProperty("发货金额")
private BigDecimal deliverMoney;

View File

@ -4,7 +4,9 @@ package net.jjjerp.framework.util;
import net.jjjerp.config.constant.DatePattern;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
@ -27,4 +29,97 @@ public class DateUtil {
return dateString;
}
public static String getDateStart(Date date){
if (date == null){
return null;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
String dateString = simpleDateFormat.format(date);
return dateString;
}
public static String getDateEnd(Date date){
if (date == null){
return null;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
String dateString = simpleDateFormat.format(date);
return dateString;
}
public static String getDateBetweenString(Date yest,Date now){
if (now == null || yest == null){
return null;
}
String dateString = "";
long diff = now.getTime() - yest.getTime();//这样得到的差值是微秒级别
long days = diff / (1000 * 60 * 60 * 24);
long hours = (diff-days*(1000 * 60 * 60 * 24))/(1000* 60 * 60);
long minutes = (diff-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60))/(1000* 60);
long sec = (diff-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60)-minutes*(1000* 60)) /1000;
if(days > 0){
dateString = dateString + days+"";
}
if(hours > 0){
dateString = dateString + hours+"小时";
}
if(minutes > 0){
dateString = dateString + minutes+"";
}
if(sec > 0){
dateString = dateString + sec+"";
}
return dateString;
}
public static String getMd(Date date){
if (date == null){
return null;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd");
String dateString = simpleDateFormat.format(date);
return dateString;
}
public static String getHi(Date date){
if (date == null){
return null;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
String dateString = simpleDateFormat.format(date);
return dateString;
}
public static String getTimeString(Date date){
if (date == null){
return null;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatePattern.HH_MM);
String dateString = simpleDateFormat.format(date);
return dateString;
}
//是否本年,本月,本天
public static boolean isThisTime(Date time, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
String param = sdf.format(time);//参数时间
String now = sdf.format(new Date());//当前时间
if (param.equals(now)) {
return true;
}
return false;
}
//判断选择的日期是否是本周
public static boolean isThisWeek(Date time) {
Calendar calendar = Calendar.getInstance();
int currentWeek = calendar.get(Calendar.WEEK_OF_YEAR);
calendar.setTime(time);
int paramWeek = calendar.get(Calendar.WEEK_OF_YEAR);
if (paramWeek == currentWeek) {
return true;
}
return false;
}
}

View File

@ -49,7 +49,7 @@ public class ShopLoginUtil {
public static Integer getUserId() {
LoginShopUserRedisVo loginShopUserRedisVo = getLoginShopUserRedisVo();
if (loginShopUserRedisVo == null) {
return null;
return 0;
}
return loginShopUserRedisVo.getShopUserId();
}

View File

@ -20,7 +20,8 @@ export default defineConfig(({ mode }) => {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
}
}
},
port: 8080,//前端端口
},
plugins: [
viteCompression({