|
@@ -9,9 +9,15 @@ import com.zbkj.admin.controller.newapi.request.BoundShopRequest;
|
|
|
import com.zbkj.admin.controller.newapi.request.SetLineOfCreditRequest;
|
|
|
import com.zbkj.admin.controller.newapi.request.UserEnterpriseSearchRequest;
|
|
|
import com.zbkj.common.constants.BalanceRecordConstants;
|
|
|
+import com.zbkj.common.model.admin.SystemAdmin;
|
|
|
+import com.zbkj.common.model.organization.Organization;
|
|
|
+import com.zbkj.common.model.organization.OrganizationDepartmentUser;
|
|
|
+import com.zbkj.common.model.organization.VO.OrganizationDepartmentVO;
|
|
|
+import com.zbkj.common.model.organization.VO.OrganizationVO;
|
|
|
import com.zbkj.common.model.product.Product;
|
|
|
import com.zbkj.common.model.user.User;
|
|
|
import com.zbkj.common.model.user.UserBypassAccount;
|
|
|
+import com.zbkj.common.model.organization.OrganizationDepartment;
|
|
|
import com.zbkj.common.model.user.UserEnterprise;
|
|
|
import com.zbkj.common.model.user.UserEnterpriseRecord;
|
|
|
import com.zbkj.common.page.CommonPage;
|
|
@@ -21,16 +27,24 @@ import com.zbkj.common.request.UserSearchRequest;
|
|
|
import com.zbkj.common.request.UserUpdateRequest;
|
|
|
import com.zbkj.common.response.MerchantOrder2PageResponse;
|
|
|
import com.zbkj.common.result.CommonResult;
|
|
|
+import com.zbkj.common.utils.SecurityUtil;
|
|
|
+import com.zbkj.service.dao.OrganizationDeparementDao;
|
|
|
+import com.zbkj.service.dao.OrganizationDeparementUserDao;
|
|
|
import com.zbkj.service.service.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
+import org.aspectj.weaver.ast.Or;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -68,27 +82,33 @@ public class NewPlatformApi {
|
|
|
private SystemConfigService systemConfigService;
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationDepartmentService organizationDepartmentService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationDepartmentUserService organizationDepartmentUserService;
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "平台端企业用户分页列表")
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
public CommonResult<CommonPage<UserEnterprise>> getList(@ModelAttribute @Validated UserEnterpriseSearchRequest request,
|
|
|
- @Validated PageParamRequest pageParamRequest) {
|
|
|
+ @Validated PageParamRequest pageParamRequest) {
|
|
|
|
|
|
LambdaQueryWrapper<UserEnterprise> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
if (request.getRealName() != null) {
|
|
|
- queryWrapper.like( UserEnterprise::getRealName, request.getRealName() );
|
|
|
+ queryWrapper.like(UserEnterprise::getRealName, request.getRealName());
|
|
|
}
|
|
|
if (request.getPhone() != null) {
|
|
|
- queryWrapper.like( UserEnterprise::getPhone, request.getPhone() );
|
|
|
+ queryWrapper.like(UserEnterprise::getPhone, request.getPhone());
|
|
|
}
|
|
|
if (request.getEnterpriseName() != null) {
|
|
|
- queryWrapper.like( UserEnterprise::getEnterpriseName, request.getEnterpriseName() );
|
|
|
+ queryWrapper.like(UserEnterprise::getEnterpriseName, request.getEnterpriseName());
|
|
|
}
|
|
|
Page<UserEnterprise> page = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
|
|
- List<UserEnterprise> list = userEnterpriseService.list( queryWrapper );
|
|
|
+ List<UserEnterprise> list = userEnterpriseService.list(queryWrapper);
|
|
|
|
|
|
- return CommonResult.success( CommonPage.restPage(CommonPage.copyPageInfo(page, list)) );
|
|
|
+ return CommonResult.success(CommonPage.restPage(CommonPage.copyPageInfo(page, list)));
|
|
|
}
|
|
|
// @PreAuthorize("hasAuthority('platform:userEnterprise:page:list')")
|
|
|
// @ApiOperation(value = "平台端企业用户分页列表")
|
|
@@ -113,48 +133,48 @@ public class NewPlatformApi {
|
|
|
//// return CommonResult.success( pageList );
|
|
|
//// }
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:page:getbyid')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:page:getbyid')")
|
|
|
@ApiOperation(value = "平台端企业用户详情")
|
|
|
@RequestMapping(value = "/getbyid/{id}", method = RequestMethod.GET)
|
|
|
public CommonResult<UserEnterprise> getbyid(@PathVariable String id) {
|
|
|
- UserEnterprise byId = userEnterpriseService.getById( id );
|
|
|
- return CommonResult.success( byId );
|
|
|
+ UserEnterprise byId = userEnterpriseService.getById(id);
|
|
|
+ return CommonResult.success(byId);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "认证")
|
|
|
@RequestMapping(value = "/authentication", method = RequestMethod.POST)
|
|
|
public CommonResult<String> authentication(@RequestBody @Validated UserEnterprise userEnterprise) {
|
|
|
try {
|
|
|
- User byId = userService.getById( userEnterprise.getUserId() );
|
|
|
- userEnterprise.setAccount( byId.getAccount() );
|
|
|
- userEnterprise.setPhone( byId.getPhone() );
|
|
|
+ User byId = userService.getById(userEnterprise.getUserId());
|
|
|
+ userEnterprise.setAccount(byId.getAccount());
|
|
|
+ userEnterprise.setPhone(byId.getPhone());
|
|
|
LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq( UserBypassAccount::getUserId, userEnterprise.getUserId() );
|
|
|
- queryWrapper.eq( UserBypassAccount::getIsDelete, 0 );
|
|
|
- List<UserBypassAccount> list = userBypassAccountService.list( queryWrapper );
|
|
|
+ queryWrapper.eq(UserBypassAccount::getUserId, userEnterprise.getUserId());
|
|
|
+ queryWrapper.eq(UserBypassAccount::getIsDelete, 0);
|
|
|
+ List<UserBypassAccount> list = userBypassAccountService.list(queryWrapper);
|
|
|
if (list.size() != 0) {
|
|
|
- return CommonResult.failed( "该用户已成为企业子用户" );
|
|
|
+ return CommonResult.failed("该用户已成为企业子用户");
|
|
|
}
|
|
|
LambdaQueryWrapper<UserEnterprise> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper2.eq( UserEnterprise::getUserId, userEnterprise.getUserId() );
|
|
|
- List<UserEnterprise> list2 = userEnterpriseService.list( queryWrapper2 );
|
|
|
+ queryWrapper2.eq(UserEnterprise::getUserId, userEnterprise.getUserId());
|
|
|
+ List<UserEnterprise> list2 = userEnterpriseService.list(queryWrapper2);
|
|
|
if (list2.size() != 0) {
|
|
|
- return CommonResult.failed( "该用户已认证过企业用户" );
|
|
|
+ return CommonResult.failed("该用户已认证过企业用户");
|
|
|
}
|
|
|
//需要判断认证这个是否已经认证过了 子用户也需要做校验添加过的子用户不能添加
|
|
|
- userEnterprise.setLineOfCredit( BigDecimal.valueOf( 0 ) );
|
|
|
- userEnterprise.setUsedLineOfCredit( BigDecimal.valueOf( 0 ) );
|
|
|
- userEnterprise.setAvailableLineOfCredit( BigDecimal.valueOf( 0 ) );
|
|
|
- userEnterprise.setIsAuthentication( 1 );
|
|
|
- userEnterprise.setCreateTime( new Date() );
|
|
|
- userEnterpriseService.save( userEnterprise );
|
|
|
+ userEnterprise.setLineOfCredit(BigDecimal.valueOf(0));
|
|
|
+ userEnterprise.setUsedLineOfCredit(BigDecimal.valueOf(0));
|
|
|
+ userEnterprise.setAvailableLineOfCredit(BigDecimal.valueOf(0));
|
|
|
+ userEnterprise.setIsAuthentication(1);
|
|
|
+ userEnterprise.setCreateTime(new Date());
|
|
|
+ userEnterpriseService.save(userEnterprise);
|
|
|
|
|
|
//修改用户表字段
|
|
|
- byId.setIsEnterpriseUser( 2 );
|
|
|
- userService.updateById( byId );
|
|
|
- return CommonResult.success( "认证成功" );
|
|
|
+ byId.setIsEnterpriseUser(2);
|
|
|
+ userService.updateById(byId);
|
|
|
+ return CommonResult.success("认证成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "认证失败,接口错误" );
|
|
|
+ return CommonResult.failed("认证失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -162,85 +182,85 @@ public class NewPlatformApi {
|
|
|
@RequestMapping(value = "/logoutAuthentication/{id}", method = RequestMethod.POST)
|
|
|
public CommonResult<String> logoutAuthentication(@PathVariable Integer id) {
|
|
|
try {
|
|
|
- UserEnterprise byId = userEnterpriseService.getById( id );
|
|
|
+ UserEnterprise byId = userEnterpriseService.getById(id);
|
|
|
if (byId.getUsedLineOfCredit().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
- return CommonResult.failed( "已用额度不为零,需还清后才能注销" );
|
|
|
+ return CommonResult.failed("已用额度不为零,需还清后才能注销");
|
|
|
}
|
|
|
userEnterpriseService.removeById(id);
|
|
|
LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq( UserBypassAccount::getEnterpriseId, id );
|
|
|
- userBypassAccountService.remove( queryWrapper );
|
|
|
+ queryWrapper.eq(UserBypassAccount::getEnterpriseId, id);
|
|
|
+ userBypassAccountService.remove(queryWrapper);
|
|
|
User user = new User();
|
|
|
- user.setId( byId.getUserId() );
|
|
|
- user.setIsEnterpriseUser( 1 );
|
|
|
- userService.updateById( user );
|
|
|
+ user.setId(byId.getUserId());
|
|
|
+ user.setIsEnterpriseUser(1);
|
|
|
+ userService.updateById(user);
|
|
|
// UserEnterprise userEnterprise = new UserEnterprise();
|
|
|
// userEnterprise.setId(id );
|
|
|
// userEnterprise.setIsDelete( 1 );
|
|
|
// userEnterpriseService.updateById( userEnterprise );
|
|
|
- return CommonResult.success( "注销企业账户成功" );
|
|
|
+ return CommonResult.success("注销企业账户成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "注销企业账户失败,接口错误" );
|
|
|
+ return CommonResult.failed("注销企业账户失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:edit')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:edit')")
|
|
|
@ApiOperation(value = "编辑")
|
|
|
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
|
|
public CommonResult<String> edit(@RequestBody @Validated UserEnterprise userEnterprise) {
|
|
|
try {
|
|
|
// UserEnterprise userEnterprise = new UserEnterprise();
|
|
|
- userEnterpriseService.updateById( userEnterprise );
|
|
|
- return CommonResult.success( "编辑成功" );
|
|
|
+ userEnterpriseService.updateById(userEnterprise);
|
|
|
+ return CommonResult.success("编辑成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "编辑失败,接口错误" );
|
|
|
+ return CommonResult.failed("编辑失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:addBypassAccountList')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:addBypassAccountList')")
|
|
|
@ApiOperation(value = "批量添加子账号(暂时可能不需要批量添加)")
|
|
|
@RequestMapping(value = "/addBypassAccountList", method = RequestMethod.POST)
|
|
|
public CommonResult<String> addBypassAccountList(@RequestBody @Validated List<UserBypassAccount> userBypassAccountList) {
|
|
|
|
|
|
- if (userBypassAccountService.saveBatch( userBypassAccountList )) {
|
|
|
- return CommonResult.success( "添加子账号成功" );
|
|
|
+ if (userBypassAccountService.saveBatch(userBypassAccountList)) {
|
|
|
+ return CommonResult.success("添加子账号成功");
|
|
|
}
|
|
|
- return CommonResult.failed( "添加子账号失败,接口错误" );
|
|
|
+ return CommonResult.failed("添加子账号失败,接口错误");
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:addBypassAccount')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:addBypassAccount')")
|
|
|
@ApiOperation(value = "添加子账号")
|
|
|
@RequestMapping(value = "/addBypassAccount", method = RequestMethod.POST)
|
|
|
public CommonResult<String> addBypassAccount(@RequestBody @Validated UserBypassAccount userBypassAccount) {
|
|
|
try {
|
|
|
- User byId = userService.getById( userBypassAccount.getUserId() );
|
|
|
- userBypassAccount.setAccount( byId.getAccount() );
|
|
|
- userBypassAccount.setPhone( byId.getPhone() );
|
|
|
+ User byId = userService.getById(userBypassAccount.getUserId());
|
|
|
+ userBypassAccount.setAccount(byId.getAccount());
|
|
|
+ userBypassAccount.setPhone(byId.getPhone());
|
|
|
LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq( UserBypassAccount::getUserId, userBypassAccount.getUserId() );
|
|
|
- queryWrapper.eq( UserBypassAccount::getIsDelete, 0 );
|
|
|
- List<UserBypassAccount> list = userBypassAccountService.list( queryWrapper );
|
|
|
+ queryWrapper.eq(UserBypassAccount::getUserId, userBypassAccount.getUserId());
|
|
|
+ queryWrapper.eq(UserBypassAccount::getIsDelete, 0);
|
|
|
+ List<UserBypassAccount> list = userBypassAccountService.list(queryWrapper);
|
|
|
if (list.size() != 0) {
|
|
|
- return CommonResult.failed( "该用户已存在一个企业里" );
|
|
|
+ return CommonResult.failed("该用户已存在一个企业里");
|
|
|
}
|
|
|
LambdaQueryWrapper<UserEnterprise> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper2.eq( UserEnterprise::getUserId, userBypassAccount.getUserId() );
|
|
|
- List<UserEnterprise> list2 = userEnterpriseService.list( queryWrapper2 );
|
|
|
+ queryWrapper2.eq(UserEnterprise::getUserId, userBypassAccount.getUserId());
|
|
|
+ List<UserEnterprise> list2 = userEnterpriseService.list(queryWrapper2);
|
|
|
if (list2.size() != 0) {
|
|
|
- return CommonResult.failed( "该用户已认证过企业用户" );
|
|
|
+ return CommonResult.failed("该用户已认证过企业用户");
|
|
|
}
|
|
|
- userBypassAccountService.save( userBypassAccount );
|
|
|
+ userBypassAccountService.save(userBypassAccount);
|
|
|
|
|
|
//修改用户表字段
|
|
|
- byId.setIsEnterpriseUser( 3 );
|
|
|
- userService.updateById( byId );
|
|
|
- return CommonResult.success( "添加子账号成功" );
|
|
|
+ byId.setIsEnterpriseUser(3);
|
|
|
+ userService.updateById(byId);
|
|
|
+ return CommonResult.success("添加子账号成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "添加子账号失败,接口错误" );
|
|
|
+ return CommonResult.failed("添加子账号失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:updataBypassAccount')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:updataBypassAccount')")
|
|
|
@ApiOperation(value = "删除子账号")
|
|
|
@RequestMapping(value = "/updataBypassAccount/{id}", method = RequestMethod.POST)
|
|
|
public CommonResult<String> updataBypassAccount(@PathVariable Integer id) {
|
|
@@ -250,18 +270,18 @@ public class NewPlatformApi {
|
|
|
// userBypassAccount.setIsDelete( 1 );
|
|
|
// //需要软删除
|
|
|
// userBypassAccountService.updateById( userBypassAccount );
|
|
|
- UserBypassAccount byId = userBypassAccountService.getById( id );
|
|
|
+ UserBypassAccount byId = userBypassAccountService.getById(id);
|
|
|
User user = new User();
|
|
|
- user.setId( byId.getUserId() );
|
|
|
- user.setIsEnterpriseUser( 1 );
|
|
|
- userService.updateById( user );
|
|
|
+ user.setId(byId.getUserId());
|
|
|
+ user.setIsEnterpriseUser(1);
|
|
|
+ userService.updateById(user);
|
|
|
|
|
|
- userBypassAccountService.removeById( id );
|
|
|
+ userBypassAccountService.removeById(id);
|
|
|
|
|
|
|
|
|
- return CommonResult.success( "删除子账号成功" );
|
|
|
+ return CommonResult.success("删除子账号成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "删除子账号失败,接口错误" );
|
|
|
+ return CommonResult.failed("删除子账号失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -269,182 +289,182 @@ public class NewPlatformApi {
|
|
|
@RequestMapping(value = "/updataBypassAccount2", method = RequestMethod.POST)
|
|
|
public CommonResult<String> updataBypassAccount2(@RequestBody @Validated UserBypassAccount userBypassAccount) {
|
|
|
try {
|
|
|
- userBypassAccountService.updateById( userBypassAccount );
|
|
|
- return CommonResult.success( "修改子账号信息成功" );
|
|
|
+ userBypassAccountService.updateById(userBypassAccount);
|
|
|
+ return CommonResult.success("修改子账号信息成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "修改子账号信息失败,接口错误" );
|
|
|
+ return CommonResult.failed("修改子账号信息失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:bypassAccountList')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:bypassAccountList')")
|
|
|
@ApiOperation(value = "查询企业账户下的子账号")
|
|
|
@RequestMapping(value = "/bypassAccountList/{id}", method = RequestMethod.GET)
|
|
|
public CommonResult<List<UserBypassAccount>> bypassAccountList(@PathVariable String id) {
|
|
|
try {
|
|
|
LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq( UserBypassAccount::getEnterpriseId, id );
|
|
|
- queryWrapper.eq( UserBypassAccount::getIsDelete, 0 );
|
|
|
- List<UserBypassAccount> list = userBypassAccountService.list( queryWrapper );
|
|
|
- return CommonResult.success( list );
|
|
|
+ queryWrapper.eq(UserBypassAccount::getEnterpriseId, id);
|
|
|
+ queryWrapper.eq(UserBypassAccount::getIsDelete, 0);
|
|
|
+ List<UserBypassAccount> list = userBypassAccountService.list(queryWrapper);
|
|
|
+ return CommonResult.success(list);
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "查询企业账户下的子账号失败,接口错误" );
|
|
|
+ return CommonResult.failed("查询企业账户下的子账号失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:setLineOfCredit')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:setLineOfCredit')")
|
|
|
@ApiOperation(value = "初次设置信用额度")
|
|
|
@RequestMapping(value = "/setLineOfCredit", method = RequestMethod.POST)
|
|
|
public CommonResult<String> setLineOfCredit(@RequestBody @Validated SetLineOfCreditRequest setLineOfCreditRequest) {
|
|
|
try {
|
|
|
UserEnterprise userEnterprise = new UserEnterprise();
|
|
|
- userEnterprise.setId( setLineOfCreditRequest.getId() );
|
|
|
- userEnterprise.setLineOfCredit( setLineOfCreditRequest.getLineOfCredit() );
|
|
|
- userEnterprise.setAvailableLineOfCredit( setLineOfCreditRequest.getLineOfCredit() );
|
|
|
- userEnterprise.setUsedLineOfCredit( BigDecimal.valueOf( 0 ) );
|
|
|
- userEnterpriseService.updateById( userEnterprise );
|
|
|
+ userEnterprise.setId(setLineOfCreditRequest.getId());
|
|
|
+ userEnterprise.setLineOfCredit(setLineOfCreditRequest.getLineOfCredit());
|
|
|
+ userEnterprise.setAvailableLineOfCredit(setLineOfCreditRequest.getLineOfCredit());
|
|
|
+ userEnterprise.setUsedLineOfCredit(BigDecimal.valueOf(0));
|
|
|
+ userEnterpriseService.updateById(userEnterprise);
|
|
|
|
|
|
- UserEnterprise byId = userEnterpriseService.getById( setLineOfCreditRequest.getId() );
|
|
|
+ UserEnterprise byId = userEnterpriseService.getById(setLineOfCreditRequest.getId());
|
|
|
//信用额度记录
|
|
|
UserEnterpriseRecord userEnterpriseRecord = new UserEnterpriseRecord();
|
|
|
- userEnterpriseRecord.setUid( byId.getUserId() );
|
|
|
+ userEnterpriseRecord.setUid(byId.getUserId());
|
|
|
// userEnterpriseRecord.setLinkId(order.getOrderNo());
|
|
|
- userEnterpriseRecord.setLinkType( "system" );
|
|
|
- userEnterpriseRecord.setType( 1 );
|
|
|
- userEnterpriseRecord.setAmount( setLineOfCreditRequest.getLineOfCredit() );
|
|
|
- userEnterpriseRecord.setBalance( setLineOfCreditRequest.getLineOfCredit() );
|
|
|
- userEnterpriseRecord.setRemark( StrUtil.format( "初次设置信用额度成功,设置信用额度{}元", setLineOfCreditRequest.getLineOfCredit() ) );
|
|
|
- userEnterpriseRecordService.save( userEnterpriseRecord );
|
|
|
- return CommonResult.success( "初次设置信用额度成功" );
|
|
|
+ userEnterpriseRecord.setLinkType("system");
|
|
|
+ userEnterpriseRecord.setType(1);
|
|
|
+ userEnterpriseRecord.setAmount(setLineOfCreditRequest.getLineOfCredit());
|
|
|
+ userEnterpriseRecord.setBalance(setLineOfCreditRequest.getLineOfCredit());
|
|
|
+ userEnterpriseRecord.setRemark(StrUtil.format("初次设置信用额度成功,设置信用额度{}元", setLineOfCreditRequest.getLineOfCredit()));
|
|
|
+ userEnterpriseRecordService.save(userEnterpriseRecord);
|
|
|
+ return CommonResult.success("初次设置信用额度成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "初次设置信用额度失败,接口错误" );
|
|
|
+ return CommonResult.failed("初次设置信用额度失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:setLineOfCreditS')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:setLineOfCreditS')")
|
|
|
@ApiOperation(value = "增加可用信用额度(线下打款后恢复用的)(加可用额度的 暂时不用)")
|
|
|
@RequestMapping(value = "/setLineOfCreditS", method = RequestMethod.POST)
|
|
|
public CommonResult<String> setLineOfCreditS(@RequestBody @Validated SetLineOfCreditRequest setLineOfCreditRequest) {
|
|
|
try {
|
|
|
- UserEnterprise byId = userEnterpriseService.getById( setLineOfCreditRequest.getId() );
|
|
|
+ UserEnterprise byId = userEnterpriseService.getById(setLineOfCreditRequest.getId());
|
|
|
BigDecimal a = byId.getLineOfCredit();//总信用额度
|
|
|
BigDecimal b = byId.getAvailableLineOfCredit();//可用信用额度
|
|
|
BigDecimal c = byId.getUsedLineOfCredit();//已用信用额度
|
|
|
|
|
|
- BigDecimal sum = b.add( setLineOfCreditRequest.getLineOfCredit() );//可用信用额度 加 要恢复的信用额度
|
|
|
+ BigDecimal sum = b.add(setLineOfCreditRequest.getLineOfCredit());//可用信用额度 加 要恢复的信用额度
|
|
|
|
|
|
// 比较
|
|
|
- int result = sum.compareTo( a );
|
|
|
+ int result = sum.compareTo(a);
|
|
|
|
|
|
if (result > 0) {
|
|
|
// 和大于总信用额度
|
|
|
- return CommonResult.failed( "调整额度加上可用额度不能超过总额度" );
|
|
|
+ return CommonResult.failed("调整额度加上可用额度不能超过总额度");
|
|
|
}
|
|
|
- int result2 = setLineOfCreditRequest.getLineOfCredit().compareTo( c );
|
|
|
+ int result2 = setLineOfCreditRequest.getLineOfCredit().compareTo(c);
|
|
|
if (result2 > 0) {
|
|
|
// 调整额度大于已用额度
|
|
|
- return CommonResult.failed( "调整额度不能超过已用额度" );
|
|
|
+ return CommonResult.failed("调整额度不能超过已用额度");
|
|
|
}
|
|
|
//调整后的可用额度和已用额度
|
|
|
// BigDecimal bb = b.add( setLineOfCreditRequest.getLineOfCredit() );//可用信用额度 加 要恢复的信用额度
|
|
|
- BigDecimal cc = c.subtract( setLineOfCreditRequest.getLineOfCredit() );//已用信用额度 减 要恢复的信用额度
|
|
|
+ BigDecimal cc = c.subtract(setLineOfCreditRequest.getLineOfCredit());//已用信用额度 减 要恢复的信用额度
|
|
|
|
|
|
UserEnterprise userEnterprise = new UserEnterprise();
|
|
|
- userEnterprise.setId( setLineOfCreditRequest.getId() );
|
|
|
- userEnterprise.setAvailableLineOfCredit( sum );
|
|
|
- userEnterprise.setUsedLineOfCredit( cc );
|
|
|
- userEnterpriseService.updateById( userEnterprise );
|
|
|
+ userEnterprise.setId(setLineOfCreditRequest.getId());
|
|
|
+ userEnterprise.setAvailableLineOfCredit(sum);
|
|
|
+ userEnterprise.setUsedLineOfCredit(cc);
|
|
|
+ userEnterpriseService.updateById(userEnterprise);
|
|
|
//信用额度记录
|
|
|
UserEnterpriseRecord userEnterpriseRecord = new UserEnterpriseRecord();
|
|
|
- userEnterpriseRecord.setUid( byId.getUserId() );
|
|
|
+ userEnterpriseRecord.setUid(byId.getUserId());
|
|
|
// userEnterpriseRecord.setLinkId(order.getOrderNo());
|
|
|
- userEnterpriseRecord.setLinkType( "system" );
|
|
|
- userEnterpriseRecord.setType( 1 );
|
|
|
- userEnterpriseRecord.setAmount( setLineOfCreditRequest.getLineOfCredit() );
|
|
|
- userEnterpriseRecord.setBalance( sum );
|
|
|
- userEnterpriseRecord.setRemark( StrUtil.format( "增加信用额度成功(可能是线下打款),增加信用额度{}元",
|
|
|
- setLineOfCreditRequest.getLineOfCredit() ) );
|
|
|
- userEnterpriseRecordService.save( userEnterpriseRecord );
|
|
|
- return CommonResult.success( "调整信用额度成功" );
|
|
|
+ userEnterpriseRecord.setLinkType("system");
|
|
|
+ userEnterpriseRecord.setType(1);
|
|
|
+ userEnterpriseRecord.setAmount(setLineOfCreditRequest.getLineOfCredit());
|
|
|
+ userEnterpriseRecord.setBalance(sum);
|
|
|
+ userEnterpriseRecord.setRemark(StrUtil.format("增加信用额度成功(可能是线下打款),增加信用额度{}元",
|
|
|
+ setLineOfCreditRequest.getLineOfCredit()));
|
|
|
+ userEnterpriseRecordService.save(userEnterpriseRecord);
|
|
|
+ return CommonResult.success("调整信用额度成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "调整信用额度失败,接口错误" );
|
|
|
+ return CommonResult.failed("调整信用额度失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:setLineOfCreditSS')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:setLineOfCreditSS')")
|
|
|
@ApiOperation(value = "调整信用额度")
|
|
|
@RequestMapping(value = "/setLineOfCreditSS", method = RequestMethod.POST)
|
|
|
public CommonResult<String> setLineOfCreditSS(@RequestBody @Validated SetLineOfCreditRequest setLineOfCreditRequest) {
|
|
|
try {
|
|
|
- UserEnterprise byId = userEnterpriseService.getById( setLineOfCreditRequest.getId() );
|
|
|
+ UserEnterprise byId = userEnterpriseService.getById(setLineOfCreditRequest.getId());
|
|
|
BigDecimal a = byId.getLineOfCredit();//总信用额度
|
|
|
BigDecimal b = byId.getAvailableLineOfCredit();//可用信用额度
|
|
|
|
|
|
- BigDecimal bb = b.add( setLineOfCreditRequest.getLineOfCredit() );//可用信用额度 加 要恢复的信用额度
|
|
|
+ BigDecimal bb = b.add(setLineOfCreditRequest.getLineOfCredit());//可用信用额度 加 要恢复的信用额度
|
|
|
|
|
|
- BigDecimal aa = a.add( setLineOfCreditRequest.getLineOfCredit() );
|
|
|
+ BigDecimal aa = a.add(setLineOfCreditRequest.getLineOfCredit());
|
|
|
|
|
|
|
|
|
//调整后的可用额度和总额度
|
|
|
UserEnterprise userEnterprise = new UserEnterprise();
|
|
|
- userEnterprise.setId( setLineOfCreditRequest.getId() );
|
|
|
- userEnterprise.setLineOfCredit( aa );
|
|
|
- userEnterprise.setAvailableLineOfCredit( bb );
|
|
|
- userEnterpriseService.updateById( userEnterprise );
|
|
|
+ userEnterprise.setId(setLineOfCreditRequest.getId());
|
|
|
+ userEnterprise.setLineOfCredit(aa);
|
|
|
+ userEnterprise.setAvailableLineOfCredit(bb);
|
|
|
+ userEnterpriseService.updateById(userEnterprise);
|
|
|
//信用额度记录
|
|
|
UserEnterpriseRecord userEnterpriseRecord = new UserEnterpriseRecord();
|
|
|
- userEnterpriseRecord.setUid( byId.getUserId() );
|
|
|
+ userEnterpriseRecord.setUid(byId.getUserId());
|
|
|
// userEnterpriseRecord.setLinkId(order.getOrderNo());
|
|
|
- userEnterpriseRecord.setLinkType( "system" );
|
|
|
- userEnterpriseRecord.setType( 1 );
|
|
|
- userEnterpriseRecord.setAmount( setLineOfCreditRequest.getLineOfCredit() );
|
|
|
- userEnterpriseRecord.setBalance( bb );
|
|
|
- userEnterpriseRecord.setRemark( StrUtil.format( "调整信用额度成功,调整增加信用额度{}元",
|
|
|
- setLineOfCreditRequest.getLineOfCredit() ) );
|
|
|
- userEnterpriseRecordService.save( userEnterpriseRecord );
|
|
|
- return CommonResult.success( "调整信用额度成功" );
|
|
|
+ userEnterpriseRecord.setLinkType("system");
|
|
|
+ userEnterpriseRecord.setType(1);
|
|
|
+ userEnterpriseRecord.setAmount(setLineOfCreditRequest.getLineOfCredit());
|
|
|
+ userEnterpriseRecord.setBalance(bb);
|
|
|
+ userEnterpriseRecord.setRemark(StrUtil.format("调整信用额度成功,调整增加信用额度{}元",
|
|
|
+ setLineOfCreditRequest.getLineOfCredit()));
|
|
|
+ userEnterpriseRecordService.save(userEnterpriseRecord);
|
|
|
+ return CommonResult.success("调整信用额度成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "调整信用额度失败,接口错误" );
|
|
|
+ return CommonResult.failed("调整信用额度失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:userEnterprise:boundShop')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:userEnterprise:boundShop')")
|
|
|
@ApiOperation(value = "绑定/换绑商铺")
|
|
|
@RequestMapping(value = "/boundShop", method = RequestMethod.POST)
|
|
|
public CommonResult<String> boundShop(@RequestBody @Validated BoundShopRequest boundShopRequest) {
|
|
|
try {
|
|
|
- UserEnterprise byId = userEnterpriseService.getById( boundShopRequest.getId() );
|
|
|
+ UserEnterprise byId = userEnterpriseService.getById(boundShopRequest.getId());
|
|
|
if (byId.getMerchantId() == null) {
|
|
|
//第一次绑定
|
|
|
UserEnterprise userEnterprise = new UserEnterprise();
|
|
|
- userEnterprise.setId( boundShopRequest.getId() );
|
|
|
- userEnterprise.setMerchantId( boundShopRequest.getMerchantId() );
|
|
|
- userEnterprise.setMerchantName( boundShopRequest.getMerchantName() );
|
|
|
- userEnterpriseService.updateById( userEnterprise );
|
|
|
+ userEnterprise.setId(boundShopRequest.getId());
|
|
|
+ userEnterprise.setMerchantId(boundShopRequest.getMerchantId());
|
|
|
+ userEnterprise.setMerchantName(boundShopRequest.getMerchantName());
|
|
|
+ userEnterpriseService.updateById(userEnterprise);
|
|
|
} else {
|
|
|
//换绑 查询信用额度是否还清
|
|
|
- if (byId.getUsedLineOfCredit().compareTo( BigDecimal.ZERO ) != 0) {
|
|
|
- return CommonResult.failed( "调整信用需还清之后才能换绑商铺" );
|
|
|
+ if (byId.getUsedLineOfCredit().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ return CommonResult.failed("调整信用需还清之后才能换绑商铺");
|
|
|
}
|
|
|
|
|
|
- int result = byId.getLineOfCredit().compareTo( byId.getAvailableLineOfCredit() );
|
|
|
+ int result = byId.getLineOfCredit().compareTo(byId.getAvailableLineOfCredit());
|
|
|
if (result != 0) {
|
|
|
- return CommonResult.failed( "调整信用需还清之后才能换绑商铺" );
|
|
|
+ return CommonResult.failed("调整信用需还清之后才能换绑商铺");
|
|
|
}
|
|
|
|
|
|
//还清了 换绑
|
|
|
UserEnterprise userEnterprise = new UserEnterprise();
|
|
|
- userEnterprise.setId( boundShopRequest.getId() );
|
|
|
- userEnterprise.setMerchantId( boundShopRequest.getMerchantId() );
|
|
|
- userEnterprise.setMerchantName( boundShopRequest.getMerchantName() );
|
|
|
- userEnterpriseService.updateById( userEnterprise );
|
|
|
+ userEnterprise.setId(boundShopRequest.getId());
|
|
|
+ userEnterprise.setMerchantId(boundShopRequest.getMerchantId());
|
|
|
+ userEnterprise.setMerchantName(boundShopRequest.getMerchantName());
|
|
|
+ userEnterpriseService.updateById(userEnterprise);
|
|
|
}
|
|
|
- return CommonResult.success( "绑定/换绑商铺成功" );
|
|
|
+ return CommonResult.success("绑定/换绑商铺成功");
|
|
|
} catch (Exception e) {
|
|
|
- return CommonResult.failed( "绑定/换绑商铺失败,接口错误" );
|
|
|
+ return CommonResult.failed("绑定/换绑商铺失败,接口错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:system:config:ssmConfigInfo')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:system:config:ssmConfigInfo')")
|
|
|
@ApiOperation(value = "设置短信请求价格 详情")
|
|
|
@RequestMapping(value = "/ssmConfigInfo", method = RequestMethod.GET)
|
|
|
public CommonResult<HashMap<String, String>> ssmConfigInfo() {
|
|
@@ -460,7 +480,7 @@ public class NewPlatformApi {
|
|
|
return CommonResult.success(systemConfigService.info(formId));
|
|
|
}
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('platform:system:config:save:form')")
|
|
|
+ // @PreAuthorize("hasAuthority('platform:system:config:save:form')")
|
|
|
@ApiOperation(value = "保存表单数据")
|
|
|
@RequestMapping(value = "/save/form", method = RequestMethod.POST)
|
|
|
public CommonResult<String> saveFrom(@RequestBody @Validated SystemFormCheckRequest systemFormCheckRequest) {
|
|
@@ -469,4 +489,78 @@ public class NewPlatformApi {
|
|
|
}
|
|
|
return CommonResult.failed();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "平台端组织机构分页列表")
|
|
|
+ @RequestMapping(value = "/organization", method = RequestMethod.GET)
|
|
|
+ public CommonResult<CommonPage<OrganizationVO>> organization(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// LambdaQueryWrapper<OrganizationVO> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ Page<OrganizationVO> page = PageHelper.startPage(pageNo, pageSize);
|
|
|
+
|
|
|
+ List<OrganizationVO> list = organizationService.selectAll();
|
|
|
+ for (OrganizationVO organizationVO:list){
|
|
|
+ String id = organizationVO.getId();
|
|
|
+ List<OrganizationDepartmentVO> organizationDepartments = organizationDepartmentService.selectMain(id);
|
|
|
+ organizationVO.setDepartment(organizationDepartments);
|
|
|
+ for (OrganizationDepartmentVO organizationDepartment:organizationDepartments){
|
|
|
+ String departmentId = organizationDepartment.getId();
|
|
|
+ List<OrganizationDepartmentUser> organizationDepartmentUsers= organizationDepartmentUserService.selectMainBydepartmentId(departmentId);
|
|
|
+ organizationDepartment.setOrganizationUser(organizationDepartmentUsers);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return CommonResult.success(CommonPage.restPage(CommonPage.copyPageInfo(page, list)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "平台端组织机构删除")
|
|
|
+ @RequestMapping(value = "/organizationDelete", method = RequestMethod.POST)
|
|
|
+ public CommonResult<String> organizationDelete(@RequestParam(name = "id") String id) {
|
|
|
+ organizationService.delete(id);
|
|
|
+
|
|
|
+
|
|
|
+ return CommonResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "平台端组织机构批量删除")
|
|
|
+ @RequestMapping(value = "/organizationDeleteBatch", method = RequestMethod.POST)
|
|
|
+ public CommonResult<String> organizationDeleteBatch(@RequestParam(name = "ids") String ids) {
|
|
|
+ organizationService.deleteBatch(ids);
|
|
|
+
|
|
|
+
|
|
|
+ return CommonResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "平台端组织机构新增")
|
|
|
+ @RequestMapping(value = "/organizationSave", method = RequestMethod.POST)
|
|
|
+ public CommonResult<String> organizationSave(@RequestBody @Validated OrganizationVO request) {
|
|
|
+ SystemAdmin systemAdmin = SecurityUtil.getLoginUserVo().getUser();
|
|
|
+ organizationService.saveMain(request, systemAdmin);
|
|
|
+ return CommonResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "平台端组织机构编辑")
|
|
|
+ @RequestMapping(value = "/organizationEdit", method = RequestMethod.POST)
|
|
|
+ public CommonResult<String> organizationEdit(@RequestBody @Validated OrganizationVO request) {
|
|
|
+ organizationService.updateMain(request);
|
|
|
+ return CommonResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "平台端组织机构-通过主表id查询", notes = "平台端组织机构-通过主表id查询")
|
|
|
+ @GetMapping(value = "/queryOrganizationByMainId")
|
|
|
+ public CommonResult<?> queryOrganizationByMainId(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ OrganizationVO organizationVO = organizationService.selectMessageByMainId(id);
|
|
|
+
|
|
|
+ return CommonResult.success(organizationVO);
|
|
|
+ }
|
|
|
}
|