Commit 10c06d10 by 丁伟峰

layerId, skillGroupCode,翻译为对应的中文返回

1 parent b1e7c906
package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.MapLayerCustomizeEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface MapLayerCustomizeDao extends JpaRepository<MapLayerCustomizeEntity, Long> {
}
package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.MapLayerEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface MapLayerDao extends JpaRepository<MapLayerEntity, Long> {
MapLayerEntity getByLayerId(String layerId);
}
package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.SkillGroupEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface SkillGroupDao extends JpaRepository<SkillGroupEntity, Long> {
}
...@@ -40,14 +40,16 @@ public class BusinessSkillListDTO { ...@@ -40,14 +40,16 @@ public class BusinessSkillListDTO {
private String brand; private String brand;
private LocalDateTime createTime; private LocalDateTime createTime;
private Boolean gasCert; private Boolean gasCert;
private Object layerId; private String layerId;
private String layerName;
private Boolean lowElectricianCert; private Boolean lowElectricianCert;
private String memo; private String memo;
private Integer priority; // private Integer priority;
private String skill; private String skill;
private String skillCategory; private String skillCategory;
private String skillCode; private String skillCode;
private String skillGroupCode; private String skillGroupCode;
private String skillGroupName;
private Integer takeEngineer; private Integer takeEngineer;
private Integer takeTime; private Integer takeTime;
private String type; private String type;
......
package com.dituhui.pea.order.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
@Entity
@Data
@Table(name = "map_layer_customize_entity")
public class MapLayerCustomizeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "branch_id", nullable = false, length = 32)
private String branchId;
@Column(name = "layer_id", length = 32)
private String layerId;
@Column(name = "layer", nullable = false, length = 50)
private String layer;
@Column(name = "layer_describe", nullable = false, length = 200)
private String layerDescribe;
@Column(name = "disabled", nullable = false)
private boolean disabled;
@Column(name = "memo", nullable = false, length = 100)
private String memo;
@Column(name = "create_time", nullable = false)
private Date createTime;
@Column(name = "update_time", nullable = false)
private Date updateTime;
// Getters and Setters
// ...
}
package com.dituhui.pea.order.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
@Entity
@Data
@Table(name = "map_layer")
public class MapLayerEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "layer_id", nullable = false, length = 32)
private String layerId;
@Column(name = "layer", nullable = false, length = 50)
private String layer;
@Column(name = "layer_describe", nullable = false, length = 200)
private String layerDescribe;
@Column(name = "memo", nullable = false, length = 100)
private String memo;
@Column(name = "create_time", nullable = false)
private Date createTime;
@Column(name = "update_time", nullable = false)
private Date updateTime;
// Getters and Setters
// ...
}
package com.dituhui.pea.order.service.impl; package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.dao.MapLayerCustomizeDao;
import com.dituhui.pea.order.dao.MapLayerDao;
import com.dituhui.pea.order.dao.SkillGroupDao;
import com.dituhui.pea.order.dao.SkillInfoDao; import com.dituhui.pea.order.dao.SkillInfoDao;
import com.dituhui.pea.order.dto.BusinessSkillListDTO; import com.dituhui.pea.order.dto.BusinessSkillListDTO;
import com.dituhui.pea.order.entity.MapLayerCustomizeEntity;
import com.dituhui.pea.order.entity.MapLayerEntity;
import com.dituhui.pea.order.entity.SkillGroupEntity;
import com.dituhui.pea.order.entity.SkillInfoEntity; import com.dituhui.pea.order.entity.SkillInfoEntity;
import com.dituhui.pea.order.service.BusinessBaseService; import com.dituhui.pea.order.service.BusinessBaseService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -12,7 +18,9 @@ import org.springframework.data.domain.PageRequest; ...@@ -12,7 +18,9 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -22,12 +30,25 @@ public class BusinessBaseServiceImpl implements BusinessBaseService { ...@@ -22,12 +30,25 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
@Autowired @Autowired
private SkillInfoDao skillInfoDao; private SkillInfoDao skillInfoDao;
@Autowired
private MapLayerDao mapLayerDao;
@Autowired
private MapLayerCustomizeDao mapLayerCustomizeDao;
@Autowired
private SkillGroupDao skillGroupDao;
private Map<String, String> mapLayer = null;
private Map<String, String> mapSkillGroup = null;
@Override @Override
public Result<?> getSkillList(BusinessSkillListDTO.Request req) { public Result<?> getSkillList(BusinessSkillListDTO.Request req) {
Pageable pageable = PageRequest.of(req.getPage() - 1, req.getSize()); Pageable pageable = PageRequest.of(req.getPage() - 1, req.getSize());
Page<SkillInfoEntity> page = skillInfoDao.findAll(pageable); Page<SkillInfoEntity> page = skillInfoDao.findAll(pageable);
List<BusinessSkillListDTO.Content> contents = page.getContent().stream().map(e->{ List<BusinessSkillListDTO.Content> contents = page.getContent().stream().map(e -> {
return new BusinessSkillListDTO.Content() return new BusinessSkillListDTO.Content()
.setSkillCode(e.getSkillCode()) .setSkillCode(e.getSkillCode())
.setBrand(e.getBrand()) .setBrand(e.getBrand())
...@@ -37,9 +58,11 @@ public class BusinessBaseServiceImpl implements BusinessBaseService { ...@@ -37,9 +58,11 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
.setTakeEngineer(e.getTakeEngineer()) .setTakeEngineer(e.getTakeEngineer())
.setLowElectricianCert(e.getLowElectricianCert()) .setLowElectricianCert(e.getLowElectricianCert())
.setGasCert(e.getGasCert()) .setGasCert(e.getGasCert())
.setPriority(e.getPriority()) //.setPriority(e.getPriority())
.setSkillGroupCode(e.getSkillGroupCode()) .setSkillGroupCode(e.getSkillGroupCode())
.setSkillGroupName(this.getSkillGroupName(e.getSkillCode()))
.setLayerId(e.getLayerId()) .setLayerId(e.getLayerId())
.setLayerName(this.getLayerName(e.getLayerId()))
.setTypeCategory(e.getTypeCategory()) .setTypeCategory(e.getTypeCategory())
.setSkillCategory(e.getSkillCategory()) .setSkillCategory(e.getSkillCategory())
.setMemo(e.getMemo()) .setMemo(e.getMemo())
...@@ -54,4 +77,29 @@ public class BusinessBaseServiceImpl implements BusinessBaseService { ...@@ -54,4 +77,29 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
rs.setContent(contents); rs.setContent(contents);
return Result.success(rs); return Result.success(rs);
} }
private void initMaps() {
// 图层
mapLayer = new HashMap<>();
mapLayer.putAll(mapLayerDao.findAll().stream().collect(Collectors.toMap(MapLayerEntity::getLayerId, MapLayerEntity::getLayer)));
mapLayer.putAll(mapLayerCustomizeDao.findAll().stream().collect(Collectors.toMap(MapLayerCustomizeEntity::getLayerId, MapLayerCustomizeEntity::getLayer)));
// 技能组
mapSkillGroup = new HashMap<>();
mapSkillGroup.putAll(skillGroupDao.findAll().stream().collect(Collectors.toMap(SkillGroupEntity::getSkillGroupCode, SkillGroupEntity::getSkillGroup)));
}
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!