pom.xml
@@ -131,6 +131,23 @@ <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <!--MPä¾èµ--> <!-- <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.0.7.1</version> <exclusions> <exclusion> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <version>3.0.7.1</version> </dependency>--> </dependencies> <dependencyManagement> @@ -207,4 +224,4 @@ </plugin> </plugins> </build> </project> </project> src/main/java/api/bean/SinglelampDataEntity.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,55 @@ package api.bean; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @author van * @version 1.0 * msgï¼MQTT串å£ï¼CAT1 åç¯æ°æ® å®ä½ç±» * @date 2021/12/13 15:19 */ @Data public class SinglelampDataEntity implements Serializable { private Integer singlelampDataId; //ç¯æid private Long streetlightId; //ç¯æmac private String mac; //ç¯æå private String streetlightName; // æ°æ®æ¶é´ private String dataTime; // è®¾å¤æ¸©åº¦ private Double deviceTemperature; // 亮度ç¾åæ¯ private Integer lightPercent; // çµç½çµå private Double gridVol; // çµç½çµæµ private Double gridCur; // èµ«å ¹ private Double hertz; // åçå ç´ private Double powerFactor; // æååç private Double activePower; // æ ååç private Double reactivePower; // æè¿ä¸æ¬¡äº®ç¯æ¶é´ private Long recentlyLightSec; private String recentlyLightSecStr; // ç´¯è®¡äº®ç¯æ¶é´ private Long totalLightTime; private String totalLightTimeStr; // æè¿ä¸æ¬¡ç¨çµçµé private Double recentlyUsingPower; // 累计ç¨çµçµé private Double totalUsingPower; // å建æ¶é´ private Date createTime; } src/main/java/api/controller/LampController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,78 @@ package api.controller; import api.bean.LampEntity; import api.bean.ReqParams; import api.dao.LampDao; import api.result.Msg; import api.service.AccessService; import api.service.LampService; import com.github.pagehelper.PageInfo; import com.google.common.util.concurrent.RateLimiter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.Map; /** * @author van * @version 1.0 * msgï¼åç¯æ°æ®æ§å¶å± * @date 2021/11/2 15:04 */ @RestController @RequestMapping("/lamp") public class LampController { @Autowired private AccessService accessService; @Autowired private LampService lampService; RateLimiter rateLimiter = RateLimiter.create(10.0); @RequestMapping(value = "/list",method = RequestMethod.POST) public Msg list(@RequestBody ReqParams reqParams){ rateLimiter.acquire(1); if (reqParams.getLimit()>50){ return Msg.error("limit exception!!!"); } Long userId = accessService.getUserId(reqParams.getAccessToken()); if(userId == null){ return Msg.error("server exception!!!"); } PageInfo<LampEntity> info = lampService.selectList(userId,reqParams); Map data = new HashMap(); data.put("total",info.getTotal()); data.put("list",info.getList()); return Msg.ok().put("data",data); } @RequestMapping(value ="/info",method = RequestMethod.POST) public Msg info(@RequestBody ReqParams reqParams){ rateLimiter.acquire(1); if (reqParams.getLimit()>50){ return Msg.error("limit exception!!!"); } Long userId = accessService.getUserId(reqParams.getAccessToken()); if(userId == null){ return Msg.error("server exception!!!"); } PageInfo<LampEntity> info = lampService.selectByStreetlightId(reqParams); Map data = new HashMap(); data.put("total",info.getTotal()); data.put("list",info.getList()); return Msg.ok().put("data",data); } } src/main/java/api/controller/SinglelampDataController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,83 @@ package api.controller; import api.bean.LampEntity; import api.bean.ReqParams; import api.bean.SinglelampDataEntity; import api.result.Msg; import api.service.AccessService; import api.service.LampService; import api.service.SinglelampDataServer; import com.github.pagehelper.PageInfo; import com.google.common.util.concurrent.RateLimiter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; /** * @author van * @version 1.0 * msgï¼MQTTåCAT1åç¯æ§å¶ * @date 2021/12/13 15:26 */ @RestController @RequestMapping("/singlelampData") public class SinglelampDataController { @Autowired private AccessService accessService; @Autowired private SinglelampDataServer singlelampDataServer; RateLimiter rateLimiter = RateLimiter.create(10.0); @RequestMapping(value = "/list",method = RequestMethod.POST) public Msg list(@RequestBody ReqParams reqParams){ rateLimiter.acquire(1); if (reqParams.getLimit()>50){ return Msg.error("limit exception!!!"); } Long userId = accessService.getUserId(reqParams.getAccessToken()); if(userId == null){ return Msg.error("server exception!!!"); } reqParams.toString(); PageInfo<SinglelampDataEntity> info = singlelampDataServer.selectList(userId,reqParams); Map data = new HashMap(); data.put("total",info.getTotal()); data.put("list",info.getList()); return Msg.ok().put("data",data); } @RequestMapping(value ="/info",method = RequestMethod.POST) public Msg info(@RequestBody ReqParams reqParams){ rateLimiter.acquire(1); if (reqParams.getLimit()>50){ return Msg.error("limit exception!!!"); } Long userId = accessService.getUserId(reqParams.getAccessToken()); if(userId == null){ return Msg.error("server exception!!!"); } PageInfo<SinglelampDataEntity> info = singlelampDataServer.selectByStreetlightId(reqParams); Map data = new HashMap(); data.put("total",info.getTotal()); data.put("list",info.getList()); return Msg.ok().put("data",data); } } src/main/java/api/controller/WeatherController.java
@@ -36,7 +36,7 @@ public Msg list(@RequestBody ReqParams reqParams){ rateLimiter.acquire(1); if(reqParams.getLimit() > 50){ return Msg.error("limit exception"); return Msg.error("limit exception!!!"); } Long userId = accessService.getUserId(reqParams.getAccessToken()); src/main/java/api/dao/SinglelampDataDao.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,28 @@ package api.dao; import api.bean.LampEntity; import api.bean.SinglelampDataEntity; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; import java.util.List; /** * @author van * @version 1.0 * msgï¼ * @date 2021/12/16 15:56 */ @Mapper @Repository public interface SinglelampDataDao { /**è¶ çº§ç®¡ç忥æ¾å ¨é¨*/ List<SinglelampDataEntity> selectAll(); /**æ®é管çåæå ¬å¸æ¥æ¾*/ List<SinglelampDataEntity> selectByCompany(Long userId); /**ç¨æ·æ¥æ¾*/ //List<SinglelampDataEntity> selectByUserId(Long userId); /**åä¸ªç¯ææ°æ®*/ List<SinglelampDataEntity> selectByStreetlightId(String mac); } src/main/java/api/service/LampService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,56 @@ package api.service; import api.bean.LampEntity; import api.bean.ReqParams; import api.bean.WeatherEntity; import api.dao.LampDao; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @author van * @version 1.0 * msgï¼åç¯æ°æ® * @date 2021/11/2 10:24 */ @Service("lampService") public class LampService { @Autowired private AccessService accessService; @Autowired private LampDao lampDao; public PageInfo<LampEntity> selectList(Long userId, ReqParams reqParams){ Long roleId = accessService.getRoleId(userId); if(roleId == null || roleId == 0){ return null; } List<LampEntity> list = null; if(roleId.longValue() == 1 ){ PageHelper.startPage(reqParams.getPage(),reqParams.getLimit()); list = lampDao.selectAll(); }else if (roleId.longValue() == 2){ PageHelper.startPage(reqParams.getPage(),reqParams.getLimit()); list = lampDao.selectByCompany(userId); }else if (roleId.longValue() == 3){ PageHelper.startPage(reqParams.getPage(),reqParams.getLimit()); list = lampDao.selectByUserId(userId); } PageInfo<LampEntity> page = new PageInfo<>(list); return page; } public PageInfo<LampEntity> selectByStreetlightId(ReqParams reqParams) { PageHelper.startPage(reqParams.getPage(),reqParams.getLimit()); List<LampEntity> list = lampDao.selectByStreetlightId(reqParams.getLightId()); PageInfo<LampEntity> page = new PageInfo<>(list); return page; } } src/main/java/api/service/SinglelampDataServer.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,55 @@ package api.service; import api.bean.ReqParams; import api.bean.SinglelampDataEntity; import api.dao.SinglelampDataDao; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @author van * @version 1.0 * msgï¼ * @date 2021/12/16 15:14 */ @Service("singlelampDataServer") public class SinglelampDataServer { @Autowired private AccessService accessService; @Autowired private SinglelampDataDao singlelampDao; public PageInfo<SinglelampDataEntity> selectList(Long userId, ReqParams reqParams) { Long roleId = accessService.getRoleId(userId); if(roleId == null || roleId == 0){ return null; } List<SinglelampDataEntity> list = null; if(roleId.longValue() == 1 ){ PageHelper.startPage(reqParams.getPage(),reqParams.getLimit()); list = singlelampDao.selectAll(); }else if (roleId.longValue() == 2 || roleId.longValue() == 3){ PageHelper.startPage(reqParams.getPage(),reqParams.getLimit()); list = singlelampDao.selectByCompany(userId); } PageInfo<SinglelampDataEntity> page = new PageInfo<>(list); return page; } public PageInfo<SinglelampDataEntity> selectByStreetlightId(ReqParams reqParams) { PageHelper.startPage(reqParams.getPage(),reqParams.getLimit()); List<SinglelampDataEntity> list = singlelampDao.selectByStreetlightId(reqParams.getMac()); PageInfo<SinglelampDataEntity> page = new PageInfo<>(list); return page; } } src/main/resources/application.yml
@@ -6,6 +6,7 @@ mybatis: configuration: map-underscore-to-camel-case: true mapper-locations: classpath*:/mapper/*.xml spring: target/classes/application.yml
@@ -6,6 +6,7 @@ mybatis: configuration: map-underscore-to-camel-case: true mapper-locations: classpath*:/mapper/*.xml spring: target/maven-archiver/pom.properties
ÎļþÒÑɾ³ý target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
ÎļþÒÑɾ³ý target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
ÎļþÒÑɾ³ý target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
target/wog-1.0-SNAPSHOT.jar.originalBinary files differ