diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml
index ef79b464..914575b2 100644
--- a/hiver-admin/src/main/resources/application.yml
+++ b/hiver-admin/src/main/resources/application.yml
@@ -25,8 +25,8 @@ spring:
timeout-per-shutdown-phase: 10S
# 数据源
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://8.140.198.243: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
username: reddoor
# Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456
password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe)
@@ -67,8 +67,8 @@ spring:
ddl-auto: update
# Redis 若设有密码自行添加配置password
redis:
- host: 154.8.162.157
-# host: 8.140.198.243
+# host: 154.8.162.157
+ host: 8.140.198.243
password: reddoor168
# 数据库索引 默认0
database: 1
@@ -265,8 +265,8 @@ wx:
# redis前缀配置: wx(默认)
key-prefix: wx
redis:
- host: 154.8.162.157
-# host: 8.140.198.243
+# host: 154.8.162.157
+ host: 8.140.198.243
password: reddoor168
# 数据库索引 默认0
database: 1
@@ -393,6 +393,7 @@ ignored:
- /hiver/app/product/**
- /hiver/user/login
- /hiver/app/shopprint/printImg
+ - /hiver/app/purchaseConfirm/addPurchaseConfirm
# 限流及黑名单不拦截的路径
limitUrls:
- /**/*.js
diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html
index cc7c9a5f..9cee8d50 100644
--- a/hiver-admin/test-output/test-report.html
+++ b/hiver-admin/test-output/test-report.html
@@ -35,7 +35,7 @@
Hiver
- 07, 2025 14:48:44
+ 26, 2025 17:18:30
@@ -84,7 +84,7 @@
passTest
-
14:48:44 / 0.017 secs
+
17:18:30 / 0.017 secs
@@ -92,8 +92,8 @@
#test-id=1
passTest
-
03.07.2025 14:48:44
-
03.07.2025 14:48:44
+
03.26.2025 17:18:30
+
03.26.2025 17:18:30
0.017 secs
@@ -104,7 +104,7 @@
| Pass |
- 14:48:44 |
+ 17:18:30 |
Test passed
|
@@ -128,13 +128,13 @@
Started
-
07, 2025 14:48:44
+
26, 2025 17:18:30
Ended
-
07, 2025 14:48:44
+
26, 2025 17:18:30
diff --git a/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java b/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java
index 3914bca6..d9c09e79 100644
--- a/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java
+++ b/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java
@@ -2,6 +2,7 @@ package cc.hiver.core.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.core.entity.User;
+import cc.hiver.core.vo.ShopUserDto;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
@@ -85,8 +86,11 @@ public interface UserDao extends HiverBaseDao
{
@Query("select u from User u where u.email = ?1 and u.type like %?2% ")
User findByEmailAndType(String email,String type);
- @Query(value = "select s.type,t.id,t.create_by,t.create_time,t.del_flag,t.update_by,t.update_time,t.address,t.avatar,t.description,t.email,t.mobile,t.nickname,t.password,t.sex,t.status,t.username,t.department_id,t.street,t.pass_strength,t.department_title,t.birth,t.invite_code,t.client_id,t.mini_program_openid,t.unionid,t.official_account_openid,t.wechat_name from t_shop_user s left join t_user t on s.user_id = t.id where s.shop_id = ?",nativeQuery = true)
- List findByShopId( String shopId);
+ @Query(value = " select new cc.hiver.core.vo.ShopUserDto(u.id," +
+ "u.username,u.password,u.nickname,u.mobile,u.email,u.address,u.street,u.sex,u.passStrength,u.avatar,su.type" +
+ ",u.status,u.description,u.departmentId,u.departmentTitle,u.birth,u.inviteCode,u.clientId" +
+ ",u.miniProgramOpenid,u.unionid,u.officialAccountOpenid,u.wechatName,su.warehouseKeeperFlag) from ShopUser su left join su.user u where su.shop.id = ?1")
+ List findByShopId(String shopId);
@Query("select u from User u where u.unionid = ?1 ")
User findByUnionid(String unionid);
diff --git a/hiver-core/src/main/java/cc/hiver/core/entity/User.java b/hiver-core/src/main/java/cc/hiver/core/entity/User.java
index 9bc7b817..930716b6 100644
--- a/hiver-core/src/main/java/cc/hiver/core/entity/User.java
+++ b/hiver-core/src/main/java/cc/hiver/core/entity/User.java
@@ -122,6 +122,10 @@ public class User extends HiverBaseEntity {
@ApiModelProperty(value = "是否有维护成本权限 1:是;0否")
private Integer shopAdminCost;
+ @Transient
+ @ApiModelProperty(value = "入库员标识:0:不是(数据库默认);1:是;")
+ private String warehouseKeeperFlag;
+
@ApiModelProperty(value = "小程序id")
private String miniProgramOpenid;
diff --git a/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/mapper/LogisticsAddressBookMapper.java b/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/mapper/LogisticsAddressBookMapper.java
index 1e26524a..ac688558 100644
--- a/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/mapper/LogisticsAddressBookMapper.java
+++ b/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/mapper/LogisticsAddressBookMapper.java
@@ -17,4 +17,13 @@ public interface LogisticsAddressBookMapper extends BaseMapper
*/
List getLogisticsAddressBookList(@Param("queryParams") LogisticsAddressBookQueryVo logisticsAddressBookQueryVo);
+
+ /**
+ * 获取店铺下收发货人信息
+ * @author 王富康
+ * @date 2025/3/18
+ * @param companyId
+ * @return List
+ */
+ List getByCompanyId(@Param("companyId") String companyId);
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/LogisticsAddressBookService.java b/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/LogisticsAddressBookService.java
index 7312bd8e..17a606da 100644
--- a/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/LogisticsAddressBookService.java
+++ b/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/LogisticsAddressBookService.java
@@ -7,6 +7,7 @@ import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
import java.util.Map;
public interface LogisticsAddressBookService extends IService {
@@ -19,19 +20,31 @@ public interface LogisticsAddressBookService extends IService
+ * @author 王富康
+ * @date 2024/10/15
*/
Map getByOrder(LogisticsOrder logisticsOrder);
+
+ /**
+ * 获取店铺下收发货人信息
+ *
+ * @param companyId
+ * @return Map>
+ * @author 王富康
+ * @date 2025/3/18
+ */
+ Map> getByCompanyId(String companyId);
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/impl/LogisticsAddressBookServiceImpl.java b/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/impl/LogisticsAddressBookServiceImpl.java
index f2156aa4..5345d036 100644
--- a/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/impl/LogisticsAddressBookServiceImpl.java
+++ b/hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/impl/LogisticsAddressBookServiceImpl.java
@@ -200,4 +200,38 @@ public class LogisticsAddressBookServiceImpl extends ServiceImpl>
+ */
+ @Override
+ public Map> getByCompanyId(String companyId) {
+ // 获取店铺下收发货人信息
+ final List logisticsAddressBookList = logisticsAddressBookMapper.getByCompanyId(companyId);
+ final Map> logisticsAddressBookMap = new HashMap<>();
+ for (LogisticsAddressBook logisticsAddressBook : logisticsAddressBookList) {
+ if(1 == logisticsAddressBook.getAddressType()){
+ if(logisticsAddressBookMap.containsKey("shipper")){
+ logisticsAddressBookMap.get("shipper").add(logisticsAddressBook);
+ }else{
+ final List logisticsAddressBooks = new ArrayList<>();
+ logisticsAddressBooks.add(logisticsAddressBook);
+ logisticsAddressBookMap.put("shipper",logisticsAddressBooks);
+ }
+ }else if(2 == logisticsAddressBook.getAddressType()){
+ if(logisticsAddressBookMap.containsKey("receiver")){
+ logisticsAddressBookMap.get("receiver").add(logisticsAddressBook);
+ }else{
+ final List logisticsAddressBooks = new ArrayList<>();
+ logisticsAddressBooks.add(logisticsAddressBook);
+ logisticsAddressBookMap.put("receiver",logisticsAddressBooks);
+ }
+ }
+ }
+ return logisticsAddressBookMap;
+ }
+
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/service/UserService.java b/hiver-core/src/main/java/cc/hiver/core/service/UserService.java
index 1dbf9c69..f9340eed 100644
--- a/hiver-core/src/main/java/cc/hiver/core/service/UserService.java
+++ b/hiver-core/src/main/java/cc/hiver/core/service/UserService.java
@@ -3,6 +3,7 @@ package cc.hiver.core.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.core.common.vo.SearchVo;
import cc.hiver.core.entity.User;
+import cc.hiver.core.vo.ShopUserDto;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.data.domain.Page;
@@ -114,7 +115,7 @@ public interface UserService extends HiverBaseService {
User findByUserNameAndType(String userName,String type);
User findByMobileAndType(String mobile,String type);
- List findByShopId(String shopId);
+ List findByShopId(String shopId);
/**
* 公众号关注
diff --git a/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java b/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
index dc008bae..48b23669 100644
--- a/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
+++ b/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
@@ -19,6 +19,7 @@ import cc.hiver.core.service.UserRoleService;
import cc.hiver.core.service.UserService;
import cc.hiver.core.vo.PermissionDTO;
import cc.hiver.core.vo.RoleDTO;
+import cc.hiver.core.vo.ShopUserDto;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import lombok.extern.slf4j.Slf4j;
@@ -267,7 +268,7 @@ public class UserServiceImpl implements UserService {
}
@Override
- public List findByShopId(String shopId) {
+ public List findByShopId(String shopId) {
return userDao.findByShopId(shopId);
}
diff --git a/hiver-core/src/main/java/cc/hiver/core/vo/ShopUserDto.java b/hiver-core/src/main/java/cc/hiver/core/vo/ShopUserDto.java
new file mode 100644
index 00000000..ea6e9883
--- /dev/null
+++ b/hiver-core/src/main/java/cc/hiver/core/vo/ShopUserDto.java
@@ -0,0 +1,115 @@
+package cc.hiver.core.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+public class ShopUserDto {
+ private static final long serialVersionUID = 1L;
+
+
+ @ApiModelProperty(value = "唯一标识")
+ private String id;
+
+ @ApiModelProperty(value = "登录名")
+ private String username;
+
+ @ApiModelProperty(value = "密码")
+ private String password;
+
+ @ApiModelProperty(value = "用户名/昵称/姓名")
+ private String nickname;
+
+ @ApiModelProperty(value = "手机")
+ private String mobile;
+
+ @ApiModelProperty(value = "邮箱")
+ private String email;
+
+ @ApiModelProperty(value = "省市县地址")
+ private String address;
+
+ @ApiModelProperty(value = "街道地址")
+ private String street;
+
+ @ApiModelProperty(value = "性别")
+ private String sex;
+
+ @ApiModelProperty(value = "密码强度")
+ private String passStrength;
+
+ @ApiModelProperty(value = "用户头像")
+ private String avatar;
+
+ @ApiModelProperty(value = "用户类型 0-店铺 1-物流公司 2-客户")
+ private Integer type;
+
+ @ApiModelProperty(value = "状态 默认0正常 -1拉黑")
+ private Integer status;
+
+ @ApiModelProperty(value = "描述/详情/备注")
+ private String description;
+
+ @ApiModelProperty(value = "所属部门id")
+ private String departmentId;
+
+ @ApiModelProperty(value = "所属部门名称")
+ private String departmentTitle;
+
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @ApiModelProperty(value = "生日")
+ private Date birth;
+
+ @ApiModelProperty(value = "邀请人ID")
+ private String inviteCode;
+
+ @ApiModelProperty(value = "设备编号 推送用")
+ private String clientId;
+
+ @ApiModelProperty(value = "小程序id")
+ private String miniProgramOpenid;
+
+ @ApiModelProperty(value = "微信平台统一id")
+ private String unionid;
+
+ @ApiModelProperty(value = "公众号id")
+ private String officialAccountOpenid;
+
+ @ApiModelProperty(value = "微信昵称")
+ private String wechatName;
+
+ @ApiModelProperty(value = "入库员标识:0:不是(数据库默认);1:是;")
+ private String warehouseKeeperFlag;
+
+ public ShopUserDto(String id, String username, String password, String nickname, String mobile, String email, String address, String street, String sex, String passStrength, String avatar, Integer type, Integer status, String description, String departmentId, String departmentTitle, Date birth, String inviteCode, String clientId, String miniProgramOpenid, String unionid, String officialAccountOpenid, String wechatName, String warehouseKeeperFlag) {
+ this.id = id;
+ this.username = username;
+ this.password = password;
+ this.nickname = nickname;
+ this.mobile = mobile;
+ this.email = email;
+ this.address = address;
+ this.street = street;
+ this.sex = sex;
+ this.passStrength = passStrength;
+ this.avatar = avatar;
+ this.type = type;
+ this.status = status;
+ this.description = description;
+ this.departmentId = departmentId;
+ this.departmentTitle = departmentTitle;
+ this.birth = birth;
+ this.inviteCode = inviteCode;
+ this.clientId = clientId;
+ this.miniProgramOpenid = miniProgramOpenid;
+ this.unionid = unionid;
+ this.officialAccountOpenid = officialAccountOpenid;
+ this.wechatName = wechatName;
+ this.warehouseKeeperFlag = warehouseKeeperFlag;
+ }
+}
diff --git a/hiver-core/src/main/resources/mapper/LogisticsAddressBookMapper.xml b/hiver-core/src/main/resources/mapper/LogisticsAddressBookMapper.xml
index 34b4d5f2..e1cb3b00 100644
--- a/hiver-core/src/main/resources/mapper/LogisticsAddressBookMapper.xml
+++ b/hiver-core/src/main/resources/mapper/LogisticsAddressBookMapper.xml
@@ -181,4 +181,13 @@
t.create_time desc
+
+
\ No newline at end of file
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 a5d8530f..22c432fa 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,7 +176,7 @@ public class AuthController {
if (shopUsers != null && !shopUsers.isEmpty()) {
// 获取店主手机号
for (ShopUser shopUser : shopUsers) {
- final Shop shop = shopService.findById(shopUser.getShopId());
+ final Shop shop = shopService.findById(shopUser.getShop().getId());
if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
final User shopOwner = userService.findById(shop.getShopOwnerId());
if(shopOwner != null){
@@ -221,7 +221,7 @@ public class AuthController {
if (!shopUsers.isEmpty()) {
// 获取店主手机号
for (ShopUser shopUser : shopUsers) {
- final Shop shop = shopService.findById(shopUser.getShopId());
+ final Shop shop = shopService.findById(shopUser.getShop().getId());
if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
final User shopOwner = userService.findById(shop.getShopOwnerId());
if(shopOwner != null){
@@ -419,14 +419,6 @@ public class AuthController {
// 设置注册用户为店主
shop.setShopOwnerId(user.getId());
- // 增加店铺和员工关联表信息
- final ShopUser shopUser = new ShopUser();
- shopUser.setUserId(user.getId());
- shopUser.setUserName(user.getUsername());
- shopUser.setShopId(shop.getId());
- shopUser.setShopName(shop.getShopName());
- shopUser.setType(UserConstant.SHOP_USER_ADMIN);
- shopUserService.save(shopUser);
// 判断是否传递了邀请人及邀请店铺,设置了的话,新增邀请返佣信息
if (StringUtils.isNotEmpty(registerShopVo.getInviteUserId()) && StringUtils.isNotEmpty(registerShopVo.getInviteShopId())) {
final InviteLog inviteLog = new InviteLog();
@@ -446,6 +438,15 @@ public class AuthController {
// 20241010 打印方式 字段默认给 0
shop.setPrintingMethod(ShopConstant.PRINTING_METHOD[0]);
shopService.save(shop);
+
+ // 增加店铺和员工关联表信息
+ final ShopUser shopUser = new ShopUser();
+ shopUser.setUser(user);
+ shopUser.setUserName(user.getUsername());
+ shopUser.setShop(shop);
+ shopUser.setShopName(shop.getShopName());
+ shopUser.setType(UserConstant.SHOP_USER_ADMIN);
+ shopUserService.save(shopUser);
// 20240625新增默认供应商
final Supplier supplier = new Supplier();
supplier.setShopId(shop.getId());
@@ -517,7 +518,7 @@ public class AuthController {
if(shopUsers != null && !shopUsers.isEmpty()){
// 获取店主手机号
for (ShopUser shopUser : shopUsers) {
- final Shop shop = shopService.findById(shopUser.getShopId());
+ final Shop shop = shopService.findById(shopUser.getShop().getId());
if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
final User shopOwner = userService.findById(shop.getShopOwnerId());
if(shopOwner != null){
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 e6c4bf1a..6e9ba0c2 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
@@ -671,7 +671,7 @@ public class UserController {
if (shopUsers != null && !shopUsers.isEmpty()) {
// 获取店主手机号
for (ShopUser shopUser : shopUsers) {
- final Shop shop = shopService.findById(shopUser.getShopId());
+ final Shop shop = shopService.findById(shopUser.getShop().getId());
if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
final User shopOwner = userService.findById(shop.getShopOwnerId());
if (shopOwner != null) {
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java
index 39fc65eb..cd8fe4b5 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java
@@ -12,6 +12,7 @@ import cc.hiver.core.common.vo.Result;
import cc.hiver.core.common.vo.SearchVo;
import cc.hiver.core.entity.User;
import cc.hiver.core.service.UserService;
+import cc.hiver.core.vo.ShopUserDto;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.ShopUser;
import cc.hiver.mall.pojo.vo.MallUserVo;
@@ -92,6 +93,8 @@ public class CommonController {
// 获取当前登录的店铺信息
final String shopId = securityUtil.getShopId();
+ // 获取前台传参
+ final String warehouseKeeperFlag = user.getWarehouseKeeperFlag();
// 一个用户可存在多个店铺
// 根据手机号及用户类型查询是否存在,如果存在,不新增,否则,新增用户
final User byMobileAndType = userService.findByMobile(user.getMobile());
@@ -127,12 +130,13 @@ public class CommonController {
final Shop shop = shopService.getById(shopId);
// 增加店铺和员工关联表信息
final ShopUser shopUser = new ShopUser();
- shopUser.setUserId(user.getId());
+ shopUser.setUser(user);
shopUser.setUserName(user.getUsername());
- shopUser.setShopId(shop.getId());
+ shopUser.setShop(shop);
shopUser.setShopName(shop.getShopName());
// 这里接收前台得到type,只用于shop_user的type,不会对user的type产生影响
shopUser.setType(Integer.valueOf(shopUserType));
+ shopUser.setWarehouseKeeperFlag(warehouseKeeperFlag);
shopUserService.save(shopUser);
return ResultUtil.success("添加成功");
}
@@ -147,10 +151,10 @@ public class CommonController {
final User old = userService.get(user.getId());
old.setNickname(user.getNickname()).setMobile(user.getMobile()).setUsername(user.getUsername());
userService.update(old);
+ // 修改权限
+ final String shopId = securityUtil.getShopId();
+ final ShopUser shopUser = shopUserService.selectByUserIdAndShopId(user.getId(), shopId);
if (user.getType() != null) {
- // 修改权限
- final String shopId = securityUtil.getShopId();
- final ShopUser shopUser = shopUserService.selectByUserIdAndShopId(user.getId(), shopId);
// 这里接收前台得到type,只用于shop_user的type,不会对user的type产生影响
if (!shopUser.getType().equals(Integer.valueOf(user.getType()))) {
// 如果修改了权限信息,那么就需要清除用户缓存,重新登录
@@ -160,8 +164,9 @@ public class CommonController {
}
}
shopUser.setType(Integer.valueOf(shopUserType));
- shopUserService.save(shopUser);
}
+ shopUser.setWarehouseKeeperFlag(user.getWarehouseKeeperFlag());
+ shopUserService.save(shopUser);
return ResultUtil.success("修改成功");
}
@@ -225,9 +230,9 @@ public class CommonController {
@RequestMapping(value = "/user/findAllUserByShopId", method = RequestMethod.GET)
@ApiOperation("根据店铺Id获取店铺所有人员")
- public Result> findAllUserByShopId() {
+ public Result> findAllUserByShopId() {
final String shopId = securityUtil.getShopId();
- final List users = userService.findByShopId(shopId);
- return new ResultUtil>().setData(users);
+ final List users = userService.findByShopId(shopId);
+ return new ResultUtil>().setData(users);
}
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java
index 56f81450..c2f6ac9a 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java
@@ -88,9 +88,9 @@ public class MallController {
for (String username : usernames) {
ShopUser shopUser = new ShopUser();
User clerk = userService.findByUsername(username);
- shopUser.setUserId(clerk.getId());
+ shopUser.setUser(clerk);
shopUser.setUserName(clerk.getUsername());
- shopUser.setShopId(entity.getId());
+ shopUser.setShop(entity);
shopUser.setShopName(entity.getShopName());
shopUser.setType(2);
shopUserService.save(shopUser);
@@ -130,9 +130,9 @@ public class MallController {
for (String username : usernames) {
ShopUser shopUser = new ShopUser();
User clerk = userService.findByUsername(username);
- shopUser.setUserId(clerk.getId());
+ shopUser.setUser(clerk);
shopUser.setUserName(clerk.getUsername());
- shopUser.setShopId(entity.getId());
+ shopUser.setShop(entity);
shopUser.setShopName(entity.getShopName());
shopUser.setType(2);
shopUserService.save(shopUser);
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PurchaseController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PurchaseController.java
index de419295..ecd85380 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PurchaseController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PurchaseController.java
@@ -12,6 +12,7 @@ import cc.hiver.mall.pojo.dto.DebtSupplier;
import cc.hiver.mall.pojo.query.PurchasePageQuery;
import cc.hiver.mall.pojo.vo.PurchaseVo;
import cc.hiver.mall.pojo.vo.PurchasingCostDetailVo;
+import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo;
import cc.hiver.mall.service.mybatis.PurchaseDetailService;
import cc.hiver.mall.service.mybatis.PurchaseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -338,4 +339,34 @@ public class PurchaseController {
return ResultUtil.error("撤销失败!");
}
}
+
+ /**
+ * 根据供应商id未发货总数
+ * @author 王富康
+ * @date 2025/3/9
+ * @param supplierId
+ * @return Result
+ */
+ @RequestMapping(value = "/notConfirmPurductCount", method = RequestMethod.POST)
+ @ApiOperation("根据供应商id未发货总数")
+ public Result notConfirmPurductCount(String supplierId) {
+ if (StringUtils.isEmpty(supplierId)) {
+ return ResultUtil.error("供应商id不能为空!");
+ }
+ final Integer count = purchaseService.notConfirmPurductCount(supplierId);
+ return ResultUtil.data(count);
+ }
+
+ @RequestMapping(value = "/notConfirmPurductCountGroup", method = RequestMethod.POST)
+ @ApiOperation("根据供应商id未发货总数")
+ public Result notConfirmPurductCountGroup(String type, String supplierId) {
+ if (StringUtils.isEmpty(type)) {
+ return ResultUtil.error("类型不能为空!");
+ }
+ if (StringUtils.isEmpty(supplierId)) {
+ return ResultUtil.error("供应商id不能为空!");
+ }
+ final List purchaseConfirmVos = purchaseService.notConfirmPurductCountGroup(type,supplierId);
+ return ResultUtil.data(purchaseConfirmVos);
+ }
}
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 c0122c5a..6ad90016 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
@@ -26,6 +26,7 @@ import cc.hiver.mall.pojo.dto.*;
import cc.hiver.mall.pojo.query.SalePageQuery;
import cc.hiver.mall.pojo.query.SalesRankingQueryCriteria;
import cc.hiver.mall.pojo.vo.*;
+import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmService;
import cc.hiver.mall.service.*;
import cc.hiver.mall.service.mybatis.*;
import cc.hiver.mall.utils.DateUtil;
@@ -111,6 +112,9 @@ public class SaleController {
@Autowired
private UserService userService;
+ @Autowired
+ private PurchaseConfirmService purchaseConfirmService;
+
@RequestMapping(value = "/buy", method = RequestMethod.POST)
@ApiOperation("下单操作")
@@ -733,6 +737,10 @@ public class SaleController {
// 退货总成本
final BigDecimal saleReturnCost = returnDetailService.getsaleReturnCost(shopId, startTime, endTime);
saleAllVO.setSaleReturnCost(saleReturnCost);
+
+ // 获取待确认入库的数量
+ int notConfirmPurductCount = purchaseService.shopNotConfirmPurductCount(shopId);
+ saleAllVO.setNotConfirmPurductCount(notConfirmPurductCount);
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error(500, e.getMessage());
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 eff4209f..71603ec8 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
@@ -109,13 +109,14 @@ public class ShopController {
shopService.save(shop);
if (shop.getShopMangerId() != null) {
+ // 赋予店铺登录身份
+ final User user = userService.get(shop.getShopMangerId());
// 添加店长
final List shopUsers = Collections.singletonList(shop.getShopMangerId()).stream().map(e -> {
- return new ShopUser().setShopId(shop.getId()).setShopName(shop.getShopName()).setUserId(e).setType(ShopUserConstant.SHOP_ADMIN_COST[0]);
+ return new ShopUser().setShop(shop).setShopName(shop.getShopName()).setUser(user).setType(ShopUserConstant.SHOP_ADMIN_COST[0]);
}).collect(Collectors.toList());
shopUserService.saveOrUpdateAll(shopUsers);
- // 赋予店铺登录身份
- final User user = userService.get(shop.getShopMangerId());
+
final String type = user.getType();
if (!type.contains(UserConstant.USER_TYPE_NORMAL)) {
user.setType(StringUtils.isEmpty(user.getType()) ? UserConstant.USER_TYPE_NORMAL : user.getType() + ',' + UserConstant.USER_TYPE_NORMAL);
@@ -154,14 +155,14 @@ public class ShopController {
if (shop.getShopMangerId() != null && oldShop.getShopOwnerId().equals(shop.getShopMangerId())) {
// 删除原店主关联关系
shopUserService.deleteAllByShopIdAndUserId(oldShop.getId(),oldShop.getShopOwnerId());
-
+ // 赋予店铺登录身份
+ final User user = userService.get(shop.getShopMangerId());
// 添加角色
final List shopUsers = Collections.singletonList(shop.getShopMangerId()).stream().map(e -> {
- return new ShopUser().setShopId(shop.getId()).setShopName(shop.getShopName()).setUserId(e).setType(ShopUserConstant.SHOP_ADMIN_COST[0]);
+ return new ShopUser().setShop(shop).setShopName(shop.getShopName()).setUser(user).setType(ShopUserConstant.SHOP_ADMIN_COST[0]);
}).collect(Collectors.toList());
shopUserService.saveOrUpdateAll(shopUsers);
- // 赋予店铺登录身份
- final User user = userService.get(shop.getShopMangerId());
+
final String type = user.getType();
if (!type.contains(UserConstant.USER_TYPE_NORMAL)) {
user.setType(StringUtils.isEmpty(user.getType()) ? UserConstant.USER_TYPE_NORMAL : user.getType() + ',' + UserConstant.USER_TYPE_NORMAL);
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java
index d8340a46..7eea0f3e 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java
@@ -2,6 +2,7 @@ package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.ShopUser;
+import cc.hiver.mall.pojo.dto.ShopUserDtoTwo;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
@@ -12,8 +13,9 @@ public interface ShopUserDao extends HiverBaseDao {
@Query(value = "select * from t_shop_user where user_id = ? and shop_id = ?",nativeQuery = true)
ShopUser selectByUserIdAndShopId(String userId,String shopId);
- @Query(value = "SELECT t_su.*, t_s.printing_method FROM t_shop_user t_su INNER JOIN t_shop t_s ON t_su.shop_id = t_s.id WHERE t_s.status = ? AND t_s.start_time <= ? AND t_s.end_time >= ? AND t_su.user_id = ?",nativeQuery = true)
- List selectByUserId(Integer status,String startTime,String endTime,String userId);
+ @Query(value = " select new cc.hiver.mall.pojo.dto.ShopUserDtoTwo(su.userName,su.shopName,su.type,''," +
+ "'',s.printingMethod,s.storeFlag,su.warehouseKeeperFlag,su.shop,su.user) from ShopUser su left join su.shop s WHERE s.status = ?1 AND s.startTime <= ?2 AND s.endTime >= ?3 AND su.user.id = ?4")
+ List selectByUserId(Integer status, String startTime, String endTime, String userId);
/**
* 根据店铺id获取店铺和店员关系集合
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java
index ea3e69ac..b1feb57b 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java
@@ -81,4 +81,15 @@ public interface PurchaseMapper extends BaseMapper {
* @param purchasePageQuery
*/
List getPurchaseCount(@Param("purchasePageQuery") PurchasePageQuery purchasePageQuery);
+
+ int shopNotConfirmPurductCount(@Param("shopId") String shopId);
+
+ /**
+ * 更新入库状态
+ * @author 王富康
+ * @date 2025/3/14
+ * @param id
+ * @param storeFlag
+ */
+ void updataStoreFlag(@Param("id")String id,@Param("storeFlag") int storeFlag);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java
index e629cde7..94418b44 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java
@@ -17,5 +17,8 @@ public class ProductCategory extends HiverBaseEntity {
@ApiModelProperty(value = "店铺id")
private String shopId;
+ @ApiModelProperty(value = "排序字段")
+ private String sort;
+
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java
index dc46fe96..4cd54153 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java
@@ -1,6 +1,7 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
+import cc.hiver.core.entity.User;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@@ -10,9 +11,7 @@ import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import javax.persistence.*;
@Data
@Accessors(chain = true)
@@ -25,15 +24,9 @@ import javax.persistence.Transient;
public class ShopUser extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
- @ApiModelProperty(value = "用户id")
- private String userId;
-
@ApiModelProperty(value = "用户名称")
private String userName;
- @ApiModelProperty(value = "商铺id")
- private String shopId;
-
@ApiModelProperty(value = "商铺名称")
private String shopName;
@@ -55,4 +48,20 @@ public class ShopUser extends HiverBaseEntity {
@ApiModelProperty(value = "打印方式")
private String printingMethod;
+ @ApiModelProperty(value = "入库员标识:0:不是(数据库默认);1:是;")
+ private String warehouseKeeperFlag;
+
+ @Transient
+ @TableField(exist = false)
+ @ApiModelProperty(value = "是都需要入库")
+ private String storeFlag;
+
+ @ManyToOne
+ @JoinColumn(name = "user_id")
+ private User user;
+
+ @ManyToOne
+ @JoinColumn(name = "shop_id")
+ private Shop shop;
+
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java
index dfefadac..66a8e1c8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java
@@ -65,6 +65,11 @@ public class Supplier extends HiverBaseEntity {
@ApiModelProperty(value = "欠款")
private BigDecimal noEarn;
+ @Transient
+ @TableField(exist = false)
+ @ApiModelProperty(value = "供应商的欠货数")
+ private Integer supplierNotConfirmPurductCount;
+
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "搜索关键字")
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ShopUserDtoTwo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ShopUserDtoTwo.java
new file mode 100644
index 00000000..56549606
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ShopUserDtoTwo.java
@@ -0,0 +1,54 @@
+package cc.hiver.mall.pojo.dto;
+
+import cc.hiver.core.entity.User;
+import cc.hiver.mall.entity.Shop;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class ShopUserDtoTwo {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "用户名称")
+ private String userName;
+
+ @ApiModelProperty(value = "商铺名称")
+ private String shopName;
+
+ @ApiModelProperty(value = "是否有维护成本权限 0:是;1否")
+ private Integer type;
+
+ @ApiModelProperty(value = "店主名称")
+ private String shopOwnerName;
+
+ @ApiModelProperty(value = "店主联系方式")
+ private String shopOwnerPhone;
+
+ @ApiModelProperty(value = "打印方式")
+ private String printingMethod;
+
+ @ApiModelProperty(value = "是否需要入库确认:0:不需要;1:需要(数据库默认为0)")
+ private String storeFlag;
+
+ @ApiModelProperty(value = "入库员标识:0:不是(数据库默认);1:是;")
+ private String warehouseKeeperFlag;
+
+ @ApiModelProperty(value = "店铺信息")
+ private Shop shop;
+
+ @ApiModelProperty(value = "员工信息")
+ private User user;
+
+ public ShopUserDtoTwo(String userName, String shopName, Integer type, String shopOwnerName, String shopOwnerPhone, String printingMethod, String storeFlag, String warehouseKeeperFlag, Shop shop, User user) {
+ this.userName = userName;
+ this.shopName = shopName;
+ this.type = type;
+ this.shopOwnerName = shopOwnerName;
+ this.shopOwnerPhone = shopOwnerPhone;
+ this.printingMethod = printingMethod;
+ this.storeFlag = storeFlag;
+ this.warehouseKeeperFlag = warehouseKeeperFlag;
+ this.shop = shop;
+ this.user = user;
+ }
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/PurchasePageQuery.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/PurchasePageQuery.java
index 87db7f66..38e69155 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/PurchasePageQuery.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/PurchasePageQuery.java
@@ -96,4 +96,7 @@ public class PurchasePageQuery extends HiverBasePageQuery {
@ApiModelProperty("哪个列表")
private String fromWhere;
+
+ @ApiModelProperty(value = "是否需要入库确认:0:不需要;1:需要(数据库默认为0)")
+ private int storeFlag;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo.java
index 2166e4f5..faa829ef 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo.java
@@ -22,6 +22,9 @@ public class ProductCategoryVo implements Serializable {
@ApiModelProperty(value = "店铺id")
private String shopId;
+ @ApiModelProperty(value = "排序字段")
+ private String sort;
+
@ApiModelProperty(value = "分类列表")
private CopyOnWriteArrayList productAttributeOfAddVos;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java
index 4daf56bd..5f78a00d 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java
@@ -26,5 +26,8 @@ public class ProductCategoryVo2 extends HiverBaseEntity {
@ApiModelProperty(value = "商品总负库存数(某一规格库存为正数的按0计算总数)")
private Integer minusStockCount;
+ @ApiModelProperty(value = "排序字段")
+ private String sort;
+
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleAllVO.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleAllVO.java
index c034d054..32c48617 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleAllVO.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleAllVO.java
@@ -65,4 +65,7 @@ public class SaleAllVO implements Serializable {
@ApiModelProperty(value = "退货总成本")
private BigDecimal saleReturnCost;
+
+ @ApiModelProperty(value = "待确认入库的数量")
+ private int notConfirmPurductCount;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmController.java
new file mode 100644
index 00000000..bdad080b
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmController.java
@@ -0,0 +1,111 @@
+package cc.hiver.mall.purchaseconfirm.controller;
+
+
+import cc.hiver.core.common.utils.ResultUtil;
+import cc.hiver.core.common.utils.SecurityUtil;
+import cc.hiver.core.common.vo.Result;
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm;
+import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmService;
+import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 入库确认控制层
+ * @author 王富康
+ * @date 2025/3/9
+ */
+@Slf4j
+@RestController
+@Api(tags = "入库确认控制层")
+@RequestMapping("/hiver/app/purchaseConfirm/")
+@Transactional
+public class PurchaseConfirmController {
+
+ @Autowired
+ private PurchaseConfirmService purchaseConfirmService;
+
+ @Autowired
+ private SecurityUtil securityUtil;
+
+ /**
+ * 新增入库确认信息
+ *
+ * @param purchaseConfirm
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/1
+ */
+ @RequestMapping(value = "/addPurchaseConfirm", method = RequestMethod.POST)
+ @ApiOperation("新增入库确认信息")
+ public Result addPurchaseConfirm(@RequestBody PurchaseConfirm purchaseConfirm) {
+
+ try{
+ purchaseConfirmService.addPurchaseConfirm(purchaseConfirm);
+ return ResultUtil.success("保存成功!");
+ }catch (Exception e){
+ log.error(e.getMessage(),e);
+ return ResultUtil.error("保存失败!");
+ }
+ }
+
+ /**
+ * 删除入库确认信息(更新删除标识)
+ *
+ * @param id
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/1
+ */
+ @RequestMapping(value = "/deletePurchaseConfirm", method = RequestMethod.POST)
+ @ApiOperation("删除入库确认信息")
+ public Result deletePurchaseConfirm(String id) {
+ if (StringUtils.isEmpty(id)) {
+ return ResultUtil.error("入库确认信息id不能为空!");
+ }
+ final boolean b = purchaseConfirmService.deletePurchaseConfirm(id);
+ if (b) {
+ return ResultUtil.success("删除成功!");
+ } else {
+ return ResultUtil.error("删除失败!");
+ }
+ }
+
+ /**
+ * 根据入库单id查询入库确认表
+ * @author 王富康
+ * @date 2025/3/14
+ * @param purchaseId
+ * @return Result
+ */
+ @RequestMapping(value = "/getPurchaseConfirmByPurchaseId", method = RequestMethod.POST)
+ @ApiOperation("根据入库单id查询入库确认表")
+ public Result getPurchaseConfirmByPurchaseId(String purchaseId) {
+ if (StringUtils.isEmpty(purchaseId)) {
+ return ResultUtil.error("入库单id不能为空!");
+ }
+ final List purchaseConfirms = purchaseConfirmService.getPurchaseConfirmByPurchaseId(purchaseId);
+ return new ResultUtil<>().setData(purchaseConfirms);
+ }
+
+ // 根据商品id查询入库确认子表,在再联主表,返回该商品所有欠货数>0的记录,关联入库单时间和操作人。返回返回入库确认子表id、商品货号、名称、欠货数、入库时间、入库人
+ @RequestMapping(value = "/getPurchaseConfirmDetailsByProductId", method = RequestMethod.POST)
+ @ApiOperation("根据商品id查询入库确认子表")
+ public Result getPurchaseConfirmDetailsByProductId(String productId) {
+ if (StringUtils.isEmpty(productId)) {
+ return ResultUtil.error("商品id不能为空!");
+ }
+ final List purchaseConfirmDetails = purchaseConfirmService.getPurchaseConfirmDetailsByProductId(productId);
+ return new ResultUtil<>().setData(purchaseConfirmDetails);
+ }
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmDetailsController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmDetailsController.java
new file mode 100644
index 00000000..17d37f3b
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmDetailsController.java
@@ -0,0 +1,53 @@
+package cc.hiver.mall.purchaseconfirm.controller;
+
+
+import cc.hiver.core.common.utils.ResultUtil;
+import cc.hiver.core.common.vo.Result;
+import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmDetailsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 入库确认控制层
+ * @author 王富康
+ * @date 2025/3/9
+ */
+@Slf4j
+@RestController
+@Api(tags = "入库确认子表控制层")
+@RequestMapping("/hiver/app/purchaseConfirmDetails/")
+@Transactional
+public class PurchaseConfirmDetailsController {
+
+ @Autowired
+ private PurchaseConfirmDetailsService purchaseConfirmDetailsService;
+
+ /**
+ * 根据入库确认表子表id更新未收货数
+ * @author 王富康
+ * @date 2025/3/9
+ * @param id
+ * @param productCount
+ * @return Result
+ */
+ @RequestMapping(value = "/updateProductCount", method = RequestMethod.POST)
+ @ApiOperation("根据入库确认表子表id更新未收货数")
+ public Result updateProductCount(String id,String productCount) {
+ if (StringUtils.isEmpty(id)) {
+ return ResultUtil.error("入库确认表子表id不能为空!");
+ }
+ try{
+ purchaseConfirmDetailsService.updateProductCount(id,productCount);
+ return ResultUtil.success("更新成功!");
+ }catch (Exception e){
+ return ResultUtil.error("更新失败!");
+ }
+ }
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirm.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirm.java
new file mode 100644
index 00000000..661dfd18
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirm.java
@@ -0,0 +1,46 @@
+package cc.hiver.mall.purchaseconfirm.entity;
+
+import cc.hiver.core.base.HiverBaseEntity;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.data.annotation.CreatedBy;
+
+import javax.persistence.Transient;
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel(value = "入库确认表")
+@TableName(value = "t_purchase_confirm", autoResultMap = true)
+public class PurchaseConfirm extends HiverBaseEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "创建者")
+ @CreatedBy
+ @TableField(fill = FieldFill.INSERT)
+ private String createByName;
+
+ @ApiModelProperty(value = "入库单id")
+ private String purchaseId;
+
+ @ApiModelProperty(value = "供应商id")
+ private String supplierId;
+
+ @ApiModelProperty(value = "供应商名称")
+ private String supplierName;
+
+ @ApiModelProperty(value = "入库单时间")
+ private String purchaseTime;
+
+ @Transient
+ @TableField(exist = false)
+ @ApiModelProperty(value = "入库确认子表信息")
+ private List purchaseConfirmDetailsList;
+
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirmDetails.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirmDetails.java
new file mode 100644
index 00000000..f019c64a
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirmDetails.java
@@ -0,0 +1,40 @@
+package cc.hiver.mall.purchaseconfirm.entity;
+
+import cc.hiver.core.common.utils.SnowFlakeUtil;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Id;
+import java.io.Serializable;
+
+@Data
+@ApiModel(value = "入库确认-子表表")
+@TableName(value = "t_purchase_confirm_details", autoResultMap = true)
+public class PurchaseConfirmDetails implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @TableId
+ @ApiModelProperty(value = "唯一标识")
+ private String id = SnowFlakeUtil.nextId().toString();
+
+ @ApiModelProperty(value = "入库单id")
+ private String purchaseConfirmId;
+
+ @ApiModelProperty(value = "商品id")
+ private String productId;
+
+ @ApiModelProperty(value = "商品名称")
+ private String productName;
+
+ @ApiModelProperty(value = "商品货号")
+ private String productSn;
+
+ @ApiModelProperty(value = "未入库商品数量")
+ private String productCount;
+
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmDetailsMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmDetailsMapper.java
new file mode 100644
index 00000000..9c0ca9f7
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmDetailsMapper.java
@@ -0,0 +1,32 @@
+package cc.hiver.mall.purchaseconfirm.mapper;
+
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface PurchaseConfirmDetailsMapper extends BaseMapper {
+
+ /**
+ * 根据入库确认表子表id更新未收货数
+ * @author 王富康
+ * @date 2025/3/9
+ * @param id
+ * @param productCount
+ */
+ void updateProductCount( @Param("id")String id, @Param("productCount")String productCount);
+
+ /**
+ * 根据purchaseConfirmIds 查询子表信息
+ * @author 王富康
+ * @date 2025/3/14
+ * @param purchaseConfirmIds
+ * @return List
+ */
+ List getDetailsByPurchaseConfirmIds(@Param("purchaseConfirmIds") List purchaseConfirmIds);
+
+ void deleteByPurchaseId(@Param("purchaseId") String purchaseId);
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmMapper.java
new file mode 100644
index 00000000..51883e30
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmMapper.java
@@ -0,0 +1,30 @@
+package cc.hiver.mall.purchaseconfirm.mapper;
+
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm;
+import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+@Repository
+public interface PurchaseConfirmMapper extends BaseMapper {
+
+ boolean updatePurchaseConfirmDelFlag(String id, String s);
+
+ Integer notConfirmPurductCount( @Param("supplierId") String supplierId);
+
+ List purchaseNotConfirmPurductCount(@Param("supplierId") String supplierId);
+
+ List productNotConfirmPurductCount(@Param("supplierId") String supplierId);
+
+ int shopNotConfirmPurductCount(@Param("shopId") String shopId);
+
+ List supplierNotConfirmPurductCount(@Param("supplierIdList") List supplierIds);
+
+ List selectByPurchaseId(@Param("purchaseId") String purchaseId);
+
+ List getPurchaseConfirmDetailsByProductId(@Param("productId")String productId);
+
+ void deleteByPurchaseId(@Param("purchaseId") String purchaseId);
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmDetailsService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmDetailsService.java
new file mode 100644
index 00000000..5f3da4f8
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmDetailsService.java
@@ -0,0 +1,29 @@
+package cc.hiver.mall.purchaseconfirm.service;
+
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+public interface PurchaseConfirmDetailsService extends IService {
+
+ /**
+ * 根据入库确认表子表id更新未收货数
+ * @author 王富康
+ * @date 2025/3/9
+ * @param id
+ * @param productCount
+ */
+ void updateProductCount(String id, String productCount);
+
+ /**
+ * 根据purchaseConfirmIds 查询子表信息
+ * @author 王富康
+ * @date 2025/3/14
+ * @param purchaseConfirmIds
+ * @return List
+ */
+ List getDetailsByPurchaseConfirmIds(List purchaseConfirmIds);
+
+ void deleteByPurchaseId(String purchaseId);
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmService.java
new file mode 100644
index 00000000..54e23a1b
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmService.java
@@ -0,0 +1,45 @@
+package cc.hiver.mall.purchaseconfirm.service;
+
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm;
+import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+public interface PurchaseConfirmService extends IService {
+
+ /**
+ * 删除货号规则
+ *
+ * @param id
+ * @return boolean
+ * @author 王富康
+ * @date 2024/6/1
+ */
+ boolean deletePurchaseConfirm(String id);
+
+ Integer notConfirmPurductCount(String supplierId);
+
+ List purchaseNotConfirmPurductCount(String supplierId);
+
+ List productNotConfirmPurductCount(String supplierId);
+
+ int shopNotConfirmPurductCount(String shopId);
+
+ List supplierNotConfirmPurductCount(List supplierIds);
+
+ void addPurchaseConfirm(PurchaseConfirm purchaseConfirm);
+
+ /**
+ * 根据入库单id查询入库确认表
+ * @author 王富康
+ * @date 2025/3/14
+ * @param purchaseId
+ * @return List
+ */
+ List getPurchaseConfirmByPurchaseId(String purchaseId);
+
+ List getPurchaseConfirmDetailsByProductId(String productId);
+
+ void deleteByPurchaseId(String purchaseId);
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmDetailsServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmDetailsServiceImpl.java
new file mode 100644
index 00000000..5e189548
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmDetailsServiceImpl.java
@@ -0,0 +1,46 @@
+package cc.hiver.mall.purchaseconfirm.service.impl;
+
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails;
+import cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmDetailsMapper;
+import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmDetailsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class PurchaseConfirmDetailsServiceImpl extends ServiceImpl implements PurchaseConfirmDetailsService {
+
+ @Autowired
+ private PurchaseConfirmDetailsMapper purchaseConfirmDetailsMapper;
+
+ /**
+ * 根据入库确认表子表id更新未收货数
+ * @author 王富康
+ * @date 2025/3/9
+ * @param id
+ * @param productCount
+ */
+ @Override
+ public void updateProductCount(String id, String productCount) {
+ purchaseConfirmDetailsMapper.updateProductCount(id, productCount);
+ }
+
+ /**
+ * 根据purchaseConfirmIds 查询子表信息
+ * @author 王富康
+ * @date 2025/3/14
+ * @param purchaseConfirmIds
+ * @return List
+ */
+ @Override
+ public List getDetailsByPurchaseConfirmIds(List purchaseConfirmIds) {
+ return purchaseConfirmDetailsMapper.getDetailsByPurchaseConfirmIds(purchaseConfirmIds);
+ }
+
+ @Override
+ public void deleteByPurchaseId(String purchaseId) {
+ purchaseConfirmDetailsMapper.deleteByPurchaseId(purchaseId);
+ }
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmServiceImpl.java
new file mode 100644
index 00000000..455e61af
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmServiceImpl.java
@@ -0,0 +1,133 @@
+package cc.hiver.mall.purchaseconfirm.service.impl;
+
+import cc.hiver.core.common.constant.CommonConstant;
+import cc.hiver.core.common.utils.SnowFlakeUtil;
+import cc.hiver.mall.common.constant.PurchaseConstant;
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm;
+import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails;
+import cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmMapper;
+import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmDetailsService;
+import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmService;
+import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo;
+import cc.hiver.mall.service.mybatis.PurchaseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class PurchaseConfirmServiceImpl extends ServiceImpl implements PurchaseConfirmService {
+
+ @Autowired
+ private PurchaseConfirmMapper purchaseConfirmMapper;
+
+ @Autowired
+ private PurchaseConfirmDetailsService purchaseConfirmDetailsService;
+
+ @Autowired
+ private PurchaseService purchaseService;
+
+
+ /**
+ * 删除货号规则
+ *
+ * @param id
+ * @return boolean
+ * @author 王富康
+ * @date 2024/6/1
+ */
+ @Override
+ public boolean deletePurchaseConfirm(String id) {
+ return purchaseConfirmMapper.updatePurchaseConfirmDelFlag(id, String.valueOf(CommonConstant.DEL_FLAG_TRUE));
+ }
+
+ @Override
+ public Integer notConfirmPurductCount(String supplierId) {
+ return purchaseConfirmMapper.notConfirmPurductCount(supplierId);
+ }
+
+ @Override
+ public List purchaseNotConfirmPurductCount(String supplierId) {
+ return purchaseConfirmMapper.purchaseNotConfirmPurductCount(supplierId);
+ }
+
+ @Override
+ public List productNotConfirmPurductCount(String supplierId) {
+ return purchaseConfirmMapper.productNotConfirmPurductCount(supplierId);
+ }
+
+ @Override
+ public int shopNotConfirmPurductCount(String shopId) {
+ return purchaseConfirmMapper.shopNotConfirmPurductCount(shopId);
+ }
+
+ @Override
+ public List supplierNotConfirmPurductCount(List supplierIds) {
+ return purchaseConfirmMapper.supplierNotConfirmPurductCount(supplierIds);
+ }
+
+ @Override
+ public void addPurchaseConfirm(PurchaseConfirm purchaseConfirm) {
+ final String id = SnowFlakeUtil.nextId().toString();
+ purchaseConfirm.setId(id);
+ purchaseConfirmMapper.insert(purchaseConfirm);
+ // 批量保存子表是数据
+ final List purchaseConfirmDetailsList = purchaseConfirm.getPurchaseConfirmDetailsList();
+ for (PurchaseConfirmDetails purchaseConfirmDetails : purchaseConfirmDetailsList) {
+ purchaseConfirmDetails.setPurchaseConfirmId(id);
+ }
+ purchaseConfirmDetailsService.saveBatch(purchaseConfirmDetailsList);
+
+ // 更新入库单位已确认入库。
+ purchaseService.updataStoreFlag(purchaseConfirm.getPurchaseId(), PurchaseConstant.STORE_FLAG[0]);
+ }
+
+ /**
+ * 根据入库单id查询入库确认表
+ * @author 王富康
+ * @date 2025/3/14
+ * @param purchaseId
+ * @return List
+ */
+ @Override
+ public List getPurchaseConfirmByPurchaseId(String purchaseId) {
+ final List purchaseConfirms = purchaseConfirmMapper.selectByPurchaseId(purchaseId);
+ // 查询子表信息。
+ final List purchaseConfirmIds = new ArrayList<>();
+ for (PurchaseConfirm purchaseConfirm : purchaseConfirms) {
+ purchaseConfirmIds.add(purchaseConfirm.getId());
+ }
+ // 根据purchaseConfirmIds 查询子表信息
+ final List purchaseConfirmDetailsList = purchaseConfirmDetailsService.getDetailsByPurchaseConfirmIds(purchaseConfirmIds);
+ final Map> purchaseConfirmDetailMap = new HashMap<>();
+ for (PurchaseConfirmDetails purchaseConfirmDetails : purchaseConfirmDetailsList) {
+ final String purchaseConfirmId = purchaseConfirmDetails.getPurchaseConfirmId();
+ if(purchaseConfirmDetailMap.containsKey(purchaseConfirmId)){
+ purchaseConfirmDetailMap.get(purchaseConfirmId).add(purchaseConfirmDetails);
+ }else{
+ final List purchaseConfirmDetailsLists = new ArrayList<>();
+ purchaseConfirmDetailsLists.add(purchaseConfirmDetails);
+ purchaseConfirmDetailMap.put(purchaseConfirmId,purchaseConfirmDetailsLists);
+ }
+ }
+ for (PurchaseConfirm purchaseConfirm : purchaseConfirms) {
+ purchaseConfirm.setPurchaseConfirmDetailsList(purchaseConfirmDetailMap.get(purchaseConfirm.getId()));
+ }
+ return purchaseConfirms;
+ }
+
+ @Override
+ public List getPurchaseConfirmDetailsByProductId(String productId) {
+ return purchaseConfirmMapper.getPurchaseConfirmDetailsByProductId(productId);
+ }
+
+ @Override
+ public void deleteByPurchaseId(String purchaseId) {
+ purchaseConfirmMapper.deleteByPurchaseId(purchaseId);
+ }
+
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/vo/PurchaseConfirmVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/vo/PurchaseConfirmVo.java
new file mode 100644
index 00000000..2a8541fb
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/vo/PurchaseConfirmVo.java
@@ -0,0 +1,35 @@
+package cc.hiver.mall.purchaseconfirm.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class PurchaseConfirmVo {
+
+ @ApiModelProperty(value = "子表id")
+ private String purchaseConfirmDetailsId;
+
+ @ApiModelProperty(value = "入库单id")
+ private String purchaseId;
+
+ @ApiModelProperty(value = "入库人名")
+ private String createByName;
+
+ @ApiModelProperty(value = "入库时间")
+ private String purchaseTime;
+
+ @ApiModelProperty(value = "供应商id")
+ private String supplierId;
+
+ @ApiModelProperty(value = "商品id")
+ private String productId;
+
+ @ApiModelProperty(value = "商品名称")
+ private String productName;
+
+ @ApiModelProperty(value = "商品货号")
+ private String productSn;
+
+ @ApiModelProperty(value = "商品数量")
+ private Integer totalUnshippedCount;
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java
index 10516b96..80d5978f 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java
@@ -87,11 +87,11 @@ public class PurchaseOcrPictureController {
@RequestMapping(value = "/getLogisticsOrderOfAi", method = RequestMethod.POST)
@ApiOperation("物流公司AI语音开单")
- public Result getLogisticsOrderOfAi(String questionMsg) {
+ public Result getLogisticsOrderOfAi(String questionMsg,String arrivalStation) {
if(StringUtils.isEmpty(questionMsg)){
return ResultUtil.error("信息不能为空!");
}
- JSONObject jsonObject = purchaseOcrPictureService.getLogisticsOrderOfAi(questionMsg);
+ JSONObject jsonObject = purchaseOcrPictureService.getLogisticsOrderOfAi(questionMsg,arrivalStation);
return ResultUtil.data(jsonObject);
}
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java
index 5f01bb77..050a24c1 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java
@@ -28,5 +28,5 @@ public interface PurchaseOcrPictureService {
JSONObject getCustomInfoOfAi(String questionMsg);
- JSONObject getLogisticsOrderOfAi(String questionMsg);
+ JSONObject getLogisticsOrderOfAi(String questionMsg,String arrivalStation);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
index b9d296a4..09b2f0f4 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
@@ -591,11 +591,14 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
}
@Override
- public JSONObject getLogisticsOrderOfAi(String questionMsg) {
+ public JSONObject getLogisticsOrderOfAi(String questionMsg,String arrivalStation) {
final JSONObject returnJsonObject = new JSONObject();
final List logisticsOrderOfAiVos = new ArrayList<>();
try {
- final JSONObject jsonObject = AliOcrUtil.callWithMessageOfLogisticsOrder(questionMsg);
+ LogiticsCompany currCompany = securityUtil.getCurrCompany();
+ // 获取收货人列表
+ final Map> logisticsAddressBooks = logisticsAddressBookService.getByCompanyId(currCompany.getCompanyId());
+ final JSONObject jsonObject = AliOcrUtil.callWithMessageOfLogisticsOrder(questionMsg,arrivalStation,logisticsAddressBooks);
final String resultContent = jsonObject.get("resultContent").toString();
final JSONArray json = JSON.parseArray(resultContent);
for (int i = 0; i < json.size(); i++) {
@@ -672,7 +675,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
logisticsAddressBookQueryVo.setAddressType(1);
logisticsAddressBookQueryVo.setShipperOrReceiverName(shipperName);
logisticsAddressBookQueryVo.setMobile(shipperMobile);
- LogiticsCompany currCompany = securityUtil.getCurrCompany();
+
logisticsAddressBookQueryVo.setCompanyId(currCompany.getCompanyId() == null ? currCompany.getId() : currCompany.getCompanyId());
final cn.hutool.json.JSONObject logisticsAddressBookList = logisticsAddressBookService.getLogisticsAddressBookList(logisticsAddressBookQueryVo);
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnDetailMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnDetailMapper.java
index 1efa5f03..3997d78d 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnDetailMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnDetailMapper.java
@@ -3,6 +3,7 @@ package cc.hiver.mall.purchasereturn.mapper;
import cc.hiver.mall.purchasereturn.entity.PurchaseReturnDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
import java.util.List;
@@ -12,6 +13,7 @@ import java.util.List;
* @author 王富康
* @date 2024/8/17
*/
+@Repository
public interface PurchaseReturnDetailMapper extends BaseMapper {
List getByPurchaseReturnId(@Param("id") String id);
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java
index dfc6d8a6..36714b39 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
import java.util.List;
@@ -18,6 +19,7 @@ import java.util.List;
* @author 王富康
* @date 2024/8/17
*/
+@Repository
public interface PurchaseReturnMapper extends BaseMapper {
/**
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java
index a1c6b504..a1d24548 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java
@@ -8,10 +8,12 @@ import cc.hiver.mall.pojo.query.PurchasePageQuery;
import cc.hiver.mall.pojo.vo.PurchaseVo;
import cc.hiver.mall.pojo.vo.PurchasingCostDetailVo;
import cc.hiver.mall.pojo.vo.SupplierDataVo;
+import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.math.BigDecimal;
+import java.util.List;
public interface PurchaseService extends IService {
Page getDebtByShopId(PurchasePageQuery purchasePageQuery);
@@ -88,4 +90,20 @@ public interface PurchaseService extends IService {
* @param purchasePageQuery
*/
SupplierDataVo getSupplierPurchaseInfo(PurchasePageQuery purchasePageQuery);
+
+ /**
+ * 根据供应商id未发货总数
+ * @author 王富康
+ * @date 2025/3/9
+ * @param supplierId
+ * @return Integer
+ */
+ Integer notConfirmPurductCount(String supplierId);
+
+ List notConfirmPurductCountGroup(String type, String supplierId);
+
+ int shopNotConfirmPurductCount(String shopId);
+
+
+ void updataStoreFlag(String id,int storeFlag);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java
index bdea6d0e..7191a8f4 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java
@@ -2,8 +2,10 @@ package cc.hiver.mall.serviceimpl;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.core.common.constant.ShopConstant;
+import cc.hiver.core.common.utils.BeanUtils;
import cc.hiver.mall.dao.ShopUserDao;
import cc.hiver.mall.entity.ShopUser;
+import cc.hiver.mall.pojo.dto.ShopUserDtoTwo;
import cc.hiver.mall.service.ShopUserService;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -33,21 +36,32 @@ public class ShopUserServiceImpl implements ShopUserService {
@Override
public ShopUser selectByUserIdAndShopId(String userId, String shopId) {
- return shopUserDao.selectByUserIdAndShopId(userId,shopId);
+ return shopUserDao.selectByUserIdAndShopId(userId, shopId);
}
- public List selectByUserId(String userId){
- String nowDate = DateUtil.format(new Date(), "yyyy-MM-dd");
- return shopUserDao.selectByUserId(ShopConstant.SHOP_STATUS_NORMAL,nowDate,nowDate,userId);
+
+ @Override
+ public List selectByUserId(String userId) {
+ final String nowDate = DateUtil.format(new Date(), "yyyy-MM-dd");
+ final List shopUserDtoTwos = shopUserDao.selectByUserId(ShopConstant.SHOP_STATUS_NORMAL, nowDate, nowDate, userId);
+ final List shopUsers = new ArrayList<>();
+ for (ShopUserDtoTwo shopUserDtoTwo : shopUserDtoTwos) {
+ final ShopUser shopUser = new ShopUser();
+ BeanUtils.copyBeanProp(shopUser, shopUserDtoTwo);
+ shopUsers.add(shopUser);
+ }
+ return shopUsers;
}
/**
* 根据店铺id获取店铺和店员关系集合
- * @author 王富康
- * @date 2023/10/28
+ *
* @param shopId
* @return List
+ * @author 王富康
+ * @date 2023/10/28
*/
- public List findByShopId(String shopId){
+ @Override
+ public List findByShopId(String shopId) {
return shopUserDao.findByShopId(shopId);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
index 996799af..e6a9cdd3 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
@@ -11,6 +11,8 @@ import cc.hiver.mall.entity.DealingsRecord;
import cc.hiver.mall.entity.Supplier;
import cc.hiver.mall.pojo.query.PurchasePageQuery;
import cc.hiver.mall.pojo.vo.SupplierDataVo;
+import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmService;
+import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo;
import cc.hiver.mall.purchasereturn.service.PurchaseReturnService;
import cc.hiver.mall.service.SupplierService;
import cc.hiver.mall.service.mybatis.DealingsRecordService;
@@ -27,10 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.*;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -53,6 +52,9 @@ public class SupplierServiceImpl implements SupplierService {
@Autowired
private PurchaseReturnService purchaseReturnService;
+ @Autowired
+ private PurchaseConfirmService purchaseConfirmService;
+
@Override
public HiverBaseDao getRepository() {
return supplierDao;
@@ -116,6 +118,20 @@ public class SupplierServiceImpl implements SupplierService {
supplier.setNoEarn(debt.getAmountOwed());
}
});
+
+ // 获取供应商欠货数量
+ final List purchaseConfirmVos = purchaseConfirmService.supplierNotConfirmPurductCount(idList);
+ final Map purchaseConfirmVoMap = new HashMap<>();
+ for (PurchaseConfirmVo purchaseConfirmVo : purchaseConfirmVos) {
+ purchaseConfirmVoMap.put(purchaseConfirmVo.getSupplierId(), purchaseConfirmVo);
+ }
+ list.forEach(supplier -> {
+ final String id = supplier.getId();
+ final PurchaseConfirmVo purchaseConfirmVo = purchaseConfirmVoMap.get(id);
+ if (purchaseConfirmVo != null) {
+ supplier.setSupplierNotConfirmPurductCount(purchaseConfirmVo.getTotalUnshippedCount());
+ }
+ });
}
return list;
@@ -187,10 +203,11 @@ public class SupplierServiceImpl implements SupplierService {
/**
* 查询供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数
- * @author 王富康
- * @date 2024/10/24
+ *
* @param purchasePageQuery
* @return SupplierDataVo
+ * @author 王富康
+ * @date 2024/10/24
*/
@Override
public SupplierDataVo getSupplierData(PurchasePageQuery purchasePageQuery) {
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java
index 0d4783e5..caf57c41 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java
@@ -61,6 +61,7 @@ public class ProductCategoryServiceImpl extends ServiceImpl i
private ProductService productService;
@Autowired
- private SaleService saleService;
+ private DebtService debtService;
@Autowired
- private SaleDetailService saleDetailService;
+ private PurchaseConfirmService purchaseConfirmService;
@Autowired
- private DebtService debtService;
+ private PurchaseConfirmDetailsService purchaseConfirmDetailsService;
@Override
@@ -279,11 +282,11 @@ public class PurchaseServiceImpl extends ServiceImpl i
final String purchaseId = purchaseDetail.getPurchaseId();
final String productId1 = purchaseDetail.getProductId();
if (stockLogMap.containsKey(purchaseId)) {
- int purductCount = 0;
+ int productCount = 0;
final List stockLogList1 = stockLogMap.get(purchaseId);
for (StockLog stockLog : stockLogList1) {
if (productId1.equals(stockLog.getProductId())) {
- purductCount += stockLog.getProductCount();
+ productCount += stockLog.getProductCount();
final List stockLogList11 = purchaseDetail.getStockLogList1();
if (stockLogList11 == null) {
final List stockLogListNew = new ArrayList<>();
@@ -295,7 +298,7 @@ public class PurchaseServiceImpl extends ServiceImpl i
}
}
// 将采购单明细中的数量放到采购单上
- purchaseDetail.setProductCount(purductCount);
+ purchaseDetail.setProductCount(productCount);
}
}
}
@@ -575,11 +578,11 @@ public class PurchaseServiceImpl extends ServiceImpl i
final String purchaseId = purchaseDetail.getPurchaseId();
final String productId1 = purchaseDetail.getProductId();
if (stockLogMap.containsKey(purchaseId)) {
- int purductCount = 0;
+ int productCount = 0;
final List stockLogList1 = stockLogMap.get(purchaseId);
for (StockLog stockLog : stockLogList1) {
if (productId1.equals(stockLog.getProductId())) {
- purductCount += stockLog.getProductCount();
+ productCount += stockLog.getProductCount();
final List stockLogList11 = purchaseDetail.getStockLogList1();
if (stockLogList11 == null) {
final List stockLogListNew = new ArrayList<>();
@@ -591,7 +594,7 @@ public class PurchaseServiceImpl extends ServiceImpl i
}
}
// 将采购单明细中的数量放到采购单上
- purchaseDetail.setProductCount(purductCount);
+ purchaseDetail.setProductCount(productCount);
}
}
}
@@ -753,6 +756,9 @@ public class PurchaseServiceImpl extends ServiceImpl i
purchaseService.deleteById(id);
// 2. 将订单详情设置为删除状态
purchaseDetailService.deleteByPurchaseId(id);
+ // 将入库确认表及入库确认子表删除掉
+ purchaseConfirmService.deleteByPurchaseId(id);
+ purchaseConfirmDetailsService.deleteByPurchaseId(id);
}
@Override
@@ -787,4 +793,29 @@ public class PurchaseServiceImpl extends ServiceImpl i
supplierDataVo.setProductDataVos(purchaseCount);
return supplierDataVo;
}
+
+ @Override
+ public Integer notConfirmPurductCount(String supplierId) {
+ return purchaseConfirmService.notConfirmPurductCount(supplierId);
+ }
+
+ @Override
+ public List notConfirmPurductCountGroup(String type, String supplierId) {
+ if("0".equals(type)){
+ return purchaseConfirmService.purchaseNotConfirmPurductCount(supplierId);
+ }else if("1".equals(type)){
+ return purchaseConfirmService.productNotConfirmPurductCount(supplierId);
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
+ public int shopNotConfirmPurductCount(String shopId) {
+ return purchaseMapper.shopNotConfirmPurductCount(shopId);
+ }
+
+ @Override
+ public void updataStoreFlag(String id,int storeFlag) {
+ purchaseMapper.updataStoreFlag(id,storeFlag);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
index 1c0454d8..8a93fda6 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
@@ -1189,7 +1189,7 @@ public class StockServiceImpl extends ServiceImpl implements
saleDetailService.putInUpdatePurchasePrice(purchaseDetails);
// 入库单加一个字段:是否确认入库(app/stock/putInPriceOfAi)这个接口设置为待确认
- purchase.setStoreFlag(PurchaseConstant.STORE_FLAG[0]);
+ // purchase.setStoreFlag(PurchaseConstant.STORE_FLAG[0]);
//3.登记采购单主表和采购单明细表
// log.debug("保存前的入库时间==="+DateUtil.COMMON_FULL.getDateText(purchase.getCreateTime())+"===="+DateUtil.COMMON_FULL.getDateText(purchase.getPurchaseTime()));
final boolean saveOrUpdateFlag;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/urlmapping/mapper/UrlMappingMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/urlmapping/mapper/UrlMappingMapper.java
index 3187c7fe..d685a077 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/urlmapping/mapper/UrlMappingMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/urlmapping/mapper/UrlMappingMapper.java
@@ -2,7 +2,9 @@ package cc.hiver.mall.urlmapping.mapper;
import cc.hiver.mall.urlmapping.entity.UrlMapping;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+@Repository
public interface UrlMappingMapper extends BaseMapper {
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
index dc095698..6f3660d8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
@@ -2,6 +2,7 @@ package cc.hiver.mall.utils;// Copyright (c) Alibaba, Inc. and its affiliates.
import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.utils.CommonUtil;
+import cc.hiver.core.logisticsaddressbook.entity.LogisticsAddressBook;
import cc.hiver.mall.config.aliocr.AliOcrConfig;
import cc.hiver.mall.entity.*;
import cc.hiver.mall.pojo.vo.*;
@@ -852,7 +853,7 @@ public class AliOcrUtil {
msgManager.add(userMsg);
stopWatch.start("开始回答");
final QwenParam param =
- QwenParam.builder().model("qwen-turbo-0919").messages(msgManager.get())
+ QwenParam.builder().model("qwen-turbo").messages(msgManager.get())
.resultFormat(QwenParam.ResultFormat.MESSAGE)
.seed(1234)
.temperature(0.7F)
@@ -892,19 +893,21 @@ public class AliOcrUtil {
Message.builder().role(Role.SYSTEM.getValue()).content("You are a helpful assistant.").build();
// questionMsg += "请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"productName\": \"名称\" , \"price\":\"单价\",\"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}] }]。以下是几点要求: 1.“货号”两个字和\"名称\"两个字中间的内容代表productSn的值,如果没有名称则“货号”两个字和颜色中间的内容代表productSn的值,productSn可能包含\"新\"、\"退\"、\"旧\"、\"换\"、\"补\"。2.\"SYYS色\"代表“所有颜色”,\"color\"字段返回“SYYS色”。 3.\"SYCM码\"代表“所有尺码”,\"size\"字段返回“SYCM码”。4.如果没有名称,productName字段返回\"\"。5.只输出JSON数据即可,不用返回字段描述和解析过程。";
questionMsg += "你是一个服装行业库管专家,请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"productName\": \"名称\" , \"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}], \"purchasePrice\":\"单价\" , \"price\":\"零售价\" , \"wholesalePrice\":\"批发价\" }]\n" +
- "1.如果没有识别到\"purchasePrice\"的内容,则\"purchasePrice\"赋值\"0\"。如果没有识别到\"price\"的内容,则\"price\"赋值\"0\"。如果没有识别到\"wholesalePrice\"的内容,则\"wholesalePrice\"赋值\"0\"。\n" +
- "2.如果没有识别到\"productSn\"的内容,则\"productSn\"赋值\"\"。\n" +
- "3.如果没有识别到\"productName\"的内容,则\"productName\"使用\"productSn\"的值填充。\n" +
- "4.如果识别到多种颜色,按不同颜色拆分返回。如果没有识别到\"color\"的内容,则\"color\"赋值“均色”,如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回一条JSON数据即可。\n" +
- "5.如果指令中有“各N件”,则每个尺码数量返回N。\n" +
- "6.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON、不要省略中间的尺码。(常见的尺码顺序:S码-M码-L码-XL码-2XL码-3XL码-4XL码-5XL码-6XL码-7XL码......)。\n" +
- "7.返回的JSON数据不用换行,以最快的速度返回!\n" +
- "8.只输出JSON数据即可,禁止返回除JSON数据外的任何内容!";
+ "1.如果没有识别到\"purchasePrice\"的内容,则\"purchasePrice\"赋值\"0\",purchasePrice为单价!" +
+ "2.如果没有识别到\"price\"的内容,则\"price\"赋值\"0\",price为零售价!" +
+ "3.如果没有识别到\"wholesalePrice\"的内容,则\"wholesalePrice\"赋值\"0\",wholesalePrice为批发价!\n" +
+ "4.如果没有识别到\"productSn\"的内容,则\"productSn\"赋值\"\"。\n" +
+ "5.如果没有识别到\"productName\"的内容,则\"productName\"使用\"productSn\"的值填充。\n" +
+ "6.如果识别到多种颜色,按不同颜色拆分返回。如果没有识别到\"color\"的内容,则\"color\"赋值“均色”,如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回一条JSON数据即可。\n" +
+ "7.如果指令中有“各N件”,则每个尺码数量返回N。\n" +
+ "8.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON、不要省略中间的尺码。(常见的尺码顺序:S码-M码-L码-XL码-2XL码-3XL码-4XL码-5XL码-6XL码-7XL码......)。\n" +
+ "9.返回的JSON数据不用换行,以最快的速度返回!\n" +
+ "10.只输出JSON数据即可,禁止返回除JSON数据外的任何内容!";
final Message userMsg = Message.builder().role(Role.USER.getValue()).content(questionMsg).build();
msgManager.add(systemMsg);
msgManager.add(userMsg);
final QwenParam param =
- QwenParam.builder().model("qwen-turbo-0919").messages(msgManager.get())
+ QwenParam.builder().model("qwen-turbo").messages(msgManager.get())
.resultFormat(QwenParam.ResultFormat.MESSAGE)
.seed(1234)
.temperature(0.7F)
@@ -946,7 +949,7 @@ public class AliOcrUtil {
msgManager.add(userMsg);
stopWatch.start("开始回答");
final QwenParam param =
- QwenParam.builder().model("qwen-turbo-0919").messages(msgManager.get())
+ QwenParam.builder().model("qwen-turbo").messages(msgManager.get())
.resultFormat(QwenParam.ResultFormat.MESSAGE)
.seed(1234)
.temperature(0.85F)
@@ -998,7 +1001,7 @@ public class AliOcrUtil {
// 尝试从货号中提取正确的货号,因为货号可能包含颜色等信息
productSn = CommonUtil.getProductSn(productSn);
// 根据货号去查询商品
- final CopyOnWriteArrayList byProductSn = productService.getByProductSn(productSn, shopId,"");
+ final CopyOnWriteArrayList byProductSn = productService.getByProductSn(productSn, shopId, "");
if (byProductSn != null && !byProductSn.isEmpty()) {
// 原则上一个店铺一个货号对应一个商品,这里如果查到了,直接拿第一个。
final Product product = byProductSn.get(0);
@@ -1210,7 +1213,7 @@ public class AliOcrUtil {
* @author 王富康
* @date 2024/3/31
*/
- public static JSONObject callWithMessageOfLogistics (String questionMsg)
+ public static JSONObject callWithMessageOfLogistics(String questionMsg)
throws NoApiKeyException, ApiException, InputRequiredException {
final JSONObject jsonObject = new JSONObject();
Constants.apiKey = "sk-bcfa4865b89548acb8225f910f13d682";
@@ -1225,7 +1228,7 @@ public class AliOcrUtil {
msgManager.add(userMsg);
stopWatch.start("开始回答");
final QwenParam param =
- QwenParam.builder().model("qwen-coder-turbo").messages(msgManager.get())
+ QwenParam.builder().model("qwen-max").messages(msgManager.get())
.resultFormat(QwenParam.ResultFormat.MESSAGE)
.build();
final GenerationResult result = gen.call(param);
@@ -1245,12 +1248,13 @@ public class AliOcrUtil {
/**
* 物流语音开单
- * @author 王富康
- * @date 2024/9/5
+ *
* @param questionMsg
* @return JSONObject
+ * @author 王富康
+ * @date 2024/9/5
*/
- public static JSONObject callWithMessageOfLogisticsOrder(String questionMsg) throws NoApiKeyException, ApiException, InputRequiredException {
+ public static JSONObject callWithMessageOfLogisticsOrder(String questionMsg, String arrivalStation, Map> logisticsAddressBooks) throws NoApiKeyException, ApiException, InputRequiredException {
final JSONObject jsonObject = new JSONObject();
Constants.apiKey = "sk-bcfa4865b89548acb8225f910f13d682";
final StopWatch stopWatch = new StopWatch("Ai回答计时");
@@ -1258,16 +1262,45 @@ public class AliOcrUtil {
final MessageManager msgManager = new MessageManager(10);
final Message systemMsg =
Message.builder().role(Role.SYSTEM.getValue()).content("你是一个物流开票员(这句话是给你的角色设定,不要在json信息中返回)").build();
- questionMsg += "请帮我把所有内容封装为JSON,json格式为:{\"shipperName\":\"发货人\",\"shipperMobile\":\"发货电话\",\"receiverName\":\"收货人\",\"receiverMobile\":\"收货电话\",\"weight\":\"重量\",\"count\":\"数量\",\"tips\":\"小费\",\"premium\":\"保费\",\"arrivalStationName\":\"到达站\",\"objectName\":\"物品\"}" +
- "1.没有识别到的字段,赋值\"\";" +
- "2.weight、count、tips、premium这几个字段只返回数字;" +
- "3.只输出1条JSON数据即可,禁止返回除JSON数据外的任何内容!返回的JSON数据不用换行,以最快的速度返回!";
- final Message userMsg = Message.builder().role(Role.USER.getValue()).content(questionMsg).build();
+ final List shipperLogisticsAddressBooks = logisticsAddressBooks.get("shipper");
+ final List receiverLogisticsAddressBooks = logisticsAddressBooks.get("receiver");
+ final StringBuilder endQuestionMsg = new StringBuilder();
+ final StringBuilder shipperQuestionMsg = new StringBuilder("收货人列表:");
+ final StringJoiner shipperQuestionMsgStr = new StringJoiner(",");
+ final StringBuilder receiverQuestionMsg = new StringBuilder("发货人列表:");
+ final StringJoiner receiverQuestionMsgStr = new StringJoiner(",");
+ if (!shipperLogisticsAddressBooks.isEmpty()) {
+ // shipperLogisticsAddressBooks 转逗号分隔字符串
+ for (LogisticsAddressBook shipperLogisticsAddressBook : shipperLogisticsAddressBooks) {
+ shipperQuestionMsgStr.add(shipperLogisticsAddressBook.getShipperOrReceiverName());
+ }
+ shipperQuestionMsg.append(shipperQuestionMsgStr);
+ }
+ if (!receiverLogisticsAddressBooks.isEmpty()) {
+ for (LogisticsAddressBook shipperLogisticsAddressBook : receiverLogisticsAddressBooks) {
+ receiverQuestionMsgStr.add(shipperLogisticsAddressBook.getShipperOrReceiverName());
+ }
+ receiverQuestionMsg.append(receiverQuestionMsgStr);
+ }
+ endQuestionMsg.append(shipperQuestionMsg).append(receiverQuestionMsg)
+ .append("到达站列表: " + arrivalStation + ';')
+ .append("发货物品类型: 1.服装 2.鞋子 3.其他; ")
+ .append("下面一句话\"").append(questionMsg).
+ append("\"是该物流公司人员使用微信小程序实时语音转文字识别的开单信息(部分信息或文字因为是语音转文字可能存在偏差)。")
+ .append("请你按照参考我上面提供的改物流公司收货人列表、到达站列表、发货物品类型信息返回一条开单JSON。 ")
+ .append("JSON格式为:{\"shipperName\":\"发货人\",\"shipperMobile\":\"发货电话\",\"receiverName\":\"收货人\",\"receiverMobile\":\"收货电话\",\"weight\":\"重量\",\"count\":\"数量\",\"tips\":\"小费\",\"premium\":\"保费\",\"arrivalStationName\":\"到达站\",\"objectName\":\"物品\"} ")
+ .append("1.没有识别到的字段,赋值\"\"; ")
+ .append("2.收、发货人信息因为是语音转文字,可能存在不准确性,如果语音信息和上边的实际信息不能完全对应,你可以结合已有的收、发货人列表信息通过拼音或语义的方式判断,如果对应不上则证明是一个新客户,返回语音信息中的内容即可; ")
+ .append("3.到达站信息因为是语音转文字,可能存在不准确性,如果语音信息和上边的实际信息不能完全对应,你可以结合实际信息通过拼音或语义的方式判断,返回的到达站信息必须在我提供的实际到达站信息列表中选取最接近的返回; ")
+ .append("4.weight、count、tips、premium这几个字段只返回数字; ")
+ .append("5.不要返回推理过程,只输出1条JSON数据即可,禁止返回除JSON数据外的任何内容!返回的JSON数据不用换行,以最快的速度返回!");
+ log.info("AI物流最终指令==="+endQuestionMsg);
+ final Message userMsg = Message.builder().role(Role.USER.getValue()).content(endQuestionMsg.toString()).build();
msgManager.add(systemMsg);
msgManager.add(userMsg);
stopWatch.start("开始回答");
final QwenParam param =
- QwenParam.builder().model("qwen-coder-turbo").messages(msgManager.get())
+ QwenParam.builder().model("qwen-max").messages(msgManager.get())
.resultFormat(QwenParam.ResultFormat.MESSAGE)
.build();
final GenerationResult result = gen.call(param);
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml
index f6e36d17..9f0325e6 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml
@@ -10,6 +10,7 @@
+
@@ -70,7 +71,7 @@
- id, create_by, create_time, del_flag, update_by, update_time, category_name, shop_id
+ id, create_by, create_time, del_flag, update_by, update_time, category_name, shop_id, sort