Browse Source

标签添加及其他优化

dev
wangfukang 1 year ago
parent
commit
aa444bac51
  1. 13
      hiver-admin/src/main/resources/application.yml
  2. 14
      hiver-admin/test-output/test-report.html
  3. 8
      hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java
  4. 4
      hiver-core/src/main/java/cc/hiver/core/entity/User.java
  5. 9
      hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/mapper/LogisticsAddressBookMapper.java
  6. 21
      hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/LogisticsAddressBookService.java
  7. 34
      hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/impl/LogisticsAddressBookServiceImpl.java
  8. 3
      hiver-core/src/main/java/cc/hiver/core/service/UserService.java
  9. 3
      hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
  10. 115
      hiver-core/src/main/java/cc/hiver/core/vo/ShopUserDto.java
  11. 9
      hiver-core/src/main/resources/mapper/LogisticsAddressBookMapper.xml
  12. 23
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
  13. 2
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
  14. 23
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java
  15. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java
  16. 31
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PurchaseController.java
  17. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
  18. 15
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
  19. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java
  20. 11
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java
  21. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java
  22. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java
  23. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java
  24. 54
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ShopUserDtoTwo.java
  25. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/PurchasePageQuery.java
  26. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo.java
  27. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java
  28. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleAllVO.java
  29. 111
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmController.java
  30. 53
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/controller/PurchaseConfirmDetailsController.java
  31. 46
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirm.java
  32. 40
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/entity/PurchaseConfirmDetails.java
  33. 32
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmDetailsMapper.java
  34. 30
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/mapper/PurchaseConfirmMapper.java
  35. 29
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmDetailsService.java
  36. 45
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/PurchaseConfirmService.java
  37. 46
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmDetailsServiceImpl.java
  38. 133
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/service/impl/PurchaseConfirmServiceImpl.java
  39. 35
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseconfirm/vo/PurchaseConfirmVo.java
  40. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java
  41. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java
  42. 9
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
  43. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnDetailMapper.java
  44. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java
  45. 18
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java
  46. 28
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java
  47. 29
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
  48. 1
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java
  49. 49
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java
  50. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
  51. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/urlmapping/mapper/UrlMappingMapper.java
  52. 79
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
  53. 44
      hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml
  54. 40
      hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseConfirmDetailsMapper.xml
  55. 135
      hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseConfirmMapper.xml
  56. 21
      hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml

13
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

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

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a>
</li>
<li class="m-r-10">
<a href="#"><span class="badge badge-primary">三月 07, 2025 14:48:44</span></a>
<a href="#"><span class="badge badge-primary">三月 26, 2025 17:18:30</span></a>
</li>
</ul>
</div>
@ -84,7 +84,7 @@
<div class="test-detail">
<span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p>
<p class="text-sm"><span>14:48:44 下午</span> / <span>0.017 secs</span></p>
<p class="text-sm"><span>17:18:30 下午</span> / <span>0.017 secs</span></p>
</div>
<div class="test-contents d-none">
<div class="detail-head">
@ -92,8 +92,8 @@
<div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>03.07.2025 14:48:44</span>
<span class='badge badge-danger'>03.07.2025 14:48:44</span>
<span class='badge badge-success'>03.26.2025 17:18:30</span>
<span class='badge badge-danger'>03.26.2025 17:18:30</span>
<span class='badge badge-default'>0.017 secs</span>
</div>
<div class="m-t-10 m-l-5"></div>
@ -104,7 +104,7 @@
<tbody>
<tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td>
<td>14:48:44</td>
<td>17:18:30</td>
<td>
Test passed
</td>
@ -128,13 +128,13 @@
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Started</p>
<h3>三月 07, 2025 14:48:44</h3>
<h3>三月 26, 2025 17:18:30</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>三月 07, 2025 14:48:44</h3>
<h3>三月 26, 2025 17:18:30</h3>
</div></div>
</div>
<div class="col-md-3">

8
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<User, String> {
@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<User> 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<ShopUserDto> findByShopId(String shopId);
@Query("select u from User u where u.unionid = ?1 ")
User findByUnionid(String unionid);

4
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;

9
hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/mapper/LogisticsAddressBookMapper.java

@ -17,4 +17,13 @@ public interface LogisticsAddressBookMapper extends BaseMapper<LogisticsAddressB
* @return List<LogisticsAddressBook>
*/
List<LogisticsAddressBook> getLogisticsAddressBookList(@Param("queryParams") LogisticsAddressBookQueryVo logisticsAddressBookQueryVo);
/**
* 获取店铺下收发货人信息
* @author 王富康
* @date 2025/3/18
* @param companyId
* @return List<LogisticsAddressBook>
*/
List<LogisticsAddressBook> getByCompanyId(@Param("companyId") String companyId);
}

