mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 12:35:07 +08:00
update 创建运营商同步创建管理员账号
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||
import com.jsowell.pile.dto.CreateMerchantDTO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,7 +35,7 @@ public interface IPileMerchantInfoService {
|
||||
* @param pileMerchantInfo 充电桩运营商信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPileMerchantInfo(PileMerchantInfo pileMerchantInfo);
|
||||
public int insertPileMerchantInfo(CreateMerchantDTO pileMerchantInfo);
|
||||
|
||||
/**
|
||||
* 修改充电桩运营商信息
|
||||
|
||||
@@ -3,19 +3,22 @@ package com.jsowell.pile.service.impl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.entity.SysDept;
|
||||
import com.jsowell.common.core.domain.entity.SysUser;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.DictUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||
import com.jsowell.pile.dto.CreateMerchantDTO;
|
||||
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.system.service.SysDeptService;
|
||||
import com.jsowell.system.service.SysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -37,8 +40,8 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Value("${weixin.login.appid}")
|
||||
private String appid;
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
/**
|
||||
* 查询充电桩运营商信息
|
||||
@@ -82,35 +85,46 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
/**
|
||||
* 新增充电桩运营商信息
|
||||
*
|
||||
* @param pileMerchantInfo 充电桩运营商信息
|
||||
* @param dto 充电桩运营商信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertPileMerchantInfo(PileMerchantInfo pileMerchantInfo) {
|
||||
public int insertPileMerchantInfo(CreateMerchantDTO dto) {
|
||||
// 1. 新增sys_dept
|
||||
SysDept dept = new SysDept();
|
||||
dept.setParentId(100L);
|
||||
dept.setOrderNum(0);
|
||||
dept.setDeptName(pileMerchantInfo.getMerchantName());
|
||||
dept.setLeader(pileMerchantInfo.getManagerName());
|
||||
dept.setPhone(pileMerchantInfo.getManagerPhone());
|
||||
dept.setDeptName(dto.getMerchantName());
|
||||
dept.setLeader(dto.getManagerName());
|
||||
dept.setPhone(dto.getManagerPhone());
|
||||
dept.setStatus("0");
|
||||
sysDeptService.insertDept(dept);
|
||||
|
||||
// 2. 新增pile_merchant_info
|
||||
Long deptId = dept.getDeptId();
|
||||
// pileMerchantInfo.setId(deptId);
|
||||
pileMerchantInfo.setDeptId(String.valueOf(deptId));
|
||||
pileMerchantInfo.setStatus(Constants.ONE);
|
||||
// String appId = StringUtils.isBlank(pileMerchantInfo.getAppId())
|
||||
// dto.setId(deptId);
|
||||
dto.setDeptId(String.valueOf(deptId));
|
||||
dto.setStatus(Constants.ONE);
|
||||
// String appId = StringUtils.isBlank(dto.getAppId())
|
||||
// ? appid
|
||||
// : pileMerchantInfo.getAppId();
|
||||
pileMerchantInfo.setAppId(pileMerchantInfo.getAppId());
|
||||
// : dto.getAppId();
|
||||
dto.setAppId(dto.getAppId());
|
||||
|
||||
PileMerchantInfo pileMerchantInfo = new PileMerchantInfo();
|
||||
BeanUtils.copyProperties(dto, pileMerchantInfo);
|
||||
int i = pileMerchantInfoMapper.insertPileMerchantInfo(pileMerchantInfo);
|
||||
|
||||
// 3 创建运营商管理员
|
||||
|
||||
SysUser user = new SysUser();
|
||||
user.setDeptId(deptId);
|
||||
user.setUserName(dto.getUserName());
|
||||
user.setNickName(dto.getMerchantName());
|
||||
user.setPassword(dto.getPassword());
|
||||
user.setStatus(Constants.ZERO);
|
||||
user.setPostIds(new Long[]{});
|
||||
user.setRoleIds(new Long[]{});
|
||||
userService.createUser(user);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user