121 lines
4.3 KiB
Plaintext
121 lines
4.3 KiB
Plaintext
package com.sercurityControl.proteam.newScreen.service;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.sercurityControl.proteam.newScreen.domain.GBExcellRateEntity;
|
|
import com.sercurityControl.proteam.newScreen.mapper.GreenBuildMapper;
|
|
import com.sercurityControl.proteam.util.DateTimeHelper;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
/*
|
|
*绿色建造-业务逻辑层
|
|
* */
|
|
@Service(value = "GreenBuildService")
|
|
public class GreenBuildServiceImpl implements GreenBuildService {
|
|
|
|
@Resource(name = "GreenBuildMapper")
|
|
private GreenBuildMapper mapper;
|
|
|
|
@Override
|
|
public List<GBExcellRateEntity> getExcellRateByOrg() {
|
|
List<GBExcellRateEntity> list = mapper.getExcellRateByOrg();
|
|
List<GBExcellRateEntity> sortList = list.stream().sorted(Comparator.comparing(GBExcellRateEntity::getExcellRate,Comparator.comparingInt(Integer::parseInt)).reversed()).collect(Collectors.toList());
|
|
return sortList;
|
|
}
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void updateEecellRate(GBExcellRateEntity entity) {
|
|
List<String> orgIdList = entity.getOrgIdList();
|
|
List<String> excellRateList = entity.getExcellRateList();
|
|
for (int i = 0; i < orgIdList.size(); i++) {
|
|
GBExcellRateEntity o = new GBExcellRateEntity();
|
|
o.setOrgId(orgIdList.get(i));
|
|
o.setExcellRate(excellRateList.get(i));
|
|
mapper.updateEecellRate(o);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public List<Map<String, Object>> getAwardsList() {
|
|
return mapper.getAwardsList();
|
|
}
|
|
|
|
@Override
|
|
public List<Map<String, Object>> getAwardsListOnMap() {
|
|
List<Map<String, Object>> newList = new ArrayList<>();
|
|
List<Map<String, Object>> list = mapper.getAwardsListOnMap();
|
|
Map<String,List<Map<String, Object>>> map = list.stream().collect(Collectors.groupingBy(item->{
|
|
return (String) item.get("org");
|
|
}));
|
|
map.forEach((k,v)->{
|
|
Map<String, Object> map1 = new HashMap<>(16);
|
|
StringBuilder proName = new StringBuilder();
|
|
StringBuilder jxName = new StringBuilder();
|
|
String lon = "";
|
|
String lat = "";
|
|
for (int i = 0; i < v.size(); i++) {
|
|
if(i == 0){
|
|
lon += v.get(0).get("lon");
|
|
lat += v.get(0).get("lat");
|
|
}
|
|
proName.append(v.get(i).get("proName")).append(";");
|
|
jxName.append(v.get(i).get("jxName")).append(";");
|
|
}
|
|
proName = new StringBuilder(proName.substring(0, proName.length() - 1));
|
|
jxName = new StringBuilder(jxName.substring(0, jxName.length() - 1));
|
|
map1.put("lon",lon);
|
|
map1.put("lat",lat);
|
|
map1.put("proName", proName.toString());
|
|
map1.put("jxName", jxName.toString());
|
|
newList.add(map1);
|
|
});
|
|
return newList;
|
|
}
|
|
|
|
@Override
|
|
public PageInfo<GBExcellRateEntity> getAwardsListByChild(GBExcellRateEntity entity) {
|
|
List<GBExcellRateEntity> list = mapper.getAwardsListByChild(entity);
|
|
PageInfo<GBExcellRateEntity> pageInfo = new PageInfo<>(list);
|
|
return pageInfo;
|
|
}
|
|
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void delAwardsById(String id) {
|
|
mapper.delAwardsById(id);
|
|
}
|
|
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void addAwards(GBExcellRateEntity entity) {
|
|
entity.setCreateTime(DateTimeHelper.getNowTime());
|
|
entity.setUpdateTime(DateTimeHelper.getNowTime());
|
|
mapper.addAwards(entity);
|
|
}
|
|
|
|
@Override
|
|
public void updateAwards(GBExcellRateEntity entity) {
|
|
entity.setUpdateTime(DateTimeHelper.getNowTime());
|
|
mapper.updateAwards(entity);
|
|
}
|
|
|
|
@Override
|
|
public List<Map<String, Object>> getProList() {
|
|
return mapper.getProList();
|
|
}
|
|
|
|
@Override
|
|
public GBExcellRateEntity getAwardsById(GBExcellRateEntity entity) {
|
|
return mapper.getAwardsById(entity);
|
|
}
|
|
|
|
@Override
|
|
public List<Map<String, Object>> getExcellRateListByChild() {
|
|
return mapper.getExcellRateListByChild();
|
|
}
|
|
}
|