Commit 1010d970 authored by yangyang's avatar yangyang

fix(编辑企业信息): 新增手动刷新用户组的接口

parent af8851e6
...@@ -1080,6 +1080,7 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1080,6 +1080,7 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override @Override
public TzBaseEnterpriseInfoDto updateCompanyInfoById(Map<String, Object> map, ReginParams reginParams) { public TzBaseEnterpriseInfoDto updateCompanyInfoById(Map<String, Object> map, ReginParams reginParams) {
log.info("根据ID修改企业信息 => {}, 更新人 => {}", map, RequestContext.getExeUserId()); log.info("根据ID修改企业信息 => {}, 更新人 => {}", map, RequestContext.getExeUserId());
RegUnitInfo olrRegUnitInfo = new RegUnitInfo();
try { try {
TzBaseEnterpriseInfo tzBaseEnterpriseInfo = new TzBaseEnterpriseInfo(); TzBaseEnterpriseInfo tzBaseEnterpriseInfo = new TzBaseEnterpriseInfo();
tzBaseEnterpriseInfo.setSequenceNbr(Long.valueOf(map.get("sequenceNbr").toString())); tzBaseEnterpriseInfo.setSequenceNbr(Long.valueOf(map.get("sequenceNbr").toString()));
...@@ -1138,6 +1139,7 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1138,6 +1139,7 @@ public class TzBaseEnterpriseInfoServiceImpl
if (ValidationUtil.isEmpty(regUnitInfo)) { if (ValidationUtil.isEmpty(regUnitInfo)) {
throw new BadRequest("未找到单位注册信息"); throw new BadRequest("未找到单位注册信息");
} }
BeanUtils.copyProperties(regUnitInfo, olrRegUnitInfo);
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.queryByUserId(regUnitInfo.getAdminUserId()); FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.queryByUserId(regUnitInfo.getAdminUserId());
AgencyUserModel agencyUserModel = Optional.ofNullable(userResult).map(FeignClientResult::getResult).orElse(null); AgencyUserModel agencyUserModel = Optional.ofNullable(userResult).map(FeignClientResult::getResult).orElse(null);
if (ValidationUtil.isEmpty(agencyUserModel)) { if (ValidationUtil.isEmpty(agencyUserModel)) {
...@@ -1158,7 +1160,7 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1158,7 +1160,7 @@ public class TzBaseEnterpriseInfoServiceImpl
// -- 20250627 调整为监管单位不能修改工商信息和资质 // -- 20250627 调整为监管单位不能修改工商信息和资质
regUnitInfoService.updateBySeq(regUnitInfo);
// 企业信息变更-同步修改企业下人员绑定设备类型 // 企业信息变更-同步修改企业下人员绑定设备类型
ArrayList<String> newData = new ArrayList<>(); ArrayList<String> newData = new ArrayList<>();
JSONArray objects = JSON.parseArray(tzBaseEnterpriseInfo.getEquipCategory()); JSONArray objects = JSON.parseArray(tzBaseEnterpriseInfo.getEquipCategory());
...@@ -1186,7 +1188,6 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1186,7 +1188,6 @@ public class TzBaseEnterpriseInfoServiceImpl
TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto = new TzBaseEnterpriseInfoDto(); TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto = new TzBaseEnterpriseInfoDto();
BeanUtils.copyProperties(tzBaseEnterpriseInfo, tzBaseEnterpriseInfoDto); BeanUtils.copyProperties(tzBaseEnterpriseInfo, tzBaseEnterpriseInfoDto);
// 更新完成后清理缓存 // 更新完成后清理缓存
regUnitInfoService.updateById(regUnitInfo);
redisUtil.del(RedisKey.buildReginRoleKey(agencyUserModel.getUserId())); redisUtil.del(RedisKey.buildReginRoleKey(agencyUserModel.getUserId()));
publisher.publish(new DataRefreshEvent(this, Collections.singletonList(tzBaseEnterpriseInfo.getSequenceNbr() + ""), DataRefreshEvent.DataType.enterprise.name(), DataRefreshEvent.Operation.UPDATE)); publisher.publish(new DataRefreshEvent(this, Collections.singletonList(tzBaseEnterpriseInfo.getSequenceNbr() + ""), DataRefreshEvent.DataType.enterprise.name(), DataRefreshEvent.Operation.UPDATE));
return tzBaseEnterpriseInfoDto; return tzBaseEnterpriseInfoDto;
...@@ -1194,6 +1195,9 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1194,6 +1195,9 @@ public class TzBaseEnterpriseInfoServiceImpl
return null; return null;
} }
} catch (Exception e) { } catch (Exception e) {
if (!ValidationUtil.isEmpty(olrRegUnitInfo)) {
regUnitInfoService.updateBySeq(olrRegUnitInfo);
}
log.error("更新企业信息失败: ", e); log.error("更新企业信息失败: ", e);
throw new BadRequest("更新企业信息失败!"); throw new BadRequest("更新企业信息失败!");
} }
......
...@@ -64,6 +64,7 @@ import org.springframework.mock.web.MockMultipartFile; ...@@ -64,6 +64,7 @@ import org.springframework.mock.web.MockMultipartFile;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -1182,4 +1183,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -1182,4 +1183,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
public JSONArray queryUnitType(String type) { public JSONArray queryUnitType(String type) {
return UnitTypeNewEnum.getUnitTypeByLabel(type); return UnitTypeNewEnum.getUnitTypeByLabel(type);
} }
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public void updateBySeq(RegUnitInfo regUnitInfo) {
this.updateById(regUnitInfo);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment