|
|
|
@ -10,6 +10,7 @@ import com.huoran.common.utils.TokenUtils; |
|
|
|
|
import com.huoran.nakadai.entity.PlatformTeam; |
|
|
|
|
import com.huoran.nakadai.entity.PlatformTeamAccount; |
|
|
|
|
import com.huoran.nakadai.entity.PlatformTeamClassification; |
|
|
|
|
import com.huoran.nakadai.entity.SupplierClassificationConfig; |
|
|
|
|
import com.huoran.nakadai.entity.req.*; |
|
|
|
|
import com.huoran.nakadai.entity.res.PartnerAccountResp; |
|
|
|
|
import com.huoran.nakadai.entity.res.PlatformTeamAccountResp; |
|
|
|
@ -154,9 +155,7 @@ public class PlatformTeamAccountController { |
|
|
|
|
|
|
|
|
|
@GetMapping("/removeOrganization") |
|
|
|
|
@ApiOperation(value = "移除组织") |
|
|
|
|
public R removeOrganization( |
|
|
|
|
@ApiParam(name = "teamId", value = "团队id") @RequestParam Integer teamId, |
|
|
|
|
@ApiParam(name = "manageId", value = "组织id") @RequestParam Integer manageId) { |
|
|
|
|
public R removeOrganization(@ApiParam(name = "teamId", value = "团队id") @RequestParam Integer teamId, @ApiParam(name = "manageId", value = "组织id") @RequestParam Integer manageId) { |
|
|
|
|
PlatformTeamClassification teamClassification = platformTeamClassificationService.getById(teamId); |
|
|
|
|
if (teamClassification.getIsTeam() == 1) { |
|
|
|
|
throw new CustomException(ExceptionEnum.PARTNER_REMOVAL); |
|
|
|
@ -180,8 +179,8 @@ public class PlatformTeamAccountController { |
|
|
|
|
PlatformTeam platformTeam = platformTeamService.getOne(new QueryWrapper<PlatformTeam>().eq("classification_id", teamId)); |
|
|
|
|
PlatformTeamAccount platformTeamAccount = platformTeamAccountService.getById(platformTeam.getManageId()); |
|
|
|
|
int status = 1; |
|
|
|
|
if (isEnable==1){ |
|
|
|
|
status=0; |
|
|
|
|
if (isEnable == 1) { |
|
|
|
|
status = 0; |
|
|
|
|
} |
|
|
|
|
platformTeamClassificationService.updateByAccountId(platformTeamAccount.getAccountId(), status); |
|
|
|
|
return update ? R.ok() : R.error(); |
|
|
|
@ -189,15 +188,13 @@ public class PlatformTeamAccountController { |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "用户列表更新账号状态,禁用整个账号禁止登录,不管是哪个端,哪个组织") |
|
|
|
|
@PostMapping("/updateAccountStatus") |
|
|
|
|
public R updateAccountStatus( |
|
|
|
|
@RequestParam("openId") @ApiParam(value = "openId") String openId, |
|
|
|
|
@RequestParam("isEnable") @ApiParam(value = "是否禁用(1->启用,0->禁用)") Integer isEnable) { |
|
|
|
|
public R updateAccountStatus(@RequestParam("openId") @ApiParam(value = "openId") String openId, @RequestParam("isEnable") @ApiParam(value = "是否禁用(1->启用,0->禁用)") Integer isEnable) { |
|
|
|
|
//根据openId查询账号详情List
|
|
|
|
|
List<UserAccount> userAccountList = platformTeamClassificationService.selectAccountList(openId); |
|
|
|
|
for (UserAccount userAccount : userAccountList) { |
|
|
|
|
//更新账号信息
|
|
|
|
|
platformTeamClassificationService.updateByAccountId(userAccount.getId(), isEnable); |
|
|
|
|
if (Integer.parseInt(userAccount.getPlatformId())!=7){ |
|
|
|
|
if (Integer.parseInt(userAccount.getPlatformId()) != 7) { |
|
|
|
|
//查询账号绑定的组织信息
|
|
|
|
|
List<PlatformTeamAccount> platformTeamAccounts = platformTeamAccountService.list(new QueryWrapper<PlatformTeamAccount>().eq("account_id", userAccount.getId())); |
|
|
|
|
for (PlatformTeamAccount platformTeamAccount : platformTeamAccounts) { |
|
|
|
@ -206,8 +203,8 @@ public class PlatformTeamAccountController { |
|
|
|
|
PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); |
|
|
|
|
platformTeamClassification.setId(platformTeam.getClassificationId()); |
|
|
|
|
int status = 1; |
|
|
|
|
if (isEnable==1){ |
|
|
|
|
status=0; |
|
|
|
|
if (isEnable == 1) { |
|
|
|
|
status = 0; |
|
|
|
|
} |
|
|
|
|
platformTeamClassification.setIsEnable(status); |
|
|
|
|
//更新账号绑定的组织信息
|
|
|
|
@ -257,21 +254,30 @@ public class PlatformTeamAccountController { |
|
|
|
|
|
|
|
|
|
Integer accountId = platformTeamService.getAccountIdByTeamId(teamInfo.getId()); |
|
|
|
|
|
|
|
|
|
//删除原有分类重新新增分类配置信息
|
|
|
|
|
supplierClassificationConfigService.deleteByAccountId(accountId); |
|
|
|
|
//设置分类配置信息中的accountId
|
|
|
|
|
teamInfo.getSupplierClassificationConfigs().forEach(config -> config.setAccountId(accountId)); |
|
|
|
|
|
|
|
|
|
//新增分类配置信息
|
|
|
|
|
supplierClassificationConfigService.saveBatch(teamInfo.getSupplierClassificationConfigs()); |
|
|
|
|
QueryWrapper<SupplierClassificationConfig> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("account_id", accountId); |
|
|
|
|
//删除供应商原有分类重新新增分类配置信息
|
|
|
|
|
List<SupplierClassificationConfig> classificationConfigs = supplierClassificationConfigService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
if (!classificationConfigs.isEmpty()){ |
|
|
|
|
supplierClassificationConfigService.remove(queryWrapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean update = platformTeamClassificationService.updateById(platformTeamClassification); |
|
|
|
|
return update ?R.ok():R.error(); |
|
|
|
|
} |
|
|
|
|
if (teamInfo.getSupplierClassificationConfigs()!=null) { |
|
|
|
|
for (SupplierClassificationConfig config : teamInfo.getSupplierClassificationConfigs()) { |
|
|
|
|
//获取teamInfo.getSupplierClassificationConfigs()第一个账号id
|
|
|
|
|
config.setAccountId(accountId); |
|
|
|
|
} |
|
|
|
|
//新增分类配置信息
|
|
|
|
|
supplierClassificationConfigService.saveBatch(teamInfo.getSupplierClassificationConfigs()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean update = platformTeamClassificationService.updateById(platformTeamClassification); |
|
|
|
|
return update ? R.ok() : R.error(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询团队信息") |
|
|
|
|