21
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<LogisticsAddressBook> {
@ -19,19 +20,31 @@ public interface LogisticsAddressBookService extends IService<LogisticsAddressBo
/**
* 根据姓名可拼音匹配或者手机号模糊查询地址列表
* @author 王富康
* @date 2024/10/8
*
* @param logisticsAddressBookQueryVo
* @return JSONObject
* @author 王富康
* @date 2024/10/8
*/
JSONObject getLogisticsAddressBookList(LogisticsAddressBookQueryVo logisticsAddressBookQueryVo);
/**
* 获取订单中收货人及发货人信息
* @author 王富康
* @date 2024/10/15
*
* @param logisticsOrder
* @return Map<LogisticsAddressBook>
* @author 王富康
* @date 2024/10/15
*/
Map<String, LogisticsAddressBook> getByOrder(LogisticsOrder logisticsOrder);
/**
* 获取店铺下收发货人信息
*
* @param companyId
* @return Map<List < LogisticsAddressBook>>
* @author 王富康
* @date 2025/3/18
*/
Map<String, List<LogisticsAddressBook>> getByCompanyId(String companyId);
}

34
hiver-core/src/main/java/cc/hiver/core/logisticsaddressbook/service/impl/LogisticsAddressBookServiceImpl.java

@ -200,4 +200,38 @@ public class LogisticsAddressBookServiceImpl extends ServiceImpl<LogisticsAddres
return logisticsAddressBookMap;
}
/**
* 获取店铺下收发货人信息
* @author 王富康
* @date 2025/3/18
* @param companyId
* @return Map<List<LogisticsAddressBook>>
*/
@Override
public Map<String, List<LogisticsAddressBook>> getByCompanyId(String companyId) {
// 获取店铺下收发货人信息
final List<LogisticsAddressBook> logisticsAddressBookList = logisticsAddressBookMapper.getByCompanyId(companyId);
final Map<String, List<LogisticsAddressBook>> logisticsAddressBookMap = new HashMap<>();
for (LogisticsAddressBook logisticsAddressBook : logisticsAddressBookList) {
if(1 == logisticsAddressBook.getAddressType()){
if(logisticsAddressBookMap.containsKey("shipper")){
logisticsAddressBookMap.get("shipper").add(logisticsAddressBook);
}else{
final List<LogisticsAddressBook> 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<LogisticsAddressBook> logisticsAddressBooks = new ArrayList<>();
logisticsAddressBooks.add(logisticsAddressBook);
logisticsAddressBookMap.put("receiver",logisticsAddressBooks);
}
}
}
return logisticsAddressBookMap;
}
}

3
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, String> {
User findByUserNameAndType(String userName,String type);
User findByMobileAndType(String mobile,String type);
List<User> findByShopId(String shopId);
List<ShopUserDto> findByShopId(String shopId);
/**
* 公众号关注

3
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<User> findByShopId(String shopId) {
public List<ShopUserDto> findByShopId(String shopId) {
return userDao.findByShopId(shopId);
}

115
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;
}
}

9
hiver-core/src/main/resources/mapper/LogisticsAddressBookMapper.xml

@ -181,4 +181,13 @@
t.create_time desc
</select>
<select id="getByCompanyId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_logistics_address_book
where company_id = #{queryParams.companyId}
ORDER BY
create_time desc
</select>
</mapper>

23
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){

2
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) {

23
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<List<User>> findAllUserByShopId() {
public Result<List<ShopUserDto>> findAllUserByShopId() {
final String shopId = securityUtil.getShopId();
final List<User> users = userService.findByShopId(shopId);
return new ResultUtil<List<User>>().setData(users);
final List<ShopUserDto> users = userService.findByShopId(shopId);
return new ResultUtil<List<ShopUserDto>>().setData(users);
}
}

8
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);

31
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<PurchaseConfirmVo> purchaseConfirmVos = purchaseService.notConfirmPurductCountGroup(type,supplierId);
return ResultUtil.data(purchaseConfirmVos);
}
}

8
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());

15
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<ShopUser> 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<ShopUser> 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);

6
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<ShopUser, String> {
@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<ShopUser> 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<ShopUserDtoTwo> selectByUserId(Integer status, String startTime, String endTime, String userId);
/**
* 根据店铺id获取店铺和店员关系集合

11
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java

@ -81,4 +81,15 @@ public interface PurchaseMapper extends BaseMapper<Purchase> {
* @param purchasePageQuery
*/
List<ProductDataVo> 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);
}

