Commit f0ec43e5 authored by suhuiguang's avatar suhuiguang

1.获取公司类型优化

parent ceadb056
......@@ -43,6 +43,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -540,10 +541,8 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
public Page<JgEquipTransferDto> queryForJgEquipTransferPage(Page<JgEquipTransferDto> page, JgEquipTransferDto dto, ReginParams reginParams) {
CompanyBo company = reginParams.getCompany();
Map<String, Object> companyTypeMap = jrmInstallationNoticeService.getCompanyType();
String companyLevel = getStringFromMap(companyTypeMap, "companyLevel");
String companyType = getStringFromMap(companyTypeMap, "companyType");
if ("company".equals(companyLevel) && companyType != null) {
if (companyType.contains(CompanyTypeEnum.USE.getCode()) || companyType.contains(CompanyTypeEnum.INDIVIDUAL.getCode())) {
dto.setUseUnitCodeFilter(company.getCompanyCode());
......@@ -553,19 +552,12 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
}
}
Page<JgEquipTransferDto> equipTransferPage = this.baseMapper.queryForPage(page, dto, reginParams.getUserModel().getUserId());
Page<JgEquipTransferDto> equipTransferDtoPage = new Page<>();
BeanUtils.copyProperties(equipTransferPage, equipTransferDtoPage, "records");
List<JgEquipTransferDto> records = equipTransferPage.getRecords().stream().map(transfer -> {
JgEquipTransferDto equipTransferDto = new JgEquipTransferDto();
BeanUtils.copyProperties(transfer, equipTransferDto);
equipTransferPage.getRecords().forEach(transfer -> {
if (Objects.nonNull(transfer.getApplyStatus())) {
equipTransferDto.setApplyStatusDesc(FlowStatusEnum.getNameByType(Long.valueOf(transfer.getApplyStatus())));
transfer.setApplyStatusDesc(FlowStatusEnum.getNameByType(Long.valueOf(transfer.getApplyStatus())));
}
return equipTransferDto;
}).collect(Collectors.toList());
equipTransferDtoPage.setRecords(records);
return equipTransferDtoPage;
});
return equipTransferPage;
}
@Override
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.util.StringUtil;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
......@@ -1113,11 +1114,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
public Map<String, Object> getCompanyType() {
Map<String, Object> result = new HashMap<>();
result.put("companyType", "");
List<CompanyModel> companyModels = FeignUtil.remoteCall(() -> Privilege.companyClient.queryListByChild(RequestContext.getExeUserId()));
if (companyModels.isEmpty()) {
return result;
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (reginParams == null) {
return null;
}
CompanyModel currentCompany = companyModels.get(0);
CompanyBo currentCompany = reginParams.getCompany();
result.put("creditCode", currentCompany.getCompanyCode().contains("_") ? currentCompany.getCompanyCode().split("_")[1] : currentCompany.getCompanyCode());
String companyLevel = CompanyTypeEnum.decideCompanyLevel(currentCompany.getCompanyType());
String companyType = CompanyTypeEnum.decideCompanyCode(currentCompany.getCompanyType());
......
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