diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/DealingsRecordConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/DealingsRecordConstant.java
index cc7a609f..49df3ddb 100644
--- a/hiver-core/src/main/java/cc/hiver/core/common/constant/DealingsRecordConstant.java
+++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/DealingsRecordConstant.java
@@ -13,8 +13,8 @@ public interface DealingsRecordConstant {
Integer[] TYPE = {0, 1};
/**
- * 浜ゆ槗绫诲瀷锛0:寮鍗曪紱1锛氶璐(搴旇鏄病鐢ㄥ埌)锛2锛氬洖娆撅紝3锛氭柊澧炲鎴/渚涘簲鍟嗘瑺娆撅紝4锛氬厖鍊硷紱5锛氳拷鍔犳瑺娆;6:鎾ら攢璁㈠崟;7:鍏ュ簱锛8锛氬垹闄や氦鏄撹褰
+ * 浜ゆ槗绫诲瀷锛0:寮鍗曪紱1锛氶璐(搴旇鏄病鐢ㄥ埌)锛2锛氬洖娆撅紝3锛氭柊澧炲鎴/渚涘簲鍟嗘瑺娆撅紝4锛氬厖鍊硷紱5锛氳拷鍔犳瑺娆;6:鎾ら攢璁㈠崟;7:鍏ュ簱锛8锛氬垹闄や氦鏄撹褰; 9:鍏ュ簱閫璐э紱10锛氭挙閿鍏ュ簱閫璐
*/
- Integer[] DEALINGS_TYPE = {0, 1, 2, 3, 4, 5, 6, 7, 8};
+ Integer[] DEALINGS_TYPE = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java
index 618916c2..ec5c662d 100644
--- a/hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java
+++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java
@@ -49,4 +49,9 @@ public interface SaleConstant {
* 鏄惁鏄疉I鐨勬爣璇嗭細0锛氫笉鏄疉I锛1锛氭槸锛圓I鏈瘑鍒級, 2锛圓I璇嗗埆鎴愬姛锛夛紝3锛圓I璇嗗埆澶辫触
*/
int[] AI_FLAG = {0, 1, 2, 3};
+
+ /**
+ * 鏄惁璐拱杩囷細0锛氭病涔拌繃锛1锛氫拱杩
+ */
+ int[] IS_PURCHASED_BEFORE = {0, 1};
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/config/properties/HiverTokenProperties.java b/hiver-core/src/main/java/cc/hiver/core/config/properties/HiverTokenProperties.java
index c8424561..490732f4 100644
--- a/hiver-core/src/main/java/cc/hiver/core/config/properties/HiverTokenProperties.java
+++ b/hiver-core/src/main/java/cc/hiver/core/config/properties/HiverTokenProperties.java
@@ -36,7 +36,7 @@ public class HiverTokenProperties {
/**
* 鐢ㄦ埛閫夋嫨淇濆瓨鐧诲綍鐘舵佸搴攖oken杩囨湡鏃堕棿锛堝ぉ锛
*/
- private Integer saveLoginTime = 7;
+ private Integer saveLoginTime = 365;
/**
* 闄愬埗鐢ㄦ埛鐧婚檰閿欒娆℃暟锛堟锛
diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
index 91df83ac..14a7cd42 100644
--- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
+++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
@@ -176,24 +176,19 @@ public class AuthController {
if (UserConstant.USER_TYPE_NORMAL.equals(type)) {
// 鑾峰彇
final List
shopUsers = shopUserService.selectByUserId(user.getId());
- if(shopUsers != null && !shopUsers.isEmpty()){
+ if (shopUsers != null && !shopUsers.isEmpty()) {
// 鑾峰彇搴椾富鎵嬫満鍙
- final Shop shop = shopService.findById(shopUsers.get(0).getShopId());
- if(shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())){
- final User shopOwner = userService.get(shop.getShopOwnerId());
- for (ShopUser shopUser : shopUsers) {
- shopUser.setShopOwnerName(shopOwner.getNickname());
- shopUser.setShopOwnerPhone(shopOwner.getMobile());
+ for (ShopUser shopUser : shopUsers) {
+ final Shop shop = shopService.findById(shopUser.getShopId());
+ if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
+ final User shopOwner = userService.findById(shop.getShopOwnerId());
+ if(shopOwner != null){
+ shopUser.setShopOwnerName(shopOwner.getNickname());
+ shopUser.setShopOwnerPhone(shopOwner.getMobile());
+ }
+
}
}
- }
- if (!shopUsers.isEmpty()) {
- /*if (shopUsers.size() == 1) {
- // 濡傛灉鍙湁涓涓晢閾猴紝鐩存帴鏀惧埌缂撳瓨涓彇
- final ShopUser shopUser = shopUsers.get(0);
- final Shop shop = shopService.get(shopUser.getShopId());
- securityUtil.chooseShop(shopUser.getShopId(), shop.getRegionId(), accessToken);
- }*/
result.put("shopList", shopUsers);
} else {
return ResultUtil.error("搴楅摵鏈紑閫氾紒");
@@ -227,12 +222,17 @@ public class AuthController {
// 鑾峰彇
final List shopUsers = shopUserService.selectByUserId(user.getId());
if (!shopUsers.isEmpty()) {
- /*if (shopUsers.size() == 1) {
- // 濡傛灉鍙湁涓涓晢閾猴紝鐩存帴鏀惧埌缂撳瓨涓彇
- final ShopUser shopUser = shopUsers.get(0);
- final Shop shop = shopService.get(shopUser.getShopId());
- securityUtil.chooseShop(shopUser.getShopId(), shop.getRegionId(), accessToken);
- }*/
+ // 鑾峰彇搴椾富鎵嬫満鍙
+ for (ShopUser shopUser : shopUsers) {
+ final Shop shop = shopService.findById(shopUser.getShopId());
+ if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
+ final User shopOwner = userService.findById(shop.getShopOwnerId());
+ if(shopOwner != null){
+ shopUser.setShopOwnerName(shopOwner.getNickname());
+ shopUser.setShopOwnerPhone(shopOwner.getMobile());
+ }
+ }
+ }
result.put("shopList", shopUsers);
} else {
return ResultUtil.error("搴楅摵鏈紑閫氾紒");
@@ -517,12 +517,14 @@ public class AuthController {
final List shopUsers = shopUserService.selectByUserId(u.getId());
if(shopUsers != null && !shopUsers.isEmpty()){
// 鑾峰彇搴椾富鎵嬫満鍙
- final Shop shop = shopService.findById(shopUsers.get(0).getShopId());
- if(shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())){
- final User user = userService.get(shop.getShopOwnerId());
- for (ShopUser shopUser : shopUsers) {
- shopUser.setShopOwnerName(user.getNickname());
- shopUser.setShopOwnerPhone(user.getMobile());
+ for (ShopUser shopUser : shopUsers) {
+ final Shop shop = shopService.findById(shopUser.getShopId());
+ if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
+ final User shopOwner = userService.findById(shop.getShopOwnerId());
+ if(shopOwner != null){
+ shopUser.setShopOwnerName(shopOwner.getNickname());
+ shopUser.setShopOwnerPhone(shopOwner.getMobile());
+ }
}
}
}
diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
index bc528b4f..22dc6119 100644
--- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
+++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
@@ -141,12 +141,16 @@ public class UserController {
@ApiParam("鎵嬫満鍙") @RequestParam String mobile,
@ApiParam("鏃у瘑鐮") @RequestParam String password,
@ApiParam("鏂板瘑鐮") @RequestParam String newPass) {
+ if(StringUtils.isEmpty(mobile) && StringUtils.isEmpty(newPass)){
+ return ResultUtil.error("鏈慨鏀逛换浣曚俊鎭紒");
+ }
final User user = userService.findById(userId);
// 淇敼浜嗗瘑鐮
- if (StringUtils.isNotEmpty(password) && StringUtils.isNotEmpty(newPass)) {
- if (!new BCryptPasswordEncoder().matches(password, user.getPassword())) {
+ if (StringUtils.isNotEmpty(newPass)) {
+ // 20240819 淇敼浣嶄笉鏍¢獙鏃у瘑鐮侊紝鐩存帴鏇存柊涓烘柊瀵嗙爜
+ /*if (!new BCryptPasswordEncoder().matches(password, user.getPassword())) {
return ResultUtil.error("鏃у瘑鐮佷笉姝g‘");
- }
+ }*/
final String newEncryptPass = new BCryptPasswordEncoder().encode(newPass);
user.setPassword(newEncryptPass);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/impl/BillServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/impl/BillServiceImpl.java
index 3109f309..eb01bee5 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/impl/BillServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/impl/BillServiceImpl.java
@@ -6,6 +6,8 @@ import cc.hiver.mall.bill.vo.*;
import cc.hiver.mall.debt.entity.Debt;
import cc.hiver.mall.debt.service.DebtService;
import cc.hiver.mall.entity.*;
+import cc.hiver.mall.purchasereturn.entity.PurchaseReturnDetail;
+import cc.hiver.mall.purchasereturn.service.PurchaseReturnDetailService;
import cc.hiver.mall.service.SupplierService;
import cc.hiver.mall.service.mybatis.*;
import cc.hiver.mall.utils.DateUtil;
@@ -38,6 +40,9 @@ public class BillServiceImpl implements BillService {
@Autowired
private PurchaseDetailService purchaseDetailService;
+ @Autowired
+ private PurchaseReturnDetailService purchaseReturnDetailService;
+
@Autowired
private StockLogService stockLogService;
@@ -81,9 +86,11 @@ public class BillServiceImpl implements BillService {
if (saleArrearsVo != null) {
customerBillDataVo.setArrears(saleArrearsVo.getArrears());
customerBillDataVo.setTotalSale(saleArrearsVo.getTotalSale());
+ customerBillDataVo.setSaleProductCount(saleArrearsVo.getSaleProductCount());
} else {
customerBillDataVo.setArrears(BigDecimal.ZERO);
customerBillDataVo.setTotalSale(BigDecimal.ZERO);
+ customerBillDataVo.setSaleProductCount(0);
}
// 鑾峰彇閫璐ф婚噾棰
@@ -301,6 +308,9 @@ public class BillServiceImpl implements BillService {
supplierBillDataVo.setArrears(BigDecimal.ZERO);
supplierBillDataVo.setTotalSale(BigDecimal.ZERO);
}
+ // 鑾峰彇杩涜揣鎬讳欢鏁
+ final Integer purchasingCount = purchaseDetailService.queryPurchasingCount(supplierBillQueryVo);
+ supplierBillDataVo.setPurchasingCount(purchasingCount);
// 鏍规嵁瀹㈡埛id鍙婃棩鏈熻寖鍥村璐﹀崟鏄庣粏
final Page dealingRecordPage = dealingsRecordService.getDealingsRecordPageBySupplierId(supplierBillQueryVo);
@@ -368,6 +378,20 @@ public class BillServiceImpl implements BillService {
purchaseDetailMap.put(purchaseId, purchaseDetailArrayList);
}
}
+ // 鑾峰彇鍏ュ簱閫璐у崟鍟嗗搧鏄庣粏
+ final List purchaseReturnDetails = purchaseReturnDetailService.getPurchaseReturnDetails(purchaseIdList);
+ final Map> purchaseReturnDetailMap = new HashMap<>();
+ for (PurchaseReturnDetail purchaseReturnDetail : purchaseReturnDetails) {
+ final String purchaseId = purchaseReturnDetail.getPurchaseId();
+ if (purchaseReturnDetailMap.containsKey(purchaseId)) {
+ final List purchaseReturnDetailList = purchaseReturnDetailMap.get(purchaseId);
+ purchaseReturnDetailList.add(purchaseReturnDetail);
+ } else {
+ final List purchaseReturnDetailArrayList = new ArrayList<>();
+ purchaseReturnDetailArrayList.add(purchaseReturnDetail);
+ purchaseReturnDetailMap.put(purchaseId, purchaseReturnDetailArrayList);
+ }
+ }
// 鑾峰彇鍏ュ簱鍗曡鏍兼槑缁
final List stockLogList = stockLogService.getPurchaseDetails(purchaseIdList);
final Map> stockLogMap = new HashMap<>();
@@ -386,48 +410,95 @@ public class BillServiceImpl implements BillService {
// 寮濮嬪皝瑁呮暟鎹
for (SupplierBillPurchaseVo supplierBillPurchaseVo : records) {
final String purchaseId = supplierBillPurchaseVo.getPurchaseId();
- // 灏佽閿鍞崟淇℃伅
- final List purchaseDetailList = purchaseDetailMap.get(purchaseId);
- // 鏍规嵁鍟嗗搧id鍒嗙被
- final Map> purchaseDetailMapOfSale = new HashMap<>();
- if (purchaseDetailList != null && !purchaseDetailList.isEmpty()) {
- for (PurchaseDetail purchaseDetail : purchaseDetailList) {
- final String productId = purchaseDetail.getProductId();
- if (purchaseDetailMapOfSale.containsKey(productId)) {
- final List purchaseDetailsOfMap = purchaseDetailMapOfSale.get(productId);
- purchaseDetailsOfMap.add(purchaseDetail);
- } else {
- final List purchaseDetailArrayList = new ArrayList<>();
- purchaseDetailArrayList.add(purchaseDetail);
- purchaseDetailMapOfSale.put(productId, purchaseDetailArrayList);
+ if(purchaseDetailMap.containsKey(purchaseId)){
+ // 灏佽鍏ュ簱鍗曚俊鎭
+ final List purchaseDetailList = purchaseDetailMap.get(purchaseId);
+ // 鏍规嵁鍟嗗搧id鍒嗙被
+ final Map> purchaseDetailMapOfSale = new HashMap<>();
+ if (purchaseDetailList != null && !purchaseDetailList.isEmpty()) {
+ for (PurchaseDetail purchaseDetail : purchaseDetailList) {
+ final String productId = purchaseDetail.getProductId();
+ if (purchaseDetailMapOfSale.containsKey(productId)) {
+ final List purchaseDetailsOfMap = purchaseDetailMapOfSale.get(productId);
+ purchaseDetailsOfMap.add(purchaseDetail);
+ } else {
+ final List purchaseDetailArrayList = new ArrayList<>();
+ purchaseDetailArrayList.add(purchaseDetail);
+ purchaseDetailMapOfSale.put(productId, purchaseDetailArrayList);
+ }
+ }
+ final List billSaleDetailVos = new ArrayList<>();
+ for (Map.Entry> stringListEntry : purchaseDetailMapOfSale.entrySet()) {
+ final List value = stringListEntry.getValue();
+ final BillProductDetailVo billProductDetailVo = new BillProductDetailVo();
+ // 鍚屼竴娆惧晢鍝侊紝涓嶅悓瑙勬牸锛屽晢鍝佷俊鎭彧鍙栫涓涓
+ billProductDetailVo.setProductSn(value.get(0).getProductSn());
+ billProductDetailVo.setProductName(value.get(0).getProductName());
+ final List billAttributeListVos = new ArrayList<>();
+ final List stockLogList1 = stockLogMap.get(value.get(0).getId());
+ if (stockLogList1 != null && !stockLogList1.isEmpty()) {
+ for (StockLog stockLog : stockLogList1) {
+ final BillAttributeListVo billAttributeListVo = new BillAttributeListVo();
+ billAttributeListVo.setAttributeList(stockLog.getAttributeList());
+ billAttributeListVo.setProductCount(stockLog.getProductCount());
+ billAttributeListVos.add(billAttributeListVo);
+ }
+ }
+ billProductDetailVo.setProductCount(value.get(0).getProductCount());
+ final BigDecimal purchasePrice = value.get(0).getPurchasePrice() == null ? BigDecimal.ZERO : value.get(0).getPurchasePrice();
+ final BigDecimal productCount = value.get(0).getProductCount() == null ? BigDecimal.ZERO : BigDecimal.valueOf(value.get(0).getProductCount());
+ billProductDetailVo.setTotalAmount(purchasePrice.multiply(productCount));
+ billProductDetailVo.setBillAttributeListVos(billAttributeListVos);
+ billSaleDetailVos.add(billProductDetailVo);
}
+ supplierBillPurchaseVo.setBillSaleDetailVos(billSaleDetailVos);
}
- final List billSaleDetailVos = new ArrayList<>();
- for (Map.Entry> stringListEntry : purchaseDetailMapOfSale.entrySet()) {
- final List value = stringListEntry.getValue();
- final BillProductDetailVo billProductDetailVo = new BillProductDetailVo();
- // 鍚屼竴娆惧晢鍝侊紝涓嶅悓瑙勬牸锛屽晢鍝佷俊鎭煎嚑閽卞彇绗竴涓
- billProductDetailVo.setProductSn(value.get(0).getProductSn());
- billProductDetailVo.setProductName(value.get(0).getProductName());
- final List billAttributeListVos = new ArrayList<>();
- final List stockLogList1 = stockLogMap.get(value.get(0).getId());
- if (stockLogList1 != null && !stockLogList1.isEmpty()) {
- for (StockLog stockLog : stockLogList1) {
- final BillAttributeListVo billAttributeListVo = new BillAttributeListVo();
- billAttributeListVo.setAttributeList(stockLog.getAttributeList());
- billAttributeListVo.setProductCount(stockLog.getProductCount());
- billAttributeListVos.add(billAttributeListVo);
+ }
+ if(purchaseReturnDetailMap.containsKey(purchaseId)){
+ // 灏佽鍏ュ簱鍗曚俊鎭
+ final List purchaseReturnDetailList = purchaseReturnDetailMap.get(purchaseId);
+ // 鏍规嵁鍟嗗搧id鍒嗙被
+ final Map> purchaseDetailMapOfSale = new HashMap<>();
+ if (purchaseReturnDetailList != null && !purchaseReturnDetailList.isEmpty()) {
+ for (PurchaseReturnDetail purchaseReturnDetail : purchaseReturnDetailList) {
+ final String productId = purchaseReturnDetail.getProductId();
+ if (purchaseDetailMapOfSale.containsKey(productId)) {
+ final List purchaseDetailsOfMap = purchaseDetailMapOfSale.get(productId);
+ purchaseDetailsOfMap.add(purchaseReturnDetail);
+ } else {
+ final List purchaseDetailArrayList = new ArrayList<>();
+ purchaseDetailArrayList.add(purchaseReturnDetail);
+ purchaseDetailMapOfSale.put(productId, purchaseDetailArrayList);
}
}
- billProductDetailVo.setProductCount(value.get(0).getProductCount());
- final BigDecimal purchasePrice = value.get(0).getPurchasePrice() == null ? BigDecimal.ZERO : value.get(0).getPurchasePrice();
- final BigDecimal productCount = value.get(0).getProductCount() == null ? BigDecimal.ZERO : BigDecimal.valueOf(value.get(0).getProductCount());
- billProductDetailVo.setTotalAmount(purchasePrice.multiply(productCount));
- billProductDetailVo.setBillAttributeListVos(billAttributeListVos);
- billSaleDetailVos.add(billProductDetailVo);
+ final List billSaleDetailVos = new ArrayList<>();
+ for (Map.Entry> stringListEntry : purchaseDetailMapOfSale.entrySet()) {
+ final List value = stringListEntry.getValue();
+ final BillProductDetailVo billProductDetailVo = new BillProductDetailVo();
+ // 鍚屼竴娆惧晢鍝侊紝涓嶅悓瑙勬牸锛屽晢鍝佷俊鎭彧鍙栫涓涓
+ billProductDetailVo.setProductSn(value.get(0).getProductSn());
+ billProductDetailVo.setProductName(value.get(0).getProductName());
+ final List billAttributeListVos = new ArrayList<>();
+ final List stockLogList1 = stockLogMap.get(value.get(0).getId());
+ if (stockLogList1 != null && !stockLogList1.isEmpty()) {
+ for (StockLog stockLog : stockLogList1) {
+ final BillAttributeListVo billAttributeListVo = new BillAttributeListVo();
+ billAttributeListVo.setAttributeList(stockLog.getAttributeList());
+ billAttributeListVo.setProductCount(stockLog.getProductCount());
+ billAttributeListVos.add(billAttributeListVo);
+ }
+ }
+ billProductDetailVo.setProductCount(value.get(0).getProductCount());
+ final BigDecimal purchasePrice = value.get(0).getPurchasePrice() == null ? BigDecimal.ZERO : value.get(0).getPurchasePrice();
+ final BigDecimal productCount = value.get(0).getProductCount() == null ? BigDecimal.ZERO : BigDecimal.valueOf(value.get(0).getProductCount());
+ billProductDetailVo.setTotalAmount(purchasePrice.multiply(productCount));
+ billProductDetailVo.setBillAttributeListVos(billAttributeListVos);
+ billSaleDetailVos.add(billProductDetailVo);
+ }
+ supplierBillPurchaseVo.setBillSaleDetailVos(billSaleDetailVos);
}
- supplierBillPurchaseVo.setBillSaleDetailVos(billSaleDetailVos);
}
+
}
}
// 灏嗛攢鍞俊鎭瓨鏀惧埌瀵硅处鍗曚腑
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/ArrearsVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/ArrearsVo.java
index f84e4c60..b715552b 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/ArrearsVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/ArrearsVo.java
@@ -13,6 +13,12 @@ public class ArrearsVo {
@ApiModelProperty(value = "鎷胯揣鎬婚噾棰")
private BigDecimal totalSale;
+ @ApiModelProperty(value = "鎷胯揣鏁伴噺")
+ private Integer saleProductCount;
+
@ApiModelProperty(value = "閫璐ф婚噾棰")
private BigDecimal totalReturn;
+
+ @ApiModelProperty(value = "閫璐ф绘暟閲")
+ private Integer returnProductCount;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillDataVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillDataVo.java
index 27069999..b37c1929 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillDataVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillDataVo.java
@@ -35,9 +35,15 @@ public class CustomerBillDataVo {
@ApiModelProperty(value = "鎷胯揣鎬婚噾棰")
private BigDecimal totalSale;
+ @ApiModelProperty(value = "鎷胯揣鎬绘暟閲")
+ private Integer saleProductCount;
+
@ApiModelProperty(value = "閫璐ф婚噾棰")
private BigDecimal totalReturn;
+ @ApiModelProperty(value = "閫璐ф绘暟閲")
+ private Integer returnProductCount;
+
@ApiModelProperty(value = "閿鍞崟鏄庣粏")
private Page customerBillSaleVos;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillSaleVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillSaleVo.java
index 07ee93ee..3c7ec7da 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillSaleVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillSaleVo.java
@@ -62,6 +62,9 @@ public class CustomerBillSaleVo {
@ApiModelProperty(value = "鍒犻櫎鏍囪瘑")
private Integer delFlag;
+ @ApiModelProperty(value = "澶囨敞")
+ private String remark;
+
@ApiModelProperty(value = "閿鍞槑缁")
private List billSaleDetailVos;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillDataVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillDataVo.java
index 33134b72..61d56cd5 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillDataVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillDataVo.java
@@ -35,6 +35,9 @@ public class SupplierBillDataVo {
@ApiModelProperty(value = "鎷胯揣鎬婚噾棰")
private BigDecimal totalSale;
+ @ApiModelProperty(value = "鎷胯揣鎬绘暟閲")
+ private Integer purchasingCount;
+
@ApiModelProperty(value = "鍏ュ簱鍗曟槑缁")
private Page supplierBillSaleVos;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillPurchaseVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillPurchaseVo.java
index 2e131800..d8c54cad 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillPurchaseVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/SupplierBillPurchaseVo.java
@@ -53,6 +53,9 @@ public class SupplierBillPurchaseVo {
@ApiModelProperty(value = "鍒犻櫎鏍囪瘑")
private Integer delFlag;
+ @ApiModelProperty(value = "澶囨敞")
+ private String remark;
+
@ApiModelProperty(value = "閿鍞槑缁")
private List billSaleDetailVos;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/checkstock/service/impl/CheckStockServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/checkstock/service/impl/CheckStockServiceImpl.java
index 40b194f7..12441134 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/checkstock/service/impl/CheckStockServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/checkstock/service/impl/CheckStockServiceImpl.java
@@ -12,6 +12,7 @@ import cc.hiver.mall.checkstock.vo.CheckStockAttributeVo;
import cc.hiver.mall.checkstock.vo.CheckStockDetailVo;
import cc.hiver.mall.checkstock.vo.CheckStockPageVo;
import cc.hiver.mall.checkstock.vo.CheckStockVo;
+import cc.hiver.mall.common.constant.StockLogConstant;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.Stock;
import cc.hiver.mall.entity.StockLog;
@@ -150,7 +151,7 @@ public class CheckStockServiceImpl extends ServiceImpl oldProductListBySn = productService.getByProductSn(productVo.getProductSn(), shopId);
+ if (oldProductListBySn != null && !oldProductListBySn.isEmpty()) {
+ return ResultUtil.error("鎮ㄥ凡鏈夎揣鍙"+productVo.getProductSn()+"鐨勫晢鍝侊紝璇锋洿鎹㈣揣鍙");
+ }
final Product product = new Product();
BeanUtils.copyBeanProp(product, productVo);
// 鏂板鍟嗗搧涓撳睘鍒嗙被淇℃伅
@@ -65,8 +74,6 @@ public class ProductController {
} else {
return ResultUtil.error("娣诲姞鍒嗙被淇℃伅澶辫触");
}
- // shopId浠庣紦瀛樹腑璁剧疆
- final String shopId = securityUtil.getShopId();
product.setShopId(shopId);
// 鏂板鐨勯粯璁や负宸蹭笂鏋
product.setDelFlag(CommonConstant.DEL_FLAG_TRUE);
@@ -89,6 +96,17 @@ public class ProductController {
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation("鏍规嵁璐у搧id淇敼璐у搧")
public Result edit(@RequestBody ProductVo productVo) {
+ // 20240824 澧炲姞淇敼鐨勫晢鍝佽揣鍙蜂笉鑳介噸澶
+ // 鏍规嵁璐у彿鏌ヨ鍟嗗搧鏄惁瀛樺湪
+ // shopId浠庣紦瀛樹腑璁剧疆
+ final String shopId = securityUtil.getShopId();
+ final CopyOnWriteArrayList oldProductListBySn = productService.getByProductSn(productVo.getProductSn(), shopId);
+ if (oldProductListBySn != null && !oldProductListBySn.isEmpty()) {
+ // 濡傛灉鏃у晢鍝乮d涓嶇瓑浜庡墠鍙颁紶閫掔殑鍟嗗搧id,鍒欒繑鍥炰俊鎭
+ if (!productVo.getId().equals(oldProductListBySn.get(0).getId())) {
+ return ResultUtil.error("鎮ㄥ凡鏈夎揣鍙"+productVo.getProductSn()+"鐨勫晢鍝侊紝璇锋洿鎹㈣揣鍙");
+ }
+ }
final Product product = new Product();
BeanUtils.copyBeanProp(product, productVo);
// 鍒犻櫎鍟嗗搧涓撳睘鍒嗙被淇℃伅
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
index 1597ee99..89d95c95 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
@@ -40,10 +40,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
@Slf4j
@RestController
@@ -146,9 +143,9 @@ public class SaleController {
saleQueryDTO.getSale().setShopId(shopId);
saleQueryDTO.getSale().setShopName(shop.getShopName());
// 鏍规嵁璇ュ鎴风殑娆犳淇℃伅
- String userId = saleQueryDTO.getSale().getUserId();
- Debt debt = debtService.selectByUserId(shopId, userId);
- BigDecimal amountOwed = debt.getAmountOwed();
+ final String userId = saleQueryDTO.getSale().getUserId();
+ final Debt debt = debtService.selectByUserId(shopId, userId);
+ final BigDecimal amountOwed = debt.getAmountOwed();
// 20240616 寮鍗曞彲鑳藉煎寘鍚璐у崟
Sale sale = saleQueryDTO.getSale();
sale.setLastDebtAmount(amountOwed);
@@ -452,6 +449,34 @@ public class SaleController {
.eq("sale_id", id)
.groupBy("product_id");
final List list = saleDetailService.selectByCondition1(queryWrapper);
+ // 鏌ヨ瀹㈡埛闄ゆ湰鍗曞鍏朵粬鎷胯揣淇℃伅
+ // 瀹㈡埛id
+ // 灏佽涓哄晢鍝乮d+瑙勬牸鍊间负key鐨刴ap
+ final Map> historySaleDetailMap = new HashMap<>();
+ if (list != null && !list.isEmpty()) {
+ final List historySaleDetailList = saleDetailService.selectDetailListByProductIds(list, sale);
+ for (SaleDetail saleDetail : historySaleDetailList) {
+ final String productId = StringUtils.isEmpty(saleDetail.getProductId()) ? "" : saleDetail.getProductId();
+ final String attributeList = StringUtils.isEmpty(saleDetail.getAttributeList()) ? "" : saleDetail.getAttributeList();
+ final String key = productId + attributeList;
+ if (historySaleDetailMap.containsKey(key)) {
+ historySaleDetailMap.get(key).add(saleDetail);
+ } else {
+ final List saleDetailList = new ArrayList<>();
+ saleDetailList.add(saleDetail);
+ historySaleDetailMap.put(key, saleDetailList);
+ }
+ }
+ }
+ //
+ final Map productMap = new HashMap<>();
+ if(list != null && !list.isEmpty()){
+ final List productList = productService.getProductList(list);
+ for (Product product : productList) {
+ productMap.putIfAbsent(product.getId(), product);
+ }
+ }
+
final List saleDetailDTOS = new ArrayList<>();
for (String productId : list) {
final QueryWrapper queryPWrapper = new QueryWrapper<>();
@@ -468,7 +493,14 @@ public class SaleController {
saleDetailDTO.setSaleId(saleDetail.getSaleId());
saleDetailDTO.setPrice(saleDetail.getPrice());
saleDetailDTO.setWholesalePrice(saleDetail.getWholesalePrice());
- saleDetailDTO.setPurchasePrice(saleDetail.getPurchasePrice());
+ // 鍟嗗搧鏈夐噰璐环灏变娇鐢ㄥ晢鍝佺殑閲囪喘浠
+ if (productMap.containsKey(productId)) {
+ final BigDecimal purchasePrice = productMap.get(productId).getPurchasePrice() == null ? BigDecimal.ZERO : productMap.get(productId).getPurchasePrice();
+ saleDetailDTO.setPurchasePrice(purchasePrice);
+ } else {
+ saleDetailDTO.setPurchasePrice(saleDetail.getPurchasePrice());
+ }
+
saleDetailDTO.setDiscount(saleDetail.getDiscount());
saleDetailDTO.setDiscountAmount(saleDetail.getDiscountAmount());
saleDetailDTO.setRealPrice(saleDetail.getRealPrice());
@@ -477,6 +509,12 @@ public class SaleController {
final SaleDetailQueryDTO saleDetailQueryDTO = new SaleDetailQueryDTO();
saleDetailQueryDTO.setAttributeList(saleDetail.getAttributeList());
saleDetailQueryDTO.setProductCount(saleDetail.getProductCount());
+ // 鍒ゆ柇涔嬪墠鏄惁鎷胯繃璐
+ if (historySaleDetailMap.containsKey(productId + saleDetail.getAttributeList())) {
+ saleDetailQueryDTO.setIsPurchasedBefore(SaleConstant.IS_PURCHASED_BEFORE[1]);
+ } else {
+ saleDetailQueryDTO.setIsPurchasedBefore(SaleConstant.IS_PURCHASED_BEFORE[0]);
+ }
saleDetailQueryDTOS.add(saleDetailQueryDTO);
}
saleDetailDTO.setStockLogList1(saleDetailQueryDTOS);
@@ -611,6 +649,8 @@ public class SaleController {
// 杩涜揣鎴愭湰
final BigDecimal purchasingCost = purchaseService.getPurchasingCost(shopId, startTime, endTime);
saleAllVO.setPurchasingCost(purchasingCost);
+
+
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error(500, e.getMessage());
@@ -1157,6 +1197,44 @@ public class SaleController {
}
}
+ /**
+ * 鍒╂鼎鏄庣粏-鎸夊鎴
+ *
+ * @param salePageQuery
+ * @return Result
+ * @author 鐜嬪瘜搴
+ * @date 2024/8/18
+ */
+ @PostMapping("/totalAmountDetailByCustomer")
+ public Result totalAmountDetailByCustomer(@RequestBody SalePageQuery salePageQuery) {
+ try {
+ final Page totalAmountDetailByCustomer = saleService.totalAmountDetailByCustomer(salePageQuery);
+ return new ResultUtil<>().setData(totalAmountDetailByCustomer);
+ } catch (Exception e) {
+ log.info(e.getMessage(), e);
+ return ResultUtil.error("鏌ヨ澶辫触");
+ }
+ }
+
+ /**
+ * 鍒╂鼎鏄庣粏-鎸夊晢鍝
+ *
+ * @param salePageQuery
+ * @return Result
+ * @author 鐜嬪瘜搴
+ * @date 2024/8/18
+ */
+ @PostMapping("/totalAmountDetailByProduct")
+ public Result totalAmountDetailByProduct(@RequestBody SalePageQuery salePageQuery) {
+ try {
+ final Page totalAmountDetailByProduct = saleService.totalAmountDetailByProduct(salePageQuery);
+ return new ResultUtil<>().setData(totalAmountDetailByProduct);
+ } catch (Exception e) {
+ log.info(e.getMessage(), e);
+ return ResultUtil.error("鏌ヨ澶辫触");
+ }
+ }
+
/**
* 瀹炴敹閲戦鏄庣粏
*
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
index 4c0655bd..21398b4a 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
@@ -130,6 +130,8 @@ public class ShopController {
@ResponseBody
@ApiOperation("缂栬緫")
public Result