3
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;
}

27
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;
}

5
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 = "搜索关键字")

54
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;
}
}

3
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;
}

3
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<ProductAttributeOfAddVo> productAttributeOfAddVos;

3
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;
}

3
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;
}

111
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<PurchaseConfirm> 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<PurchaseConfirmVo> purchaseConfirmDetails = purchaseConfirmService.getPurchaseConfirmDetailsByProductId(productId);
return new ResultUtil<>().setData(purchaseConfirmDetails);
}
}

53
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("更新失败!");
}
}
}

46
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<PurchaseConfirmDetails> purchaseConfirmDetailsList;
}

40
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;
}

32
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<PurchaseConfirmDetails> {
/**
* 根据入库确认表子表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<PurchaseConfirmDetails>
*/
List<PurchaseConfirmDetails> getDetailsByPurchaseConfirmIds(@Param("purchaseConfirmIds") List<String> purchaseConfirmIds);
void deleteByPurchaseId(@Param("purchaseId") String purchaseId);
}

30
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<PurchaseConfirm> {
boolean updatePurchaseConfirmDelFlag(String id, String s);
Integer notConfirmPurductCount( @Param("supplierId") String supplierId);
List<PurchaseConfirmVo> purchaseNotConfirmPurductCount(@Param("supplierId") String supplierId);
List<PurchaseConfirmVo> productNotConfirmPurductCount(@Param("supplierId") String supplierId);
int shopNotConfirmPurductCount(@Param("shopId") String shopId);
List<PurchaseConfirmVo> supplierNotConfirmPurductCount(@Param("supplierIdList") List<String> supplierIds);
List<PurchaseConfirm> selectByPurchaseId(@Param("purchaseId") String purchaseId);
List<PurchaseConfirmVo> getPurchaseConfirmDetailsByProductId(@Param("productId")String productId);
void deleteByPurchaseId(@Param("purchaseId") String purchaseId);
}

29
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<PurchaseConfirmDetails> {
/**
* 根据入库确认表子表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<PurchaseConfirmDetails>
*/
List<PurchaseConfirmDetails> getDetailsByPurchaseConfirmIds(List<String> purchaseConfirmIds);
void deleteByPurchaseId(String purchaseId);
}

45
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<PurchaseConfirm> {
/**
* 删除货号规则
*
* @param id
* @return boolean
* @author 王富康
* @date 2024/6/1
*/
boolean deletePurchaseConfirm(String id);
Integer notConfirmPurductCount(String supplierId);
List<PurchaseConfirmVo> purchaseNotConfirmPurductCount(String supplierId);
List<PurchaseConfirmVo> productNotConfirmPurductCount(String supplierId);
int shopNotConfirmPurductCount(String shopId);
List<PurchaseConfirmVo> supplierNotConfirmPurductCount(List<String> supplierIds);
void addPurchaseConfirm(PurchaseConfirm purchaseConfirm);
/**
* 根据入库单id查询入库确认表
* @author 王富康
* @date 2025/3/14
* @param purchaseId
* @return List<PurchaseConfirm>
*/
List<PurchaseConfirm> getPurchaseConfirmByPurchaseId(String purchaseId);
List<PurchaseConfirmVo> getPurchaseConfirmDetailsByProductId(String productId);
void deleteByPurchaseId(String purchaseId);
}

46
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<PurchaseConfirmDetailsMapper, PurchaseConfirmDetails> 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<PurchaseConfirmDetails>
*/
@Override
public List<PurchaseConfirmDetails> getDetailsByPurchaseConfirmIds(List<String> purchaseConfirmIds) {
return purchaseConfirmDetailsMapper.getDetailsByPurchaseConfirmIds(purchaseConfirmIds);
}
@Override
public void deleteByPurchaseId(String purchaseId) {
purchaseConfirmDetailsMapper.deleteByPurchaseId(purchaseId);
}
}

