|
@@ -71,6 +71,15 @@ public class TAdminController {
|
|
|
|
|
|
@Autowired
|
|
|
TWechatService wechatService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TAreaService areaService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CitiesService citiesService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CountriesService countriesService;
|
|
|
|
|
|
public TAdminController(SysRoleService sysRoleService, SysUserRoleService sysUserRoleService, TokenManager tokenManager, TAdminService tAdminService, TAdminEquipmentService tAdminEquipmentService, TMessageCodeService tMessageCodeService, TAirwallexWalletService airwallexWalletService, PayFeign payFeign) {
|
|
|
this.sysRoleService = sysRoleService;
|
|
@@ -225,11 +234,6 @@ public class TAdminController {
|
|
|
@Transactional
|
|
|
@Audit(type = AuditEnum.UPDATE, content = "#loginUser.name + '修改账号'")
|
|
|
public ResponseModel<?> updateLoginUser(@RequestBody @Valid UpdateLoginUserParam param) {
|
|
|
-// public ResponseModel<?> addLoginUser(@RequestBody AddLoginUserParam param) {
|
|
|
- //获取当前操作人员
|
|
|
-// UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
- // 保存用户实体
|
|
|
-// Date now = new Date();
|
|
|
Long parentId = param.getAdminId();
|
|
|
if (parentId == null) {
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
@@ -471,6 +475,28 @@ public class TAdminController {
|
|
|
return R.fail(ResponseCodesEnum.R0003);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 增加地区
|
|
|
+ Long areaId = null;
|
|
|
+ if (StringUtils.isNotEmpty(registerParam.getCities())) {
|
|
|
+ if (registerParam.getIfForeign().equals("0")) {
|
|
|
+ // 国内
|
|
|
+ LambdaQueryWrapper<TArea> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(TArea::getFullName, registerParam.getCities());
|
|
|
+ TArea area = areaService.getOne(query);
|
|
|
+ if (area != null) {
|
|
|
+ areaId = area.getId();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 国外
|
|
|
+ LambdaQueryWrapper<Cities> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(Cities::getCode, registerParam.getCities());
|
|
|
+ Cities cities = citiesService.getOne(query);
|
|
|
+ if (cities != null) {
|
|
|
+ areaId = cities.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (StringUtils.isEmpty(registerParam.getCode())) {
|
|
|
return R.fail(ResponseCodesEnum.R0005);
|
|
@@ -536,6 +562,8 @@ public class TAdminController {
|
|
|
admin.setUsername(registerParam.getUsername());
|
|
|
admin.setName(registerParam.getName());
|
|
|
admin.setIfForeign(registerParam.getIfForeign());
|
|
|
+ // 地区ID
|
|
|
+ admin.setAreaId(areaId);
|
|
|
if (registerParam.getIfForeign().equals("1")) {
|
|
|
admin.setPromoCodeOpen("0");
|
|
|
}
|
|
@@ -589,10 +617,6 @@ public class TAdminController {
|
|
|
if ("1".equals(registerParam.getIfForeign())) {
|
|
|
TAirwallexWallet wallet = new TAirwallexWallet();
|
|
|
wallet.setAdminId(admin.getId());
|
|
|
-// wallet.setAccountCurrency("USD");
|
|
|
-// wallet.setAccountAmount(new BigDecimal("0.00"));
|
|
|
-// airwallexWalletService.save(wallet);
|
|
|
-// System.out.println("wallet >>> " + wallet);
|
|
|
payFeign.saveAirwallexWallet(wallet);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -1197,5 +1221,55 @@ public class TAdminController {
|
|
|
}
|
|
|
return R.ok();
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("修改地区")
|
|
|
+ @GetMapping("/updateArea")
|
|
|
+ public ResponseModel<?> updateArea(String adminId, String areaValue) {
|
|
|
+ TAdmin admin = tAdminService.getById(adminId);
|
|
|
+ if (admin != null) {
|
|
|
+ if (StringUtils.isNotEmpty(admin.getIfForeign()) && admin.getIfForeign().equals("1")) {
|
|
|
+ // 国外
|
|
|
+ LambdaQueryWrapper<Cities> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(Cities::getCode, areaValue);
|
|
|
+ Cities cities = citiesService.getOne(query);
|
|
|
+ if (cities != null) {
|
|
|
+ admin.setAreaId(cities.getId());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 国内
|
|
|
+ LambdaQueryWrapper<TArea> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(TArea::getFullName, areaValue);
|
|
|
+ TArea area = areaService.getOne(query);
|
|
|
+ if (area != null) {
|
|
|
+ admin.setAreaId(area.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tAdminService.updateById(admin);
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("国内账号获取所属地区")
|
|
|
+ @GetMapping("/getAreaById")
|
|
|
+ public ResponseModel<?> getAreaById(Long areaId) {
|
|
|
+ TArea area = areaService.getById(areaId);
|
|
|
+ return R.ok(area);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("海外账号获取所属地区")
|
|
|
+ @GetMapping("/getCitiesById")
|
|
|
+ public ResponseModel<?> getCitiesById(Long areaId) {
|
|
|
+ String areaName = "";
|
|
|
+ Cities cities = citiesService.getById(areaId);
|
|
|
+ if (cities != null) {
|
|
|
+ Long countryId = cities.getCountryId();
|
|
|
+ String cityCode = cities.getCode();
|
|
|
+ Countries countries = countriesService.getById(countryId);
|
|
|
+ String countryCode = countries.getCode();
|
|
|
+ areaName = cityCode + "/"+ countryCode;
|
|
|
+ }
|
|
|
+ return R.ok(areaName);
|
|
|
+ }
|
|
|
}
|
|
|
|