| | |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrProject.intake.qo.OnLineIntakesQO; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import com.taobao.api.ApiException; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | |
| | | @RequiredArgsConstructor |
| | | public class IntakeCtrl { |
| | | private final IntakeSv intakeSv; |
| | | |
| | | @GetMapping("/test") |
| | | public String sendMessage(String message) throws ApiException { |
| | | return intakeSv.sendMessage(message); |
| | | } |
| | | |
| | | /** |
| | | * 客户端请求得到所有取水口名字 |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | List<String> intakeNameList = intakeSv.getIntakeName(); |
| | | for (int i = 0; i < intakeNameList.size(); i++) { |
| | | String intakeName = intakeNameList.get(i); |
| | | if (intakeName.equals(po.getName())) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_NAME_EXIST.getMessage()); |
| | | } |
| | | List<Long> ids = intakeSv.getIntakeIdsByName(po.getName()); |
| | | if (ids.size() > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_NAME_EXIST.getMessage()); |
| | | } |
| | | Date operateTime = new Date(); |
| | | po.setOperateDt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | po.setOperateDt(new Date()); |
| | | po.setDeleted((byte) 0); |
| | | Integer rec = Optional.ofNullable(intakeSv.addIntake(po)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.ADD_INTAKE_FAIL.getMessage()); |
| | |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | List<String> intakeNameList = intakeSv.getIntakeName(); |
| | | for (int i = 0; i < intakeNameList.size(); i++) { |
| | | String intakeName = intakeNameList.get(i); |
| | | if (intakeName.equals(po.getName())) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_NAME_EXIST.getMessage()); |
| | | } |
| | | List<Long> ids = intakeSv.getIntakeIdByNameExcludeId(po.getId(), po.getName()); |
| | | if (ids.size() > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_NAME_EXIST.getMessage()); |
| | | } |
| | | int count; |
| | | Date operateTime = new Date(); |
| | | po.setOperateDt(operateTime); |
| | | po.setOperateDt(new Date()); |
| | | try { |
| | | count = this.intakeSv.update(po); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | /** |
| | | * 获取取水口列表(在线和不在线) |
| | | * |
| | | * @param qo |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据操作员获取常用取水口(在线和不在线) |
| | | * |
| | | * @param operator |
| | | * @return |
| | | */ |