Commit 8ade94fd authored by jichao's avatar jichao

项目评估--节能改造

parent d9e3b2e8
......@@ -8,6 +8,7 @@ import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -39,8 +40,8 @@ public class AnalysisController {
@ApiOperation(value="下载文件", notes="下载文件")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "文件的主键", required = true, dataType = "数字")})
@RequestMapping("/download")
public void download(HttpServletResponse response, @RequestParam Integer id) {
@RequestMapping("/download/{id:\\w+}")
public void download(HttpServletResponse response, @PathVariable Integer id) {
analysisServiceImpl.download(response, id);
}
......@@ -55,8 +56,8 @@ public class AnalysisController {
@ApiOperation(value="删除文件", notes="删除文件")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "文件的主键", required = true, dataType = "数字")})
@RequestMapping("/delete")
public Result delete(@RequestParam Integer id) {
@RequestMapping("/delete/{id:\\w+}")
public Result delete(@PathVariable Integer id) {
Integer result = analysisServiceImpl.delete(id);
return Result.builder(new PersistModel(result), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, result);
}
......
......@@ -15,6 +15,7 @@ import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -75,16 +76,22 @@ public class AnalysisServiceImpl implements AnalysisService {
@Override
public List<BusReport> analysisFile(String proId, Integer year) {
//返回值,12个
List<BusReport> resultList = new ArrayList<>();
for (int i = 0; i < 12; i++) {
resultList.add(new BusReport(-1, null, null, i + 1, null));
}
BusReport busReport = new BusReport();
busReport.setProId(proId);
busReport.setYear(year);
List<BusReport> list = busReportRepository.select(busReport);
list.forEach(b -> {
b.setProId(null);
b.setYear(null);
b.setPath(null);
Integer month = b.getMonth();
BusReport br = resultList.get(month - 1);
br.setId(b.getId());
br.setMonth(month);
});
return list;
return resultList;
}
@Transactional
......
package org.rcisoft.business.evaluate.energysaving.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.evaluate.energysaving.service.EnergySavingService;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by JiChao on 2018/5/4.
*/
@Api(tags = "项目评估--节能改造")
@RestController
@RequestMapping("energysaving")
public class EnergySavingController {
@Autowired
private EnergySavingService energySavingServiceImpl;
@ApiOperation(value="团队列表", notes="团队列表,所有团队")
@RequestMapping("/teamList")
public Result teamList() {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, energySavingServiceImpl.teamList());
}
@ApiOperation(value="评估项目列表", notes="评估项目列表")
@RequestMapping("/evaluateList")
public Result evaluateList() {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, energySavingServiceImpl.evaluateList());
}
@ApiOperation(value="右边的认定信息", notes="分 工程造价认定、节能认定 两个")
@ApiImplicitParams({@ApiImplicitParam(name = "evaId", value = "评估项目主键", required = true, dataType = "字符串")})
@RequestMapping("/confirmByEvaId/{evaId:\\w+}")
public Result confirmByEvaId(@PathVariable String evaId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, energySavingServiceImpl.confirmByEvaId(evaId));
}
}
package org.rcisoft.business.evaluate.energysaving.dao;
import org.rcisoft.business.evaluate.energysaving.entity.BusEvaluateConfirm;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
/**
* Created by JiChao on 2018/5/4.
*/
@Repository
public interface BusEvaluateConfirmRepository extends Mapper<BusEvaluateConfirm> {
}
package org.rcisoft.business.evaluate.energysaving.dao;
import org.rcisoft.business.evaluate.energysaving.entity.BusEvaluate;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
/**
* Created by JiChao on 2018/5/4.
*/
@Repository
public interface BusEvaluateRepository extends Mapper<BusEvaluate> {
}
package org.rcisoft.business.evaluate.energysaving.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* Created by JiChao on 2018/5/4.
* 评估项目表
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "bus_evaluate")
public class BusEvaluate {
@Id
private String evaId;
private String buildNm;
private String buildType;//建筑类型
private String buildYear;
private String buildArea;
private String evaType;//项目类型
private String cooperation;
private String coordinate;//坐标
}
package org.rcisoft.business.evaluate.energysaving.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* Created by JiChao on 2018/5/4.
* 评估项目认定表
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "bus_evaluate_confirm")
public class BusEvaluateConfirm {
private String id;
private String examiner;
private String qualification;
private String tm;
private String performance;
private String type;//1:工程造价认定,2:节能认定
private String evaId;
}
package org.rcisoft.business.evaluate.energysaving.service;
import org.rcisoft.business.evaluate.energysaving.entity.BusEvaluate;
import org.rcisoft.business.evaluate.energysaving.entity.BusEvaluateConfirm;
import org.rcisoft.business.evaluate.team.entity.BusTeam;
import java.util.List;
/**
* Created by JiChao on 2018/5/4.
*/
public interface EnergySavingService {
/**
* 团队列表
* @return
*/
List<BusTeam> teamList();
/**
* 评估项目列表
* @return
*/
List<BusEvaluate> evaluateList();
/**
* 工程造价认定、节能认定
* @param evaId
* @return
*/
List<BusEvaluateConfirm> confirmByEvaId(String evaId);
}
package org.rcisoft.business.evaluate.energysaving.service.impl;
import org.rcisoft.business.evaluate.energysaving.dao.BusEvaluateConfirmRepository;
import org.rcisoft.business.evaluate.energysaving.dao.BusEvaluateRepository;
import org.rcisoft.business.evaluate.energysaving.entity.BusEvaluate;
import org.rcisoft.business.evaluate.energysaving.entity.BusEvaluateConfirm;
import org.rcisoft.business.evaluate.energysaving.service.EnergySavingService;
import org.rcisoft.business.evaluate.team.dao.BusTeamRepository;
import org.rcisoft.business.evaluate.team.entity.BusTeam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by JiChao on 2018/5/4.
*/
@Service
public class EnergySavingServiceImpl implements EnergySavingService {
@Autowired
private BusTeamRepository busTeamRepository;
@Autowired
private BusEvaluateRepository busEvaluateRepository;
@Autowired
private BusEvaluateConfirmRepository busEvaluateConfirmRepository;
@Override
public List<BusTeam> teamList() {
return busTeamRepository.selectByTeamId(null);
}
@Override
public List<BusEvaluate> evaluateList() {
return busEvaluateRepository.selectAll();
}
@Override
public List<BusEvaluateConfirm> confirmByEvaId(String evaId) {
BusEvaluateConfirm b = new BusEvaluateConfirm();
b.setEvaId(evaId);
return busEvaluateConfirmRepository.select(b);
}
}
package org.rcisoft.business.evaluate.team.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.evaluate.team.entity.BusTeam;
......@@ -16,9 +17,9 @@ public interface BusTeamRepository extends BaseMapper<BusTeam>{
@Select("select a.*,count(b.TEAM_ID) as teamNumber,sum(b.BLD_AREA) as area from `bus_team` a join `bus_project` b on a.`TEAM_ID`=b.`TEAM_ID` where `TEAM_TYPE` = #{type} GROUP BY TEAM_ID")
@Select("<script>select a.*,count(b.TEAM_ID) as teamNumber,sum(b.BLD_AREA) as area from `bus_team` a join `bus_project` b on a.`TEAM_ID`=b.`TEAM_ID` where 1=1 <if test=\"type != null\"> and `TEAM_TYPE` = #{type}</if> GROUP BY TEAM_ID</script>")
@ResultMap(value = "BaseResultMap" )
List<BusTeam> selectByTeamId(String type);
List<BusTeam> selectByTeamId(@Param("type") String type);
......
......@@ -5,6 +5,7 @@ import lombok.*;
import org.rcisoft.core.entity.IdNotDataEntity;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* Created with liuzhichao on 2018-4-18 17:25:08.
......@@ -34,7 +35,7 @@ public class BusTeam implements Serializable {
private String teamType;
private float area;
private BigDecimal area;
private Integer teamNumber;
}
......
......@@ -8,10 +8,10 @@
<result column="ONLINE_DATE" jdbcType="VARCHAR" property="onlineDate"/>
<result column="INTRODUCE" jdbcType="VARCHAR" property="intorduce"/>
<result column="PRI_ID" jdbcType="VARCHAR" property="priId"/>
<result column="RECOMMEND" jdbcType="VARCHAR" property="recommend"/>
<result column="RECOMMEND" jdbcType="INTEGER" property="recommend"/>
<result column="TEAM_TYPE" jdbcType="VARCHAR" property="teamType"/>
<result column="area" jdbcType="VARCHAR" property="area"/>
<result column="teamNumber" jdbcType="VARCHAR" property="teamNumber"/>
<result column="area" jdbcType="DECIMAL" property="area"/>
<result column="teamNumber" jdbcType="INTEGER" property="teamNumber"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
......
<?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="org.rcisoft.business.evaluate.energysaving.dao.BusEvaluateConfirmRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.evaluate.energysaving.entity.BusEvaluateConfirm">
<id column="ID" jdbcType="VARCHAR" property="id"/>
<result column="EXAMINER" jdbcType="VARCHAR" property="examiner"/>
<result column="QUALIFICATION" jdbcType="VARCHAR" property="qualification"/>
<result column="TM" jdbcType="VARCHAR" property="tm"/>
<result column="PERFORMANCE" jdbcType="VARCHAR" property="performance"/>
<result column="TYPE" jdbcType="VARCHAR" property="type"/>
<result column="EVA_ID" jdbcType="VARCHAR" property="evaId"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
<?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="org.rcisoft.business.evaluate.energysaving.dao.BusEvaluateRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.evaluate.energysaving.entity.BusEvaluate">
<id column="EVA_ID" jdbcType="VARCHAR" property="evaId"/>
<result column="BUILD_NM" jdbcType="VARCHAR" property="buildNm"/>
<result column="BUILD_TYPE" jdbcType="VARCHAR" property="buildType"/>
<result column="BUILD_YEAR" jdbcType="VARCHAR" property="buildYear"/>
<result column="BUILD_AREA" jdbcType="VARCHAR" property="buildArea"/>
<result column="EVA_TYPE" jdbcType="VARCHAR" property="evaType"/>
<result column="COOPERATION" jdbcType="VARCHAR" property="cooperation"/>
<result column="COORDINATE" jdbcType="VARCHAR" property="coordinate"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
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