Commit 785b568b authored by WangXinYu's avatar WangXinYu

Merge remote-tracking branch 'origin/develop' into develop

parents ba94a0ad 465cd4b2
package org.rcisoft.business.mainte.adaptive.dao; package org.rcisoft.business.mainte.adaptive.dao;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.mainte.adaptive.entity.BusTemperature; import org.rcisoft.business.mainte.adaptive.entity.BusTemperature;
import org.rcisoft.business.mainte.adaptive.vo.Params; import org.rcisoft.business.mainte.adaptive.vo.Params;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -37,4 +34,10 @@ public interface BusTemperatureRepository { ...@@ -37,4 +34,10 @@ public interface BusTemperatureRepository {
@ResultType(Integer.class) @ResultType(Integer.class)
Integer batchSaveBusTemperature(List<BusTemperature> list); Integer batchSaveBusTemperature(List<BusTemperature> list);
@Delete("<script><foreach collection=\"list\" item=\"item\" open=\"\" close=\"\" separator=\";\">" +
"delete from bus_temperature where TM=#{item.tm} and CODE=#{item.code}" +
"</foreach></script>")
@ResultType(Integer.class)
Integer batchDeleteBusTemperature(List<BusTemperature> list);
} }
...@@ -188,7 +188,8 @@ public class AdaptiveServiceImpl implements AdaptiveService { ...@@ -188,7 +188,8 @@ public class AdaptiveServiceImpl implements AdaptiveService {
cityCodeList.forEach(s -> { cityCodeList.forEach(s -> {
saveList.addAll(this.fromWeather(s)); saveList.addAll(this.fromWeather(s));
}); });
//3.将所有的结果插入bus_temperature表(批量) //3.先根据结果,删除已经存在的数据,再将所有的结果插入bus_temperature表(批量)
Integer d = busTemperatureRepository.batchDeleteBusTemperature(saveList);
Integer i = busTemperatureRepository.batchSaveBusTemperature(saveList); Integer i = busTemperatureRepository.batchSaveBusTemperature(saveList);
return new PersistModel(i); return new PersistModel(i);
} }
......
...@@ -15,9 +15,9 @@ public class AdaptiveTask { ...@@ -15,9 +15,9 @@ public class AdaptiveTask {
private AdaptiveService adaptiveServiceImpl; private AdaptiveService adaptiveServiceImpl;
/** /**
* 每天0点5分执行,查询所有项目中存在的城市,未来24小时的温度 * 每间隔3小时的第5分钟执行,查询所有项目中存在的城市,未来24小时的温度
*/ */
@Scheduled(cron = "0 5 0 * * ?") @Scheduled(cron = "0 5 */3 * * ?")
public void temperature () { public void temperature () {
adaptiveServiceImpl.temperature(); adaptiveServiceImpl.temperature();
} }
......
...@@ -35,7 +35,7 @@ public class BusDeviceMeterController extends PaginationController<BusDeviceMete ...@@ -35,7 +35,7 @@ public class BusDeviceMeterController extends PaginationController<BusDeviceMete
@ApiOperation(value="修改表具", notes="修改表具") @ApiOperation(value="修改表具", notes="修改表具")
@PutMapping("/update") @PostMapping("/update")
public Result update(@Valid BusDeviceMeter busDeviceMeter) { public Result update(@Valid BusDeviceMeter busDeviceMeter) {
PersistModel data = busDeviceMeterServiceImpl.merge(busDeviceMeter); PersistModel data = busDeviceMeterServiceImpl.merge(busDeviceMeter);
return Result.builder(data); return Result.builder(data);
......
...@@ -40,7 +40,7 @@ public class BusDeviceParamController extends PaginationController<BusDevicePara ...@@ -40,7 +40,7 @@ public class BusDeviceParamController extends PaginationController<BusDevicePara
@ApiOperation(value="修改设备参数模板", notes="修改设备参数模板") @ApiOperation(value="修改设备参数模板", notes="修改设备参数模板")
@PutMapping("/update") @PostMapping("/update")
public Result update(@RequestBody BusDeviceParamList busDeviceParamList) { public Result update(@RequestBody BusDeviceParamList busDeviceParamList) {
PersistModel data = busDeviceParamServiceImpl.merge(busDeviceParamList); PersistModel data = busDeviceParamServiceImpl.merge(busDeviceParamList);
return Result.builder(data, return Result.builder(data,
......
...@@ -43,7 +43,7 @@ public class BusDeviceTpController extends PaginationController<BusDeviceTp> { ...@@ -43,7 +43,7 @@ public class BusDeviceTpController extends PaginationController<BusDeviceTp> {
@ApiOperation(value="修改设备类型", notes="修改设备类型") @ApiOperation(value="修改设备类型", notes="修改设备类型")
@PutMapping("/update") @PostMapping("/update")
public Result update(@Valid BusDeviceTp busDeviceTp) { public Result update(@Valid BusDeviceTp busDeviceTp) {
PersistModel data = busDeviceTpServiceImpl.merge(busDeviceTp); PersistModel data = busDeviceTpServiceImpl.merge(busDeviceTp);
return Result.builder(data, return Result.builder(data,
......
...@@ -44,7 +44,7 @@ public class BusFactoryController extends PaginationController<BusFactory> { ...@@ -44,7 +44,7 @@ public class BusFactoryController extends PaginationController<BusFactory> {
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改", notes="修改")
@PutMapping("/update") @PostMapping("/update")
public Result update(@Valid BusFactory busFactory) { public Result update(@Valid BusFactory busFactory) {
PersistModel data = busFactoryServiceImpl.merge(busFactory); PersistModel data = busFactoryServiceImpl.merge(busFactory);
return Result.builder(data); return Result.builder(data);
......
...@@ -40,7 +40,7 @@ public class BusLibraryParamController extends PaginationController<BusLibraryPa ...@@ -40,7 +40,7 @@ public class BusLibraryParamController extends PaginationController<BusLibraryPa
@ApiOperation(value="修改设备参数库模板", notes="修改设备参数库模板") @ApiOperation(value="修改设备参数库模板", notes="修改设备参数库模板")
@PutMapping("/update") @PostMapping("/update")
public Result update(@RequestBody BusLibraryParamList busLibraryParamList) { public Result update(@RequestBody BusLibraryParamList busLibraryParamList) {
PersistModel data = busLibraryParamServiceImpl.merge(busLibraryParamList); PersistModel data = busLibraryParamServiceImpl.merge(busLibraryParamList);
return Result.builder(data, return Result.builder(data,
......
...@@ -29,7 +29,7 @@ public class BusParamReferController extends PaginationController<BusParamRefer> ...@@ -29,7 +29,7 @@ public class BusParamReferController extends PaginationController<BusParamRefer>
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改", notes="修改")
@PutMapping("/update") @PostMapping("/update")
public Result update(@Valid BusParamRefer busParamRefer) { public Result update(@Valid BusParamRefer busParamRefer) {
PersistModel data = busParamReferServiceImpl.merge(busParamRefer); PersistModel data = busParamReferServiceImpl.merge(busParamRefer);
return Result.builder(data); return Result.builder(data);
......
...@@ -28,7 +28,7 @@ public class BusProjectAreaController extends PaginationController<BusProjectAre ...@@ -28,7 +28,7 @@ public class BusProjectAreaController extends PaginationController<BusProjectAre
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改", notes="修改")
@PutMapping("/update") @PostMapping("/update")
public Result update(@RequestBody BusProjectAreaList busProjectAreaList) { public Result update(@RequestBody BusProjectAreaList busProjectAreaList) {
PersistModel data = busProjectAreaServiceImpl.merge(busProjectAreaList); PersistModel data = busProjectAreaServiceImpl.merge(busProjectAreaList);
return Result.builder(data); return Result.builder(data);
......
...@@ -47,7 +47,7 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -47,7 +47,7 @@ public class BusProjectController extends PaginationController<BusProject> {
@ApiOperation(value="添加项目", notes="添加项目") @ApiOperation(value="添加项目", notes="添加项目")
@PostMapping(value = "/add") @RequestMapping(value = "/add")
public Result add(@Valid BusProject busProject) { public Result add(@Valid BusProject busProject) {
PersistModel data = busProjectServiceImpl.save(busProject); PersistModel data = busProjectServiceImpl.save(busProject);
return Result.builder(data); return Result.builder(data);
...@@ -55,14 +55,14 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -55,14 +55,14 @@ public class BusProjectController extends PaginationController<BusProject> {
@ApiOperation(value="修改项目信息", notes="修改项目信息") @ApiOperation(value="修改项目信息", notes="修改项目信息")
@PutMapping("/update") @PostMapping("/update")
public Result update(@Valid BusProject busProject) { public Result update(@Valid BusProject busProject) {
PersistModel data = busProjectServiceImpl.merge(busProject); PersistModel data = busProjectServiceImpl.merge(busProject);
return Result.builder(data); return Result.builder(data);
} }
@ApiOperation(value="删除项目", notes="删除项目") @ApiOperation(value="删除项目", notes="删除项目")
@DeleteMapping("/delete") @RequestMapping("/delete")
public Result delete(@RequestParam String proId) { public Result delete(@RequestParam String proId) {
BusProject busProject = new BusProject(); BusProject busProject = new BusProject();
busProject.setProId(proId) ; busProject.setProId(proId) ;
...@@ -71,7 +71,7 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -71,7 +71,7 @@ public class BusProjectController extends PaginationController<BusProject> {
} }
@ApiOperation(value="根据条件查询单个项目信息", notes="根据条件查询单个项目信息") @ApiOperation(value="根据条件查询单个项目信息", notes="根据条件查询单个项目信息")
@GetMapping("/detail") @RequestMapping("/detail")
public Result detail(@Valid BusProject busProject) { public Result detail(@Valid BusProject busProject) {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -80,14 +80,14 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -80,14 +80,14 @@ public class BusProjectController extends PaginationController<BusProject> {
} }
@ApiOperation(value="查看 集合", notes="查看 集合") @ApiOperation(value="查看 集合", notes="查看 集合")
@GetMapping(value = "/queryBusProjectByPagination") @RequestMapping(value = "/queryBusProjectByPagination")
public GridModel listByPagination(BusProject busProject) { public GridModel listByPagination(BusProject busProject) {
busProjectServiceImpl.findAllByPagination(getPaginationUtility(), busProject); busProjectServiceImpl.findAllByPagination(getPaginationUtility(), busProject);
return getGridModelResponse(); return getGridModelResponse();
} }
@ApiOperation(value="查询用户权限项目", notes="查询用户权限项目") @ApiOperation(value="查询用户权限项目", notes="查询用户权限项目")
@GetMapping(value = "/queryBusProjectByUser") @RequestMapping(value = "/queryBusProjectByUser")
public Result queryBusProjectByUser() { public Result queryBusProjectByUser() {
String userId = UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID); String userId = UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID);
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
......
...@@ -36,7 +36,7 @@ public class BusProjectZoneController { ...@@ -36,7 +36,7 @@ public class BusProjectZoneController {
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改", notes="修改")
@PutMapping("/update") @PostMapping("/update")
public Result update(@Valid BusProjectZone busProjectZone) { public Result update(@Valid BusProjectZone busProjectZone) {
PersistModel data = busProjectZoneServiceImpl.merge(busProjectZone); PersistModel data = busProjectZoneServiceImpl.merge(busProjectZone);
return Result.builder(data); return Result.builder(data);
......
...@@ -13,6 +13,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -13,6 +13,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result; import org.rcisoft.core.result.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -49,7 +50,7 @@ public class BusSavingController extends PaginationController<BusSaving> { ...@@ -49,7 +50,7 @@ public class BusSavingController extends PaginationController<BusSaving> {
@ApiImplicitParam(name = "tm", value = "从业时间", dataType = "字符串"), @ApiImplicitParam(name = "tm", value = "从业时间", dataType = "字符串"),
@ApiImplicitParam(name = "performance", value = "项目业绩", dataType = "字符串") @ApiImplicitParam(name = "performance", value = "项目业绩", dataType = "字符串")
}) })
@RequestMapping("/update") @PostMapping("/update")
public Result update(@Valid BusSaving busSaving) { public Result update(@Valid BusSaving busSaving) {
Integer result = busSavingServiceImpl.update(busSaving); Integer result = busSavingServiceImpl.update(busSaving);
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, MessageConstant.MESSAGE_ALERT_ERROR, result);
......
...@@ -44,7 +44,7 @@ public class BusTeamController extends PaginationController<BusTeam> { ...@@ -44,7 +44,7 @@ public class BusTeamController extends PaginationController<BusTeam> {
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改", notes="修改")
@PutMapping("/update") @PostMapping("/update")
public Result update(@Valid BusTeam busTeam) { public Result update(@Valid BusTeam busTeam) {
PersistModel data = busTeamServiceImpl.merge(busTeam); PersistModel data = busTeamServiceImpl.merge(busTeam);
return Result.builder(data); return Result.builder(data);
......
...@@ -29,7 +29,7 @@ public class EnergyPriceController extends PaginationController<EnergyPrice> { ...@@ -29,7 +29,7 @@ public class EnergyPriceController extends PaginationController<EnergyPrice> {
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改", notes="修改")
@PutMapping("/update") @PostMapping("/update")
public Result update(@RequestBody EnergyPriceList energyPriceList) { public Result update(@RequestBody EnergyPriceList energyPriceList) {
PersistModel data = energyPriceServiceImpl.merge(energyPriceList); PersistModel data = energyPriceServiceImpl.merge(energyPriceList);
return Result.builder(data); return Result.builder(data);
......
...@@ -33,7 +33,7 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService { ...@@ -33,7 +33,7 @@ public class BusProjectZoneServiceImpl implements BusProjectZoneService {
public PersistModel merge(BusProjectZone busProjectZone) { public PersistModel merge(BusProjectZone busProjectZone) {
Integer line = 0; Integer line = 0;
String message = ""; String message = "";
Example example = new Example(BusFactory.class); Example example = new Example(BusProjectZone.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("bldZoneId",busProjectZone.getBldZoneId()); criteria.andEqualTo("bldZoneId",busProjectZone.getBldZoneId());
if(busProjectZone.getBldZoneId()!=null && !busProjectZone.getBldZoneId().equals("")){ if(busProjectZone.getBldZoneId()!=null && !busProjectZone.getBldZoneId().equals("")){
......
...@@ -28,8 +28,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -28,8 +28,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"sum(GAS) as gas,sum(GAS_MONEY) as gasMoney" + "sum(GAS) as gas,sum(GAS_MONEY) as gasMoney" +
" from energy_count_m e " + " from energy_count_m e " +
"where e.PRO_ID=#{proId} and `year`=#{year}" + "where e.PRO_ID=#{proId} and `year`=#{year}" +
"<if test=\"day != null\"> and `day`=#{day} group by e.`day`</if>" + "<if test=\"day != null\"> and `day`=${day} group by e.`day`</if>" +
"<if test=\"mon != null\"> and mon=#{mon} group by e.mon</if></script>") "<if test=\"mon != null\"> and mon=${mon} group by e.mon</if></script>")
@ResultMap("BaseResultMap") @ResultMap("BaseResultMap")
EnergyCountM countAmountAndPrice(EnergyCountM energyCountM); EnergyCountM countAmountAndPrice(EnergyCountM energyCountM);
...@@ -41,7 +41,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -41,7 +41,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
@Select("<script>select e.`HOUR`," + @Select("<script>select e.`HOUR`," +
"sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) as MONEY" + "sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) as MONEY" +
" from energy_count_m e" + " from energy_count_m e" +
" where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.`HOUR`+0 asc</script>") " where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon} and e.`DAY`=${day} group by e.`HOUR`+0 asc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo);
...@@ -51,7 +51,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -51,7 +51,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @return * @return
*/ */
@Select("<script>select if(sum(e.WATER) is null, 0, sum(e.WATER)) ENERGY from energy_count_m e " + @Select("<script>select if(sum(e.WATER) is null, 0, sum(e.WATER)) ENERGY from energy_count_m e " +
"where e.`DAY`=#{day} and e.MON=#{mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId}</script>") "where e.`DAY`=${day} and e.MON=${mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId}</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countEnergySplitWater(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countEnergySplitWater(EnergyCountMVo energyCountMVo);
...@@ -65,7 +65,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -65,7 +65,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"<if test=\"type == 3\">sum(e.GAS) ENERGY </if>" + "<if test=\"type == 3\">sum(e.GAS) ENERGY </if>" +
"from bus_device d,bus_device_meter dm,energy_count_m e " + "from bus_device d,bus_device_meter dm,energy_count_m e " +
"where d.DEV_NUM=dm.DEV_NUM and dm.MET_NUM=e.MET_NUM and " + "where d.DEV_NUM=dm.DEV_NUM and dm.MET_NUM=e.MET_NUM and " +
"e.`DAY`=#{day} and e.MON=#{mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId} " + "e.`DAY`=${day} and e.MON=${mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId} " +
"group by d.DEV_NM</script>") "group by d.DEV_NM</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countEnergySplitElecGas(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countEnergySplitElecGas(EnergyCountMVo energyCountMVo);
...@@ -78,8 +78,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -78,8 +78,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
@Select("<script>select a.* from (" + @Select("<script>select a.* from (" +
"select e.`DAY`," + "select e.`DAY`," +
"sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) MONEY" + "sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) MONEY" +
" from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon}" + " from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon}" +
"<if test=\"hour != null\"> and e.HOUR &lt;= #{hour}</if>" + "<if test=\"hour != null\"> and e.HOUR &lt;= ${hour}</if>" +
" group by e.`DAY`+0 asc) a order by a.MONEY desc</script>") " group by e.`DAY`+0 asc) a order by a.MONEY desc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> getPriceRank(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> getPriceRank(EnergyCountMVo energyCountMVo);
...@@ -93,7 +93,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -93,7 +93,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"<if test=\"type == 1\">sum(e.WATER)</if>" + "<if test=\"type == 1\">sum(e.WATER)</if>" +
"<if test=\"type == 2\">sum(e.ELEC)</if>" + "<if test=\"type == 2\">sum(e.ELEC)</if>" +
"<if test=\"type == 3\">sum(e.GAS)</if>" + "<if test=\"type == 3\">sum(e.GAS)</if>" +
" as ENERGY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} group by e.`DAY`+0 asc</script>") " as ENERGY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon} group by e.`DAY`+0 asc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> getEnergyCompare(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> getEnergyCompare(EnergyCountMVo energyCountMVo);
...@@ -112,7 +112,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -112,7 +112,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountM * @param energyCountM
* @return * @return
*/ */
@Select("<script>select SUM(e.WATER) WATER,SUM(e.ELEC) ELEC,SUM(e.GAS) GAS from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day}</script>") @Select("<script>select SUM(e.WATER) WATER,SUM(e.ELEC) ELEC,SUM(e.GAS) GAS from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon} and e.`DAY`=${day}</script>")
@ResultMap("BaseResultMap") @ResultMap("BaseResultMap")
EnergyCountM countEnergyDay(EnergyCountM energyCountM); EnergyCountM countEnergyDay(EnergyCountM energyCountM);
...@@ -130,7 +130,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -130,7 +130,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountMVo * @param energyCountMVo
* @return * @return
*/ */
@Select("<script>select e.`DAY`,sum(if(e.WATER_MONEY is null,0,e.WATER_MONEY))+sum(if(e.ELEC_MONEY is null,0,e.ELEC_MONEY))+sum(if(e.GAS_MONEY is null,0,e.GAS_MONEY)) MONEY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} group by e.`DAY`+0 asc</script>") @Select("<script>select e.`DAY`,sum(if(e.WATER_MONEY is null,0,e.WATER_MONEY))+sum(if(e.ELEC_MONEY is null,0,e.ELEC_MONEY))+sum(if(e.GAS_MONEY is null,0,e.GAS_MONEY)) MONEY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon} group by e.`DAY`+0 asc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanMonth(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> statEnergyPlanMonth(EnergyCountMVo energyCountMVo);
...@@ -139,7 +139,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -139,7 +139,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountMVo * @param energyCountMVo
* @return * @return
*/ */
@Select("<script>select e.`HOUR`,sum(if(e.WATER_MONEY is null,0,e.WATER_MONEY))+sum(if(e.ELEC_MONEY is null,0,e.ELEC_MONEY))+sum(if(e.GAS_MONEY is null,0,e.GAS_MONEY)) MONEY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.`HOUR`+0 asc</script>") @Select("<script>select e.`HOUR`,sum(if(e.WATER_MONEY is null,0,e.WATER_MONEY))+sum(if(e.ELEC_MONEY is null,0,e.ELEC_MONEY))+sum(if(e.GAS_MONEY is null,0,e.GAS_MONEY)) MONEY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon} and e.`DAY`=#{day} group by e.`HOUR`+0 asc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanDay(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> statEnergyPlanDay(EnergyCountMVo energyCountMVo);
......
...@@ -360,7 +360,7 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -360,7 +360,7 @@ public class OverViewServiceImpl implements OverViewService {
if (total.compareTo(new BigDecimal(0)) == 0) if (total.compareTo(new BigDecimal(0)) == 0)
energyCountMVo.setPercent(total + "%"); energyCountMVo.setPercent(total + "%");
else else
energyCountMVo.setPercent(energyCountMVo.getEnergy().divide(total).multiply(new BigDecimal(100)).setScale(1) + "%"); energyCountMVo.setPercent(energyCountMVo.getEnergy().divide(total, 1, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)) + "%");
} }
} }
return list; return list;
......
...@@ -65,6 +65,9 @@ public class UserController extends PaginationController<SysUser> { ...@@ -65,6 +65,9 @@ public class UserController extends PaginationController<SysUser> {
public Result updateUser(@RequestBody UserDto userDto){ public Result updateUser(@RequestBody UserDto userDto){
String userId = UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID); String userId = UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID);
SysUser sysUser = userDto.getSysUser(); SysUser sysUser = userDto.getSysUser();
if(userDto.getSysUser().getUserId()!=null){
userId = userDto.getSysUser().getUserId();
}
sysUser.setUserId(userId); sysUser.setUserId(userId);
SysAdmins sysAdmins = userDto.getSysAdmins(); SysAdmins sysAdmins = userDto.getSysAdmins();
SysOwner sysOwner = userDto.getSysOwner(); SysOwner sysOwner = userDto.getSysOwner();
......
...@@ -41,7 +41,7 @@ public interface UserRepository extends BaseMapper<SysUser>{ ...@@ -41,7 +41,7 @@ public interface UserRepository extends BaseMapper<SysUser>{
* 查询所有用户 * 查询所有用户
* @return * @return
*/ */
@Select("<script>select a.USER_ID,a.USER_NM,a.USER_TP " + @Select("<script>select a.USER_ID,a.USER_NM,a.USER_NICK_NAME,a.USER_TP " +
"<if test=\"stable != null\">,b.*</if> " + "<if test=\"stable != null\">,b.*</if> " +
"from sys_user a " + "from sys_user a " +
"<if test=\"stable != null\">left join ${stable} b on a.USER_ID = b.USER_ID </if> " + "<if test=\"stable != null\">left join ${stable} b on a.USER_ID = b.USER_ID </if> " +
......
...@@ -151,7 +151,7 @@ public class UserServiceImpl implements UserService { ...@@ -151,7 +151,7 @@ public class UserServiceImpl implements UserService {
String userId = sysUser.getUserId(); String userId = sysUser.getUserId();
String userTp = sysUser.getUserTp(); String userTp = sysUser.getUserTp();
try { try {
if (UserTpConstant.TP_ADMIN.equals(userTp)) { if (UserTpConstant.TP_ADMIN.equals(userTp) || UserTpConstant.TP_SUPER_ADMIN.equals(userTp)) {
SysAdmins sysAdminsByUserId = adminRepository.getSysAdminsByUserId(userId); SysAdmins sysAdminsByUserId = adminRepository.getSysAdminsByUserId(userId);
if (null != sysAdminsByUserId){ if (null != sysAdminsByUserId){
sysAdmins.setAdminId(sysAdminsByUserId.getAdminId()); sysAdmins.setAdminId(sysAdminsByUserId.getAdminId());
......
...@@ -37,11 +37,7 @@ public class MqttClient { ...@@ -37,11 +37,7 @@ public class MqttClient {
String devStr = ""; String devStr = "";
try { try {
JSONObject jb = JSONArray.parseObject(content.substring(1,content.length()-1)); JSONObject jb = JSONArray.parseObject(content.substring(1,content.length()-1));
Map<String,Object> map = new HashMap<>();
String jwnum = jb.getString("PHONE");//网关编号 String jwnum = jb.getString("PHONE");//网关编号
map.put("pro_id",jwnum);
referMap = totalService.queryBusParamRefer(map);
devStr = totalService.queryDevByPro(jwnum);
String time = jb.getString("TIME");//时间 String time = jb.getString("TIME");//时间
JSONObject jbody = jb.getJSONObject("body");//数据体 JSONObject jbody = jb.getJSONObject("body");//数据体
//String time = DateUtil.getSimepleDate("yyyyMMddHHmmss",new Date()); //String time = DateUtil.getSimepleDate("yyyyMMddHHmmss",new Date());
...@@ -59,6 +55,11 @@ public class MqttClient { ...@@ -59,6 +55,11 @@ public class MqttClient {
} }
System.out.println("++++++++++++++++++++++++++++++++++"+minute+"-----"+sec); System.out.println("++++++++++++++++++++++++++++++++++"+minute+"-----"+sec);
if(Integer.parseInt(minute)%10==0 && sec.equalsIgnoreCase("00")){//10分钟级的数据,进行存储 if(Integer.parseInt(minute)%10==0 && sec.equalsIgnoreCase("00")){//10分钟级的数据,进行存储
Map<String,Object> map = new HashMap<>();
map.put("pro_id",jwnum);
referMap = totalService.queryBusParamRefer(map);
devStr = totalService.queryDevByPro(jwnum);
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
List<TotalOriginal> originalList = new ArrayList<>(); List<TotalOriginal> originalList = new ArrayList<>();
List<TotalSensor> sensorList = new ArrayList<>(); List<TotalSensor> sensorList = new ArrayList<>();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="org.rcisoft.business.system.dao.DeviceParamRepository"> <mapper namespace="org.rcisoft.business.system.dao.DeviceParamRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.system.entity.DeviceParam"> <resultMap id="BaseResultMap" type="org.rcisoft.business.system.entity.DeviceParam">
<result column="PARAM" jdbcType="VARCHAR" property="param"/> <result column="PARAM" jdbcType="VARCHAR" property="param"/>
<result column="DEV_NUM" jdbcType="VARCHAR" property="paramNm"/> <result column="PARAM_NM" jdbcType="VARCHAR" property="paramNm"/>
<result column="P_SOURCE" jdbcType="VARCHAR" property="source"/> <result column="P_SOURCE" jdbcType="VARCHAR" property="source"/>
<result column="P_MIN" jdbcType="DECIMAL" property="min"/> <result column="P_MIN" jdbcType="DECIMAL" property="min"/>
<result column="P_MAX" jdbcType="DECIMAL" property="max"/> <result column="P_MAX" jdbcType="DECIMAL" property="max"/>
......
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