Commit 1010d970 authored by yangyang's avatar yangyang

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

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