133
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<PurchaseConfirmMapper, PurchaseConfirm> 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<PurchaseConfirmVo> purchaseNotConfirmPurductCount(String supplierId) {
return purchaseConfirmMapper.purchaseNotConfirmPurductCount(supplierId);
}
@Override
public List<PurchaseConfirmVo> productNotConfirmPurductCount(String supplierId) {
return purchaseConfirmMapper.productNotConfirmPurductCount(supplierId);
}
@Override
public int shopNotConfirmPurductCount(String shopId) {
return purchaseConfirmMapper.shopNotConfirmPurductCount(shopId);
}
@Override
public List<PurchaseConfirmVo> supplierNotConfirmPurductCount(List<String> 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<PurchaseConfirmDetails> 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<PurchaseConfirm>
*/
@Override
public List<PurchaseConfirm> getPurchaseConfirmByPurchaseId(String purchaseId) {
final List<PurchaseConfirm> purchaseConfirms = purchaseConfirmMapper.selectByPurchaseId(purchaseId);
// 查询子表信息。
final List<String> purchaseConfirmIds = new ArrayList<>();
for (PurchaseConfirm purchaseConfirm : purchaseConfirms) {
purchaseConfirmIds.add(purchaseConfirm.getId());
}
// 根据purchaseConfirmIds 查询子表信息
final List<PurchaseConfirmDetails> purchaseConfirmDetailsList = purchaseConfirmDetailsService.getDetailsByPurchaseConfirmIds(purchaseConfirmIds);
final Map<String,List<PurchaseConfirmDetails>> purchaseConfirmDetailMap = new HashMap<>();
for (PurchaseConfirmDetails purchaseConfirmDetails : purchaseConfirmDetailsList) {
final String purchaseConfirmId = purchaseConfirmDetails.getPurchaseConfirmId();
if(purchaseConfirmDetailMap.containsKey(purchaseConfirmId)){
purchaseConfirmDetailMap.get(purchaseConfirmId).add(purchaseConfirmDetails);
}else{
final List<PurchaseConfirmDetails> 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<PurchaseConfirmVo> getPurchaseConfirmDetailsByProductId(String productId) {
return purchaseConfirmMapper.getPurchaseConfirmDetailsByProductId(productId);
}
@Override
public void deleteByPurchaseId(String purchaseId) {
purchaseConfirmMapper.deleteByPurchaseId(purchaseId);
}
}

35
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;
}

4
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);
}
}

2
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);
}

9
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<LogisticsOrderOfAiVo> logisticsOrderOfAiVos = new ArrayList<>();
try {
final JSONObject jsonObject = AliOcrUtil.callWithMessageOfLogisticsOrder(questionMsg);
LogiticsCompany currCompany = securityUtil.getCurrCompany();
// 获取收货人列表
final Map<String, List<LogisticsAddressBook>> 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);

