From e16302f9d475c7cc4dd18c5abf1a23cb5502e362 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 28 五月 2025 14:57:56 +0800 Subject: [PATCH] 密码验证加- --- src/main/java/com/whyc/controller/CircleInfController.java | 82 ++++++++++++++++++++++++++++++++++++----- 1 files changed, 72 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/whyc/controller/CircleInfController.java b/src/main/java/com/whyc/controller/CircleInfController.java index ca9a90e..84e2ac6 100644 --- a/src/main/java/com/whyc/controller/CircleInfController.java +++ b/src/main/java/com/whyc/controller/CircleInfController.java @@ -6,6 +6,7 @@ import com.whyc.service.BattInfService; import com.whyc.service.CircleInfService; import com.whyc.service.StationInfService; +import com.whyc.service.SubInfService; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -13,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; + +import java.util.Date; @RestController @RequestMapping("circle") @@ -27,17 +30,20 @@ @Autowired private BattInfService binfService; + @Autowired + private SubInfService subService; - @PostMapping + + @PostMapping("addCinf") @ApiOperation(value = "娣诲姞鍔ㄧ幆") @Transactional - public Response add(@RequestBody CircleInf circleInf){ - int userId = ((UserInf)ActionUtil.getSession().getAttribute("user")).getUId().intValue(); + public Response addCinf(@RequestBody CircleInf circleInf){ + int userId = ActionUtil.getUser().getUId().intValue(); Response res = new Response(); //鏍¢獙鏈烘埧绔欑偣鏄惁瀛樺湪,瀛樺湪鍒欎笉闇�瑕佹柊寤篠tationId - StationInf sinf = sinfService.judgeStationName(circleInf.getStationName()); - if (sinf!=null) { - circleInf.setStationId(sinf.getStationId()); + Battinf binf = service.judgeBattStationName3(circleInf); + if (binf!=null) { + circleInf.setStationId(binf.getStationId()); }else { //绔欑偣涓嶅瓨鍦�,闇�瑕佹柊寤虹珯鐐硅褰� String nextStationId = binfService.getNextStationId(); @@ -55,9 +61,19 @@ //鑾峰彇鍔ㄧ幆鐨勮澶噄d String devId = service.getDeviceId(); circleInf.setDeviceId(devId); + //瀛樺叆鑷缓鏁伴噺 + if(circleInf.getSubList()!=null){ + circleInf.setSubCount(circleInf.getSubList().size()); + } + circleInf.setCircleInuseDate(new Date()); if (service.add(circleInf)>0){ //娣诲姞鏈烘埧绔欑偣鍒扮敤鎴峰搴旂殑鍖呮満缁� binfService.insertUserBattgroupBaojigroupBattgroupSelect(circleInf.getStationId(),0,userId); + //娣诲姞瀛愪欢淇℃伅 + if(circleInf.getSubList()!=null&&circleInf.getSubList().size()>0){ + subService.addSubList(devId,circleInf.getSubList()); + } + //娣诲姞鐢垫簮绔欑偣鏃�,鏇存柊ReInit瀛楁涓�1,閫氳绋嬪簭鐩戞帶鍙樺寲閲嶆柊鍒濆鍖� /*if(powerInf.getPowerDeviceType()== BattinfGroupFactory.DEVICE_POWER) { boolean flag = powerAppSysService.updateFlag("AppServer_Reinit_PowerData_EN"); @@ -78,17 +94,63 @@ return res; } - @PostMapping("update") + + @PostMapping("updateCinf") @ApiOperation(value = "鏇存柊鐢垫簮") - public Response updateByDeviceId(@RequestBody CircleInf circleInf){ + public Response updateCinf(@RequestBody CircleInf circleInf){ service.updateByDeviceId(circleInf); return new Response().set(1,true,"鏇存柊鎴愬姛"); } - @PostMapping("delete") + + @GetMapping("deleteCinf") @ApiOperation(value = "鍒犻櫎鐢垫簮") - public Response deleteByDeviceId(@RequestParam Integer deviceId){ + public Response deleteCinf(@RequestParam Integer deviceId){ service.deleteByDeviceId(deviceId); return new Response().set(1,true,"鍒犻櫎鎴愬姛"); } + @PostMapping("getCinf") + @ApiOperation(value = "鑾峰彇鍔ㄧ幆淇℃伅") + public Response getCinf(@RequestBody CircleInf cinf,@RequestParam int pageCurr,@RequestParam int pageSize){ + return service.getCinf(cinf,pageCurr,pageSize); + } + + @PostMapping("getConditionCid") + @ApiOperation(value = "鑾峰彇鍔ㄧ幆涓嬫媺璧勪骇淇℃伅") + public Response getConditionCid(){ + return service.getConditionCid(); + } + + @GetMapping("getCinfById") + @ApiOperation(value = "鏍规嵁id鑾峰彇鍔ㄧ幆淇℃伅") + public Response getCinfById(@RequestParam int deviceId){ + return service.getCinfById(deviceId); + } + + @PostMapping("getSub") + @ApiOperation(value = "鑾峰彇瀛愪欢淇℃伅") + public Response getSub(@RequestBody SubInf sub,@RequestParam int pageCurr,@RequestParam int pageSize){ + return subService.getSub(sub,pageCurr,pageSize); + } + + @PostMapping("updateSub") + @ApiOperation(value = "鏇存柊瀛愪欢") + public Response updateSub(@RequestBody SubInf sub){ + subService.updateSub(sub); + return new Response().set(1,true,"鏇存柊鎴愬姛"); + } + + @GetMapping("deleteSub") + @ApiOperation(value = "鍒犻櫎瀛愪欢") + public Response deleteSub(@RequestParam Integer subId){ + subService.deleteSub(subId); + return new Response().set(1,true,"鍒犻櫎鎴愬姛"); + } + @PostMapping("addSub") + @ApiOperation(value = "娣诲姞瀛愪欢") + public Response addSub(@RequestBody SubInf sub){ + subService.addSub(sub); + return new Response().set(1,true,"娣诲姞鎴愬姛"); + } + } \ No newline at end of file -- Gitblit v1.9.1