diff --git a/db/init.sql b/db/init.sql index dcff8b8..048b598 100644 --- a/db/init.sql +++ b/db/init.sql @@ -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; diff --git a/jjj_erp/config/src/main/resources/config/application-test.yml b/jjj_erp/config/src/main/resources/config/application-test.yml index 40e65b7..283129b 100644 --- a/jjj_erp/config/src/main/resources/config/application-test.yml +++ b/jjj_erp/config/src/main/resources/config/application-test.yml @@ -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: @@ -39,4 +34,7 @@ spring: # 打印SQL语句和结果集,本地开发环境可开启,线上注释掉 mybatis-plus: configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl \ No newline at end of file + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +logging: + file: + path: /www/wwwroot/erp3.huadeng.fun/logs diff --git a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/market/audit/MarketOrderController.java b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/market/audit/MarketOrderController.java index 26e14d8..4da6f72 100644 --- a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/market/audit/MarketOrderController.java +++ b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/market/audit/MarketOrderController.java @@ -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{ diff --git a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/purchase/purchase/PurchaseStorageController.java b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/purchase/purchase/PurchaseStorageController.java index f876644..4375b87 100644 --- a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/purchase/purchase/PurchaseStorageController.java +++ b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/controller/purchase/purchase/PurchaseStorageController.java @@ -49,7 +49,7 @@ public class PurchaseStorageController { @RequiresPermissions("/purchase/purchase/storage/add") @OperationLog(name = "add") @ApiOperation(value = "add", response = String.class) - public ApiResult addStorage(@RequestBody @Validated BillHead head) { + public ApiResult addStorage(@RequestBody BillHead head) { head.setBillType(BillTypeEnum.CGRKD.getValue()); if(billHeadService.addOrder(head)) { return ApiResult.ok(null, "新增成功"); diff --git a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/param/shopUser/ShopUserParam.java b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/param/shopUser/ShopUserParam.java index ec9269a..db071fa 100644 --- a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/param/shopUser/ShopUserParam.java +++ b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/param/shopUser/ShopUserParam.java @@ -33,6 +33,9 @@ public class ShopUserParam implements Serializable { @ApiModelProperty("姓名") private String realName; + @ApiModelProperty("是否为业务员0不是,1是") + private Integer isSales; + @ApiModelProperty("用户角色") private List roleId; } diff --git a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/bill/impl/BillHeadServiceImpl.java b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/bill/impl/BillHeadServiceImpl.java index 495b5ad..6db498f 100644 --- a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/bill/impl/BillHeadServiceImpl.java +++ b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/bill/impl/BillHeadServiceImpl.java @@ -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 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 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 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 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 billItem.getAvailableAllNumber()){ - ProductExtend extend = productExtendService.getById(item.getProductExtendId()); throw new BusinessException("不能超收,规格编码:" + extend.getProductCode() + ",可入库总数:" + billItem.getAvailableAllNumber() + ",实收总数:" + item.getBasicNumber()); } //未到货数量 = 可入库数 - 实收数 @@ -1518,7 +1517,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl availableAllNumber){ - ProductExtend extend = productExtendService.getById(item.getProductExtendId()); throw new BusinessException("不能超出,规格编码:" + extend.getProductCode() + ",可操作总数:" + availableAllNumber + ",操作总数:" + item.getBasicNumber()); } } @@ -1532,7 +1530,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl noArrivalAllNumber){ - ProductExtend extend = productExtendService.getById(item.getProductExtendId()); throw new BusinessException("不能超入,规格编码:" + extend.getProductCode() + ",可操作总数:" + noArrivalAllNumber + ",操作总数:" + item.getBasicNumber()); } } @@ -1545,7 +1542,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl billItem.getAvailableAllNumber() ){ - ProductExtend extend = productExtendService.getById(item.getProductExtendId()); throw new BusinessException("实退数量不能大于可退数量,商品编码:" + extend.getProductCode() + ",可退数量:" + billItem.getAvailableAllNumber() + ",实退数量:" + item.getBasicNumber()); } } @@ -1557,7 +1553,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl billItem.getAvailableAllNumber()){ - ProductExtend extend = productExtendService.getById(item.getProductExtendId()); if(extend == null){ throw new BusinessException("商品规格ID"+item.getProductExtendId()+"不存在"); } @@ -1572,7 +1567,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl billItem.getAvailableAllNumber()){ - ProductExtend extend = productExtendService.getById(item.getProductExtendId()); throw new BusinessException("入库数量不能大于可入库数量,商品编码:" + extend.getProductCode() + ",可入库数量:" + billItem.getAvailableAllNumber() + ",入库数量:" + item.getBasicNumber()); } } @@ -1585,7 +1579,6 @@ public class BillHeadServiceImpl extends BaseServiceImpl billItem.getAvailableAllNumber()){ - ProductExtend extend = productExtendService.getById(item.getProductExtendId()); throw new BusinessException("下单数量不能大于可下单数量,商品编码:" + extend.getProductCode() + ",可下单数量:" + billItem.getAvailableAllNumber() + ",下单数量:" + item.getBasicNumber()); } //减少可下单数量 @@ -1682,7 +1675,7 @@ public class BillHeadServiceImpl extends BaseServiceImpl 0){ + DepotReservoir reservoir = reservoirService.getById(storage.getReservoirId()); + if(reservoir != null){ + storage.setReservoirName(reservoir.getReservoirName()); + } + } return storage; } diff --git a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/finance/capital/impl/AccountMoneyLogServiceImpl.java b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/finance/capital/impl/AccountMoneyLogServiceImpl.java index 5f19aa3..2a8a07b 100644 --- a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/finance/capital/impl/AccountMoneyLogServiceImpl.java +++ b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/finance/capital/impl/AccountMoneyLogServiceImpl.java @@ -135,7 +135,7 @@ public class AccountMoneyLogServiceImpl extends BaseServiceImpl 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 iPage = this.page(page, wrapper); diff --git a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/product/impl/ProductExtendServiceImpl.java b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/product/impl/ProductExtendServiceImpl.java index b47cde9..14b65ff 100644 --- a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/product/impl/ProductExtendServiceImpl.java +++ b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/product/impl/ProductExtendServiceImpl.java @@ -115,6 +115,22 @@ public class ProductExtendServiceImpl extends BaseServiceImpl i.or().in(ProductExtend::getProductId, productIds) .or().like(ProductExtend::getProductCode, productPageParam.getProductCode())); } + LambdaQueryWrapper 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 subCategoryIds = productCategoryService.getSubCategoryId(productPageParam.getCategoryId()); + wrapperProduct.in(Product::getCategoryId, subCategoryIds); + } + List 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 iPage = this.page(page, wrapper); // 最终返回分页对象 @@ -266,7 +282,7 @@ public class ProductExtendServiceImpl extends BaseServiceImpl openningList = billHeadService.getOpenningList(param); //期初库存 @@ -374,10 +390,16 @@ public class ProductExtendServiceImpl extends BaseServiceImpl itemStockList = billHeadService.getStockitemList(param); //获取锁定类型子单据 @@ -408,7 +430,7 @@ public class ProductExtendServiceImpl extends BaseServiceImpl 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 } 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 public int checkIsProductCodeExist(Long id, String productCode) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); if(id != null){ - wrapper.ne(ProductExtend::getId, id); + wrapper.ne(ProductExtend::getProductExtendId, id); } wrapper.eq(ProductExtend::getProductCode, productCode); //删除标记,0未删除,1删除 diff --git a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/shop/impl/ShopUserServiceImpl.java b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/shop/impl/ShopUserServiceImpl.java index 5f31785..986db2c 100644 --- a/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/shop/impl/ShopUserServiceImpl.java +++ b/jjj_erp/jjj-admin/src/main/java/net/jjjerp/admin/service/shop/impl/ShopUserServiceImpl.java @@ -333,6 +333,7 @@ public class ShopUserServiceImpl extends BaseServiceImpl 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; + } + } diff --git a/jjj_erp/jjj-common/src/main/java/net/jjjerp/framework/util/ShopLoginUtil.java b/jjj_erp/jjj-common/src/main/java/net/jjjerp/framework/util/ShopLoginUtil.java index 434f788..69fa948 100644 --- a/jjj_erp/jjj-common/src/main/java/net/jjjerp/framework/util/ShopLoginUtil.java +++ b/jjj_erp/jjj-common/src/main/java/net/jjjerp/framework/util/ShopLoginUtil.java @@ -49,7 +49,7 @@ public class ShopLoginUtil { public static Integer getUserId() { LoginShopUserRedisVo loginShopUserRedisVo = getLoginShopUserRedisVo(); if (loginShopUserRedisVo == null) { - return null; + return 0; } return loginShopUserRedisVo.getShopUserId(); }