Commit a20230ab authored by jichao's avatar jichao

评估--节能改造--认定 接口,删除之前的接口,列表查询由 工程项目 模块提供

parent 789610a2
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.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.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.manage.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.manage.entity.BusSaving;
import org.rcisoft.business.manage.service.BusSavingService;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Created by JiChao on 2018/5/17.
*/
@Api(tags = "评估--节能改造--认定")
@RestController
@RequestMapping("bussaving")
public class BusSavingController {
@Autowired
private BusSavingService busSavingServiceImpl;
@ApiOperation(value="修改", notes="传list对象")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "字符串"),
@ApiImplicitParam(name = "examiner", value = "检定员", dataType = "字符串"),
@ApiImplicitParam(name = "qualification", value = "执业资质", dataType = "字符串"),
@ApiImplicitParam(name = "tm", value = "从业时间", dataType = "字符串"),
@ApiImplicitParam(name = "performance", value = "项目业绩", dataType = "字符串"),
@ApiImplicitParam(name = "type", value = "1:工程造价认定,2:节能认定", dataType = "字符串"),
@ApiImplicitParam(name = "proId", value = "项目表主键", dataType = "字符串,可以不传")
})
@RequestMapping("/update")
public Result update(@RequestBody List<BusSaving> busSavingList) {
return Result.builder(busSavingServiceImpl.update(busSavingList));
}
@ApiOperation(value="查询", notes="2条记录,工程造价认定、节能认定")
@ApiImplicitParams({
@ApiImplicitParam(name = "proId", value = "项目表主键", required = true, dataType = "字符串")
})
@RequestMapping("/queryBusSaving/{proId:\\w+}")
public Result queryBusSaving(@PathVariable String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, busSavingServiceImpl.queryBusSaving(proId));
}
}
package org.rcisoft.business.evaluate.energysaving.dao; package org.rcisoft.business.manage.dao;
import org.rcisoft.business.evaluate.energysaving.entity.BusEvaluate; import org.rcisoft.business.manage.entity.BusSaving;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
/** /**
* Created by JiChao on 2018/5/4. * Created by JiChao on 2018/5/17.
*/ */
@Repository @Repository
public interface BusEvaluateRepository extends Mapper<BusEvaluate> { public interface BusSavingRepository extends Mapper<BusSaving> {
} }
package org.rcisoft.business.evaluate.energysaving.entity; package org.rcisoft.business.manage.entity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
* Created by JiChao on 2018/5/4. * Created by JiChao on 2018/5/17.
* 评估项目认定表 * 节能改造认定表(工程造价认定、节能认定)
*/ */
@Entity @Entity
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Table(name = "bus_evaluate_confirm") @Table(name = "bus_saving")
public class BusEvaluateConfirm { public class BusSaving {
@Id
private String id; private String id;
private String examiner; private String examiner;
private String qualification; private String qualification;
private String tm; private String tm;
private String performance; private String performance;
private String type;//1:工程造价认定,2:节能认定 private String type;
private String evaId; private String proId;
} }
package org.rcisoft.business.manage.service;
import org.rcisoft.business.manage.entity.BusSaving;
import org.rcisoft.core.model.PersistModel;
import java.util.List;
/**
* Created by JiChao on 2018/5/17.
*/
public interface BusSavingService {
/**
* 保存
* @return
*/
PersistModel save(List<BusSaving> busSavingList);
/**
* 修改
* @return
*/
PersistModel update(List<BusSaving> busSavingList);
/**
* 删除
* @return
*/
PersistModel delete(String proId);
/**
* 根据proId查询
* @return
*/
List<BusSaving> queryBusSaving(String proId);
}
package org.rcisoft.business.manage.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.manage.dao.BusSavingRepository;
import org.rcisoft.business.manage.entity.BusSaving;
import org.rcisoft.business.manage.service.BusSavingService;
import org.rcisoft.business.overview.entity.BusProjectArea;
import org.rcisoft.core.model.PersistModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* Created by JiChao on 2018/5/17.
*/
@Service
public class BusSavingServiceImpl implements BusSavingService {
@Autowired
private BusSavingRepository busSavingRepository;
@Transactional
@Override
public PersistModel save(List<BusSaving> busSavingList) {
int result = 0;
for (BusSaving busSaving : busSavingList) {
result += busSavingRepository.insert(busSaving);
}
return new PersistModel(result);
}
@Transactional
@Override
public PersistModel update(List<BusSaving> busSavingList) {
int result = 0;
String message = "";
Example example = new Example(BusSaving.class);
Example.Criteria criteria = example.createCriteria();
for (BusSaving busSaving : busSavingList) {
String id = busSaving.getId();
criteria.andEqualTo("id", id);
if (StringUtils.isNotEmpty(id)) {
result += busSavingRepository.updateByExample(busSaving, criteria);
message = "更新成功";
} else {
message = "ID为空,更新失败";
}
}
return new PersistModel(result, message);
}
@Transactional
@Override
public PersistModel delete(String proId) {
int result = 0;
String message = "";
Example example = new Example(BusSaving.class);
Example.Criteria criteria = example.createCriteria();
if (StringUtils.isNotEmpty(proId)) {
criteria.andEqualTo("proId", proId);
result += busSavingRepository.deleteByExample(criteria);
message = "删除成功";
} else {
message = "项目ID为空,删除失败";
}
return new PersistModel(result, message);
}
@Override
public List<BusSaving> queryBusSaving(String proId) {
Example example = new Example(BusSaving.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("proId", proId);
return busSavingRepository.selectByExample(criteria);
}
}
<?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
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <mapper namespace="org.rcisoft.business.manage.dao.BusSavingRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.evaluate.energysaving.entity.BusEvaluateConfirm"> <resultMap id="BaseResultMap" type="org.rcisoft.business.manage.entity.BusSaving">
<id column="ID" jdbcType="VARCHAR" property="id"/> <id column="ID" jdbcType="VARCHAR" property="id"/>
<result column="EXAMINER" jdbcType="VARCHAR" property="examiner"/> <result column="EXAMINER" jdbcType="VARCHAR" property="examiner"/>
<result column="QUALIFICATION" jdbcType="VARCHAR" property="qualification"/> <result column="QUALIFICATION" jdbcType="VARCHAR" property="qualification"/>
<result column="TM" jdbcType="VARCHAR" property="tm"/> <result column="TM" jdbcType="VARCHAR" property="tm"/>
<result column="PERFORMANCE" jdbcType="VARCHAR" property="performance"/> <result column="PERFORMANCE" jdbcType="VARCHAR" property="performance"/>
<result column="TYPE" jdbcType="VARCHAR" property="type"/> <result column="TYPE" jdbcType="VARCHAR" property="type"/>
<result column="EVA_ID" jdbcType="VARCHAR" property="evaId"/> <result column="PRO_ID" jdbcType="VARCHAR" property="proId"/>
</resultMap> </resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>--> <!--<cache type="${corePackag!}.util.RedisCache"/>-->
......
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