Commit f7869e10 authored by jichao's avatar jichao

修改bug

parent 28326304
...@@ -3,6 +3,7 @@ package org.rcisoft.business.buildtp.service.impl; ...@@ -3,6 +3,7 @@ package org.rcisoft.business.buildtp.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.manage.dao.ProjectRepository; import org.rcisoft.business.manage.dao.ProjectRepository;
import org.rcisoft.business.manage.entity.BusProject; import org.rcisoft.business.manage.entity.BusProject;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
...@@ -47,7 +48,7 @@ public class BuildTpServiceImpl implements BuildTpService { ...@@ -47,7 +48,7 @@ public class BuildTpServiceImpl implements BuildTpService {
public PersistModel save(BuildTp buildTp){ public PersistModel save(BuildTp buildTp){
int line = 0; int line = 0;
// 验重 // 验重
Integer repeat = this.repeat(buildTp.getBldTpNm()); Integer repeat = this.repeat(null, buildTp.getBldTpNm());
if (repeat > 0) if (repeat > 0)
return new PersistModel(line, "建筑类型不能重复"); return new PersistModel(line, "建筑类型不能重复");
buildTp.setBldTpId(UUID.randomUUID().toString().replace("-","")); buildTp.setBldTpId(UUID.randomUUID().toString().replace("-",""));
...@@ -87,7 +88,7 @@ public class BuildTpServiceImpl implements BuildTpService { ...@@ -87,7 +88,7 @@ public class BuildTpServiceImpl implements BuildTpService {
public PersistModel merge(BuildTp buildTp){ public PersistModel merge(BuildTp buildTp){
int line = 0; int line = 0;
// 验重 // 验重
Integer repeat = this.repeat(buildTp.getBldTpNm()); Integer repeat = this.repeat(buildTp.getBldTpId(), buildTp.getBldTpNm());
if (repeat > 0) if (repeat > 0)
return new PersistModel(line, "建筑类型不能重复"); return new PersistModel(line, "建筑类型不能重复");
Example example = new Example(BuildTp.class); Example example = new Example(BuildTp.class);
...@@ -112,10 +113,12 @@ public class BuildTpServiceImpl implements BuildTpService { ...@@ -112,10 +113,12 @@ public class BuildTpServiceImpl implements BuildTpService {
* @param bldTpNm * @param bldTpNm
* @return * @return
*/ */
private Integer repeat(String bldTpNm) { private Integer repeat(String bldTpId, String bldTpNm) {
Example example = new Example(BuildTp.class); Example example = new Example(BuildTp.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("bldTpNm", bldTpNm); criteria.andEqualTo("bldTpNm", bldTpNm);
if (StringUtils.isNotEmpty(bldTpId))
criteria.andNotEqualTo("bldTpId", bldTpId);
return buildTpRepository.selectCountByExample(example); return buildTpRepository.selectCountByExample(example);
} }
......
...@@ -6,6 +6,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet; ...@@ -6,6 +6,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.CellType;
import com.google.zxing.WriterException; import com.google.zxing.WriterException;
import org.apache.poi.ss.util.CellRangeAddress;
import org.rcisoft.business.device.assets.dao.BusDeviceRepository; import org.rcisoft.business.device.assets.dao.BusDeviceRepository;
import org.rcisoft.business.device.assets.service.BusDeviceService; import org.rcisoft.business.device.assets.service.BusDeviceService;
import org.rcisoft.business.device.assets.vo.DeviceAssetStatisticVo; import org.rcisoft.business.device.assets.vo.DeviceAssetStatisticVo;
...@@ -341,6 +342,16 @@ public class BusDeviceServiceImpl implements BusDeviceService { ...@@ -341,6 +342,16 @@ public class BusDeviceServiceImpl implements BusDeviceService {
} }
// 表明参数类型行 // 表明参数类型行
rowNum = rowNum + 4 - size; rowNum = rowNum + 4 - size;
// 合并单元格
CellRangeAddress cra1 = new CellRangeAddress(7, 7, 3, 4);
CellRangeAddress cra2 = new CellRangeAddress(7, 7, 5, 6);
//在sheet里增加合并单元格
sheet.addMergedRegion(cra1);
sheet.addMergedRegion(cra2);
HSSFRow row_param_title = sheet.createRow(rowNum);
row_param_title.createCell(3, CellType.STRING).setCellValue("主参数");
row_param_title.createCell(5, CellType.STRING).setCellValue("其他参数");
rowNum++;
//添加参数值表头列 //添加参数值表头列
HSSFRow row_next = sheet.createRow(rowNum); HSSFRow row_next = sheet.createRow(rowNum);
row_next.createCell(0, CellType.STRING).setCellValue("参数值列表"); row_next.createCell(0, CellType.STRING).setCellValue("参数值列表");
......
...@@ -35,7 +35,7 @@ public interface BusTeamRepository extends BaseMapper<BusTeam>{ ...@@ -35,7 +35,7 @@ public interface BusTeamRepository extends BaseMapper<BusTeam>{
* *
*/ */
@Select("<script>select a.*,b.* from bus_team a,sys_principal b where a.pri_id =b.pri_id " + @Select("<script>select a.*,b.* from bus_team a,sys_principal b where a.pri_id =b.pri_id " +
" and team_type = #{teamType}" " and team_type = #{teamType} order by a.ONLINE_DATE desc"
+ "</script>") + "</script>")
List<Map<String,Object>> queryBusTeams(@Param("teamType") String teamType); List<Map<String,Object>> queryBusTeams(@Param("teamType") String teamType);
......
...@@ -113,11 +113,11 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan> ...@@ -113,11 +113,11 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
@ApiOperation(value="根据设备类型查询设备", notes="根据设备类型查询设备") @ApiOperation(value="根据设备类型查询设备", notes="根据设备类型查询设备")
@GetMapping(value = "/queryDeviceByTp") @GetMapping(value = "/queryDeviceByTp")
public Result queryDeviceByTp(@RequestParam String dev_tp_id){ public Result queryDeviceByTp(@RequestParam String dev_tp_id, @RequestParam String proId){
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
busEnergyPlanServiceImpl.queryDeviceByTp(dev_tp_id)); busEnergyPlanServiceImpl.queryDeviceByTp(dev_tp_id, proId));
} }
@ApiOperation(value="根据项目查询某一天实际总能耗", notes="根据项目查询某一天实际总能耗") @ApiOperation(value="根据项目查询某一天实际总能耗", notes="根据项目查询某一天实际总能耗")
......
...@@ -48,7 +48,7 @@ public interface BusEnergyPlanRepository extends BaseMapper<BusEnergyPlan> { ...@@ -48,7 +48,7 @@ public interface BusEnergyPlanRepository extends BaseMapper<BusEnergyPlan> {
"select aa.dev_num,aa.dev_nm,GROUP_CONCAT(aa.tm) tm_str from (" + "select aa.dev_num,aa.dev_nm,GROUP_CONCAT(aa.tm) tm_str from (" +
"select a.dev_num,b.dev_nm,a.tm from bus_energy_plan a left join bus_device b on a.DEV_NUM = b.DEV_NUM " + "select a.dev_num,b.dev_nm,a.tm from bus_energy_plan a left join bus_device b on a.DEV_NUM = b.DEV_NUM " +
"left join bus_device_param p on a.DEV_NUM=p.DEV_NUM and a.PARAM=p.PARAM " + "left join bus_device_param p on a.DEV_NUM=p.DEV_NUM and a.PARAM=p.PARAM " +
"where DATE_FORMAT(a.tm,'%Y-%m-%d') = #{day} and b.PRO_ID = #{pro_id} order by a.tm asc) aa" + "where DATE_FORMAT(a.tm,'%Y-%m-%d') = #{day} and b.PRO_ID = #{pro_id} order by a.tm asc) aa group by aa.dev_num" +
"</script>") "</script>")
List<Map<String,Object>> queryEnergyPlanList(Map<String,Object> map); List<Map<String,Object>> queryEnergyPlanList(Map<String,Object> map);
...@@ -70,7 +70,7 @@ public interface BusEnergyPlanRepository extends BaseMapper<BusEnergyPlan> { ...@@ -70,7 +70,7 @@ public interface BusEnergyPlanRepository extends BaseMapper<BusEnergyPlan> {
"\tbus_device a " + "\tbus_device a " +
"LEFT JOIN bus_device_tp b ON a.DEV_TP_ID = b.DEV_TP_ID " + "LEFT JOIN bus_device_tp b ON a.DEV_TP_ID = b.DEV_TP_ID " +
"LEFT JOIN bus_factory c ON a.FAC_ID = c.FAC_ID " + "LEFT JOIN bus_factory c ON a.FAC_ID = c.FAC_ID " +
"where a.dev_tp_id = #{dev_tp_id} " "where a.dev_tp_id = #{dev_tp_id} and a.PRO_ID = #{proId} "
+ "</script>") + "</script>")
List<Map<String,Object>> queryDeviceByTp(Map<String,Object> map); List<Map<String,Object>> queryDeviceByTp(Map<String,Object> map);
......
...@@ -63,7 +63,7 @@ public interface BusEnergyPlanService { ...@@ -63,7 +63,7 @@ public interface BusEnergyPlanService {
* @param * @param
* @return * @return
*/ */
List<Map<String,Object>> queryDeviceByTp(String dev_tp_id); List<Map<String,Object>> queryDeviceByTp(String dev_tp_id, String proId);
List<Map<String, Object>> queryBusEnergyRealCount(String proid, String day); List<Map<String, Object>> queryBusEnergyRealCount(String proid, String day);
......
...@@ -253,9 +253,10 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService { ...@@ -253,9 +253,10 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
} }
@Override @Override
public List<Map<String, Object>> queryDeviceByTp(String dev_tp_id) { public List<Map<String, Object>> queryDeviceByTp(String dev_tp_id, String proId) {
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
map.put("dev_tp_id",dev_tp_id); map.put("dev_tp_id",dev_tp_id);
map.put("proId",proId);
return busEnergyPlanRepository.queryDeviceByTp(map); return busEnergyPlanRepository.queryDeviceByTp(map);
} }
......
...@@ -60,7 +60,7 @@ public class ParamLibraryController { ...@@ -60,7 +60,7 @@ public class ParamLibraryController {
@ApiOperation(value="查询参数3", notes="查询参数3") @ApiOperation(value="查询参数3", notes="查询参数3")
@GetMapping(value = "/queryPlanParamVal_3") @GetMapping(value = "/queryPlanParamVal_3")
public Result queryPlanParamVal_3(@RequestParam String dev_num,@RequestParam String p1_v,@RequestParam String p2_v){ public Result queryPlanParamVal_3(@RequestParam String dev_num,@RequestParam String p1_v,@RequestParam(required = false) String p2_v){
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
map.put("dev_num",dev_num); map.put("dev_num",dev_num);
map.put("p1_v",p1_v); map.put("p1_v",p1_v);
...@@ -116,6 +116,6 @@ public class ParamLibraryController { ...@@ -116,6 +116,6 @@ public class ParamLibraryController {
@RequestMapping("/uploadExcel") @RequestMapping("/uploadExcel")
public Result uploadExcel(@RequestParam MultipartFile file, @RequestParam String devNum) { public Result uploadExcel(@RequestParam MultipartFile file, @RequestParam String devNum) {
Integer result = paramLibraryService.uploadExcel(file, devNum); Integer result = paramLibraryService.uploadExcel(file, devNum);
return Result.builder(new PersistModel(result), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, result); return Result.builder(new PersistModel(result), MessageConstant.MESSAGE_ALERT_SUCCESS, "没有可以保存的数据", result);
} }
} }
...@@ -29,30 +29,30 @@ public interface ParamLibraryRepository extends BaseMapper<BusParamLibrary>{ ...@@ -29,30 +29,30 @@ public interface ParamLibraryRepository extends BaseMapper<BusParamLibrary>{
"AND a.PARAM = b.PARAM\n" + "AND a.PARAM = b.PARAM\n" +
"AND b.PARAM_CODE = c.PARAM_CODE and a.PARAM_CODE = c.PARAM_CODE \n" + "AND b.PARAM_CODE = c.PARAM_CODE and a.PARAM_CODE = c.PARAM_CODE \n" +
"AND a.DEV_NUM = #{dev_num} and c.PRO_ID = #{pro_id} " "AND a.DEV_NUM = #{dev_num} and c.PRO_ID = #{pro_id} "
+ " order by a.compare_flag desc</script>") + " order by a.compare_flag desc,a.FIRST_PARAM desc,a.param asc</script>")
List<Map<String,Object>> queryLibraryParamByDev(Map<String,Object> map); List<Map<String,Object>> queryLibraryParamByDev(Map<String,Object> map);
/** /**
* 根据设备编码获取第一个参数集合 * 根据设备编码获取第一个参数集合
* @return * @return
*/ */
@Select("<script>select distinct p1_v,p2_v from bus_param_library where dev_num = #{dev_num} and year = #{year} " @Select("<script>select distinct p1_v from bus_param_library where dev_num = #{dev_num} and year = #{year} order by p1_v asc"
+ "</script>") + "</script>")
List<Map<String,Object>> queryPlanParamVal_1(Map<String,Object> map); List<Map<String,Object>> queryPlanParamVal_1(Map<String,Object> map);
/** /**
* 根据设备编码及第一个参数获取第二个参数集合 * 根据设备编码及第一个参数获取第二个参数集合
* @return * @return
*/ */
@Select("<script>select distinct p3_v,p4_v,power,gas_speed from bus_param_library where dev_num = #{dev_num}" + @Select("<script>select distinct p2_v from bus_param_library where dev_num = #{dev_num}" +
" and p1_v = #{p1_v} <if test=\"p2_v != null\"> and p2_v = #{p2_v}</if> and year = #{year} " " and p1_v = #{p1_v} and year = #{year} order by p2_v asc"
+ "</script>") + "</script>")
List<Map<String,Object>> queryPlanParamVal_2(Map<String,Object> map); List<Map<String,Object>> queryPlanParamVal_2(Map<String,Object> map);
/** /**
* 根据设备编码及前两个参数获取第三个参数集合 * 根据设备编码及前两个参数获取第三个参数集合
* @return * @return
*/ */
@Select("<script>select distinct p1_v,p2_v,p3_v,power,gas_speed from bus_param_library where dev_num = #{dev_num}" + @Select("<script>select p3_v,p4_v,power,gas_speed from bus_param_library where dev_num = #{dev_num}" +
" and p1_v = #{p1_v} and p2_v = #{p2_v} and year = #{year} " " and p1_v = #{p1_v}<if test=\"p2_v != null and p2_v != ''\"> and p2_v = #{p2_v}</if> and year = #{year} "
+ "</script>") + "</script>")
List<Map<String,Object>> queryPlanParamVal_3(Map<String,Object> map); List<Map<String,Object>> queryPlanParamVal_3(Map<String,Object> map);
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public interface ParamLibraryService { public interface ParamLibraryService {
List<Map<String,Object>> queryLibraryParamByDev(Map<String,Object> map); Map<String, Object> queryLibraryParamByDev(Map<String,Object> map);
List<Map<String,Object>> queryPlanParamVal_1(Map<String,Object> map); List<Map<String,Object>> queryPlanParamVal_1(Map<String,Object> map);
......
...@@ -53,41 +53,55 @@ public class ParamLibraryServiceImpl implements ParamLibraryService { ...@@ -53,41 +53,55 @@ public class ParamLibraryServiceImpl implements ParamLibraryService {
private BusEnergyplanVRepository busEnergyplanVRepository; private BusEnergyplanVRepository busEnergyplanVRepository;
@Override @Override
public List<Map<String, Object>> queryLibraryParamByDev(Map<String, Object> map) { public Map<String, Object> queryLibraryParamByDev(Map<String, Object> map) {
Map<String, Object> result = new HashMap<String, Object>();
List<Map<String, Object>> mainParam = new ArrayList<>();
List<Map<String, Object>> otherParam = new ArrayList<>();
List<Map<String, Object>> list = paramLibraryRepository.queryLibraryParamByDev(map); List<Map<String, Object>> list = paramLibraryRepository.queryLibraryParamByDev(map);
list.forEach(map1 -> {
String flag = (String) map1.get("compare_flag");
if (flag.equals("1"))
mainParam.add(map1);
else
otherParam.add(map1);
});
result.put("mainParam", mainParam);
result.put("otherParam", otherParam);
return result;
// 如果list=4,将主参数合并 // 如果list=4,将主参数合并
if (list.size() == 4) { // if (list.size() == 4) {
List<Map<String, Object>> list_4 = new ArrayList<>(); // List<Map<String, Object>> list_4 = new ArrayList<>();
// 合并前两个 // // 合并前两个
Map<String, Object> map1and2 = new HashMap<>(); // Map<String, Object> map1and2 = new HashMap<>();
map1and2.put("compare_flag", "1"); // map1and2.put("compare_flag", "1");
map1and2.put("param", list.get(0).get("param") + "/" + list.get(1).get("param")); // map1and2.put("param", list.get(0).get("param") + "/" + list.get(1).get("param"));
map1and2.put("param_nm", list.get(0).get("param_nm") + "/" + list.get(1).get("param_nm")); // map1and2.put("param_nm", list.get(0).get("param_nm") + "/" + list.get(1).get("param_nm"));
map1and2.put("param_unit", list.get(0).get("param_unit") + "/" + list.get(1).get("param_unit")); // map1and2.put("param_unit", list.get(0).get("param_unit") + "/" + list.get(1).get("param_unit"));
map1and2.put("p_source", list.get(0).get("p_source") + "/" + list.get(1).get("p_source")); // map1and2.put("p_source", list.get(0).get("p_source") + "/" + list.get(1).get("p_source"));
// 放入返回值 // // 放入返回值
list_4.add(map1and2); // list_4.add(map1and2);
list_4.add(list.get(2)); // list_4.add(list.get(2));
list_4.add(list.get(3)); // list_4.add(list.get(3));
return list_4; // return list_4;
} else { // } else {
return list; // return list;
} // }
// return list;
} }
@Override @Override
public List<Map<String, Object>> queryPlanParamVal_1(Map<String, Object> map) { public List<Map<String, Object>> queryPlanParamVal_1(Map<String, Object> map) {
SimpleDateFormat simple = new SimpleDateFormat("yyyy"); SimpleDateFormat simple = new SimpleDateFormat("yyyy");
map.put("year",simple.format(new Date())); map.put("year",simple.format(new Date()));
List<Map<String, Object>> list = paramLibraryRepository.queryPlanParamVal_1(map); // List<Map<String, Object>> list = paramLibraryRepository.queryPlanParamVal_1(map);
list.forEach(map1 -> { // list.forEach(map1 -> {
Object p1_v = map1.get("p1_v"); // Object p1_v = map1.get("p1_v");
Object p2_v = map1.get("p2_v"); // Object p2_v = map1.get("p2_v");
if (p2_v != null) { // if (p2_v != null) {
map1.put("p1_v", p1_v + "/" + p2_v); // map1.put("p1_v", p1_v + "/" + p2_v);
} // }
map1.remove("p2_v"); // map1.remove("p2_v");
}); // });
return paramLibraryRepository.queryPlanParamVal_1(map); return paramLibraryRepository.queryPlanParamVal_1(map);
} }
...@@ -95,13 +109,13 @@ public class ParamLibraryServiceImpl implements ParamLibraryService { ...@@ -95,13 +109,13 @@ public class ParamLibraryServiceImpl implements ParamLibraryService {
public List<Map<String, Object>> queryPlanParamVal_2(Map<String, Object> map) { public List<Map<String, Object>> queryPlanParamVal_2(Map<String, Object> map) {
SimpleDateFormat simple = new SimpleDateFormat("yyyy"); SimpleDateFormat simple = new SimpleDateFormat("yyyy");
map.put("year",simple.format(new Date())); map.put("year",simple.format(new Date()));
// 如果 p1_v 是两个参数组成的 // // 如果 p1_v 是两个参数组成的
String p1_v = (String) map.get("p1_v"); // String p1_v = (String) map.get("p1_v");
String[] split = p1_v.split("/"); // String[] split = p1_v.split("/");
if (split.length == 2) { // if (split.length == 2) {
map.put("p1_v", split[0]); // map.put("p1_v", split[0]);
map.put("p2_v", split[1]); // map.put("p2_v", split[1]);
} // }
return paramLibraryRepository.queryPlanParamVal_2(map); return paramLibraryRepository.queryPlanParamVal_2(map);
} }
...@@ -194,7 +208,7 @@ public class ParamLibraryServiceImpl implements ParamLibraryService { ...@@ -194,7 +208,7 @@ public class ParamLibraryServiceImpl implements ParamLibraryService {
if (StringUtils.isEmpty(param2)) empty++; if (StringUtils.isEmpty(param2)) empty++;
if (StringUtils.isEmpty(param3)) empty++; if (StringUtils.isEmpty(param3)) empty++;
if (StringUtils.isEmpty(param4)) empty++; if (StringUtils.isEmpty(param4)) empty++;
if (empty != 4) { if (empty > 0) {
param4 = param3; param4 = param3;
param3 = param2; param3 = param2;
param2 = null; param2 = null;
......
...@@ -25,7 +25,7 @@ public interface BusLibraryParamRepository extends BaseMapper<BusLibraryParam> { ...@@ -25,7 +25,7 @@ public interface BusLibraryParamRepository extends BaseMapper<BusLibraryParam> {
*/ */
@Select("<script>select l.PARAM param,t.PARAM_NM paramNm,t.PARAM_CODE paramCode,l.COMPARE_FLAG compareFlag,t.P_SOURCE source from bus_library_param l,bus_device_param d,bus_devicetp_param t " + @Select("<script>select l.PARAM param,t.PARAM_NM paramNm,t.PARAM_CODE paramCode,l.COMPARE_FLAG compareFlag,t.P_SOURCE source from bus_library_param l,bus_device_param d,bus_devicetp_param t " +
"where l.DEV_NUM=d.DEV_NUM and l.PARAM=d.PARAM and d.PARAM_CODE=t.PARAM_CODE and l.PARAM_CODE = t.PARAM_CODE " + "where l.DEV_NUM=d.DEV_NUM and l.PARAM=d.PARAM and d.PARAM_CODE=t.PARAM_CODE and l.PARAM_CODE = t.PARAM_CODE " +
"and l.DEV_NUM=#{devNum} and t.PRO_ID=substring_index(#{devNum}, '_', 1) order by l.COMPARE_FLAG desc</script>") "and l.DEV_NUM=#{devNum} and t.PRO_ID=substring_index(#{devNum}, '_', 1) order by l.COMPARE_FLAG desc,l.FIRST_PARAM desc,l.PARAM asc</script>")
List<Map<String, String>> selectParamsByDevNum(@Param(value = "devNum") String devNum); List<Map<String, String>> selectParamsByDevNum(@Param(value = "devNum") String devNum);
@Select("<script>select * from bus_library_param where dev_num = #{devNum}</script>") @Select("<script>select * from bus_library_param where dev_num = #{devNum}</script>")
......
...@@ -54,7 +54,7 @@ public interface ProjectRepository extends BaseMapper<BusProject> { ...@@ -54,7 +54,7 @@ public interface ProjectRepository extends BaseMapper<BusProject> {
"<if test =' jwnum != null '> and a.jwnum = #{jwnum}</if>" + "<if test =' jwnum != null '> and a.jwnum = #{jwnum}</if>" +
"<if test =' saveFlag != null '> and a.SAVE_FLAG = #{saveFlag}</if>" + "<if test =' saveFlag != null '> and a.SAVE_FLAG = #{saveFlag}</if>" +
"<if test =' online != null '> and a.ONLINE = #{online}</if>" + "<if test =' online != null '> and a.ONLINE = #{online}</if>" +
"</script>") " order by a.CREATE_TIME desc</script>")
List<Map<String,Object>> queryBusProjects(BusProject busProject); List<Map<String,Object>> queryBusProjects(BusProject busProject);
} }
...@@ -29,6 +29,8 @@ public class BusLibraryParam{ ...@@ -29,6 +29,8 @@ public class BusLibraryParam{
private String paramCode; private String paramCode;
private Integer firstParam;
} }
...@@ -51,7 +51,7 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService { ...@@ -51,7 +51,7 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
public PersistModel save(BusDeviceTp busDeviceTp){ public PersistModel save(BusDeviceTp busDeviceTp){
int line = 0; int line = 0;
// 验重 // 验重
Integer repeat = this.repeat(busDeviceTp.getDevTpNm()); Integer repeat = this.repeat(null, busDeviceTp.getDevTpNm());
if (repeat > 0) if (repeat > 0)
return new PersistModel(line, "设备类型名称不能重复"); return new PersistModel(line, "设备类型名称不能重复");
//增加操作 //增加操作
...@@ -93,7 +93,7 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService { ...@@ -93,7 +93,7 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
int line = 0; int line = 0;
if (StringUtils.isNotEmpty(busDeviceTp.getDevTpNm())) { if (StringUtils.isNotEmpty(busDeviceTp.getDevTpNm())) {
// 验重 // 验重
Integer repeat = this.repeat(busDeviceTp.getDevTpNm()); Integer repeat = this.repeat(busDeviceTp.getDevTpId(), busDeviceTp.getDevTpNm());
if (repeat > 0) if (repeat > 0)
return new PersistModel(line, "设备类型名称不能重复"); return new PersistModel(line, "设备类型名称不能重复");
} }
...@@ -146,10 +146,12 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService { ...@@ -146,10 +146,12 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
* @param devTpNm * @param devTpNm
* @return * @return
*/ */
private Integer repeat(String devTpNm) { private Integer repeat(String devTpId, String devTpNm) {
Example example = new Example(BusDeviceTp.class); Example example = new Example(BusDeviceTp.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("devTpNm", devTpNm); criteria.andEqualTo("devTpNm", devTpNm);
if (StringUtils.isNotEmpty(devTpId))
criteria.andNotEqualTo("devTpId", devTpId);
return busDeviceTpRepository.selectCountByExample(example); return busDeviceTpRepository.selectCountByExample(example);
} }
......
...@@ -43,7 +43,7 @@ public class BusFactoryServiceImpl implements BusFactoryService { ...@@ -43,7 +43,7 @@ public class BusFactoryServiceImpl implements BusFactoryService {
if (StringUtils.isEmpty(facNm)) if (StringUtils.isEmpty(facNm))
return new PersistModel(line, "厂家名称不能为空"); return new PersistModel(line, "厂家名称不能为空");
// 验重 // 验重
Integer repeat = this.repeat(facNm); Integer repeat = this.repeat(null, facNm);
if (repeat > 0) if (repeat > 0)
return new PersistModel(line, "厂家名称不能重复"); return new PersistModel(line, "厂家名称不能重复");
...@@ -67,7 +67,7 @@ public class BusFactoryServiceImpl implements BusFactoryService { ...@@ -67,7 +67,7 @@ public class BusFactoryServiceImpl implements BusFactoryService {
if (StringUtils.isEmpty(facNm)) if (StringUtils.isEmpty(facNm))
return new PersistModel(line, "厂家名称不能为空"); return new PersistModel(line, "厂家名称不能为空");
// 验重 // 验重
Integer repeat = this.repeat(busFactory.getFacNm()); Integer repeat = this.repeat(busFactory.getFacId(), busFactory.getFacNm());
if (repeat > 0) if (repeat > 0)
return new PersistModel(line, "厂家名称重复"); return new PersistModel(line, "厂家名称重复");
...@@ -107,10 +107,12 @@ public class BusFactoryServiceImpl implements BusFactoryService { ...@@ -107,10 +107,12 @@ public class BusFactoryServiceImpl implements BusFactoryService {
* @param factoryName * @param factoryName
* @return * @return
*/ */
private Integer repeat(String factoryName) { private Integer repeat(String facId, String factoryName) {
Example example = new Example(BusFactory.class); Example example = new Example(BusFactory.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("facNm", factoryName); criteria.andEqualTo("facNm", factoryName);
if (StringUtils.isNotEmpty(facId))
criteria.andNotEqualTo("facId", facId);
return busFactoryRepository.selectCountByExample(example); return busFactoryRepository.selectCountByExample(example);
} }
......
package org.rcisoft.business.manage.service.impl; package org.rcisoft.business.manage.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.manage.dao.BusProjectZoneRepository; import org.rcisoft.business.manage.dao.BusProjectZoneRepository;
import org.rcisoft.business.manage.entity.BusFactory; import org.rcisoft.business.manage.entity.BusFactory;
import org.rcisoft.business.manage.entity.BusProjectZone; import org.rcisoft.business.manage.entity.BusProjectZone;
...@@ -25,7 +26,7 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService { ...@@ -25,7 +26,7 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService {
public PersistModel save(BusProjectZone busProjectZone) { public PersistModel save(BusProjectZone busProjectZone) {
int line = 0; int line = 0;
// 验重 // 验重
Integer repeat = this.repeat(busProjectZone.getBldZoneName()); Integer repeat = this.repeat(null, busProjectZone.getBldZoneName());
if (repeat > 0) if (repeat > 0)
return new PersistModel(0, "气候类型不能重复"); return new PersistModel(0, "气候类型不能重复");
//增加操作 //增加操作
...@@ -39,7 +40,7 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService { ...@@ -39,7 +40,7 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService {
Integer line = 0; Integer line = 0;
String message = ""; String message = "";
// 验重 // 验重
Integer repeat = this.repeat(busProjectZone.getBldZoneName()); Integer repeat = this.repeat(busProjectZone.getBldZoneId(), busProjectZone.getBldZoneName());
if (repeat > 0) if (repeat > 0)
return new PersistModel(0, "气候类型不能重复"); return new PersistModel(0, "气候类型不能重复");
Example example = new Example(BusProjectZone.class); Example example = new Example(BusProjectZone.class);
...@@ -78,10 +79,12 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService { ...@@ -78,10 +79,12 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService {
* @param bldZoneName * @param bldZoneName
* @return * @return
*/ */
private Integer repeat(String bldZoneName) { private Integer repeat(String bldZoneId, String bldZoneName) {
Example example = new Example(BusProjectZone.class); Example example = new Example(BusProjectZone.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("bldZoneName", bldZoneName); criteria.andEqualTo("bldZoneName", bldZoneName);
if (StringUtils.isNotEmpty(bldZoneId))
criteria.andNotEqualTo("bldZoneId", bldZoneId);
return busProjectZoneRepository.selectCountByExample(example); return busProjectZoneRepository.selectCountByExample(example);
} }
} }
...@@ -52,7 +52,10 @@ public class BusSavingServiceImpl implements BusSavingService { ...@@ -52,7 +52,10 @@ public class BusSavingServiceImpl implements BusSavingService {
@Override @Override
public List<BusSaving> findAllByPagination(PageUtil<BusSaving> paginationUtility) { public List<BusSaving> findAllByPagination(PageUtil<BusSaving> paginationUtility) {
return busSavingRepository.selectAll(); Example example = new Example(BusSaving.class);
example.orderBy("TM desc");
return busSavingRepository.selectByExample(example);
// return busSavingRepository.selectAll();
} }
@Override @Override
......
package org.rcisoft.business.manage.service.impl; package org.rcisoft.business.manage.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.evaluate.team.dao.BusTeamRepository; import org.rcisoft.business.evaluate.team.dao.BusTeamRepository;
import org.rcisoft.business.evaluate.team.entity.BusTeam; import org.rcisoft.business.evaluate.team.entity.BusTeam;
import org.rcisoft.business.manage.service.BusTeamService; import org.rcisoft.business.manage.service.BusTeamService;
...@@ -106,6 +107,8 @@ public class BusTeamServiceImpl implements BusTeamService { ...@@ -106,6 +107,8 @@ public class BusTeamServiceImpl implements BusTeamService {
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("teamNm", busTeam.getTeamNm()); criteria.andEqualTo("teamNm", busTeam.getTeamNm());
criteria.andEqualTo("teamType", busTeam.getTeamType()); criteria.andEqualTo("teamType", busTeam.getTeamType());
if (StringUtils.isNotEmpty(busTeam.getTeamId()))
criteria.andNotEqualTo("teamId", busTeam.getTeamId());
return busTeamRepository.selectCountByExample(example); return busTeamRepository.selectCountByExample(example);
} }
......
...@@ -206,7 +206,7 @@ public class SystemServiceImpl implements SystemService { ...@@ -206,7 +206,7 @@ public class SystemServiceImpl implements SystemService {
// 根据proId得到redis中的数据 // 根据proId得到redis中的数据
String newData = this.selectDataByCache(proId); String newData = this.selectDataByCache(proId);
String oldData = this.selectDataByCache(proId + "-old"); String oldData = this.selectDataByCache(proId + "-old");
// 循环list,根据param查询数据,新的-旧的 > 0.005:认为是开启状态 // 循环list,根据param查询数据,新的-旧的 > 0.003:认为是开启状态
JSONObject newJson = JSON.parseObject(newData); JSONObject newJson = JSON.parseObject(newData);
JSONObject oldJson = JSON.parseObject(oldData); JSONObject oldJson = JSON.parseObject(oldData);
if (newJson != null && oldJson != null) { if (newJson != null && oldJson != null) {
...@@ -219,6 +219,12 @@ public class SystemServiceImpl implements SystemService { ...@@ -219,6 +219,12 @@ public class SystemServiceImpl implements SystemService {
// 新数据 // 新数据
JSONObject newObj = (JSONObject) newJson.get(devNum); JSONObject newObj = (JSONObject) newJson.get(devNum);
if (newObj != null) { if (newObj != null) {
// 先判断设备中的status,如果=0,是掉线状态,用2表示
Integer status = (Integer) newObj.get("status");
if (status == 0) {
paramStatus.setStatus(2);
continue;
}
JSONObject newVal = (JSONObject) newObj.get("REG_VAL"); JSONObject newVal = (JSONObject) newObj.get("REG_VAL");
if (newVal != null) { if (newVal != null) {
Object o = newVal.get(param); Object o = newVal.get(param);
...@@ -240,7 +246,7 @@ public class SystemServiceImpl implements SystemService { ...@@ -240,7 +246,7 @@ public class SystemServiceImpl implements SystemService {
} }
// 判断两个比较电量大小 // 判断两个比较电量大小
if (newElec != null && oldElec != null) { if (newElec != null && oldElec != null) {
// 如果两数相减小于0.005,认为是关闭,大于等于认为是开启 // 如果两数相减小于0.003,认为是关闭,大于等于认为是开启
if (newElec.subtract(oldElec).compareTo(new BigDecimal(0.003)) < 0) if (newElec.subtract(oldElec).compareTo(new BigDecimal(0.003)) < 0)
paramStatus.setStatus(0); paramStatus.setStatus(0);
else else
......
...@@ -49,7 +49,8 @@ public interface UserRepository extends BaseMapper<SysUser>{ ...@@ -49,7 +49,8 @@ public interface UserRepository extends BaseMapper<SysUser>{
"<if test = \"userTp=='1'.toString()\"> and (user_tp = '1' or user_tp = '2')</if>" + "<if test = \"userTp=='1'.toString()\"> and (user_tp = '1' or user_tp = '2')</if>" +
"<if test = \"userTp=='2'.toString()\"> and user_tp = '3'</if>" + "<if test = \"userTp=='2'.toString()\"> and user_tp = '3'</if>" +
"<if test = \"userTp=='3'.toString()\"> and user_tp = '4'</if>" + "<if test = \"userTp=='3'.toString()\"> and user_tp = '4'</if>" +
"<if test = \"userTp=='5'.toString()\"> and user_tp = '5'</if></script>") "<if test = \"userTp=='5'.toString()\"> and user_tp = '5'</if>" +
" order by a.create_date desc</script>")
List<Map<String,Object>> listUserAll(@Param("stable") String stable,@Param("userTp") String userTp); List<Map<String,Object>> listUserAll(@Param("stable") String stable,@Param("userTp") String userTp);
} }
...@@ -12,6 +12,7 @@ import javax.persistence.Id; ...@@ -12,6 +12,7 @@ import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -37,6 +38,8 @@ public class SysUser { ...@@ -37,6 +38,8 @@ public class SysUser {
private String openid; private String openid;
private Date createDate;
/** /**
* 拥有角色列表 * 拥有角色列表
*/ */
......
...@@ -92,7 +92,7 @@ public class UserServiceImpl implements UserService { ...@@ -92,7 +92,7 @@ public class UserServiceImpl implements UserService {
String userId = IdGen.uuid(); String userId = IdGen.uuid();
sysUser.setUserPwd(passwordEncoder.encode(UserPassWordConstant.PASSWORD)); sysUser.setUserPwd(passwordEncoder.encode(UserPassWordConstant.PASSWORD));
sysUser.setUserId(userId); sysUser.setUserId(userId);
sysUser.setCreateDate(new Date());
try { try {
if (UserTpConstant.TP_ADMIN.equals(userTp)) { if (UserTpConstant.TP_ADMIN.equals(userTp)) {
userRepository.insertSelective(sysUser); userRepository.insertSelective(sysUser);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<result column="PARAM" jdbcType="VARCHAR" property="param"/> <result column="PARAM" jdbcType="VARCHAR" property="param"/>
<result column="COMPARE_FLAG" jdbcType="CHAR" property="compareFlag"/> <result column="COMPARE_FLAG" jdbcType="CHAR" property="compareFlag"/>
<result column="PARAM_CODE" jdbcType="VARCHAR" property="paramCode"/> <result column="PARAM_CODE" jdbcType="VARCHAR" property="paramCode"/>
<result column="FIRST_PARAM" jdbcType="INTEGER" property="firstParam"/>
</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