2
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<PurchaseReturnDetail> {
List<PurchaseReturnDetail> getByPurchaseReturnId(@Param("id") String id);

2
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<PurchaseReturn> {
/**

18
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<Purchase> {
Page<DebtSupplier> getDebtByShopId(PurchasePageQuery purchasePageQuery);
@ -88,4 +90,20 @@ public interface PurchaseService extends IService<Purchase> {
* @param purchasePageQuery
*/
SupplierDataVo getSupplierPurchaseInfo(PurchasePageQuery purchasePageQuery);
/**
* 根据供应商id未发货总数
* @author 王富康
* @date 2025/3/9
* @param supplierId
* @return Integer
*/
Integer notConfirmPurductCount(String supplierId);
List<PurchaseConfirmVo> notConfirmPurductCountGroup(String type, String supplierId);
int shopNotConfirmPurductCount(String shopId);
void updataStoreFlag(String id,int storeFlag);
}

28
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<ShopUser> 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<ShopUser> selectByUserId(String userId) {
final String nowDate = DateUtil.format(new Date(), "yyyy-MM-dd");
final List<ShopUserDtoTwo> shopUserDtoTwos = shopUserDao.selectByUserId(ShopConstant.SHOP_STATUS_NORMAL, nowDate, nowDate, userId);
final List<ShopUser> 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<ShopUser>
* @author 王富康
* @date 2023/10/28
*/
public List<ShopUser> findByShopId(String shopId){
@Override
public List<ShopUser> findByShopId(String shopId) {
return shopUserDao.findByShopId(shopId);
}

29
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<Supplier, String> getRepository() {
return supplierDao;
@ -116,6 +118,20 @@ public class SupplierServiceImpl implements SupplierService {
supplier.setNoEarn(debt.getAmountOwed());
}
});
// 获取供应商欠货数量
final List<PurchaseConfirmVo> purchaseConfirmVos = purchaseConfirmService.supplierNotConfirmPurductCount(idList);
final Map<String, PurchaseConfirmVo> 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) {

1
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java

@ -61,6 +61,7 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
}
productCategory.setCategoryName(productCategoryVo.getCategoryName());
productCategory.setSort(productCategoryVo.getSort());
productCategoryMapper.insert(productCategory);
// 新增类别

49
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java

@ -13,6 +13,9 @@ import cc.hiver.mall.entity.*;
import cc.hiver.mall.pojo.dto.DebtSupplier;
import cc.hiver.mall.pojo.query.PurchasePageQuery;
import cc.hiver.mall.pojo.vo.*;
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.purchaseocr.entity.PurchaseOcrPicture;
import cc.hiver.mall.purchaseocr.service.PurchaseOcrPictureService;
import cc.hiver.mall.purchaseocr.vo.PurchaseOcrCountVo;
@ -67,13 +70,13 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> 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<PurchaseMapper, Purchase> i
final String purchaseId = purchaseDetail.getPurchaseId();
final String productId1 = purchaseDetail.getProductId();
if (stockLogMap.containsKey(purchaseId)) {
int purductCount = 0;
int productCount = 0;
final List<StockLog> stockLogList1 = stockLogMap.get(purchaseId);
for (StockLog stockLog : stockLogList1) {
if (productId1.equals(stockLog.getProductId())) {
purductCount += stockLog.getProductCount();
productCount += stockLog.getProductCount();
final List<StockLog> stockLogList11 = purchaseDetail.getStockLogList1();
if (stockLogList11 == null) {
final List<StockLog> stockLogListNew = new ArrayList<>();
@ -295,7 +298,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
}
}
// 将采购单明细中的数量放到采购单上
purchaseDetail.setProductCount(purductCount);
purchaseDetail.setProductCount(productCount);
}
}
}
@ -575,11 +578,11 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
final String purchaseId = purchaseDetail.getPurchaseId();
final String productId1 = purchaseDetail.getProductId();
if (stockLogMap.containsKey(purchaseId)) {
int purductCount = 0;
int productCount = 0;
final List<StockLog> stockLogList1 = stockLogMap.get(purchaseId);
for (StockLog stockLog : stockLogList1) {
if (productId1.equals(stockLog.getProductId())) {
purductCount += stockLog.getProductCount();
productCount += stockLog.getProductCount();
final List<StockLog> stockLogList11 = purchaseDetail.getStockLogList1();
if (stockLogList11 == null) {
final List<StockLog> stockLogListNew = new ArrayList<>();
@ -591,7 +594,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
}
}
// 将采购单明细中的数量放到采购单上
purchaseDetail.setProductCount(purductCount);
purchaseDetail.setProductCount(productCount);
}
}
}
@ -753,6 +756,9 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
purchaseService.deleteById(id);
// 2. 将订单详情设置为删除状态
purchaseDetailService.deleteByPurchaseId(id);
// 将入库确认表及入库确认子表删除掉
purchaseConfirmService.deleteByPurchaseId(id);
purchaseConfirmDetailsService.deleteByPurchaseId(id);
}
@Override
@ -787,4 +793,29 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
supplierDataVo.setProductDataVos(purchaseCount);
return supplierDataVo;
}
@Override
public Integer notConfirmPurductCount(String supplierId) {
return purchaseConfirmService.notConfirmPurductCount(supplierId);
}
@Override
public List<PurchaseConfirmVo> 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);
}
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java

@ -1189,7 +1189,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> 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;

2
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<UrlMapping> {
}

79
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<Product> byProductSn = productService.getByProductSn(productSn, shopId,"");
final CopyOnWriteArrayList<Product> 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<String, List<LogisticsAddressBook>> 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<LogisticsAddressBook> shipperLogisticsAddressBooks = logisticsAddressBooks.get("shipper");
final List<LogisticsAddressBook> 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);

44
hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml

