上架时间添加

main
cheney 10 months ago
parent 2bcfcb9109
commit fa4ef5b375
  1. 3
      gateway/src/main/resources/jwt.properties
  2. 6
      nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java
  3. 2
      nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java
  4. 3
      nakadai/src/main/java/com/huoran/nakadai/entity/req/AppletCallbackReq.java
  5. 3
      nakadai/src/main/java/com/huoran/nakadai/entity/req/InviteJoinInfo.java
  6. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml
  7. 2
      nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamAccountService.java
  8. 109
      nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamAccountServiceImpl.java
  9. 10
      users/src/main/java/com/huoran/users/mapper/xml/HrUserAccountMapper.xml
  10. 5
      users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java

@ -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

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

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

@ -20,6 +20,9 @@ public class AppletCallbackReq {
@ApiModelProperty("平台标识:5幼儿园,6供应商,7个人端")
private Integer platformId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty("唯一标识")
private String openId;

@ -11,6 +11,9 @@ public class InviteJoinInfo {
@ApiModelProperty(value = "手机验证码")
private String code;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "电话")
private String phone;

@ -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,

@ -26,6 +26,8 @@ public interface PlatformTeamAccountService extends IService<PlatformTeamAccount
R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq);
R getUserAccountByPhone(AppletCallbackReq appletCallbackReq);
R getTeamsByPlatformId(String accountId, Integer platformId);
R pagePlatformTeamAccountList(PlatformTeamAccountListReq req);

@ -1,6 +1,7 @@
package com.huoran.nakadai.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -161,35 +162,50 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco
}
@Override
public R kindergartenWeChatApplication(AppletCallbackReq appletCallbackReq) {
public R getUserAccountByPhone(AppletCallbackReq appletCallbackReq) {
Map<String, Object> data = new HashedMap<String, Object>();
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<String> 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<String, Object> data = new HashedMap<String, Object>();
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<PlatformTeamAcco
userName = "个人" + randomNumber7;
break;
}
if (appletCallbackReq.getName()!=null){
userName = appletCallbackReq.getName();
}
//企业认证获取个人平台手机号进行绑定
UserAccount account = baseMapper.selectAccountByOpenId(appletCallbackReq.getOpenId(), 7);
if (account != null) {
@ -373,7 +392,7 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco
//查询邀请用户是否存在账号
UserAccount userAccount = baseMapper.selectAccount(inviteJoinInfo.getPhone(),inviteJoinInfo.getPlatformId().toString());
Integer manageId ;
Integer manageId = 0;
//邀请人为成员且账号存在,则直接拉入该团队,不可重复拉入
if (userAccount != null) {
//无法加入自己的团队
@ -384,14 +403,14 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco
//查询合伙人账号
PlatformTeamAccount platformTeamAccount = baseMapper.selectOne(new QueryWrapper<PlatformTeamAccount>().
eq("account_id", userAccount.getId()));
manageId = platformTeamAccount.getManageId();
//被邀请人有合伙人账号,判断是否已经存在当前团队中
//被邀请人有团队账号,判断是否已经存在当前团队中
if (ObjectUtil.isNotNull(platformTeamAccount)){
manageId = platformTeamAccount.getManageId();
List<PlatformTeam> platformTeamList = platformTeamMapper.selectList(new QueryWrapper<PlatformTeam>().
eq("manage_id", platformTeamAccount.getManageId()));
//查询团队下的成员是否存在团队中
List<PlatformTeamClassification> teamMeb = platformTeamClassificationMapper.selectList(new QueryWrapper<PlatformTeamClassification>().
eq("parent_id", inviteJoinInfo.getClassificationId()));
@ -405,6 +424,51 @@ public class PlatformTeamAccountServiceImpl extends ServiceImpl<PlatformTeamAcco
}
}
}
//不存在加入当前组织
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(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<PlatformTeamAcco
appletCallbackReq.setPlatformId(inviteJoinInfo.getPlatformId());
appletCallbackReq.setPhone(inviteJoinInfo.getPhone());
appletCallbackReq.setOpenId("0");
appletCallbackReq.setName(inviteJoinInfo.getName());
R r = kindergartenWeChatApplication(appletCallbackReq);
Map<String, Object> data =(Map<String, Object>) r.get("data");
Integer registerId =(Integer) data.get("registerId");

@ -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
</select>
<update id="unbindMobilePhone" parameterType="java.lang.Integer">

@ -426,10 +426,15 @@ public class HrUserAccountServiceImpl extends ServiceImpl<HrUserAccountMapper, H
//查询个人端用户信息
Integer userId = null;
String phone = null;
String platformId = null;
Integer accountId = null;
for (HrUserAccount hrUserAccount : userAccountList) {
if (hrUserAccount.getPlatformId().equals("7")){
userId = hrUserAccount.getUserId();
phone = hrUserAccount.getPhone();
}else {
platformId= hrUserAccount.getPlatformId();
accountId=hrUserAccount.getId();
}
}
HrUserInfo hrUserInfo = hrUserInfoMapper.selectByUserId(userId);

Loading…
Cancel
Save