|
@@ -3,20 +3,19 @@ package com.gree.mall.manager.logic.admin;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gree.mall.manager.bean.admin.AdminUserBean;
|
|
|
import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
import com.gree.mall.manager.bean.admin.AdminWebsitTree;
|
|
|
import com.gree.mall.manager.bean.admin.AdminWebsitVO;
|
|
|
+import com.gree.mall.manager.bean.admin.reqDto.AdminUserAddReqBean;
|
|
|
+import com.gree.mall.manager.bean.admin.reqDto.AdminUserPermissions;
|
|
|
import com.gree.mall.manager.commonmapper.AdminMapper;
|
|
|
+import com.gree.mall.manager.enums.IsYesNoEnum;
|
|
|
import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
|
|
|
-import com.gree.mall.manager.plus.entity.AdminCompanyWechatPayConfig;
|
|
|
-import com.gree.mall.manager.plus.entity.AdminWebsit;
|
|
|
-import com.gree.mall.manager.plus.entity.AdminZone;
|
|
|
-import com.gree.mall.manager.plus.service.AdminCompanyWechatPayConfigService;
|
|
|
-import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
|
|
|
-import com.gree.mall.manager.plus.service.AdminWebsitService;
|
|
|
-import com.gree.mall.manager.plus.service.AdminZoneService;
|
|
|
+import com.gree.mall.manager.logic.common.LbsAmapLogic;
|
|
|
+import com.gree.mall.manager.plus.entity.*;
|
|
|
+import com.gree.mall.manager.plus.service.*;
|
|
|
import com.gree.mall.manager.utils.StringUtil;
|
|
|
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
@@ -24,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -52,6 +52,15 @@ public class AdminWebsitLogic {
|
|
|
@Autowired
|
|
|
AdminCompanyWechatPayConfigService adminCompanyWechatPayConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SysDictCompanyService sysDictCompanyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ AdminUserLogic adminUserLogic;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ LbsAmapLogic lbsAmapLogic;
|
|
|
+
|
|
|
/**
|
|
|
* 区域列表
|
|
|
*/
|
|
@@ -99,23 +108,42 @@ public class AdminWebsitLogic {
|
|
|
if(count > 0){
|
|
|
throw new RemoteServiceException("部门名称或部门编号已存在");
|
|
|
}
|
|
|
- if(adminWebsit.getParentId() == 0){
|
|
|
- throw new RemoteServiceException("请选择父部门");
|
|
|
- }
|
|
|
+
|
|
|
if (StringUtil.isEmpty(adminWebsit.getCompanyWechatId()))
|
|
|
throw new RemoteServiceException("上级商家不能为空");
|
|
|
AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getById(adminWebsit.getPayWorkerCodeId());
|
|
|
AdminCompanyWechat adminCompanyWechatP = adminCompanyWechatService.getById(adminWebsit.getCompanyWechatId());
|
|
|
|
|
|
- //Long aLong = workWechatLogic.addOrganization(adminWebsit.getName(), adminWebsit.getParentId(),adminUser.getAdminCompanyWechat());
|
|
|
- String aLong = IdWorker.getIdStr();
|
|
|
- adminWebsit.setWebsitId(aLong+"");
|
|
|
-// adminWebsit.setCorpId(adminUser.getCorpIds().get(0));
|
|
|
- adminWebsit.setWebsitId(aLong);
|
|
|
+
|
|
|
+ adminWebsit.setWebsitId(adminWebsit.getWebsitNumber());
|
|
|
adminWebsit.setCompanyName(adminCompanyWechatP.getCompanyName());
|
|
|
adminWebsit.setPayWorkerCodeName(adminCompanyWechat.getCompanyName());
|
|
|
adminWebsit.insert();
|
|
|
|
|
|
+ AdminUserAddReqBean adminUserBean = new AdminUserAddReqBean();
|
|
|
+ adminUserBean.setUserName(adminWebsit.getWebsitId());
|
|
|
+ adminUserBean.setNickName(adminWebsit.getName());
|
|
|
+ adminUserBean.setLinkPhone(adminWebsit.getPersonMobile());
|
|
|
+ adminUserBean.setLinkName(adminWebsit.getPerson());
|
|
|
+ adminUserBean.setPassword("123456");
|
|
|
+ adminUserBean.setRoleId("1899638664615489538");
|
|
|
+ adminUserBean.setRoleName("网点");
|
|
|
+ adminUserBean.setWebsitId(adminWebsit.getWebsitId());
|
|
|
+ adminUserBean.setWebsitName(adminWebsit.getName());
|
|
|
+ adminUserBean.setCompanyWechatId(adminWebsit.getCompanyWechatId());
|
|
|
+ adminUserBean.setCompanyName(adminWebsit.getCompanyName());
|
|
|
+ adminUserBean.setAddress(adminWebsit.getAddress());
|
|
|
+ adminUserBean.setType(2);
|
|
|
+
|
|
|
+ List<AdminUserPermissions> adminUserPermissions = new ArrayList<>();
|
|
|
+ AdminUserPermissions adminUserPermissions1 = new AdminUserPermissions();
|
|
|
+ adminUserPermissions1.setAdminUserPermissionsId(adminWebsit.getWebsitId());
|
|
|
+ adminUserPermissions1.setIsDept(false);
|
|
|
+ adminUserPermissions.add(adminUserPermissions1);
|
|
|
+
|
|
|
+ adminUserBean.setPermissions(adminUserPermissions);
|
|
|
+ adminUserLogic.save(adminUserBean, request);
|
|
|
+
|
|
|
}
|
|
|
/**
|
|
|
* 编辑部门
|
|
@@ -135,10 +163,6 @@ public class AdminWebsitLogic {
|
|
|
if(count > 0){
|
|
|
throw new RemoteServiceException("部门名称或部门编号已存在");
|
|
|
}
|
|
|
- if(adminWebsit.getParentId() == 0){
|
|
|
- throw new RemoteServiceException("请选择父部门");
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
if (StringUtil.isEmpty(adminWebsit.getCompanyWechatId()))
|
|
|
throw new RemoteServiceException("上级商家不能为空");
|
|
@@ -242,7 +266,8 @@ public class AdminWebsitLogic {
|
|
|
return adminDeptWebsitVOIPage;
|
|
|
}
|
|
|
|
|
|
- public void importData(List<Object> objects) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void importData(List<Object> objects,HttpServletRequest request) {
|
|
|
|
|
|
List<AdminWebsit> adminWebsits = new ArrayList<>();
|
|
|
|
|
@@ -252,32 +277,58 @@ public class AdminWebsitLogic {
|
|
|
|
|
|
AdminWebsit adminWebsit = new AdminWebsit();
|
|
|
|
|
|
- adminWebsit.setWebsitId((String) row.get(0));
|
|
|
- adminWebsit.setWebsitNumber((String) row.get(0));
|
|
|
- adminWebsit.setName((String) row.get(1));
|
|
|
- adminWebsit.setMobile((String) row.get(2));
|
|
|
- adminWebsit.setPerson((String) row.get(3));
|
|
|
- adminWebsit.setPersonMobile((String) row.get(4));
|
|
|
- adminWebsit.setType((String) row.get(5));
|
|
|
- adminWebsit.setAddress((String) row.get(6));
|
|
|
- AdminCompanyWechatPayConfig one = adminCompanyWechatPayConfigService.lambdaQuery()
|
|
|
- .eq(AdminCompanyWechatPayConfig::getCompanyName, (String) row.get(7))
|
|
|
+ AdminCompanyWechat oneP = adminCompanyWechatService.lambdaQuery()
|
|
|
+ .eq(AdminCompanyWechat::getCompanyName, (String) row.get(0))
|
|
|
+ .last("limit 1").one();
|
|
|
+
|
|
|
+
|
|
|
+ if (oneP == null)
|
|
|
+ throw new RemoteServiceException("第"+rowIndex+"行,找不到上级商户");
|
|
|
|
|
|
+ adminWebsit.setCompanyName(oneP.getCompanyName());
|
|
|
+ adminWebsit.setCompanyWechatId(oneP.getCompanyWechatId());
|
|
|
+ adminWebsit.setWebsitId((String) row.get(1));
|
|
|
+ adminWebsit.setWebsitNumber((String) row.get(1));
|
|
|
+ adminWebsit.setName((String) row.get(2));
|
|
|
+ adminWebsit.setMobile((String) row.get(3));
|
|
|
+ adminWebsit.setPerson((String) row.get(4));
|
|
|
+ adminWebsit.setPersonMobile((String) row.get(5));
|
|
|
+
|
|
|
+ SysDictCompany sysDictCompany = sysDictCompanyService.lambdaQuery()
|
|
|
+ .eq(SysDictCompany::getDictType, "WEBSIT_TYPE")
|
|
|
+ .eq(SysDictCompany::getDictValue, (String) row.get(6)).one();
|
|
|
+
|
|
|
+ if (sysDictCompany == null)
|
|
|
+ throw new RemoteServiceException("第"+rowIndex+"行,找不到店铺类型");
|
|
|
+
|
|
|
+ adminWebsit.setType((String) row.get(6));
|
|
|
+ adminWebsit.setTypeId(sysDictCompany.getDictCode());
|
|
|
+ adminWebsit.setAddress((String) row.get(7));
|
|
|
+ AdminCompanyWechat one = adminCompanyWechatService.lambdaQuery()
|
|
|
+ .eq(AdminCompanyWechat::getCompanyName, (String) row.get(8))
|
|
|
.last("limit 1").one();
|
|
|
|
|
|
if (one == null)
|
|
|
throw new RemoteServiceException("第"+rowIndex+"行,找不到支付商户");
|
|
|
- adminWebsit.setPayWorkerCodeName((String) row.get(7));
|
|
|
- adminWebsit.setPayWorkerCodeId(one.getId());
|
|
|
- if (row.size() > 7) {
|
|
|
- adminWebsit.setYunAppid((String) row.get(8));
|
|
|
- adminWebsit.setYunAppkey((String) row.get(9));
|
|
|
- adminWebsit.setYunCompany((String) row.get(10));
|
|
|
- adminWebsit.setYunNumber((String) row.get(11));
|
|
|
- adminWebsit.setYunSystem((String) row.get(12));
|
|
|
- adminWebsit.setYunTax((String) row.get(13));
|
|
|
- adminWebsit.setYunName((String) row.get(14));
|
|
|
- adminWebsit.setYunTwo((((String) row.get(15)).equals("是"))?"YES":"NO");
|
|
|
+ adminWebsit.setPayWorkerCodeName(one.getCompanyName());
|
|
|
+ adminWebsit.setPayWorkerCodeId(one.getCompanyWechatId());
|
|
|
+
|
|
|
+ String lnglat = lbsAmapLogic.getLocationByAddress(adminWebsit.getAddress());
|
|
|
+
|
|
|
+ adminWebsit.setLng(lnglat.split(",")[0]);
|
|
|
+ adminWebsit.setLat(lnglat.split(",")[1]);
|
|
|
+ if (row.size() > 8) {
|
|
|
+ if (!StringUtil.isEmpty((String) row.get(9))) {
|
|
|
+ adminWebsit.setIsOpen(IsYesNoEnum.YES.getKey());
|
|
|
+ adminWebsit.setYunAppid((String) row.get(9));
|
|
|
+ adminWebsit.setYunAppkey((String) row.get(10));
|
|
|
+ adminWebsit.setYunCompany((String) row.get(11));
|
|
|
+ adminWebsit.setYunNumber((String) row.get(12));
|
|
|
+ adminWebsit.setYunSystem((String) row.get(13));
|
|
|
+ adminWebsit.setYunTax((String) row.get(14));
|
|
|
+ adminWebsit.setYunName((String) row.get(15));
|
|
|
+ adminWebsit.setYunTwo((((String)row.get(16)).equals("是")) ? "YES" : "NO");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
adminWebsits.add(adminWebsit);
|
|
@@ -285,5 +336,32 @@ public class AdminWebsitLogic {
|
|
|
}
|
|
|
|
|
|
adminWebsitService.saveBatch(adminWebsits);
|
|
|
+
|
|
|
+ for (AdminWebsit adminWebsit : adminWebsits) {
|
|
|
+
|
|
|
+ AdminUserAddReqBean adminUserBean = new AdminUserAddReqBean();
|
|
|
+ adminUserBean.setUserName(adminWebsit.getWebsitId());
|
|
|
+ adminUserBean.setNickName(adminWebsit.getName());
|
|
|
+ adminUserBean.setLinkPhone(adminWebsit.getPersonMobile());
|
|
|
+ adminUserBean.setLinkName(adminWebsit.getPerson());
|
|
|
+ adminUserBean.setPassword("123456");
|
|
|
+ adminUserBean.setRoleId("1899638664615489538");
|
|
|
+ adminUserBean.setRoleName("网点");
|
|
|
+ adminUserBean.setWebsitId(adminWebsit.getWebsitId());
|
|
|
+ adminUserBean.setWebsitName(adminWebsit.getName());
|
|
|
+ adminUserBean.setCompanyWechatId(adminWebsit.getCompanyWechatId());
|
|
|
+ adminUserBean.setCompanyName(adminWebsit.getCompanyName());
|
|
|
+ adminUserBean.setAddress(adminWebsit.getAddress());
|
|
|
+ adminUserBean.setType(2);
|
|
|
+
|
|
|
+ List<AdminUserPermissions> adminUserPermissions = new ArrayList<>();
|
|
|
+ AdminUserPermissions adminUserPermissions1 = new AdminUserPermissions();
|
|
|
+ adminUserPermissions1.setAdminUserPermissionsId(adminWebsit.getWebsitId());
|
|
|
+ adminUserPermissions1.setIsDept(false);
|
|
|
+ adminUserPermissions.add(adminUserPermissions1);
|
|
|
+
|
|
|
+ adminUserBean.setPermissions(adminUserPermissions);
|
|
|
+ adminUserLogic.save(adminUserBean, request);
|
|
|
+ }
|
|
|
}
|
|
|
}
|