@ -10,6 +10,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="category_name" jdbcType="VARCHAR" property="categoryName" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="sort" jdbcType="VARCHAR" property="sort" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -70,7 +71,7 @@
</where>
</sql>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.ProductCategoryExample" resultMap="BaseResultMap">
select
@ -105,10 +106,10 @@
<insert id="insert" parameterType="cc.hiver.mall.entity.ProductCategory">
insert into t_product_category (id, create_by, create_time,
del_flag, update_by, update_time,
category_name, shop_id)
category_name, shop_id,sort)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{categoryName,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR})
#{categoryName,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{sort,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.ProductCategory">
insert into t_product_category
@ -137,6 +138,10 @@
<if test="shopId != null">
shop_id,
</if>
<if test="sort != null">
sort,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -163,6 +168,9 @@
<if test="shopId != null">
#{shopId,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="cc.hiver.mall.entity.ProductCategoryExample" resultType="java.lang.Long">
@ -198,6 +206,9 @@
<if test="record.shopId != null">
shop_id = #{record.shopId,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -212,7 +223,8 @@
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
category_name = #{record.categoryName,jdbcType=VARCHAR},
shop_id = #{record.shopId,jdbcType=VARCHAR}
shop_id = #{record.shopId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -241,6 +253,9 @@
<if test="shopId != null">
shop_id = #{shopId,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -252,20 +267,21 @@
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
category_name = #{categoryName,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=VARCHAR}
shop_id = #{shopId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="selectByShopId" parameterType="java.lang.String" resultType="cc.hiver.mall.pojo.vo.ProductCategoryVo">
select
id as category_id,category_name,shop_id
id as category_id,category_name,shop_id,sort
from t_product_category
where shop_id = #{shopId,jdbcType=VARCHAR}
</select>
<select id="selectByCategoryIdList" parameterType="java.lang.String" resultType="cc.hiver.mall.pojo.vo.ProductCategoryVo">
select
id as category_id,category_name,shop_id
id as category_id,category_name,shop_id,sort
from t_product_category
where id in
<foreach close=")" collection="categoryIdList" item="listItem" open="(" separator=",">
@ -275,7 +291,7 @@
<select id="getDefaultCategory" parameterType="java.lang.String" resultType="cc.hiver.mall.pojo.vo.ProductCategoryVo">
select
id as category_id,category_name,shop_id
id as category_id,category_name,shop_id,sort
from t_product_category
where shop_id = #{shopId,jdbcType=VARCHAR}
and category_name = '默认分类'
@ -294,7 +310,8 @@
dd.create_time,
dd.update_by,
dd.update_time,
dd.del_flag
dd.del_flag,
dd.sort
FROM
t_product_category dd
LEFT JOIN (
@ -327,6 +344,13 @@
WHERE
dd.shop_id = #{shopId,jdbcType=VARCHAR}
GROUP BY
dd.id
dd.id
order by
CASE
WHEN dd.sort IS NULL OR dd.sort = '' THEN 1
ELSE 0
END,
dd.sort ASC,
dd.create_time
</select>
</mapper>

40
hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseConfirmDetailsMapper.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmDetailsMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="purchase_confirm_id" jdbcType="VARCHAR" property="purchaseConfirmId" />
<result column="product_id" jdbcType="VARCHAR" property="productId" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="product_sn" jdbcType="VARCHAR" property="productSn" />
<result column="product_count" jdbcType="INTEGER" property="productCount" />
</resultMap>
<sql id="Base_Column_List">
id, purchase_confirm_id, product_id, product_name,product_sn,product_count
</sql>
<!-- -->
<update id="updateProductCount" parameterType="java.lang.String">
update t_purchase_confirm_details
set product_count = #{productCount,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="getDetailsByPurchaseConfirmIds" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_purchase_confirm_details
where product_count > 0
and purchase_confirm_id in
<foreach close=")" collection="purchaseConfirmIds" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</select>
<delete id="deleteByPurchaseId" parameterType="java.lang.String">
delete from t_purchase_confirm_details
where purchase_confirm_id in (
select id from t_purchase_confirm where purchase_id = #{purchaseId,jdbcType=VARCHAR}
)
</delete>
</mapper>

135
hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseConfirmMapper.xml

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="purchase_id" jdbcType="VARCHAR" property="purchaseId" />
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
<result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
<result column="purchase_time" jdbcType="INTEGER" property="purchaseTime" />
</resultMap>
<sql id="Base_Column_List">
id, create_by,create_by_name, create_time, del_flag, update_by, update_time,purchase_id,supplier_id,supplier_name,purchase_time
</sql>
<!-- -->
<update id="updatePurchaseConfirmDelFlag" parameterType="java.lang.String">
update t_purchase_confirm
set del_flag = #{delFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="notConfirmPurductCount" resultType="java.lang.Integer">
SELECT
COALESCE(SUM(pcd.product_count), 0) AS total_product_count
FROM
t_purchase_confirm_details pcd
JOIN
t_purchase_confirm pc ON pcd.purchase_confirm_id = pc.id
WHERE
pc.supplier_id = #{supplierId,jdbcType=VARCHAR}
</select>
<select id="purchaseNotConfirmPurductCount" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo">
SELECT
pc.purchase_id,
pc.create_by_name,
pc.purchase_time,
COALESCE(SUM(pcd.product_count), 0) AS total_unshipped_count
FROM
t_purchase_confirm pc
JOIN
t_purchase_confirm_details pcd ON pc.id = pcd.purchase_confirm_id
WHERE
pcd.product_count > 0 -- 未发货的记录
AND pc.supplier_id = #{supplierId,jdbcType=VARCHAR}
GROUP BY
pc.purchase_id,pc.create_by_name,pc.purchase_time;
</select>
<select id="productNotConfirmPurductCount" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo">
SELECT
pcd.product_id,
pcd.product_name,
pcd.product_sn,
COALESCE(SUM(pcd.product_count), 0) AS total_unshipped_count
FROM
t_purchase_confirm pc
JOIN
t_purchase_confirm_details pcd ON pc.id = pcd.purchase_confirm_id
WHERE
pcd.product_count > 0
AND pc.supplier_id = #{supplierId,jdbcType=VARCHAR}
GROUP BY
pcd.product_id,
pcd.product_name,
pcd.product_sn;
</select>
<select id="shopNotConfirmPurductCount" resultType="java.lang.Integer">
SELECT
COALESCE(SUM(pcd.product_count), 0) AS total_product_count
FROM
t_purchase_confirm_details pcd
JOIN
t_purchase_confirm pc ON pcd.purchase_confirm_id = pc.id
JOIN
t_purchase p ON pc.purchase_id = p.id
WHERE
p.shop_id = #{shopId,jdbcType=VARCHAR}
</select>
<select id="supplierNotConfirmPurductCount" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo">
SELECT
pc.supplier_id,
COALESCE(SUM(pcd.product_count), 0) AS total_unshipped_count
FROM
t_purchase_confirm pc
JOIN
t_purchase_confirm_details pcd ON pc.id = pcd.purchase_confirm_id
WHERE
pcd.product_count > 0 -- 未发货的记录
AND pc.supplier_id in
<foreach close=")" collection="supplierIdList" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
GROUP BY
pc.supplier_id; -- 根据 t_purchase_confirm_details 的 product_id 分组
</select>
<select id="selectByPurchaseId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_purchase_confirm a
where a.purchase_id = #{purchaseId,jdbcType=VARCHAR}
</select>
<select id="getPurchaseConfirmDetailsByProductId" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo">
SELECT
pcd.id as purchase_confirmdetails_id,
pcd.product_id,
pcd.product_name,
pcd.product_sn,
COALESCE(pcd.product_count, 0) AS total_unshipped_count,
pc.purchase_time,
pc.create_by_name
FROM
t_purchase_confirm_details pcd
left JOIN
t_purchase_confirm pc ON pc.id = pcd.purchase_confirm_id
WHERE
pcd.product_count > 0
AND pcd.product_id = #{productId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPurchaseId" parameterType="java.lang.String">
delete from t_purchase_confirm
where purchase_id = #{purchaseId,jdbcType=VARCHAR}
</delete>
</mapper>

21
hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml

@ -490,6 +490,10 @@
and supplier_id = #{queryParams.supplierId}
</if>
<if test="queryParams.storeFlag != null and queryParams.storeFlag != ''">
and store_flag = #{queryParams.storeFlag}
</if>
<if test="queryParams.searchStr != null and queryParams.searchStr != ''">
and (id in(
select purchase_id from t_purchase_detail
@ -643,4 +647,21 @@
dd.product_id
</select>
<select id="shopNotConfirmPurductCount" resultType="java.lang.Integer">
SELECT
count(*) count
FROM
t_purchase tp
WHERE
tp.del_flag ='0'
and tp.store_flag = '1'
and tp.shop_id = #{shopId,jdbcType=VARCHAR}
</select>
<update id="updataStoreFlag" >
update t_purchase
set
store_flag = #{storeFlag,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save