This commit is contained in:
2023-07-19 15:20:29 +08:00
parent 33ccda7214
commit a487054e79
3 changed files with 41 additions and 14 deletions

View File

@@ -212,20 +212,10 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
return 0;
}
// 1. 新增sys_dept
SysDept dept = new SysDept();
// 根据运营商Id查询到对应的部门id
dept.setParentId(Long.parseLong(merchantInfo.getDeptId()));
dept.setOrderNum(0);
dept.setDeptName(StringUtils.trim(dto.getStationName()));
dept.setLeader(StringUtils.trim(dto.getStationAdminName()));
dept.setPhone(StringUtils.trim(dto.getStationTel()));
dept.setStatus("0");
sysDeptService.insertDept(dept);
// 创建站点对应部门
SysDept dept = sysDeptService.createStationDept(Long.valueOf(merchantInfo.getDeptId()), dto.getStationName(), dto.getStationAdminName(), dto.getStationTel());
PileStationInfo pileStationInfo = new PileStationInfo();
// pileStationInfo.setId(dept.getDeptId());
pileStationInfo.setDeptId(String.valueOf(dept.getDeptId()));
// 前端输入信息
pileStationInfo.setMerchantId(Long.valueOf(dto.getMerchantId()));
@@ -259,9 +249,14 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
String redisKey = CacheConstants.SELECT_PILE_STATION_INFO_BY_ID + pileStationInfo.getId();
redisCache.deleteObject(redisKey);
// 更新数据库
pileStationInfo.setUpdateBy(SecurityUtils.getUsername());
pileStationInfo.setUpdateTime(DateUtils.getNowDate());
int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo);
// 同步组织中的名称,联系人,电话
SysDept sysDept = sysDeptService.selectDeptById(Long.parseLong(pileStationInfo.getDeptId()));
// 若修改运营商,则将此站点下所有桩对应的运营商也进行修改
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getMerchantId()))) {
// 先查出桩基本信息
@@ -271,9 +266,11 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
// 修改桩基本信息
pileBasicInfoService.updatePileMerchantBatch(pileIdList, String.valueOf(pileStationInfo.getMerchantId()));
}
// 修改了运营商,同步修改组织
}
// 同步组织中的名称,联系人,电话
SysDept sysDept = sysDeptService.selectDeptById(Long.parseLong(pileStationInfo.getDeptId()));
if (sysDept != null) {
sysDept.setDeptName(pileStationInfo.getStationName());
sysDept.setLeader(pileStationInfo.getStationAdminName());