Commit b543cce1 authored by tianbo's avatar tianbo

refactor(jg): 优化单位列表获取逻辑并调整监管机构处理方式

- 删除 CommonController 中冗余的 COMPANY_TYPE_SUPERVISION_NAME 常量定义 - 修改 getUseUnitListByCurrentLoginUser 方法中公司类型的判断条件,使用 companyLevel 替代 companyType - 注释掉 CodeUtil 中不再使用的 selectCityCompanyCode 方法调用 - 移除 FeedbackSuggestionsMapper 中已废弃的 getCompanyNameByOrgCode 接口及其实现 - 更新反馈建议服务实现类,通过 Feign 调用获取上级公司信息替换原有数据库查询逻辑
parent 0eca30c4
......@@ -10,7 +10,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.FeedbackSuggestions;
* @date 2025-05-15
*/
public interface FeedbackSuggestionsMapper extends BaseMapper<FeedbackSuggestions> {
String getCompanyNameByOrgCode(String orgCode);
String getCompanySeqByCompanyCode(String companyCode);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.FeedbackSuggestionsMapper">
<select id="getCompanyNameByOrgCode" resultType="java.lang.String">
select company_name
from privilege_company
where org_code = #{orgCode}
limit 1
</select>
<select id="getCompanySeqByCompanyCode" resultType="java.lang.String">
SELECT sequence_nbr as sequenceNbr
FROM "amos_tzs_biz"."tz_base_enterprise_info"
......
......@@ -14,7 +14,9 @@ import com.yeejoin.amos.boot.module.common.api.enums.ProblemTypeEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.FeedbackSuggestionsMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFeedbackSuggestionsService;
import com.yeejoin.amos.boot.module.common.api.vo.FeedbackSuggestionsVo;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -72,8 +74,11 @@ public class FeedbackSuggestionsServiceImpl extends BaseService<FeedbackSuggesti
suggestions.setCreateUserName(userModel.getRealName());
suggestions.setCreateDate(new Date());
suggestions.setIsDelete(Boolean.FALSE);
suggestions.setSuperviseOrgCode(company.getOrgCode());
suggestions.setSuperviseOrgName(feedbackSuggestionsMapper.getCompanyNameByOrgCode(company.getOrgCode()));
CompanyModel parentCompany = Privilege.companyClient.seleteOne(company.getParentId()).getResult();
if (!ValidationUtil.isEmpty(parentCompany)) {
suggestions.setSuperviseOrgCode(parentCompany.getOrgCode());
suggestions.setSuperviseOrgName(parentCompany.getCompanyName());
}
suggestions.setCompanyCode(company.getCompanyCode());
suggestions.setCompanyName(company.getCompanyName());
suggestions.setReporterUserId(Objects.toString(userModel.getUserId()));
......
......@@ -73,11 +73,6 @@ public class CommonController extends BaseController {
private final CodeUtil codeUtil;
private final DataDictionaryServiceImpl iDataDictionaryService;
/**
* 监管机构
*/
public static final String COMPANY_TYPE_SUPERVISION_NAME = "监管机构";
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/currentLoginInfo")
@ApiOperation(httpMethod = "GET", value = "当前登录人信息", notes = "当前登录人信息")
......@@ -165,15 +160,15 @@ public class CommonController extends BaseController {
@GetMapping(value = "/getUseUnitListByCurrentLoginUser")
@ApiOperation(httpMethod = "GET", value = "根据当前登录人获取使用单位列表(用作设备列表查询)", notes = "根据当前登录人获取使用单位列表(用作设备列表查询)")
public ResponseModel<List<Map<String, Object>>> getUseUnitListByCurrentLoginUser() {
String companyType = getSelectedOrgInfo().getCompany().getCompanyType();
String companyLevel = getSelectedOrgInfo().getCompany().getLevel();
List<Map<String, Object>> result = new ArrayList<>();
if (COMPANY_TYPE_SUPERVISION_NAME.equals(companyType)) {
result = commonService.getUnitListByType("use", null, false);
}else {
if (BaseController.COMPANY_TYPE_COMPANY.equals(companyLevel)) {
result.add(MapBuilder.<String, Object>create()
.put("useCode", getSelectedOrgInfo().getCompany().getCompanyCode())
.put("useUnit", getSelectedOrgInfo().getCompany().getCompanyName())
.build());
} else {
result = commonService.getUnitListByType("use", null, false);
}
return ResponseHelper.buildResponse(result);
}
......
......@@ -103,7 +103,8 @@ public class CodeUtil {
} else {
if (!ValidationUtil.isEmpty(receiveCompanyCode)) {
String regionSeq = commonMapper.selectCompanyRegionSeq(receiveCompanyCode);
return commonMapper.selectCityCompanyCode(this.getRegionCodeByRegionSeq(regionSeq), EXCLUSION_CITY_REGIONS);
return this.getRegionCodeByRegionSeq(regionSeq);
// return commonMapper.selectCityCompanyCode(this.getRegionCodeByRegionSeq(regionSeq), EXCLUSION_CITY_REGIONS);
}
return null;
}
......
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