From fa4ef5b3755b5669c9dec08a5fa69f91c298d672 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Thu, 18 Jan 2024 11:36:27 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=B8=8A=E6=9E=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gateway/src/main/resources/jwt.properties | 3 +- .../PlatformTeamAccountController.java | 6 + .../nakadai/controller/ProductController.java | 2 +- .../nakadai/entity/req/AppletCallbackReq.java | 3 + .../nakadai/entity/req/InviteJoinInfo.java | 3 + .../mapper/xml/PlatformTeamAccountMapper.xml | 2 +- .../service/PlatformTeamAccountService.java | 2 + .../impl/PlatformTeamAccountServiceImpl.java | 109 ++++++++++++++---- .../users/mapper/xml/HrUserAccountMapper.xml | 10 +- .../impl/HrUserAccountServiceImpl.java | 5 + 10 files changed, 115 insertions(+), 30 deletions(-) diff --git a/gateway/src/main/resources/jwt.properties b/gateway/src/main/resources/jwt.properties index 4540c90..c136a2e 100644 --- a/gateway/src/main/resources/jwt.properties +++ b/gateway/src/main/resources/jwt.properties @@ -101,4 +101,5 @@ jwt.ignoreUrlList=/users/users/user/captcha,\ /nakadai/tags/tagsList,\ /nakadai/nakadai/partner/schemeManagement/schemeList,\ /nakadai/kindergarten/platformTeamAccount/weChatAppletCallbackByKindergarten,\ - /nakadai/kindergarten/platformTeamAccount/kindergartenWeChatApplication + /nakadai/kindergarten/platformTeamAccount/kindergartenWeChatApplication,\ + /nakadai/kindergarten/platformTeamAccount/loginWithPhoneNumber diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java index 5ecaf65..35d2cb6 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java @@ -229,6 +229,12 @@ public class PlatformTeamAccountController { return platformTeamAccountService.kindergartenWeChatApplication(appletCallbackReq); } + @ApiOperation(value = "幼教产品微信小程序查询手机号登录") + @PostMapping("/loginWithPhoneNumber") + public R loginWithPhoneNumber(@RequestBody @Valid AppletCallbackReq appletCallbackReq) { + return platformTeamAccountService.getUserAccountByPhone(appletCallbackReq); + } + @ApiOperation(value = "获取当前平台用户的团队信息", response = PartnerAccountResp.class) @GetMapping("/getTeamsByPlatformId") public R getTeamsByPlatformId(@ApiParam(name = "platformId", value = "平台id") @RequestParam Integer platformId, HttpServletRequest request) { diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java index 5ecaf89..4fcbcb4 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java @@ -131,7 +131,7 @@ public class ProductController { // product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); product.setShopId(TokenUtils.getShopIdByJwtToken(request)); product.setUpdateTime(new Date()); - if (product.getStatus() == 0) { + if (product.getStatus() == 1) { product.setPutawayTime(new Date()); } product.setCreateTime(new Date()); diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/AppletCallbackReq.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/AppletCallbackReq.java index 7dab0cc..0a6511a 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/req/AppletCallbackReq.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/AppletCallbackReq.java @@ -20,6 +20,9 @@ public class AppletCallbackReq { @ApiModelProperty("平台标识:5幼儿园,6供应商,7个人端") private Integer platformId; + @ApiModelProperty(value = "姓名") + private String name; + @ApiModelProperty("唯一标识") private String openId; diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/req/InviteJoinInfo.java b/nakadai/src/main/java/com/huoran/nakadai/entity/req/InviteJoinInfo.java index 43bfc4a..54352d2 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/req/InviteJoinInfo.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/req/InviteJoinInfo.java @@ -11,6 +11,9 @@ public class InviteJoinInfo { @ApiModelProperty(value = "手机验证码") private String code; + @ApiModelProperty(value = "姓名") + private String name; + @ApiModelProperty(value = "电话") private String phone; diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml index 646f83b..6d4660a 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml @@ -146,7 +146,7 @@ hpa.account_id, a.account, pc.classification_name as teamName, - pc.id as partnerClassificationId, + pc.id as classificationId, pc.is_team, pc.parent_id, pc.create_time as joinTime, diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java b/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java index 4e10acf..9ba66a3 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java @@ -26,6 +26,8 @@ public interface PlatformTeamAccountService extends IService data = new HashedMap(); - UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId()); - //该平台已经注册 - if (userAccount != null){ - data.put("registerId", userAccount.getId()); - data.put("openId", appletCallbackReq.getOpenId()); - return R.ok().put("data",data); - } - if (appletCallbackReq.getPhone()!= null){ - UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(),appletCallbackReq.getPlatformId().toString()); + ArrayList arrayList = new ArrayList<>(); + arrayList.add("5"); + arrayList.add("6"); + for (String platformId : arrayList) { + UserAccount userAccountByPhone = baseMapper.selectAccount(appletCallbackReq.getPhone(), platformId); //根据手机号查询用户 if (userAccountByPhone != null){ if (!userAccountByPhone.getIsEnable()){ throw new CustomException(ExceptionEnum.ACCOUNT_DISABLED); } - //邀请添加用户没有openid,登录更新openId - baseMapper.updateAccountOpenId(appletCallbackReq.getOpenId(),userAccountByPhone.getId()); - //更新登录时间 - baseMapper.updateUserInfo(userAccountByPhone.getUserId()); - data.put("token", JwtUtils.getJwtToken(userAccountByPhone.getId().toString(),getShopId(appletCallbackReq.getOpenId(),appletCallbackReq.getPlatformId()),appletCallbackReq.getPlatformId())); + if (userAccountByPhone.getAppOpenId().equals("0")){ + data.put("platformId", platformId); + //邀请添加用户没有openid,登录更新openId + baseMapper.updateAccountOpenId(appletCallbackReq.getOpenId(),userAccountByPhone.getId()); + //查询个人端账号更新openid + UserAccount userAccount = baseMapper.selectAccount(appletCallbackReq.getPhone(), "7"); + baseMapper.updateAccountOpenId(appletCallbackReq.getOpenId(),userAccount.getId()); + //更新登录时间 + baseMapper.updateUserInfo(userAccountByPhone.getUserId()); + } + data.put("token", JwtUtils.getJwtToken(userAccountByPhone.getId().toString(),getShopId(appletCallbackReq.getOpenId(),Integer.valueOf(platformId)),Integer.valueOf(platformId))); data.put("openId", appletCallbackReq.getOpenId()); - //TODO 团队信息待处理 -// data.put("teamId",platformTeamClassification.getId()); -// data.put("teamName",teamName); + return R.ok().put("data",data); } } + + return R.ok(); + } + + @Override + public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) { + Map data = new HashedMap(); + UserAccount userAccount = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), appletCallbackReq.getPlatformId()); + //该平台已经注册 + if (userAccount != null){ + data.put("registerId", userAccount.getId()); + data.put("openId", appletCallbackReq.getOpenId()); + return R.ok().put("data",data); + } + String randomNumber5 = cn.hutool.core.util.RandomUtil.randomNumbers(5); String randomNumber6 = cn.hutool.core.util.RandomUtil.randomNumbers(6); String randomNumber7 = cn.hutool.core.util.RandomUtil.randomNumbers(7); @@ -216,6 +232,9 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl(). eq("account_id", userAccount.getId())); - manageId = platformTeamAccount.getManageId(); - //被邀请人有合伙人账号,判断是否已经存在当前团队中 + + //被邀请人有团队账号,判断是否已经存在当前团队中 if (ObjectUtil.isNotNull(platformTeamAccount)){ + manageId = platformTeamAccount.getManageId(); List platformTeamList = platformTeamMapper.selectList(new QueryWrapper(). eq("manage_id", platformTeamAccount.getManageId())); - //查询团队下的成员是否存在团队中 List teamMeb = platformTeamClassificationMapper.selectList(new QueryWrapper(). eq("parent_id", inviteJoinInfo.getClassificationId())); @@ -405,6 +424,51 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl 0) { + PlatformTeam platformTeam = new PlatformTeam(); + platformTeam.setManageId(platformTeamAccount.getManageId()); + platformTeam.setClassificationId(platformTeamMeb.getId()); + platformTeamMapper.insert(platformTeam); + } + return insert > 0 ? R.ok() : R.error(); + //拉入当前团队 + }else { + //添加团队管理账号 + PlatformTeamAccount platformTeamAccount1 = new PlatformTeamAccount(); + platformTeamAccount1.setAccountId(userAccount.getId()); + platformTeamAccount1.setPlatformId(inviteJoinInfo.getPlatformId()); + String username = partnerAccountMapper.selectUsername(inviteJoinInfo.getAccountId()); + platformTeamAccount1.setInvitationAccount(username); + baseMapper.insert(platformTeamAccount1); + + PlatformTeamClassification platformTeamAdmin = platformTeamClassificationMapper.selectById(inviteJoinInfo.getClassificationId()); + //新增团队成员 + PlatformTeamClassification platformTeamMeb = new PlatformTeamClassification(); + platformTeamMeb.setIsTeam(0); + platformTeamMeb.setParentId(inviteJoinInfo.getClassificationId()); + platformTeamMeb.setLevel(platformTeamAdmin.getLevel() + 1); + platformTeamMeb.setClassificationName(platformTeamAdmin.getClassificationName()); + int insert = platformTeamClassificationMapper.insert(platformTeamMeb); + + //团队分类 + if (insert > 0) { + PlatformTeam platformTeam = new PlatformTeam(); + platformTeam.setManageId(platformTeamAccount1.getManageId()); + platformTeam.setClassificationId(platformTeamMeb.getId()); + platformTeamMapper.insert(platformTeam); + } + return insert > 0 ? R.ok() : R.error(); } }else { //不存在创建账号,拉入组织 @@ -412,6 +476,7 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl data =(Map) r.get("data"); Integer registerId =(Integer) data.get("registerId"); diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml index 21ebeae..9edae4e 100644 --- a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml @@ -843,7 +843,7 @@ count(u.login_number) as login_number, max(CASE WHEN a.platform_id = 7 THEN u.user_name ELSE NULL END) as user_name, a.work_number, - GROUP_CONCAT(s.platform_name) as platformName, + GROUP_CONCAT( DISTINCT s.platform_name) as platformName, CASE WHEN count(ai.id) > 0 THEN '已认证' ELSE '未认证' @@ -1116,14 +1116,14 @@ ec.audit_status, ta.manage_id FROM - hr_enterprise_certification ec - INNER JOIN hr_user_account hu ON hu.app_open_id = ec.open_id - AND ec.platform_source = hu.platform_id and hu.is_del = 0 + hr_user_account hu + left JOIN hr_enterprise_certification ec ON hu.app_open_id = ec.open_id + AND ec.platform_source = hu.platform_id INNER JOIN k_platform_team_account ta ON ta.account_id = hu.id INNER JOIN k_platform_team pt ON ta.manage_id = pt.manage_id INNER JOIN k_platform_team_classification tc ON tc.id = pt.classification_id and tc.is_del = 0 WHERE - ec.open_id = #{openId} + hu.app_open_id = #{openId} and hu.is_del = 0 diff --git a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java index bc32263..26e015c 100644 --- a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java +++ b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java @@ -426,10 +426,15 @@ public class HrUserAccountServiceImpl extends ServiceImpl Date: Thu, 18 Jan 2024 17:38:47 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=94=BE=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gateway/src/main/resources/jwt.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gateway/src/main/resources/jwt.properties b/gateway/src/main/resources/jwt.properties index c136a2e..c750187 100644 --- a/gateway/src/main/resources/jwt.properties +++ b/gateway/src/main/resources/jwt.properties @@ -102,4 +102,5 @@ jwt.ignoreUrlList=/users/users/user/captcha,\ /nakadai/nakadai/partner/schemeManagement/schemeList,\ /nakadai/kindergarten/platformTeamAccount/weChatAppletCallbackByKindergarten,\ /nakadai/kindergarten/platformTeamAccount/kindergartenWeChatApplication,\ - /nakadai/kindergarten/platformTeamAccount/loginWithPhoneNumber + /nakadai/kindergarten/platformTeamAccount/loginWithPhoneNumber,\ + /nakadai/kindergarten/platformTeamAccount/inviteJoinOrganization From 9515791a36f519166e29d3359dc327500436aa62 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Tue, 23 Jan 2024 18:36:31 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=8E=BB=E9=87=8D=E3=80=81=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=E3=80=81=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/xml/CompetitionMapper.xml | 2 +- .../PlatformTeamAccountController.java | 2 +- .../xml/EnterpriseCertificationMapper.xml | 4 ++ .../impl/PlatformTeamAccountServiceImpl.java | 5 +- .../controller/HrUserAccountController.java | 14 ++++ .../users/entity/res/OrganizationInfo.java | 6 ++ .../users/mapper/HrUserAccountMapper.java | 2 + .../users/mapper/xml/HrUserAccountMapper.xml | 68 +++++++++++++++---- .../users/service/IHrUserAccountService.java | 2 + .../impl/HrUserAccountServiceImpl.java | 12 ++-- 10 files changed, 95 insertions(+), 22 deletions(-) diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml index f464722..07e8fb5 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml @@ -825,7 +825,7 @@ diff --git a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java index 06b2d8b..c2827de 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java +++ b/nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java @@ -110,6 +110,7 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl ids) { + String tips = null; + for (String id : ids) { + int team = iHrUserAccountService.selectTeam(id); + if (team > 0){ + tips = "该用户为组织负责人,删除后会同步删除该组织,确定删除?"; + } + } + return R.ok().put("tips",tips); + } + /** * 查看用户系统绑定详情 */ diff --git a/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java b/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java index 3e50719..f1a0b81 100644 --- a/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java +++ b/users/src/main/java/com/huoran/users/entity/res/OrganizationInfo.java @@ -24,6 +24,12 @@ public class OrganizationInfo { @ApiModelProperty("团队id") private Integer teamId; + @ApiModelProperty("是否团队负责人") + private Integer isTeam; + + @ApiModelProperty("团队父id") + private Integer parentId; + @ApiModelProperty("团队启用禁用") private Integer isEnable; diff --git a/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java index 7f6e2de..c16c4ab 100644 --- a/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java +++ b/users/src/main/java/com/huoran/users/mapper/HrUserAccountMapper.java @@ -63,4 +63,6 @@ public interface HrUserAccountMapper extends BaseMapper { boolean save(Student student); List selectOrganizationInfo(@Param("openId")String openId); + + int selectTeamByOpenId(String id); } diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml index 9edae4e..f01baf2 100644 --- a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml @@ -1100,30 +1100,74 @@ + diff --git a/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java index b98be0e..c2fc42c 100644 --- a/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java +++ b/users/src/main/java/com/huoran/users/service/IHrUserAccountService.java @@ -88,4 +88,6 @@ public interface IHrUserAccountService extends IService { UserInfoDetailsRes viewUserDetails(String openId); R updateAvatars(String openId, String url, String userName,String platformId); + + int selectTeam(String id); } diff --git a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java index 26e015c..c296579 100644 --- a/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java +++ b/users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java @@ -416,7 +416,7 @@ public class HrUserAccountServiceImpl extends ServiceImpl userAccountList = hrUserAccountMapper.selectList(new QueryWrapper() - .eq("app_open_id", openId)); + .eq("app_open_id", openId).orderByDesc("platform_id")); if (userAccountList.size() == 0){ res.setStatus(true); res.setMessage("用户不存在,请先重新登录注册!"); @@ -426,15 +426,10 @@ public class HrUserAccountServiceImpl extends ServiceImpl0 ? R.ok():R.error(); } + @Override + public int selectTeam(String id) { + return baseMapper.selectTeamByOpenId(id); + } + @Override public R oneClickEnableVerification(Integer accountId) { From 0dafc5331f92426f600f917b5b1fcbcd91e7fc43 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Wed, 24 Jan 2024 11:36:13 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E5=95=86=E6=9C=BA=E7=BA=BF=E7=B4=A2?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=EF=BC=8C=E5=95=86=E5=93=81=E5=88=A4=E9=87=8D?= =?UTF-8?q?=EF=BC=8C=E8=A7=84=E6=A0=BC=E5=88=A4=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nakadai/controller/ProductController.java | 37 ++++++++++++++----- .../nakadai/entity/param/ProductParam.java | 7 +++- .../huoran/nakadai/mapper/xml/OrderMapper.xml | 2 +- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java index 4fcbcb4..8ed3bc3 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java @@ -45,6 +45,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; @Api(tags = "商品列表、商品发布管理") @@ -125,11 +126,11 @@ public class ProductController { @PostMapping("/save") @ApiOperation(value = "保存商品信息") public ServerResponseEntity save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { + productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); checkParam(productParam); - Product product = BeanUtil.copyProperties(productParam, Product.class); -// product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); product.setShopId(TokenUtils.getShopIdByJwtToken(request)); +// product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); product.setUpdateTime(new Date()); if (product.getStatus() == 1) { product.setPutawayTime(new Date()); @@ -143,6 +144,7 @@ public class ProductController { @PostMapping("/update") @ApiOperation(value = "修改商品信息") public ServerResponseEntity update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { + productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); checkParam(productParam); Product dbProduct = productService.getProductByProdId(productParam.getProdId()); if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { @@ -233,6 +235,15 @@ public class ProductController { } private void checkParam(ProductParam productParam) { + QueryWrapper productQueryWrapper = new QueryWrapper<>(); + productQueryWrapper.eq("prod_name",productParam.getProdName()); + if (productParam.getProdId()!= null){ + productQueryWrapper.notIn("prod_id",productParam.getProdId()); + } + Product one = productService.getOne(productQueryWrapper); + if (one != null){ + throw new YamiShopBindException("商品名称已存在"); + } // if (CollectionUtil.isEmpty(productParam.getTagList())) { // throw new YamiShopBindException("请选择产品分组"); // } @@ -244,14 +255,20 @@ public class ProductController { // throw new YamiShopBindException("请选择配送方式"); // } List skuList = productParam.getSkuList(); - boolean isAllUnUse = true; - for (Sku sku : skuList) { - if (sku.getStatus() == 1) { - isAllUnUse = false; - } - } - if (isAllUnUse) { - throw new YamiShopBindException("至少要启用一种商品规格"); + List stringList = skuList.stream().map(Sku::getSkuName) + .collect(Collectors.toList()); + long count = stringList.stream().distinct().count(); + if (stringList.size() != count) { + throw new YamiShopBindException("商品规格名称重复"); } +// boolean isAllUnUse = true; +// for (Sku sku : skuList) { +// if (sku.getStatus() == 1) { +// isAllUnUse = false; +// } +// } +// if (isAllUnUse) { +// throw new YamiShopBindException("至少要启用一种商品规格"); +// } } } diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java index c895395..2c81847 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java @@ -76,7 +76,7 @@ public class ProductParam { @ApiModelProperty(value = "简要描述,卖点等") private String brief; - @NotBlank(message = "请选择图片上传") +// @NotBlank(message = "请选择图片上传") @ApiModelProperty(value = "商品主图") private String pic; @@ -90,7 +90,7 @@ public class ProductParam { /** * 商品分类 */ - @NotNull(message = "请选择商品分类") +// @NotNull(message = "请选择商品分类") @ApiModelProperty(value = "商品分类") private Long categoryId; @@ -106,6 +106,9 @@ public class ProductParam { @ApiModelProperty(value = "商品详情") private String content; + @ApiModelProperty(value = "店铺id",hidden = true) + private Integer shopId; + /** * 是否能够用户自提 */ diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml index a086877..9ebf1be 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml @@ -410,7 +410,7 @@ WHEN o.order_type = 2 THEN IFNULL( ec.company_name, ua.account ) WHEN o.order_type = 1 THEN - IFNULL( uai.real_name, ua.account ) + IFNULL( uai.real_name, avatars.account ) END) LIKE CONCAT('%', #{orderParam.queryCriteria} ,'%')) From 5d5f00f84f3864d79d44321aeb78c22549e15751 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Wed, 24 Jan 2024 11:55:06 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml index f01baf2..42e2d57 100644 --- a/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml +++ b/users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml @@ -849,7 +849,7 @@ ELSE '未认证' END as authentication, CASE - WHEN a.platform_id != 7 AND ta.invitation_account IS NULL THEN '自行注册' + WHEN ta.invitation_account IS NULL THEN '自行注册' WHEN a.platform_id != 7 AND ta.invitation_account IS NOT NULL THEN ta.invitation_account ELSE NULL END as accountSource From 6d57d241b90eae605a50a45d80eaa1940a8f4216 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Wed, 24 Jan 2024 17:21:34 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E7=88=86=E6=AC=BE=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/huoran/nakadai/entity/ExplosiveRecommendation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/ExplosiveRecommendation.java b/nakadai/src/main/java/com/huoran/nakadai/entity/ExplosiveRecommendation.java index ccaeeae..a017393 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/ExplosiveRecommendation.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/ExplosiveRecommendation.java @@ -66,7 +66,7 @@ public class ExplosiveRecommendation implements Serializable { private String selectLinkId; @ApiModelProperty(value = "对应链接id的主键(如:选择活动则保存的活动id)") - private Integer correspondingLinkId; + private String correspondingLinkId; @ApiModelProperty(value = "跳转链接") private String jumpLink; From f70a2c853e28ebbc0e5b88d22480db39b9a339b3 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Wed, 24 Jan 2024 17:36:05 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/huoran/nakadai/controller/ProductController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java index 8ed3bc3..754e25e 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java @@ -111,9 +111,9 @@ public class ProductController { @ApiOperation(value = "获取商品信息", response = Product.class) public ServerResponseEntity info(@RequestParam("prodId") Integer prodId, HttpServletRequest request) { Product prod = productService.getProductByProdId(prodId); - if (!Objects.equals(prod.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { - throw new YamiShopBindException("没有权限获取该商品规格信息"); - } +// if (!Objects.equals(prod.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { +// throw new YamiShopBindException("没有权限获取该商品规格信息"); +// } List skuList = skuService.listByProdId(prodId); prod.setSkuList(skuList); From e2dbddb3dadffbf5bf5b6495d190e1bc67511a84 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Thu, 25 Jan 2024 17:00:26 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=88=90=E5=91=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=BA=97=E9=93=BAid=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E4=BC=A0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/nakadai/controller/ProductController.java | 10 +++++----- .../com/huoran/nakadai/entity/param/ProductParam.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java index 754e25e..a5ffe62 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java +++ b/nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java @@ -126,7 +126,7 @@ public class ProductController { @PostMapping("/save") @ApiOperation(value = "保存商品信息") public ServerResponseEntity save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { - productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); +// productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); checkParam(productParam); Product product = BeanUtil.copyProperties(productParam, Product.class); product.setShopId(TokenUtils.getShopIdByJwtToken(request)); @@ -144,7 +144,7 @@ public class ProductController { @PostMapping("/update") @ApiOperation(value = "修改商品信息") public ServerResponseEntity update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { - productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); +// productParam.setShopId(TokenUtils.getShopIdByJwtToken(request)); checkParam(productParam); Product dbProduct = productService.getProductByProdId(productParam.getProdId()); if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { @@ -180,9 +180,9 @@ public class ProductController { */ public ServerResponseEntity delete(Integer prodId,HttpServletRequest request) { Product dbProduct = productService.getProductByProdId(prodId); - if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { - throw new YamiShopBindException("无法获取非本店铺商品信息"); - } +// if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { +// throw new YamiShopBindException("无法获取非本店铺商品信息"); +// } List dbSkus = skuService.listByProdId(dbProduct.getProdId()); // 删除商品 productService.removeProductByProdId(prodId); diff --git a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java index 2c81847..689b362 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java +++ b/nakadai/src/main/java/com/huoran/nakadai/entity/param/ProductParam.java @@ -106,7 +106,7 @@ public class ProductParam { @ApiModelProperty(value = "商品详情") private String content; - @ApiModelProperty(value = "店铺id",hidden = true) + @ApiModelProperty(value = "店铺id") private Integer shopId; /** From e7eff1902d2093f805f394fdf467eda7ebc2d338 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Fri, 26 Jan 2024 10:15:22 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml index 55ea4c9..34ffb6e 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml @@ -137,7 +137,7 @@ AND u.is_del = 0 ) t WHERE - t.id = #{id} + t.id = #{id} GROUP BY id