|
@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
+import cn.hutool.poi.excel.ExcelReader;
|
|
|
+import cn.hutool.poi.excel.ExcelUtil;
|
|
|
import com.aliyuncs.utils.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -29,6 +32,7 @@ import com.zfire.mall.manager.enums.SMSTypeEnum;
|
|
|
import com.zfire.mall.manager.exception.RemoteServiceException;
|
|
|
import com.zfire.mall.manager.logic.common.CommonLogic;
|
|
|
import com.zfire.mall.manager.logic.common.SMSLogic;
|
|
|
+import com.zfire.mall.manager.logic.external.ExternalEnginLogic;
|
|
|
import com.zfire.mall.manager.logic.k3.K3CustomerLogic;
|
|
|
import com.zfire.mall.manager.logic.wallet.WalletLogic;
|
|
|
import com.zfire.mall.manager.plus.entity.*;
|
|
@@ -37,15 +41,11 @@ import com.zfire.mall.manager.utils.CommonUtils;
|
|
|
import com.zfire.mall.manager.utils.JiaSMUtil;
|
|
|
import com.zfire.mall.manager.utils.JwtUtils;
|
|
|
import com.zfire.mall.manager.utils.RedisUtil;
|
|
|
-import com.zfire.mall.manager.utils.JiaSMUtil;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.imageio.ImageIO;
|
|
@@ -53,6 +53,9 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -65,8 +68,8 @@ public class AdminUserLogic {
|
|
|
DefaultKaptcha defaultKaptcha;
|
|
|
@Autowired
|
|
|
CommonLogic commonLogic;
|
|
|
-// @Autowired
|
|
|
-// ExternalEnginLogic externalEnginLogic;
|
|
|
+ @Autowired
|
|
|
+ ExternalEnginLogic externalEnginLogic;
|
|
|
@Autowired
|
|
|
AdminWebsitLogic adminWebsitLogic;
|
|
|
@Autowired
|
|
@@ -110,6 +113,12 @@ public class AdminUserLogic {
|
|
|
@Autowired
|
|
|
CustomerBillLimitConfigService customerBillLimitConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ CustomerProductTypeRelaService customerProductTypeRelaService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TradeLoginOrderService tradeLoginOrderService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 验证码
|
|
@@ -138,7 +147,8 @@ public class AdminUserLogic {
|
|
|
/**
|
|
|
* 登录
|
|
|
*/
|
|
|
- public AdminUserBean login(String userName, String password, String code, String codeValue,String smsCode,String loginType,HttpServletRequest request) throws RemoteServiceException {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AdminUserBean login(String userName, String password, String code, String codeValue,String smsCode,String loginType,HttpServletRequest request) throws RemoteServiceException, ParseException {
|
|
|
String value = (String) redisUtil.get(Constant.RedisPrefix.VERIFICATION + code);
|
|
|
if (Constant.LOGIN_TYPE_ACCOUNT.equals(loginType) && (value == null || !value.toLowerCase().equals(codeValue.toLowerCase()))) {
|
|
|
throw new RemoteServiceException("验证码错误");
|
|
@@ -173,6 +183,8 @@ public class AdminUserLogic {
|
|
|
|
|
|
//经销商获得是否前置仓
|
|
|
KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.getById(adminUser.getCustomerId());
|
|
|
+ if(kingDeeCustomer == null)
|
|
|
+ throw new RemoteServiceException("绑定了无效的经销商信息,请联系相关人员");
|
|
|
adminUserBean.setIsFront(kingDeeCustomer.getIsFront());
|
|
|
adminUserBean.setIsPick(kingDeeCustomer.getIsPick());
|
|
|
adminUserBean.setFrontPickType(kingDeeCustomer.getFrontPickType());
|
|
@@ -190,8 +202,18 @@ public class AdminUserLogic {
|
|
|
|
|
|
AdminUserCom adminUserCom = commonLogic.getAdminUser(adminUser.getAdminUserId(),true, request);
|
|
|
adminUserBean.setAdminWebsit(adminUserCom.getAdminWebsit());
|
|
|
+
|
|
|
+ String timeString = "2024-07-18 17:30:00";
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ Date date = format.parse(timeString);
|
|
|
+
|
|
|
+ if (adminUserCom.getIsCustomer() && new Date().before(DateUtil.offsetHour(date,12))){
|
|
|
+ throw new RemoteServiceException("系统更新中");
|
|
|
+ }
|
|
|
+
|
|
|
//存放到redis
|
|
|
- redisUtil.set(Constant.RedisPrefix.TOKEN_MGR + adminUserBean.getToken(), adminUserCom, 20 * 60 * 60 * 1000);
|
|
|
+ redisUtil.set(Constant.RedisPrefix.TOKEN_MGR + adminUserBean.getToken(), adminUserCom, 20 * 60 * 60);
|
|
|
return adminUserBean;
|
|
|
}
|
|
|
|
|
@@ -280,7 +302,7 @@ public class AdminUserLogic {
|
|
|
if (count > 0) {
|
|
|
throw new RemoteServiceException("帐号已被注册");
|
|
|
}
|
|
|
- if(CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()) && adminUser.getType() != null && adminUser.getType() == 0){
|
|
|
+ if(CollectionUtils.isEmpty(adminUser.getAdminWebsitIds())){
|
|
|
throw new RemoteServiceException("请选择部门");
|
|
|
}
|
|
|
if(adminUser.getType() != null && admin.getType() == 0 && adminUser.getAdminWebsitIds().size() > 1){
|
|
@@ -319,7 +341,7 @@ public class AdminUserLogic {
|
|
|
walletLogic.initByAddUser(admin.getAdminCompanyIds(),adminUser.getCustomerId());
|
|
|
}
|
|
|
//业务员
|
|
|
- if(addUserRole.getName().equals(Constant.NOT_DEL_ROLE_NAME) && addUserRole.getName().equals(Constant.NOT_DEL_ROLE_NAME2)){
|
|
|
+ if(addUserRole.getName().equals(Constant.NOT_DEL_ROLE_YWY) || addUserRole.getName().equals(Constant.NOT_DEL_SHANGYONG_ROLE_YWY)){
|
|
|
adminUser.setIsService(true);
|
|
|
}
|
|
|
|
|
@@ -433,6 +455,8 @@ public class AdminUserLogic {
|
|
|
if(newUser.getType() == null){
|
|
|
newUser.setType(oldUser.getType());
|
|
|
}
|
|
|
+ //前端传参错误,所以这里赋值下
|
|
|
+ newUser.setIsCustomerCompany(newUser.getIsGroupCompany());
|
|
|
|
|
|
//添加账户绑定仓库
|
|
|
if (CollectionUtils.isNotEmpty(newUser.getCorrespondIds())) {
|
|
@@ -445,6 +469,31 @@ public class AdminUserLogic {
|
|
|
adminUserList.add(adminUserStock);
|
|
|
}
|
|
|
adminUserStockService.saveBatch(adminUserList);
|
|
|
+
|
|
|
+ //把所有子账号都变更
|
|
|
+ if (admin.getIsCustomer() && !admin.getIsMaster()) {
|
|
|
+ List<AdminUser> adminUsers = adminUserService.lambdaQuery().eq(AdminUser::getCustomerId, admin.getCustomerNumber())
|
|
|
+ .eq(AdminUser::getIsMaster, false).list();
|
|
|
+
|
|
|
+
|
|
|
+ List<String> adminUserId = adminUsers.stream().map(AdminUser::getAdminUserId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ adminUserStockService.lambdaUpdate().in(AdminUserStock::getAdminUserId,adminUserId).remove();
|
|
|
+
|
|
|
+ for (AdminUser adminUser : adminUsers) {
|
|
|
+
|
|
|
+ List<AdminUserStock> adminUserListin = new ArrayList<>();
|
|
|
+ for (String correspondId : newUser.getCorrespondIds()) {
|
|
|
+ AdminUserStock adminUserStock = new AdminUserStock();
|
|
|
+ adminUserStock.setAdminUserId(adminUser.getAdminUserId());
|
|
|
+ adminUserStock.setCorrespondId(correspondId);
|
|
|
+ adminUserListin.add(adminUserStock);
|
|
|
+ }
|
|
|
+ adminUserStockService.saveBatch(adminUserListin);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//添加金蝶物料权限
|
|
@@ -484,6 +533,10 @@ public class AdminUserLogic {
|
|
|
// if(adminUserCount > 0){
|
|
|
// throw new RemoteServiceException("该经销商已被绑定");
|
|
|
// }
|
|
|
+
|
|
|
+ kingDeeCustomerService.lambdaUpdate().eq(KingDeeCustomer::getId,oldUser.getCustomerId())
|
|
|
+ .set(KingDeeCustomer::getBindUser,false).update();
|
|
|
+
|
|
|
KingDeeCustomer kingDeeCustomer = k3CustomerLogic.bindUser(newUser.getCustomerId());
|
|
|
newUser.setCustomerNumber(kingDeeCustomer.getNumber());
|
|
|
newUser.setCustomerName(kingDeeCustomer.getName());
|
|
@@ -495,8 +548,13 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
|
|
|
//业务员
|
|
|
- if(oldUser.getIsService() && !addUserRole.getName().equals(Constant.NOT_DEL_ROLE_YWY)){
|
|
|
- throw new RemoteServiceException("业务员帐号不可更改职位/角色");
|
|
|
+ if(oldUser.getIsService() && !(addUserRole.getName().equals(Constant.NOT_DEL_ROLE_YWY) || addUserRole.getName().equals(Constant.NOT_DEL_SHANGYONG_ROLE_YWY))){
|
|
|
+
|
|
|
+ if (customerProductTypeRelaService.lambdaQuery().eq(CustomerProductTypeRela::getServiceId,newUser.getAdminUserId()).count() > 0) {
|
|
|
+ throw new RemoteServiceException("有钱包关联不可更改角色");
|
|
|
+ }
|
|
|
+ newUser.setIsService(false);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 添加用户的角色级别 <= 被添加的用户的角色级别
|
|
@@ -597,7 +655,7 @@ public class AdminUserLogic {
|
|
|
* @return
|
|
|
*/
|
|
|
public IPage<AdminUserDto> list(String adminWebsitId,String roleId,String customerId,Boolean isCustomer,Boolean isMaster, Boolean status, String userName, Integer pageNum, Integer pageSize, HttpServletRequest request) {
|
|
|
- String roleName = "";
|
|
|
+ List<String> roleName = new ArrayList<>();
|
|
|
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(true);
|
|
|
List<String> adminWebsitIds = new ArrayList<>();
|
|
@@ -614,7 +672,8 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
String websitNumber = "";
|
|
|
if(isCustomer != null && !isCustomer){
|
|
|
- roleName = Constant.NOT_DEL_ROLE_YWY;
|
|
|
+ roleName.add(Constant.NOT_DEL_ROLE_YWY);
|
|
|
+ roleName.add(Constant.NOT_DEL_SHANGYONG_ROLE_YWY);
|
|
|
if(adminUser.getAdminWebsit() != null) {
|
|
|
websitNumber = adminUser.getAdminWebsit().getWebsitNumber();
|
|
|
}
|
|
@@ -716,7 +775,7 @@ public class AdminUserLogic {
|
|
|
AdminWebsit adminWebsit = adminWebsitService.getById(list.get(0).getAdminWebsitId());
|
|
|
adminUserBean.setAdminWebsit(adminWebsit);
|
|
|
}
|
|
|
-// adminUserBean.setEnginSysUrl(externalEnginLogic.getLoginUrl());
|
|
|
+ adminUserBean.setEnginSysUrl(externalEnginLogic.getLoginUrl());
|
|
|
if(detail != null) {
|
|
|
adminUserBean.setIsZr(detail.getIsZr());
|
|
|
}
|
|
@@ -740,13 +799,15 @@ public class AdminUserLogic {
|
|
|
if (adminUserBean.getIsCustomer()){
|
|
|
//经销商获得是否前置仓
|
|
|
KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.getById(adminUser.getCustomerId());
|
|
|
- adminUserBean.setIsFront(kingDeeCustomer.getIsFront());
|
|
|
- adminUserBean.setFrontPickType(kingDeeCustomer.getFrontPickType());
|
|
|
- adminUserBean.setIsPick(kingDeeCustomer.getIsPick());
|
|
|
-
|
|
|
- //所属集团
|
|
|
- adminUserBean.setIsCustomerCompany(kingDeeCustomer.getIsGroupCompany());
|
|
|
- adminUserBean.setGroupCompanyId(kingDeeCustomer.getParentId());
|
|
|
+ if(kingDeeCustomer != null) {
|
|
|
+ adminUserBean.setIsFront(kingDeeCustomer.getIsFront());
|
|
|
+ adminUserBean.setFrontPickType(kingDeeCustomer.getFrontPickType());
|
|
|
+ adminUserBean.setIsPick(kingDeeCustomer.getIsPick());
|
|
|
+
|
|
|
+ //所属集团
|
|
|
+ adminUserBean.setIsCustomerCompany(kingDeeCustomer.getIsGroupCompany());
|
|
|
+ adminUserBean.setGroupCompanyId(kingDeeCustomer.getParentId());
|
|
|
+ }
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(adminUserBean.getAdminWebsitIds()) && !CollectionUtils.isEmpty(adminUserBean.getAdminWebsitIds().stream().filter(item -> item.equals("1")).collect(Collectors.toList()))){
|
|
|
adminUserBean.setIsHongGe(true);
|
|
@@ -755,7 +816,21 @@ public class AdminUserLogic {
|
|
|
adminUserBean.setChangeNum(Convert.toInt(redisUtil.get(Constant.SUPPLY_CHANGE_NUM+adminUser.getAdminUserId())));
|
|
|
|
|
|
// 商用登录审核员
|
|
|
- adminUserBean.setIsTradeExaminer(adminUser.getRoleName().equals(Constant.NOT_DEL_ROLE_SPY));
|
|
|
+ if (StrUtil.isNotBlank(adminUser.getRoleName()) ) {
|
|
|
+ for (String str : Constant.NOT_DEL_ROLE_SPY) {
|
|
|
+ if (adminUser.getRoleName().contains(str)) {
|
|
|
+ adminUserBean.setIsTradeExaminer(true);
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ adminUserBean.setIsTradeExaminer(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.isNull(adminUserBean.getIsTradeExaminer())) {
|
|
|
+ adminUserBean.setIsTradeExaminer(false);
|
|
|
+ }
|
|
|
+// adminUserBean.setIsTradeExaminer(Constant.NOT_DEL_ROLE_SPY.contains(adminUser.getRoleName()));
|
|
|
|
|
|
return adminUserBean;
|
|
|
}
|
|
@@ -790,11 +865,11 @@ public class AdminUserLogic {
|
|
|
* 检查工程机系统是否合法
|
|
|
*/
|
|
|
public void checkEnginUser(HttpServletRequest request){
|
|
|
-// AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
-// Integer result = externalEnginLogic.checkEnginUser(adminUser.getEnginUserName(), adminUser.getEnginPassword());
|
|
|
-// if(Objects.isNull(result)){
|
|
|
-// throw new RemoteServiceException(4444,"帐号密码验证失败");
|
|
|
-// }
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
+ Integer result = externalEnginLogic.checkEnginUser(adminUser.getEnginUserName(), adminUser.getEnginPassword());
|
|
|
+ if(Objects.isNull(result)){
|
|
|
+ throw new RemoteServiceException(4444,"帐号密码验证失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -825,10 +900,10 @@ public class AdminUserLogic {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
-// Integer result = externalEnginLogic.checkEnginUser(userName, password);
|
|
|
-// if(Objects.isNull(result)){
|
|
|
-// throw new RemoteServiceException(4444,"帐号密码验证失败");
|
|
|
-// }
|
|
|
+ Integer result = externalEnginLogic.checkEnginUser(userName, password);
|
|
|
+ if(Objects.isNull(result)){
|
|
|
+ throw new RemoteServiceException(4444,"帐号密码验证失败");
|
|
|
+ }
|
|
|
|
|
|
// if (!isReset) {
|
|
|
// AdminUserBindEngin adminUserBindEngin = new AdminUserBindEngin();
|
|
@@ -855,21 +930,35 @@ public class AdminUserLogic {
|
|
|
//String adminUserId = CommonUtils.getUserId(request);
|
|
|
|
|
|
AdminUser adminUser = adminUserService.getById(adminUserId);
|
|
|
+
|
|
|
+ List<AdminModuleTree> adminModuleTrees = new ArrayList<>();
|
|
|
+
|
|
|
if (adminUser.getUserName().equals("admin")) {
|
|
|
return this.queryAdminModuleTree(null, true, null, flag);
|
|
|
} else {
|
|
|
if(adminUser.getIsCustomer() && !adminUser.getIsMaster()){
|
|
|
KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.getById(adminUser.getCustomerId());
|
|
|
- if (kingDeeCustomer.getJiaxianType().equals(JiaXianStockEnum.JIAXIAN.getKey()) || adminUser.getIsGongcheng())
|
|
|
- return this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
|
|
|
-
|
|
|
- return this.queryAdminModuleTree(adminUser.getAdminUserId(), false, null, flag);
|
|
|
+ if (kingDeeCustomer.getJiaxianType().equals(JiaXianStockEnum.JIAXIAN.getKey()) || adminUser.getIsGongcheng())
|
|
|
+ adminModuleTrees = this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
|
|
|
+ else
|
|
|
+ adminModuleTrees = this.queryAdminModuleTree(adminUser.getAdminUserId(), false, null, flag);
|
|
|
}else {
|
|
|
- return this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
|
|
|
+ adminModuleTrees = this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (adminUser.getIsShangyong() && adminUser.getIsCustomer()){
|
|
|
+ adminModuleTrees.addAll(this.queryAdminModuleTree(Constant.SHANGYONGJINGXIAOSHANG, false, null, flag));
|
|
|
+ }
|
|
|
+
|
|
|
+ /* if (adminUser.getIsShangyong() && adminUser.getIsService()){
|
|
|
+ adminModuleTrees.addAll(this.queryAdminModuleTree(Constant.SHANGYONGYEWUYUAN ,false, null, flag));
|
|
|
+ }*/
|
|
|
+
|
|
|
+ return adminModuleTrees;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 给角色授权
|
|
|
*/
|
|
@@ -1116,7 +1205,7 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
|
|
|
//业务员
|
|
|
- if (roleName.equals(Constant.NOT_DEL_ROLE_NAME) && roleName.equals(Constant.NOT_DEL_ROLE_NAME2)) {
|
|
|
+ if (roleName.equals(Constant.NOT_DEL_ROLE_YWY) || roleName.equals(Constant.NOT_DEL_SHANGYONG_ROLE_YWY)) {
|
|
|
saveUser.setIsService(true);
|
|
|
}
|
|
|
|
|
@@ -1268,7 +1357,7 @@ public class AdminUserLogic {
|
|
|
|
|
|
AdminUser adminUser = adminUserService.lambdaQuery().eq(AdminUser::getUserName, userName).one();
|
|
|
if(adminUser == null){
|
|
|
- throw new RemoteServiceException("帐号【"+adminUser.getUserName()+"】不存在");
|
|
|
+ throw new RemoteServiceException("帐号【"+userName+"】不存在");
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(canUseStore)) {
|
|
|
canUseStore = canUseStore.replaceAll(",",",");
|
|
@@ -1455,7 +1544,7 @@ public class AdminUserLogic {
|
|
|
*/
|
|
|
public ExcelData listExport(List<AdminUserDto> adminUserDtos) {
|
|
|
String[] titles = new String[]{"账号", "用户名", "角色组称", "部门", "经销商", "集团公司",
|
|
|
- "所属集团", "是否折让", "密码", "可用仓库", "登录手机号","金蝶物料权限","状态"};
|
|
|
+ "所属集团", "是否折让", "密码", "可用仓库", "登录手机号","金蝶物料权限","状态","是否商用经销商"};
|
|
|
List<List<Object>> rows = new ArrayList<>();
|
|
|
if(adminUserDtos.size() >2000){
|
|
|
throw new RemoteServiceException("数据量太大,请分批导出");
|
|
@@ -1535,6 +1624,7 @@ public class AdminUserLogic {
|
|
|
row.add(user.getLoginMobile());
|
|
|
row.add(user.getBindCategoryName());
|
|
|
row.add(user.getStatus()?"正常":"冻结");
|
|
|
+ row.add(user.getIsCustomer()?user.getIsShangyong()?"是":"否":"");
|
|
|
rows.add(row);
|
|
|
}
|
|
|
|
|
@@ -1579,7 +1669,7 @@ public class AdminUserLogic {
|
|
|
if(!adminUser.getIsCustomer()){
|
|
|
//List<String> allAdminWebsitIds = adminWebsitLogic.getAllAdminWebsitIds(adminUserCom.getAdminWebsitId());
|
|
|
//List<String> serviceIds = adminMapper.queryChildServiceId(allAdminWebsitIds,Constant.NOT_DEL_ROLE_YWY);
|
|
|
- List<String> serviceIds = adminMapper.queryChildServiceId(adminUser.getAdminWebsitIds(),null);
|
|
|
+ List<String> serviceIds = adminMapper.queryChildServiceId(adminUser.getAdminWebsitIds(),null,adminUser.getAdminWebsitId());
|
|
|
adminUser.setServiceIds(serviceIds);
|
|
|
//添加自己
|
|
|
if(CollectionUtils.isEmpty(serviceIds)) {
|
|
@@ -1590,7 +1680,6 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
String token = CommonUtils.getToken(request);
|
|
|
redisUtil.set(Constant.RedisPrefix.TOKEN_MGR + token, adminUser, 20 * 60 * 60 * 1000);
|
|
|
- AdminUserCom adminUserCom = commonLogic.getAdminUser();
|
|
|
}
|
|
|
|
|
|
public IPage<AdminUserDto> listJiaXian(String adminWebsitId, String roleId, String customerId, Boolean isCustomer, Boolean isMaster, Boolean status, String userName, Integer pageNum, Integer pageSize, HttpServletRequest request) {
|
|
@@ -1630,7 +1719,7 @@ public class AdminUserLogic {
|
|
|
|
|
|
List<String> customerNumbers = (isCustomer != null && !isCustomer) || (isMaster!= null && isMaster)?null:customerNumberS;
|
|
|
IPage<AdminUserDto> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize),adminUser.getAdminCompanyIds(),adminWebsitIds,
|
|
|
- userName, null,null,null, status,roleId,isMaster,null,isCustomer,roleName,websitNumber,customerNumbers,1,null);
|
|
|
+ userName, null,null,null, status,roleId,isMaster,null,isCustomer,null,websitNumber,customerNumbers,1,null);
|
|
|
|
|
|
return adminUserIPage;
|
|
|
}
|
|
@@ -1736,7 +1825,7 @@ public class AdminUserLogic {
|
|
|
|
|
|
List<String> customerNumbers = (isCustomer != null && !isCustomer) || (isMaster!= null && isMaster)?null:customerNumberS;
|
|
|
IPage<AdminUserDto> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize),adminUser.getAdminCompanyIds(),null,
|
|
|
- userName, null,null,null, status,roleId,isMaster,null,isCustomer,roleName,websitNumber,customerNumbers,0,1);
|
|
|
+ userName, null,null,null, status,roleId,isMaster,null,isCustomer,null,websitNumber,customerNumbers,0,1);
|
|
|
|
|
|
return adminUserIPage;
|
|
|
}
|
|
@@ -1765,8 +1854,19 @@ public class AdminUserLogic {
|
|
|
.like(KingDeeCustomer::getNumber, "CUST" + byId.getNumber())
|
|
|
.orderByDesc(KingDeeCustomer::getId).count();
|
|
|
int num = count+1;
|
|
|
+ String number = "CUST" + byId.getNumber();
|
|
|
+
|
|
|
|
|
|
- byId.setNumber("CUST" + byId.getNumber()+(num>9?num:"0"+num));
|
|
|
+
|
|
|
+ while (true){
|
|
|
+ byId.setNumber(number+(num>9?num:"0"+num));
|
|
|
+ if (kingDeeCustomerService.lambdaQuery()
|
|
|
+ .eq(KingDeeCustomer::getNumber, byId.getNumber()).count()>0) {
|
|
|
+ num = num +1;
|
|
|
+ }else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
byId.setJiaxianType(CuseromtTypeEnum.GONGCHENG.getKey());
|
|
|
byId.setId(IdWorker.getIdStr());
|
|
@@ -1817,8 +1917,8 @@ public class AdminUserLogic {
|
|
|
|
|
|
adminUser.setRoleName(adminRole.getName());
|
|
|
adminUser.setCustomerId(byId.getId());
|
|
|
- adminUser.setCustomerName(byId.getHigherPrantName());
|
|
|
- adminUser.setCustomerNumber(byId.getHigherPrantNumber());
|
|
|
+ adminUser.setCustomerName(byId.getName());
|
|
|
+ adminUser.setCustomerNumber(byId.getNumber());
|
|
|
adminUser.setRoleId(adminRole.getAdminRoleId());
|
|
|
adminUser.setPassword(SecureUtil.md5(password));
|
|
|
adminUser.setIsMaster(false);
|
|
@@ -1866,6 +1966,11 @@ public class AdminUserLogic {
|
|
|
adminUser.setNickName(nickName);
|
|
|
adminUser.updateById();
|
|
|
|
|
|
+ kingDeeCustomerService.lambdaUpdate()
|
|
|
+ .eq(KingDeeCustomer::getNumber,adminUser.getCustomerNumber())
|
|
|
+ .set(KingDeeCustomer::getName,nickName)
|
|
|
+ .update();
|
|
|
+
|
|
|
customerBillLimitConfigService
|
|
|
.lambdaUpdate()
|
|
|
.eq(CustomerBillLimitConfig::getCustomerId,adminUser.getCustomerId())
|
|
@@ -1873,6 +1978,12 @@ public class AdminUserLogic {
|
|
|
.set(CustomerBillLimitConfig::getHomeLoginLimit,homeLoginLimit)
|
|
|
.set(CustomerBillLimitConfig::getSpanLoginLimit,spanLoginLimit)
|
|
|
.update();
|
|
|
+
|
|
|
+ tradeLoginOrderService
|
|
|
+ .lambdaUpdate()
|
|
|
+ .eq(TradeLoginOrder::getCustomerId,adminUser.getCustomerId())
|
|
|
+ .set(TradeLoginOrder::getCustomerName,nickName)
|
|
|
+ .update();
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -1903,4 +2014,89 @@ public class AdminUserLogic {
|
|
|
adminMapper.delByUserName(userName);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void importData(InputStream inputStream, HttpServletRequest request) {
|
|
|
+
|
|
|
+ ExcelReader reader = ExcelUtil.getReader(inputStream);
|
|
|
+ reader.addHeaderAlias("工程登录名额", "barCode");
|
|
|
+ reader.addHeaderAlias("家装登录名额", "specification");
|
|
|
+ reader.addHeaderAlias("跨区登录名额", "id");
|
|
|
+ reader.addHeaderAlias("上级经销商", "salesCompany");
|
|
|
+ reader.addHeaderAlias("子经销商名称", "address");
|
|
|
+ reader.addHeaderAlias("密码", "materialType");
|
|
|
+
|
|
|
+ List<CustomerCode> customerCodes = reader.readAll(CustomerCode.class);
|
|
|
+
|
|
|
+ for (CustomerCode customerCode : customerCodes) {
|
|
|
+
|
|
|
+ KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.lambdaQuery().eq(KingDeeCustomer::getName, customerCode.getSalesCompany()).last("limit 1").one();
|
|
|
+
|
|
|
+ if (kingDeeCustomer == null)
|
|
|
+ throw new RemoteServiceException(customerCode.getSalesCompany());
|
|
|
+
|
|
|
+ this.addGongCheng(null,"123456",kingDeeCustomer.getId(),customerCode.getAddress(),
|
|
|
+ Convert.toInt(customerCode.getBarCode()),Convert.toInt(customerCode.getSpecification()),Convert.toInt(customerCode.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public IPage<AdminUserDto> listService(String adminWebsitId, String roleId, String customerId, Boolean isCustomer, Boolean isMaster, Boolean status, String userName, Integer pageNum, Integer pageSize, HttpServletRequest request) {
|
|
|
+ List<String> roleName = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ roleName.add(Constant.NOT_DEL_SHANGYONG_ROLE_YWY);
|
|
|
+
|
|
|
+ IPage<AdminUserDto> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize),null,null,
|
|
|
+ userName, null,null,null, status,roleId,isMaster,customerId,isCustomer,roleName,null,null,null,null);
|
|
|
+
|
|
|
+ return adminUserIPage;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addChildUserSync() {
|
|
|
+
|
|
|
+ List<AdminUser> adminUserList = adminUserService.lambdaQuery().eq(AdminUser::getIsCustomer, true)
|
|
|
+ .eq(AdminUser::getIsMaster, true).list();
|
|
|
+
|
|
|
+ for (AdminUser adminUser : adminUserList) {
|
|
|
+
|
|
|
+ List<AdminUser> adminUserListZi = adminUserService.lambdaQuery().eq(AdminUser::getIsCustomer, true)
|
|
|
+ .eq(AdminUser::getIsMaster, false)
|
|
|
+ .eq(AdminUser::getCustomerId, adminUser.getCustomerId())
|
|
|
+ .list();
|
|
|
+
|
|
|
+ for (AdminUser user : adminUserListZi) {
|
|
|
+ //仓库权限
|
|
|
+ List<AdminUserStock> stocks = adminUserStockService.lambdaQuery()
|
|
|
+ .eq(AdminUserStock::getAdminUserId, adminUser.getAdminUserId()).list();
|
|
|
+
|
|
|
+
|
|
|
+ adminUserStockService.lambdaUpdate().eq(AdminUserStock::getAdminUserId,user.getAdminUserId()).remove();
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(stocks)){
|
|
|
+ for (AdminUserStock stock : stocks) {
|
|
|
+ stock.setId(null);
|
|
|
+ stock.setAdminUserId(user.getAdminUserId());
|
|
|
+ stock.insert();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //分类权限
|
|
|
+ List<AdminUserCategoryRela> categoryRelas = adminUserCategoryRelaService.lambdaQuery()
|
|
|
+ .eq(AdminUserCategoryRela::getAdminUserId, adminUser.getAdminUserId()).list();
|
|
|
+
|
|
|
+ adminUserCategoryRelaService.lambdaUpdate()
|
|
|
+ .eq(AdminUserCategoryRela::getAdminUserId, user.getAdminUserId()).remove();
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(categoryRelas)){
|
|
|
+ for(AdminUserCategoryRela rela:categoryRelas){
|
|
|
+ rela.setId(null);
|
|
|
+ rela.setAdminUserId(user.getAdminUserId());
|
|
|
+ rela.insert();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|