diff --git a/hiver-core/src/main/java/cc/hiver/core/entity/User.java b/hiver-core/src/main/java/cc/hiver/core/entity/User.java
index 930716b6..94356244 100644
--- a/hiver-core/src/main/java/cc/hiver/core/entity/User.java
+++ b/hiver-core/src/main/java/cc/hiver/core/entity/User.java
@@ -126,6 +126,10 @@ public class User extends HiverBaseEntity {
@ApiModelProperty(value = "鍏ュ簱鍛樻爣璇嗭細0锛氫笉鏄紙鏁版嵁搴撻粯璁わ級锛1锛氭槸锛")
private String warehouseKeeperFlag;
+ @Transient
+ @ApiModelProperty(value = "搴楅摵id")
+ private String shopId;
+
@ApiModelProperty(value = "灏忕▼搴廼d")
private String miniProgramOpenid;
diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
index 0fe45fb8..b06a6cb5 100644
--- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
+++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
@@ -5,7 +5,10 @@ import cc.hiver.base.vo.QRStatusVo;
import cc.hiver.base.vo.RegisterShopVo;
import cc.hiver.core.common.annotation.RateLimiter;
import cc.hiver.core.common.annotation.SystemLog;
-import cc.hiver.core.common.constant.*;
+import cc.hiver.core.common.constant.AppToBConstant;
+import cc.hiver.core.common.constant.SecurityConstant;
+import cc.hiver.core.common.constant.ShopConstant;
+import cc.hiver.core.common.constant.UserConstant;
import cc.hiver.core.common.enums.LogType;
import cc.hiver.core.common.exception.HiverException;
import cc.hiver.core.common.redis.RedisTemplateHelper;
@@ -19,10 +22,8 @@ import cc.hiver.core.service.RoleService;
import cc.hiver.core.service.UserRoleService;
import cc.hiver.core.service.UserService;
import cc.hiver.mall.debt.service.DebtService;
-import cc.hiver.mall.entity.Customer;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.ShopUser;
-import cc.hiver.mall.entity.Supplier;
import cc.hiver.mall.invitelog.constant.InviteLogConstant;
import cc.hiver.mall.invitelog.entity.InviteLog;
import cc.hiver.mall.invitelog.service.InviteLogService;
@@ -360,17 +361,16 @@ public class AuthController {
@ApiOperation("娉ㄥ唽搴楅摵")
public Result register(@Valid RegisterShopVo registerShopVo) {
// 鏂板鐢ㄦ埛琛ㄤ俊鎭
- User user = new User();
+ /*User user = new User();
if (StringUtils.isEmpty(registerShopVo.getMobile())) {
return ResultUtil.error("鎵嬫満鍙蜂笉鑳戒负绌猴紒");
}
if (StringUtils.isEmpty(registerShopVo.getPassword())) {
return ResultUtil.error("瀵嗙爜涓嶈兘涓虹┖锛");
- }
+ }*/
// 涓涓敤鎴峰彲瀛樺湪澶氫釜搴楅摵
- // 鏍规嵁鎵嬫満鍙峰強鐢ㄦ埛绫诲瀷鏌ヨ鏄惁瀛樺湪锛屽鏋滃瓨鍦紝涓嶆柊澧烇紝鍚﹀垯锛屾柊澧炵敤鎴
- final User byMobileAndType = userService.findByMobile(registerShopVo.getMobile());
- if (byMobileAndType != null) {
+ // 鏍规嵁unionid鍙婄敤鎴风被鍨嬫煡璇㈡槸鍚﹀瓨鍦紝濡傛灉瀛樺湪锛屼笉鏂板锛屽惁鍒欙紝鏂板鐢ㄦ埛
+ /*if (byMobileAndType != null) {
user = byMobileAndType;
if (!byMobileAndType.getType().contains(UserConstant.USER_TYPE_NORMAL)) {
// 濡傛灉涓嶅寘鍚紝璧嬩簣搴楅摵瑙掕壊
@@ -401,9 +401,9 @@ public class AuthController {
user.setNickname(registerShopVo.getNickname());
}
user = userService.save(user);
- }
+ }*/
// 榛樿瑙掕壊
- final List
roleList = roleService.findByDefaultRole(true);
+ /* final List roleList = roleService.findByDefaultRole(true);
if (roleList != null && !roleList.isEmpty()) {
for (Role role : roleList) {
final UserRole ur = new UserRole().setUserId(user.getId()).setRoleId(role.getId());
@@ -411,7 +411,11 @@ public class AuthController {
}
}
// 寮傛鍙戦佸垱寤鸿处鍙锋秷鎭
- addMessage.addSendMessage(user.getId());
+ addMessage.addSendMessage(user.getId());*/
+
+ final User byMobileAndType = userService.findByUnionid(registerShopVo.getUnionid());
+ byMobileAndType.setNickname(registerShopVo.getNickname());
+ userService.update(byMobileAndType);
// 鏂板搴楅摵淇℃伅
final Shop shop = new Shop();
shop.setShopName(registerShopVo.getShopName());
@@ -424,7 +428,7 @@ public class AuthController {
shop.setAliName(registerShopVo.getAliName());
shop.setRegion(registerShopVo.getRegion());
shop.setRegionId(registerShopVo.getRegionId());
-
+ shop.setIsStudent(registerShopVo.getIsStudent());
// 1. 鑾峰彇褰撳墠鏃ユ湡 (LocalDate 鍙寘鍚勾鏈堟棩锛屼笉鍖呭惈鏃跺垎绉)
final LocalDate today = LocalDate.now();
@@ -442,8 +446,8 @@ public class AuthController {
shop.setEndTime(formattedFutureDate);
// 搴楅摵搴楅摵鍚嶇О锛屽簵閾哄湴鍧锛屼笌鐢ㄦ埛锛堥粯璁ゅ簵涓伙級鐨勫叧鑱
// 璁剧疆娉ㄥ唽鐢ㄦ埛涓哄簵涓
- shop.setShopOwnerId(user.getId());
-
+ shop.setShopOwnerId(byMobileAndType.getId());
+ shop.setShopMangerId(byMobileAndType.getId());
// 鍒ゆ柇鏄惁浼犻掍簡閭璇蜂汉鍙婇個璇峰簵閾猴紝璁剧疆浜嗙殑璇濓紝鏂板閭璇疯繑浣d俊鎭
if (StringUtils.isNotEmpty(registerShopVo.getInviteUserId()) && StringUtils.isNotEmpty(registerShopVo.getInviteShopId())) {
final InviteLog inviteLog = new InviteLog();
@@ -462,21 +466,22 @@ public class AuthController {
shop.setAttrId(categoryId);
// 20241010 鎵撳嵃鏂瑰紡 瀛楁榛樿缁 0
shop.setPrintingMethod(ShopConstant.PRINTING_METHOD[0]);
+ shop.setContactPhone(registerShopVo.getMobile());
shopService.save(shop);
-
+ shopService.refreshShopCache(shop.getId(), shop.getRegionId());
// 澧炲姞搴楅摵鍜屽憳宸ュ叧鑱旇〃淇℃伅
final ShopUser shopUser = new ShopUser();
- shopUser.setUser(user);
- shopUser.setUserName(user.getUsername());
+ shopUser.setUser(byMobileAndType);
+ shopUser.setUserName(byMobileAndType.getUsername());
shopUser.setShop(shop);
shopUser.setShopName(shop.getShopName());
shopUser.setType(UserConstant.SHOP_USER_ADMIN);
shopUserService.save(shopUser);
// 20240625鏂板榛樿渚涘簲鍟
- final Supplier supplier = new Supplier();
+ /*final Supplier supplier = new Supplier();
supplier.setShopId(shop.getId());
supplier.setConsigneeName("榛樿渚涘簲鍟");
- supplier.setCreateBy(user.getId());
+ supplier.setCreateBy(byMobileAndType.getId());
supplier.setCreateTime(new Date());
supplier.setConsigneeMobile("13222222222");
supplier.setProvince("鏆傛棤");
@@ -487,8 +492,8 @@ public class AuthController {
supplierService.addSupplier(supplier);
// 鍚敤搴楅摵鐨勬椂鍊欓渶瑕佺粰璇ュ簵閾烘柊澧炰竴涓暎瀹㈢殑瀹㈡埛锛
final Customer customer = new Customer();
- customer.setCreateBy(user.getId());
- customer.setCreateByName(user.getNickname());
+ customer.setCreateBy(byMobileAndType.getId());
+ customer.setCreateByName(byMobileAndType.getNickname());
customer.setName("鏁e");
customer.setPhone("13111111111");
customer.setProvince("鏆傛棤");
@@ -496,8 +501,9 @@ public class AuthController {
customer.setArea("鏆傛棤");
customer.setUserName("sanke");
customer.setShopId(shop.getId());
- customerService.addCustomer(customer);
- return ResultUtil.data(user);
+ customerService.addCustomer(customer);*/
+ byMobileAndType.setShopId(shop.getId());
+ return ResultUtil.data(byMobileAndType);
}
@RequestMapping(value = "/chooseShop", method = RequestMethod.POST)
diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
index 32ffb65a..da9d1305 100644
--- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
+++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
@@ -18,11 +18,14 @@ import cc.hiver.core.service.*;
import cc.hiver.core.service.mybatis.IUserRoleService;
import cc.hiver.core.vo.RoleDTO;
import cc.hiver.core.vo.WechatVo;
+import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.ShopArea;
+import cc.hiver.mall.entity.WorkerRelaPrice;
import cc.hiver.mall.service.ShopAreaService;
import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopUserService;
import cc.hiver.mall.service.mybatis.CustomerService;
+import cc.hiver.mall.service.mybatis.WorkerRelaPriceService;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.http.HttpUtil;
import com.google.gson.JsonObject;
@@ -77,6 +80,9 @@ public class UserController {
@Autowired
private ShopAreaService shopAreaService;
+ @Autowired
+ private WorkerRelaPriceService workerRelaPriceService;
+
@Autowired
private DepartmentHeaderService departmentHeaderService;
@@ -628,20 +634,17 @@ public class UserController {
wechatUser.setUsername(username);
final String encryptPass = new BCryptPasswordEncoder().encode("123456");
wechatUser.setPassword(encryptPass);
- wechatUser.setType(UserConstant.USER_TYPE_CUSTOM);
+ wechatUser.setType(UserConstant.USER_TYPE_NORMAL);
wechatUser = userService.save(wechatUser);
// 璁剧疆鐢ㄦ埛瑙掕壊
- final UserRole userRole = new UserRole();
- final PageVo pageVo = new PageVo();
- pageVo.setPageNumber(1);
- pageVo.setPageSize(1);
- final Page roleCustomer = roleService.findByCondition("ROLE_CUSTOMER", PageUtil.initPage(pageVo));
- final Role role = roleCustomer.getContent().get(0);
- //瀹㈡埛瑙掕壊
- userRole.setRoleId(role.getId());
- userRole.setRoleName("瀹㈡埛");
- userRole.setUserId(wechatUser.getId());
- userRoleService.save(userRole);
+ // 榛樿瑙掕壊
+ final List roleList = roleService.findByDefaultRole(true);
+ if (roleList != null && !roleList.isEmpty()) {
+ for (Role role : roleList) {
+ final UserRole ur = new UserRole().setUserId(wechatUser.getId()).setRoleId(role.getId());
+ userRoleService.save(ur);
+ }
+ }
// 鏇存柊瀹㈡埛淇℃伅锛岀粦瀹氱櫥褰曠敤鎴
customerService.updateUserId(wechatVo.getCustomId(), wechatUser.getId());
// 杩斿洖褰撳墠鐧诲綍浜虹殑淇℃伅
@@ -650,15 +653,6 @@ public class UserController {
} catch (Exception e) {
return ResultUtil.error(e.getMessage());
}
- } else {
- // 鏇存柊瀹㈡埛淇℃伅锛岀粦瀹氱櫥褰曠敤鎴
- customerService.updateUserId(wechatVo.getCustomId(), wechatUser.getId());
- final String type = wechatUser.getType();
- if (!type.contains(UserConstant.USER_TYPE_CUSTOM)) {
- // 涓嶅寘鍚紝璧嬩簣涓嬫父瀹㈡埛韬唤
- final String newUserType = StringUtils.isEmpty(type) ? UserConstant.USER_TYPE_CUSTOM : type + ',' + UserConstant.USER_TYPE_CUSTOM;
- wechatUser.setType(newUserType);
- }
}
wechatUser.setUnionid(unionid);
wechatUser.setWechatName(wechatVo.getWechatName());
@@ -666,13 +660,37 @@ public class UserController {
// 缁熶竴鏇存柊灏忕▼搴忕殑涓浜涗俊鎭
userService.save(wechatUser);
// 閿佸畾褰撳墠鐧诲綍鐢ㄦ埛鐨勭被鍨
- wechatUser.setType(wechatVo.getUserType());
+ //wechatUser.setType(wechatVo.getUserType());
final String accessToken = securityUtil.getToken(userService.userToDTO(wechatUser), true);
resultMap.put("accessToken", accessToken);
// 杩斿洖褰撳墠鐧诲綍浜虹殑淇℃伅
resultMap.put("user", wechatUser);
+ Shop shop = shopService.getShopByUserid(wechatUser.getId());
+ if(shop != null){
+ resultMap.put("shop", shop);
+ }
Worker worker = workerService.findByUserId(wechatUser.getId());
+ if(worker.getGetPushOrder() == 1){
+ final List workerRelaPriceList = workerRelaPriceService.selectByWorkerId(worker.getWorkerId());
+ List workerRelaPriceListWaimai = new ArrayList<>();
+ List workerRelaPriceListKuaidi = new ArrayList<>();
+ workerRelaPriceList.forEach(workerRelaPrice -> {
+ if(workerRelaPrice.getGetPushOrder() == 1){
+ if(workerRelaPrice.getOrderType() == 0 ){
+ workerRelaPriceListWaimai.add(workerRelaPrice);
+ }else{
+ workerRelaPriceListKuaidi.add(workerRelaPrice);
+ }
+ }
+ });
+ if(workerRelaPriceListWaimai.size() > 0){
+ resultMap.put("waimaiData", workerRelaPriceListWaimai);
+ }
+ if(workerRelaPriceListKuaidi.size() > 0){
+ resultMap.put("kuaidiData", workerRelaPriceListKuaidi);
+ }
+ }
resultMap.put("worker", worker);
return ResultUtil.data(resultMap);
}
diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/vo/RegisterShopVo.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/vo/RegisterShopVo.java
index e1439185..02919aad 100644
--- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/vo/RegisterShopVo.java
+++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/vo/RegisterShopVo.java
@@ -15,6 +15,10 @@ public class RegisterShopVo {
private String nickname;
+ private Integer isStudent;
+
+ private String unionid;
+
private String password;
private String inviteUserId;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallDeliveryOrderController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallDeliveryOrderController.java
new file mode 100644
index 00000000..071a6bfa
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallDeliveryOrderController.java
@@ -0,0 +1,111 @@
+package cc.hiver.mall.controller;
+
+import cc.hiver.core.common.utils.ResultUtil;
+import cc.hiver.core.common.vo.Result;
+import cc.hiver.mall.entity.MallDeliveryOrder;
+import cc.hiver.mall.pojo.query.MallDeliveryOrderPageQuery;
+import cc.hiver.mall.service.mybatis.MallDeliveryOrderService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 閰嶉佽鍗曟帴鍙
+ */
+@Slf4j
+@RestController
+@Api(tags = "閰嶉佽鍗曟帴鍙")
+@RequestMapping("/hiver/mall/delivery")
+public class MallDeliveryOrderController {
+
+ @Autowired
+ private MallDeliveryOrderService mallDeliveryOrderService;
+
+ /**
+ * 鍒嗛〉鏌ヨ閰嶉佸崟
+ * hallOnly=true 鏃舵煡璇㈡姠鍗曞ぇ鍘咃紙鏈鎺ュ崟鐨勫崟锛
+ */
+ @PostMapping("/page")
+ @ApiOperation(value = "鍒嗛〉鏌ヨ閰嶉佸崟", notes = "hallOnly=true 鏌ヨ鎶㈠崟澶у巺")
+ public Result