| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.moral.api.entity.DeviceAdjustValue; |
| | | import com.moral.api.pojo.dto.adjust.AdjustDTO; |
| | | import com.moral.api.pojo.form.adjust.AdjustForm; |
| | | import com.moral.api.service.DeviceAdjustValueService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.WebUtils; |
| | | import com.sun.org.apache.regexp.internal.RE; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | /** |
| | | * 批量查询校准值 |
| | | * @param parameters |
| | | * @return |
| | | */ |
| | | @PostMapping("getAllAdjust") |
| | | public ResultMessage getAllAdjust(@RequestBody Map<String, Object> parameters){ |
| | | if (!parameters.containsKey("id")|| !parameters.containsKey("code")){ |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), |
| | | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | List<Map<String, Object>> allAdjust = deviceAdjustValueService.getAllAdjust(parameters); |
| | | if (ObjectUtils.isEmpty(allAdjust)){ |
| | | return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), |
| | | ResponseCodeEnum.TARGET_IS_NULL.getMsg()); |
| | | } |
| | | return ResultMessage.ok(allAdjust); |
| | | } |
| | | |
| | | /** |
| | | * 批量修改校准值 |
| | | * @return |
| | | */ |
| | | @PostMapping("updateAllAdjust") |
| | | public ResultMessage updateAllAdjust( @RequestBody Map<String, List<AdjustForm>> parameters){ |
| | | List<AdjustForm> o = parameters.get("AdjustForm"); |
| | | if (ObjectUtils.isEmpty(o)){ |
| | | return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), |
| | | ResponseCodeEnum.TARGET_IS_NULL.getMsg()); |
| | | } |
| | | Map<String, Object> map = deviceAdjustValueService.updateAllAdjust(o); |
| | | int code = Integer.parseInt(map.get("code").toString()); |
| | | if (code != 0){ |
| | | return ResultMessage.fail(ResponseCodeEnum.FAIL.getCode(),ResponseCodeEnum.FAIL.getMsg()); |
| | | } |
| | | return ResultMessage.fail(ResponseCodeEnum.SUCCESS.getCode(),ResponseCodeEnum.SUCCESS.getMsg()); |
| | | |
| | | // return ResultMessage.ok(map); |
| | | } |
| | | |
| | | |
| | | } |