| | |
| | | package com.fgkj.controller; |
| | | |
| | | import com.fgkj.util.*; |
| | | |
| | | import com.fgkj.dto.*; |
| | | import com.fgkj.mapper.UinfDaoFactory; |
| | | import com.fgkj.services.Batt_attentionService; |
| | | import com.fgkj.services.User_logService; |
| | | import com.fgkj.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RequestMapping("battAttention") |
| | | @RestController |
| | | @Api |
| | | @Api(tags = "battAttention接口") |
| | | public class Batt_attentionController{ |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private Batt_attentionService service; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private User_logService uservice; |
| | | |
| | | |
| | | //添加关注 |
| | | @PostMapping("/") |
| | | public ServiceModel add(@RequestBody Batt_attention attention) { |
| | | // Batt_attention attention = getGson().fromJson(json, Batt_attention.class); |
| | | @ApiOperation(notes = "",value="添加关注") |
| | | public ServiceModel add(@RequestParam Integer battGroupId,@RequestParam Integer monNum) { |
| | | Batt_attention attention = new Batt_attention(); |
| | | User_inf uinf = (User_inf)ActionUtil.getUser(); |
| | | attention.setUid(uinf.getUId()); |
| | | // User_inf uinf = new User_inf(); |
| | | // uinf.setuId(1001); |
| | | attention.setUid(uinf.getuId()); |
| | | attention.setBattGroupId(battGroupId); |
| | | attention.setMonNum(monNum); |
| | | ServiceModel model = service.add(attention); |
| | | { |
| | | if (model.getCode().equals(1)){ |
| | | String msg="添加对"+attention.getBattGroupId()+"电池组的"+attention.getMonNum()+"单体的关注"; |
| | | User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg); |
| | | uservice.add(ulog);//将用户的操作记录下来 |
| | |
| | | |
| | | //取消关注 |
| | | @DeleteMapping("/") |
| | | public ServiceModel delete(@RequestBody Batt_attention attention) { |
| | | // Batt_attention attention = getGson().fromJson(json, Batt_attention.class); |
| | | @ApiOperation(notes = "",value="取消关注") |
| | | public ServiceModel delete(@RequestParam Integer battGroupId,@RequestParam Integer monNum) { |
| | | Batt_attention attention = new Batt_attention(); |
| | | User_inf uinf = (User_inf)ActionUtil.getUser(); |
| | | attention.setUid(uinf.getUId()); |
| | | attention.setUid(uinf.getuId()); |
| | | attention.setBattGroupId(battGroupId); |
| | | attention.setMonNum(monNum); |
| | | ServiceModel model = service.delete(attention); |
| | | { |
| | | if (model.getCode().equals(1)){ |
| | | String msg="取消对"+attention.getBattGroupId()+"电池组的"+attention.getMonNum()+"号单体的关注"; |
| | | User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Delete, msg); |
| | | uservice.add(ulog);//将用户的操作记录下来 |
| | |
| | | |
| | | return model; |
| | | } |
| | | |
| | | |
| | | //根据电池组的筛选条件,查询单体的实际电压 |
| | | @GetMapping("byCondition") |
| | | @PostMapping("byCondition") |
| | | @ApiOperation(notes = "{ \"binf\": { \"stationName1\": \"\", \"stationName\": \"\", \"battGroupId\": 0, \"monNum\": 0 },\"pageBean\": { \"pageNum\": 1, \"pageSize\": 3 } }",value="根据电池组的筛选条件,查询单体的实际电压") |
| | | public ServiceModel serchByCondition(@RequestBody Batt_Maint_Dealarm bmd) { |
| | | // Batt_Maint_Dealarm bmd = getGson().fromJson(json, Batt_Maint_Dealarm.class); |
| | | User_inf uinf = (User_inf)ActionUtil.getUser(); |
| | | bmd.getBinf().setNum(uinf.getUId()); |
| | | bmd.getBinf().setNum(uinf.getuId()); |
| | | ServiceModel model = service.serchByCondition(bmd); |
| | | |
| | | return model; |
| | | } |
| | | //关注之前识别是否关注过 |
| | | @GetMapping("judge") |
| | | public ServiceModel judgeInOrNot(@RequestBody Batt_attention attention) { |
| | | // Batt_attention attention = getGson().fromJson(json, Batt_attention.class); |
| | | @ApiOperation(notes = "",value="关注之前识别是否关注过") |
| | | public ServiceModel judgeInOrNot(@RequestParam Integer battGroupId,@RequestParam Integer monNum) { |
| | | Batt_attention attention = new Batt_attention(); |
| | | User_inf uinf = (User_inf)ActionUtil.getUser(); |
| | | attention.setUid(uinf.getUId()); |
| | | attention.setUid(uinf.getuId()); |
| | | attention.setBattGroupId(battGroupId); |
| | | attention.setMonNum(monNum); |
| | | ServiceModel model = service.judgeInOrNot(attention); |
| | | |
| | | return model; |