|
@@ -71,10 +71,10 @@ public class TAdminController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
TWechatService wechatService;
|
|
TWechatService wechatService;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
TAreaService areaService;
|
|
TAreaService areaService;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
CitiesService citiesService;
|
|
CitiesService citiesService;
|
|
|
|
|
|
@@ -146,14 +146,9 @@ public class TAdminController {
|
|
@Transactional
|
|
@Transactional
|
|
@Audit(type = AuditEnum.INSERT, content = "#loginUser.name + '添加账号'")
|
|
@Audit(type = AuditEnum.INSERT, content = "#loginUser.name + '添加账号'")
|
|
public ResponseModel<?> addLoginUser(@RequestBody @Valid AddLoginUserParam param) {
|
|
public ResponseModel<?> addLoginUser(@RequestBody @Valid AddLoginUserParam param) {
|
|
- if (StringUtils.isEmpty(param.getEquipmentIds())) {
|
|
|
|
- return R.fail(ResponseCodesEnum.A0001, "机器不能为空");
|
|
|
|
- }
|
|
|
|
if (param.getRoleList().size() < 1) {
|
|
if (param.getRoleList().size() < 1) {
|
|
return R.fail(ResponseCodesEnum.A0001, "角色不能为空");
|
|
return R.fail(ResponseCodesEnum.A0001, "角色不能为空");
|
|
}
|
|
}
|
|
- //获取当前操作人员
|
|
|
|
-// UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
|
// 保存用户实体
|
|
// 保存用户实体
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
Long parentId = param.getAdminId();
|
|
Long parentId = param.getAdminId();
|
|
@@ -195,8 +190,8 @@ public class TAdminController {
|
|
}
|
|
}
|
|
|
|
|
|
// 管理的机器 需要再建立一个关系表 type区分全部还是部分
|
|
// 管理的机器 需要再建立一个关系表 type区分全部还是部分
|
|
- String equipmentIds = param.getEquipmentIds();
|
|
|
|
- if (StringUtils.isNotEmpty(equipmentIds)) {
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(param.getEquipmentIds())) {
|
|
|
|
+ String equipmentIds = param.getEquipmentIds();
|
|
if (equipmentIds.equals("all")) {
|
|
if (equipmentIds.equals("all")) {
|
|
//管理全部机器
|
|
//管理全部机器
|
|
TAdminEquipment tAdminEquipment = new TAdminEquipment();
|
|
TAdminEquipment tAdminEquipment = new TAdminEquipment();
|
|
@@ -444,7 +439,7 @@ public class TAdminController {
|
|
return R.fail(ResponseCodesEnum.A0001, "是否国内外为空!");
|
|
return R.fail(ResponseCodesEnum.A0001, "是否国内外为空!");
|
|
}
|
|
}
|
|
String relationAdminId = "";
|
|
String relationAdminId = "";
|
|
- if(StringUtils.isNotEmpty(registerParam.getInviteCode())) {
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(registerParam.getInviteCode())) {
|
|
// 验证邀请码
|
|
// 验证邀请码
|
|
relationAdminId = String.valueOf(AdminUtils.decrypt(false, registerParam.getInviteCode()));
|
|
relationAdminId = String.valueOf(AdminUtils.decrypt(false, registerParam.getInviteCode()));
|
|
TAdmin admin = tAdminService.getById(relationAdminId);
|
|
TAdmin admin = tAdminService.getById(relationAdminId);
|
|
@@ -475,7 +470,7 @@ public class TAdminController {
|
|
return R.fail(ResponseCodesEnum.R0003);
|
|
return R.fail(ResponseCodesEnum.R0003);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 增加地区
|
|
// 增加地区
|
|
Long areaId = null;
|
|
Long areaId = null;
|
|
if (StringUtils.isNotEmpty(registerParam.getCities())) {
|
|
if (StringUtils.isNotEmpty(registerParam.getCities())) {
|
|
@@ -568,7 +563,7 @@ public class TAdminController {
|
|
admin.setPromoCodeOpen("0");
|
|
admin.setPromoCodeOpen("0");
|
|
}
|
|
}
|
|
// 邀请码,即上级账号
|
|
// 邀请码,即上级账号
|
|
- if(StringUtils.isNotEmpty(relationAdminId)) {
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(relationAdminId)) {
|
|
admin.setRelationAdminId(relationAdminId);
|
|
admin.setRelationAdminId(relationAdminId);
|
|
}
|
|
}
|
|
admin.setCompanyType(registerParam.getCompanyType());
|
|
admin.setCompanyType(registerParam.getCompanyType());
|
|
@@ -1267,9 +1262,33 @@ public class TAdminController {
|
|
String cityCode = cities.getCode();
|
|
String cityCode = cities.getCode();
|
|
Countries countries = countriesService.getById(countryId);
|
|
Countries countries = countriesService.getById(countryId);
|
|
String countryCode = countries.getCode();
|
|
String countryCode = countries.getCode();
|
|
- areaName = cityCode + "/"+ countryCode;
|
|
|
|
|
|
+ areaName = cityCode + "/" + countryCode;
|
|
}
|
|
}
|
|
return R.ok(areaName);
|
|
return R.ok(areaName);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取用户信息")
|
|
|
|
+ @GetMapping("/changeArea")
|
|
|
|
+ public ResponseModel<?> changeArea() {
|
|
|
|
+ LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
|
|
|
|
+ query.eq(TAdmin::getIfForeign, "0");
|
|
|
|
+ List<TAdmin> list = tAdminService.list(query);
|
|
|
|
+ for (TAdmin admin : list) {
|
|
|
|
+ Long areaId = admin.getAreaId();
|
|
|
|
+ if (areaId != null) {
|
|
|
|
+ TArea area = areaService.getById(areaId);
|
|
|
|
+ if (area != null) {
|
|
|
|
+ String treePath = area.getTreePath();
|
|
|
|
+ String[] split = treePath.split(",");
|
|
|
|
+ if (split.length > 2) {
|
|
|
|
+ admin.setAreaId(Long.valueOf(split[2]));
|
|
|
|
+// System.out.println(split[2]);
|
|
|
|
+ tAdminService.updateById(admin);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return R.ok();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|