mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 创建运营商同步创建管理员账号
This commit is contained in:
@@ -7,6 +7,7 @@ import com.jsowell.common.core.page.TableDataInfo;
|
|||||||
import com.jsowell.common.enums.BusinessType;
|
import com.jsowell.common.enums.BusinessType;
|
||||||
import com.jsowell.common.util.poi.ExcelUtil;
|
import com.jsowell.common.util.poi.ExcelUtil;
|
||||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||||
|
import com.jsowell.pile.dto.CreateMerchantDTO;
|
||||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
import com.jsowell.pile.service.IPileMerchantInfoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@@ -77,7 +78,7 @@ public class PileMerchantInfoController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('pile:merchant:add')")
|
@PreAuthorize("@ss.hasPermi('pile:merchant:add')")
|
||||||
@Log(title = "充电桩运营商信息", businessType = BusinessType.INSERT)
|
@Log(title = "充电桩运营商信息", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody PileMerchantInfo pileMerchantInfo) {
|
public AjaxResult add(@RequestBody CreateMerchantDTO pileMerchantInfo) {
|
||||||
return toAjax(pileMerchantInfoService.insertPileMerchantInfo(pileMerchantInfo));
|
return toAjax(pileMerchantInfoService.insertPileMerchantInfo(pileMerchantInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.jsowell.pile.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建运营商DTO
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class CreateMerchantDTO {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商名称
|
||||||
|
*/
|
||||||
|
private String merchantName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
* 0-失效;1-生效
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织机构代码
|
||||||
|
*/
|
||||||
|
private String organizationCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
private String managerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人电话号码
|
||||||
|
*/
|
||||||
|
private String managerPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客服电话号码
|
||||||
|
*/
|
||||||
|
private String servicePhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logo
|
||||||
|
*/
|
||||||
|
private String logoUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商的小程序appId
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.pile.service;
|
package com.jsowell.pile.service;
|
||||||
|
|
||||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||||
|
import com.jsowell.pile.dto.CreateMerchantDTO;
|
||||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -34,7 +35,7 @@ public interface IPileMerchantInfoService {
|
|||||||
* @param pileMerchantInfo 充电桩运营商信息
|
* @param pileMerchantInfo 充电桩运营商信息
|
||||||
* @return 结果
|
* @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.google.common.collect.Lists;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.domain.entity.SysDept;
|
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.core.domain.vo.AuthorizedDeptVO;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.common.util.DictUtils;
|
import com.jsowell.common.util.DictUtils;
|
||||||
import com.jsowell.common.util.SecurityUtils;
|
import com.jsowell.common.util.SecurityUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||||
|
import com.jsowell.pile.dto.CreateMerchantDTO;
|
||||||
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
||||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
import com.jsowell.pile.service.IPileMerchantInfoService;
|
||||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
import com.jsowell.system.service.SysDeptService;
|
import com.jsowell.system.service.SysDeptService;
|
||||||
|
import com.jsowell.system.service.SysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -37,8 +40,8 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptService sysDeptService;
|
private SysDeptService sysDeptService;
|
||||||
|
|
||||||
@Value("${weixin.login.appid}")
|
@Autowired
|
||||||
private String appid;
|
private SysUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询充电桩运营商信息
|
* 查询充电桩运营商信息
|
||||||
@@ -82,35 +85,46 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
|||||||
/**
|
/**
|
||||||
* 新增充电桩运营商信息
|
* 新增充电桩运营商信息
|
||||||
*
|
*
|
||||||
* @param pileMerchantInfo 充电桩运营商信息
|
* @param dto 充电桩运营商信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int insertPileMerchantInfo(PileMerchantInfo pileMerchantInfo) {
|
public int insertPileMerchantInfo(CreateMerchantDTO dto) {
|
||||||
// 1. 新增sys_dept
|
// 1. 新增sys_dept
|
||||||
SysDept dept = new SysDept();
|
SysDept dept = new SysDept();
|
||||||
dept.setParentId(100L);
|
dept.setParentId(100L);
|
||||||
dept.setOrderNum(0);
|
dept.setOrderNum(0);
|
||||||
dept.setDeptName(pileMerchantInfo.getMerchantName());
|
dept.setDeptName(dto.getMerchantName());
|
||||||
dept.setLeader(pileMerchantInfo.getManagerName());
|
dept.setLeader(dto.getManagerName());
|
||||||
dept.setPhone(pileMerchantInfo.getManagerPhone());
|
dept.setPhone(dto.getManagerPhone());
|
||||||
dept.setStatus("0");
|
dept.setStatus("0");
|
||||||
sysDeptService.insertDept(dept);
|
sysDeptService.insertDept(dept);
|
||||||
|
|
||||||
// 2. 新增pile_merchant_info
|
// 2. 新增pile_merchant_info
|
||||||
Long deptId = dept.getDeptId();
|
Long deptId = dept.getDeptId();
|
||||||
// pileMerchantInfo.setId(deptId);
|
// dto.setId(deptId);
|
||||||
pileMerchantInfo.setDeptId(String.valueOf(deptId));
|
dto.setDeptId(String.valueOf(deptId));
|
||||||
pileMerchantInfo.setStatus(Constants.ONE);
|
dto.setStatus(Constants.ONE);
|
||||||
// String appId = StringUtils.isBlank(pileMerchantInfo.getAppId())
|
// String appId = StringUtils.isBlank(dto.getAppId())
|
||||||
// ? appid
|
// ? appid
|
||||||
// : pileMerchantInfo.getAppId();
|
// : dto.getAppId();
|
||||||
pileMerchantInfo.setAppId(pileMerchantInfo.getAppId());
|
dto.setAppId(dto.getAppId());
|
||||||
|
|
||||||
|
PileMerchantInfo pileMerchantInfo = new PileMerchantInfo();
|
||||||
|
BeanUtils.copyProperties(dto, pileMerchantInfo);
|
||||||
int i = pileMerchantInfoMapper.insertPileMerchantInfo(pileMerchantInfo);
|
int i = pileMerchantInfoMapper.insertPileMerchantInfo(pileMerchantInfo);
|
||||||
|
|
||||||
// 3 创建运营商管理员
|
// 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;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user