whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
src/main/java/com/fgkj/controller/Batt_attentionController.java
@@ -7,6 +7,7 @@
import com.fgkj.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -26,14 +27,16 @@
   //添加关注
   @PostMapping("/")
   @ApiOperation(notes = "",value="添加关注")
   public ServiceModel add(@RequestBody Batt_attention attention) {
      // Batt_attention attention = getGson().fromJson(json, Batt_attention.class);
   public ServiceModel add(@RequestParam Integer battGroupId,@RequestParam Integer monNum) {
      Batt_attention attention = new Batt_attention();
      User_inf uinf = (User_inf)ActionUtil.getUser();
//      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);//将用户的操作记录下来
@@ -54,12 +57,14 @@
   //取消关注
   @DeleteMapping("/")
   @ApiOperation(notes = "",value="取消关注")
   public ServiceModel delete(@RequestBody Batt_attention attention) {
      // Batt_attention attention = getGson().fromJson(json, Batt_attention.class);
   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.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);//将用户的操作记录下来
@@ -67,10 +72,10 @@
      return model;
   }
   //根据电池组的筛选条件,查询单体的实际电压
   @GetMapping("byCondition")
   @ApiOperation(notes = "",value="根据电池组的筛选条件,查询单体的实际电压")
   @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();
@@ -82,10 +87,12 @@
    //关注之前识别是否关注过
   @GetMapping("judge")
   @ApiOperation(notes = "",value="关注之前识别是否关注过")
   public ServiceModel judgeInOrNot(@RequestBody Batt_attention attention) {
      // Batt_attention attention = getGson().fromJson(json, Batt_attention.class);
   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.setBattGroupId(battGroupId);
      attention.setMonNum(monNum);
      ServiceModel model = service.judgeInOrNot(attention);
      return model;