去掉原controller 中的try catch 和BindingResult
| | |
| | | public @interface CheckLength { |
| | | |
| | | int min() default 11; |
| | | int max() default 12; |
| | | int max() default 11; |
| | | |
| | | String message() default "手机号长度必须是11位"; |
| | | |
| | |
| | | @ExceptionHandler |
| | | public BaseResponse exceptionHandler(Throwable t) { |
| | | log.error("捕获到异常:{}",t.getMessage(),t); |
| | | return BaseResponseUtils.buildException("在Controller中或后产生异常:" + t.getMessage()); |
| | | return BaseResponseUtils.buildException( t.getMessage()); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | /** |
| | |
| | | * 产品实体编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @NotEmpty(message = "产品实体编号不能为空") |
| | | @NotNull(message = "产品实体编号不能为空") |
| | | public Long proId; |
| | | |
| | | /** |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 物料管理 |
| | |
| | | /** |
| | | * 保存物料信息 |
| | | * @param material |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="save") |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("保存物料信息") |
| | | public BaseResponse<PltMaterial> save(@RequestBody @Valid PltMaterial material,BindingResult bindingResult){ |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | public BaseResponse<PltMaterial> save(@RequestBody @Valid PltMaterial material){ |
| | | material.deleted = false; |
| | | return BaseResponseUtils.buildSuccess(sv.save(material)); |
| | | }catch (Exception e){ |
| | | log.error("保存物料异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | int count = sv.save(material); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * 更新物料信息 |
| | | * @param material |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="update") |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("更新物料信息") |
| | | public BaseResponse<PltMaterial> update(@RequestBody @Valid PltMaterial material,BindingResult bindingResult){ |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.update(material)); |
| | | }catch (Exception e){ |
| | | log.error("更新物料异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | public BaseResponse<PltMaterial> update(@RequestBody @Valid PltMaterial material){ |
| | | int count = sv.update(material); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("删除物料信息") |
| | | public BaseResponse<PltMaterial> delete(String id){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.delete(Long.parseLong(id))); |
| | | }catch (Exception e){ |
| | | log.error("删除物料异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | int count = sv.delete(Long.parseLong(id)); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | |
| | | @SsoPowerAop(power = "10300000") //登录与权限同时验证 |
| | | @Log("根据ID查询物料信息") |
| | | public BaseResponse<PltMaterial> one(String id){ |
| | | try{ |
| | | PltMaterial material=sv.selectById(id); |
| | | return BaseResponseUtils.buildSuccess(JSON.toJSON(material)); |
| | | }catch (Exception e){ |
| | | log.error("查询物料异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300000") |
| | | @Log("查询物料信息") |
| | | public BaseResponse<QueryResultVo<List<PltMaterial>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<PltMaterial>> list = sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("查询物料异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pmsGlobal.aop.Log; |
| | | import com.dy.pmsGlobal.pojoBa.BaRole; |
| | | import com.dy.pmsGlobal.pojoPlt.PltProductParams; |
| | | import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems; |
| | | import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 产品品质检查项目 |
| | |
| | | /** |
| | | * 保存产品品质检查项目 |
| | | * @param item |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="save") |
| | | @SsoPowerAop(power = "10300003") |
| | | @Log("保存产品品质检查项目信息") |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltProductQualityInspectionItems item, BindingResult bindingResult){ |
| | | int count = 0; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltProductQualityInspectionItems item){ |
| | | item.deleted = false; |
| | | item.disabled = false; |
| | | count =sv.save(item); |
| | | }catch (Exception e){ |
| | | log.error("保存产品品质检查项目异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count =sv.save(item); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | /** |
| | | * 更新产品品质检查项目信息 |
| | | * @param item |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="update") |
| | | @SsoPowerAop(power = "10300003") |
| | | @Log("更新产品品质检查项目信息") |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltProductQualityInspectionItems item,BindingResult bindingResult){ |
| | | int count ; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | count = sv.update(item); |
| | | }catch (Exception e){ |
| | | log.error("更新产品品质检查项目异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltProductQualityInspectionItems item){ |
| | | int count = sv.update(item); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300003") |
| | | @Log("删除产品品质检查项目信息") |
| | | public BaseResponse<Boolean> delete(String id){ |
| | | int count; |
| | | try { |
| | | count = sv.delete(Long.parseLong(id)); |
| | | }catch (Exception e){ |
| | | log.error("删除产品品质检查项目异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.delete(Long.parseLong(id)); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300002") //登录与权限同时验证 |
| | | @Log("根据ID查询产品品质检查项目信息") |
| | | public BaseResponse<PltProductQualityInspectionItems> one(String id){ |
| | | try{ |
| | | PltProductQualityInspectionItems item=sv.selectById(id); |
| | | return BaseResponseUtils.buildSuccess(JSON.toJSON(item)); |
| | | }catch (Exception e){ |
| | | log.error("查询产品品质检查项目异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300002") |
| | | @Log("查询产品品质检查项目信息") |
| | | public BaseResponse<QueryResultVo<List<PltProductQualityInspectionItems>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<PltProductQualityInspectionItems>> list = sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("查询产品品质检查项目异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | | * 禁用或启用 |
| | |
| | | @SsoPowerAop(power = "10100011") |
| | | @Log("禁用或启用质检项目") |
| | | public BaseResponse<Boolean> disabled(@RequestBody PltProductUnqualifiedReason reason){ |
| | | int count; |
| | | try { |
| | | count = sv.disabled(reason.id,reason.disabled); |
| | | }catch (Exception e){ |
| | | log.error("禁用或启用质检项目异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.disabled(reason.id,reason.disabled); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 产品技术参数管理 |
| | |
| | | /** |
| | | * 保存产品技术参数信息 |
| | | * @param param |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="save") |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("保存产品技术参数信息") |
| | | public BaseResponse<PltProductParams> save(@RequestBody @Valid PltProductParams param,BindingResult bindingResult){ |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | public BaseResponse<PltProductParams> save(@RequestBody @Valid PltProductParams param){ |
| | | param.deleted = false; |
| | | return BaseResponseUtils.buildSuccess(sv.save(param)); |
| | | }catch (Exception e){ |
| | | log.error("保存产品技术参数异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | int count = sv.save(param); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * 更新产品技术参数信息 |
| | | * @param param |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="update") |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("更新产品技术参数信息") |
| | | public BaseResponse<PltProductParams> update(@RequestBody @Valid PltProductParams param,BindingResult bindingResult){ |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.update(param)); |
| | | }catch (Exception e){ |
| | | log.error("更新产品技术参数异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | public BaseResponse<PltProductParams> update(@RequestBody @Valid PltProductParams param){ |
| | | param.deleted = false; |
| | | int count = sv.update(param); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("删除产品技术参数信息") |
| | | public BaseResponse<PltProductParams> delete(String id){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.delete(Long.parseLong(id))); |
| | | }catch (Exception e){ |
| | | log.error("删除产品技术参数异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | int count = sv.delete(Long.parseLong(id)); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | |
| | | @SsoPowerAop(power = "10300000") //登录与权限同时验证 |
| | | @Log("根据ID查询产品技术参数信息") |
| | | public BaseResponse<PltProductParams> one(String id){ |
| | | try{ |
| | | PltProductParams param=sv.selectById(id); |
| | | return BaseResponseUtils.buildSuccess(JSON.toJSON(param)); |
| | | }catch (Exception e){ |
| | | log.error("查询产品技术参数异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300000") |
| | | @Log("查询产品技术参数信息") |
| | | public BaseResponse<QueryResultVo<List<PltProductParams>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<PltProductParams>> list = sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("查询产品技术参数异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pmsGlobal.aop.Log; |
| | | import com.dy.pmsGlobal.pojoBa.BaRole; |
| | | import com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason; |
| | | import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 产品设备报废原因 |
| | |
| | | /** |
| | | * 保存 |
| | | * @param reason |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="save") |
| | | @SsoPowerAop(power = "10300011") |
| | | @Log("保存产品设备报废原因") |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ |
| | | int count; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltProductScrappingReason reason){ |
| | | reason.disabled = false; |
| | | reason.deleted = false; |
| | | count = sv.save(reason); |
| | | }catch (Exception e){ |
| | | log.error("保存产品设备报废原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.save(reason); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | /** |
| | | * 更新 |
| | | * @param reason |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="update") |
| | | @SsoPowerAop(power = "10300011") |
| | | @Log("更新产品设备报废原因") |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ |
| | | int count; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | count = sv.update(reason); |
| | | }catch (Exception e){ |
| | | log.error("更新产品设备报废原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltProductScrappingReason reason){ |
| | | int count = sv.update(reason); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300011") |
| | | @Log("删除产品设备报废原因") |
| | | public BaseResponse<Boolean> delete(String id){ |
| | | int count; |
| | | try { |
| | | count = sv.delete(Long.parseLong(id)); |
| | | }catch (Exception e){ |
| | | log.error("删除产品设备报废原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.delete(Long.parseLong(id)); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300010") //登录与权限同时验证 |
| | | @Log("根据ID查询产品设备报废原因") |
| | | public BaseResponse<PltProductScrappingReason> one(String id){ |
| | | try{ |
| | | PltProductScrappingReason param=sv.selectById(id); |
| | | return BaseResponseUtils.buildSuccess(JSON.toJSON(param)); |
| | | }catch (Exception e){ |
| | | log.error("查询产品设备报废原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300010") |
| | | @Log("查询产品设备报废原因") |
| | | public BaseResponse<QueryResultVo<List<PltProductScrappingReason>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<PltProductScrappingReason>> list = sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("查询产品设备报废原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10100011") |
| | | @Log("禁用或启用报废原因") |
| | | public BaseResponse<Boolean> disabled(@RequestBody PltProductUnqualifiedReason reason){ |
| | | int count; |
| | | try { |
| | | count = sv.disabled(reason.id,reason.disabled); |
| | | }catch (Exception e){ |
| | | log.error("禁用或启用报废原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.disabled(reason.id,reason.disabled); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 产品生产不合格原因 |
| | |
| | | /** |
| | | * 保存产品生产不合格原因 |
| | | * @param reason |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="save") |
| | | @SsoPowerAop(power = "10300009") |
| | | @Log("保存产品生产不合格原因") |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ |
| | | int count; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltProductUnqualifiedReason reason){ |
| | | reason.deleted = false; |
| | | reason.disabled = false; |
| | | count = sv.save(reason); |
| | | }catch (Exception e){ |
| | | log.error("保存产品生产不合格原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.save(reason); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | /** |
| | | * 更新产品生产不合格原因 |
| | | * @param reason |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="update") |
| | | @SsoPowerAop(power = "10300009") |
| | | @Log("更新产品生产不合格原因") |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltProductUnqualifiedReason reason,BindingResult bindingResult){ |
| | | int count; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | count = sv.update(reason); |
| | | }catch (Exception e){ |
| | | log.error("更新产品生产不合格原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltProductUnqualifiedReason reason){ |
| | | int count = sv.update(reason); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300009") |
| | | @Log("删除产品生产不合格原因") |
| | | public BaseResponse<Boolean> delete(String id){ |
| | | int count; |
| | | try { |
| | | count = sv.delete(Long.parseLong(id)); |
| | | }catch (Exception e){ |
| | | log.error("删除产品生产不合格原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.delete(Long.parseLong(id)); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300008") //登录与权限同时验证 |
| | | @Log("根据ID查询产品生产不合格原因") |
| | | public BaseResponse<PltProductUnqualifiedReason> one(String id){ |
| | | try{ |
| | | PltProductUnqualifiedReason param=sv.selectById(id); |
| | | return BaseResponseUtils.buildSuccess(JSON.toJSON(param)); |
| | | }catch (Exception e){ |
| | | log.error("根据ID查询产品生产不合格原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300008") |
| | | @Log("查询产品生产不合格原因") |
| | | public BaseResponse<QueryResultVo<List<PltProductUnqualifiedReason>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<PltProductUnqualifiedReason>> list = sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("查询产品生产不合格原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300009") |
| | | @Log("禁用或启用不合格原因") |
| | | public BaseResponse<Boolean> disabled(@RequestBody PltProductUnqualifiedReason reason){ |
| | | int count; |
| | | try { |
| | | count = sv.disabled(reason.id,reason.disabled); |
| | | }catch (Exception e){ |
| | | log.error("禁用或启用不合格原因异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.disabled(reason.id,reason.disabled); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | |
| | | /** |
| | | * 保存产品信息 |
| | | * @param pro |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="save") |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("保存产品信息") |
| | | public BaseResponse<PltProduct> save(@RequestBody @Valid PltProduct pro, |
| | | BindingResult bindingResult){ |
| | | public BaseResponse<PltProduct> save(@RequestBody @Valid PltProduct pro){ |
| | | pro.id = null; |
| | | int count; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | pro.setDeleted(false); |
| | | count = proSv.save(pro); |
| | | }catch (Exception e){ |
| | | log.error("保存产品异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = proSv.save(pro); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | /** |
| | | * 更新产品信息 |
| | | * @param pro |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="update") |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("更新产品信息") |
| | | public BaseResponse<PltProduct> update(@RequestBody @Valid PltProduct pro,BindingResult bindingResult){ |
| | | int count; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | count = proSv.update(pro); |
| | | }catch (Exception e){ |
| | | log.error("更新产品异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | public BaseResponse<PltProduct> update(@RequestBody @Valid PltProduct pro){ |
| | | int count = proSv.update(pro); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300001") |
| | | @Log("删除产品信息") |
| | | public BaseResponse<Boolean> delete(String id){ |
| | | int count; |
| | | try { |
| | | count = proSv.delete(Long.parseLong(id)); |
| | | }catch (Exception e){ |
| | | log.error("删除产品异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = proSv.delete(Long.parseLong(id)); |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300000") //登录与权限同时验证 |
| | | @Log("根据ID查询产品信息") |
| | | public BaseResponse<PltProduct> one(String id){ |
| | | try{ |
| | | PltProduct pro=proSv.selectById(id); |
| | | |
| | | return BaseResponseUtils.buildSuccess(pro); |
| | | }catch (Exception e){ |
| | | log.error("根据ID查询产品异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300000") |
| | | @Log("分页查询产品信息") |
| | | public BaseResponse<QueryResultVo<List<PltProduct>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<PltProduct>> list = proSv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("分页查询产品异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300000") |
| | | @Log("查询所有产品") |
| | | public BaseResponse<List<PltProduct>> all(){ |
| | | try { |
| | | QueryVo vo = new QueryVo(); |
| | | return BaseResponseUtils.buildSuccess(proSv.selectAll(vo)); |
| | | }catch (Exception e){ |
| | | log.error("查询所有产品异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping(path="export") |
| | | @SsoPowerAop(power = "10300000") |
| | | @Log("导出产品信息") |
| | | public void export(@RequestBody QueryVo queryVo, HttpServletResponse response){ |
| | | try{ |
| | | List<Converter> list = new ArrayList<>() ; |
| | | |
| | | List<PltProduct> porList = proSv.selectAll(queryVo); |
| | |
| | | list.add(vo); |
| | | }); |
| | | QrCodeUtil.downloadExcel(response, fileName,sheetName,list); |
| | | }catch (Exception e){ |
| | | log.error("导出产品信息异常", e); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 工站 |
| | |
| | | /** |
| | | * 保存 |
| | | * @param station |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="save") |
| | | @SsoPowerAop(power = "10300007") |
| | | @Log("保存工站") |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltStation station,BindingResult bindingResult){ |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | int count; |
| | | try { |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid PltStation station){ |
| | | station.deleted = false; |
| | | count = sv.save(station); |
| | | }catch (Exception e){ |
| | | log.error("保存工站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.save(station); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | |
| | | /** |
| | | * 更新 |
| | | * @param station |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path="update") |
| | | @SsoPowerAop(power = "10300007") |
| | | @Log("更新工站") |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltStation station,BindingResult bindingResult){ |
| | | int count; |
| | | try { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | count = sv.update(station); |
| | | }catch (Exception e){ |
| | | log.error("更新工站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PltStation station){ |
| | | int count = sv.update(station); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300007") |
| | | @Log("删除工站") |
| | | public BaseResponse<Boolean> delete(String id){ |
| | | int count; |
| | | try { |
| | | count = sv.delete(Long.parseLong(id)); |
| | | }catch (Exception e){ |
| | | log.error("删除工站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.delete(Long.parseLong(id)); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300006") //登录与权限同时验证 |
| | | @Log("根据ID查询工站") |
| | | public BaseResponse<PltStation> one(String id){ |
| | | try{ |
| | | PltStation param=sv.selectById(id); |
| | | return BaseResponseUtils.buildSuccess(JSON.toJSON(param)); |
| | | }catch (Exception e){ |
| | | log.error("根据ID查询工站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoPowerAop(power = "10300006") |
| | | @Log("分页查询工站") |
| | | public BaseResponse<QueryResultVo<List<PltStation>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<PltStation>> list = sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | }catch (Exception e){ |
| | | log.error("分页查询工站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping(path="disabled") |
| | | @SsoPowerAop(power = "10100011") |
| | | @Log("禁用或启用工站") |
| | | public BaseResponse<Boolean> disabled(@RequestBody PltStation station){ |
| | | int count; |
| | | try { |
| | | count = sv.disabled(station.id,station.disabled); |
| | | }catch (Exception e){ |
| | | log.error("禁用或启用工站异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | int count = sv.disabled(station.id,station.disabled); |
| | | |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | |
| | | @SsoPowerAop(power = "10300000") |
| | | @Log("导出工站信息") |
| | | public void export(HttpServletResponse response){ |
| | | try{ |
| | | List<Converter> list = new ArrayList<>() ; |
| | | |
| | | List<PltStation> stations = sv.selectAll(); |
| | |
| | | list.add(vo); |
| | | }); |
| | | QrCodeUtil.downloadExcel(response, fileName,sheetName,list); |
| | | }catch (Exception e){ |
| | | log.error("导出产品信息异常", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public int save(PltStation station) throws Exception { |
| | | public int save(PltStation station) throws RuntimeException { |
| | | if(dao.selectByCodeId(station.id,station.code)>0){ |
| | | throw new Exception("工站编号已存在"); |
| | | throw new RuntimeException("工站编号已存在"); |
| | | } |
| | | int count = dao.insertSelective(station); |
| | | return count; |
| | |
| | | |
| | | |
| | | @Transactional |
| | | public int update(PltStation station) throws Exception { |
| | | public int update(PltStation station) throws RuntimeException { |
| | | if(dao.selectByCodeId(station.id,station.code)>0){ |
| | | throw new Exception("工站编号已存在"); |
| | | throw new RuntimeException("工站编号已存在"); |
| | | } |
| | | int count = dao.updateByPrimaryKeySelective(station); |
| | | return count; |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 生产流程 |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 组装任务计划 |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pmsGlobal.aop.Log; |
| | | import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; |
| | | import com.dy.pmsGlobal.pojoPr.PrDevOpsPlan; |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 安装运维任务计划 |