Commit bcf20b7f by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents 77d97efc df81069f
......@@ -12,6 +12,7 @@ import com.dituhui.pea.order.entity.SkillGroupEntity;
import com.dituhui.pea.order.entity.SkillInfoEntity;
import com.dituhui.pea.order.service.BusinessBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
......@@ -46,28 +47,14 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
@Override
public Result<?> getSkillList(BusinessSkillListDTO.Request req) {
Pageable pageable = PageRequest.of(req.getPage() - 1, req.getSize());
this.initMaps();
Page<SkillInfoEntity> page = skillInfoDao.findAll(pageable);
List<BusinessSkillListDTO.Content> contents = page.getContent().stream().map(e -> {
return new BusinessSkillListDTO.Content()
.setSkillCode(e.getSkillCode())
.setBrand(e.getBrand())
.setType(e.getType())
.setSkill(e.getSkill())
.setTakeTime(e.getTakeTime())
.setTakeEngineer(e.getTakeEngineer())
.setLowElectricianCert(e.getLowElectricianCert())
.setGasCert(e.getGasCert())
//.setPriority(e.getPriority())
.setSkillGroupCode(e.getSkillGroupCode())
.setSkillGroupName(this.getSkillGroupName(e.getSkillCode()))
.setLayerId(e.getLayerId())
.setLayerName(this.getLayerName(e.getLayerId()))
.setTypeCategory(e.getTypeCategory())
.setSkillCategory(e.getSkillCategory())
.setMemo(e.getMemo())
.setCreateTime(e.getCreateTime())
.setUpdateTime(e.getUpdateTime());
BusinessSkillListDTO.Content content = new BusinessSkillListDTO.Content();
BeanUtils.copyProperties(e, content);
content.setSkillGroupName(mapSkillGroup.get(e.getSkillCode()));
content.setLayerName(mapLayer.get(e.getLayerId()));
return content;
}).collect(Collectors.toList());
BusinessSkillListDTO.Result rs = new BusinessSkillListDTO.Result();
rs.setTotal(page.getTotalElements())
......@@ -88,18 +75,4 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
mapSkillGroup.putAll(skillGroupDao.findAll().stream().collect(Collectors.toMap(SkillGroupEntity::getSkillGroupCode, SkillGroupEntity::getSkillGroup)));
log.info("initMaps ====> mapLayer ==> {}, mapSkillGroup ==> {}", mapLayer, mapSkillGroup);
}
String getLayerName(String layerId) {
if (mapLayer == null) {
initMaps();
}
return mapLayer.get(layerId);
}
String getSkillGroupName(String skillGroupCode) {
if (mapSkillGroup == null) {
initMaps();
}
return mapSkillGroup.get(skillGroupCode);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!