|
@@ -27,8 +27,9 @@ import java.time.LocalDateTime;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 年检记录 前端控制器
|
|
|
+ * 年检记录 前端控制器
|
|
|
* </p>
|
|
|
+ *
|
|
|
* @author wcz
|
|
|
* @since 2019-12-10
|
|
|
*/
|
|
@@ -49,7 +50,7 @@ public class AnnualInspectionController {
|
|
|
*/
|
|
|
@PostMapping("findOne")
|
|
|
@Judger(fields = {"id"})
|
|
|
- public RestResponse findOne(@RequestBody InspectionRequest request){
|
|
|
+ public RestResponse findOne(@RequestBody InspectionRequest request) {
|
|
|
InspectionResponse entity = annualInspectionService.selectByIdWithInfo(request);
|
|
|
return RestResponse.success(entity);
|
|
|
}
|
|
@@ -61,7 +62,7 @@ public class AnnualInspectionController {
|
|
|
*/
|
|
|
@PostMapping("page")
|
|
|
@Judger(fields = "mtCompanyId")
|
|
|
- public RestResponse page(@RequestBody InspectionRequest request){
|
|
|
+ public RestResponse page(@RequestBody InspectionRequest request) {
|
|
|
IPage<InspectionResponse> pages = annualInspectionService.pageByCondition(request);
|
|
|
long count = annualInspectionService.countByCondition(request);
|
|
|
CountPage<InspectionResponse> countPage = new CountPage<>(count, pages);
|
|
@@ -75,39 +76,38 @@ public class AnnualInspectionController {
|
|
|
*/
|
|
|
@PostMapping("pageWorker")
|
|
|
@Judger(fields = {"workerId"})
|
|
|
- public RestResponse pageWorker(@RequestBody InspectionRequest request){
|
|
|
+ public RestResponse pageWorker(@RequestBody InspectionRequest request) {
|
|
|
IPage<InspectionResponse> pages = annualInspectionService.pageByCondition(request);
|
|
|
return RestResponse.success(pages);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 修改年检信息
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* status 状态(0 待完成;1 已完成;2 超期)
|
|
|
- *
|
|
|
* stepStatus :年检阶段状态
|
|
|
- *
|
|
|
* 未开始0,第一阶段 1-2,第二阶段 3,第三阶段 4-7,第四阶段 8-10
|
|
|
- *
|
|
|
- 1 维保工确认年检计划
|
|
|
- 2 维保工上传自检报告,选择自检时间 或者 文员设置 是否检查限速器和荷载年检设置,
|
|
|
- 文员也可以上传自检报告或者确认自检报告和自检时间,自检时间以最后设置的为准
|
|
|
- --------------------------------
|
|
|
- 3 企业文员确认现场检验时间
|
|
|
- 录入人员信息,政府质检,企业质检,联系电话
|
|
|
- --------------------------------
|
|
|
- 4 维保工上传检验结果
|
|
|
- 5 企业文员确认检验结果-合格 --> 不能算年检超期
|
|
|
- 6 企业文员确认检验结果-整改 --> 回到第二阶段
|
|
|
- 7 企业文员确认检验结果-不合格 --> 可以算年检超期
|
|
|
- --------------------------------
|
|
|
- 8 维保工上传年检报告和合格证
|
|
|
- 9 企业文员确认年检报告和合格证-合格
|
|
|
- 10 企业文员确认年检报告和合格证-不合格 -->停用电梯
|
|
|
+ * <p>
|
|
|
+ * 1 维保工确认年检计划
|
|
|
+ * 2 维保工上传自检报告,选择自检时间 或者 文员设置 是否检查限速器和荷载年检设置,
|
|
|
+ * 文员也可以上传自检报告或者确认自检报告和自检时间,自检时间以最后设置的为准
|
|
|
+ * --------------------------------
|
|
|
+ * 3 企业文员确认现场检验时间
|
|
|
+ * 录入人员信息,政府质检,企业质检,联系电话
|
|
|
+ * --------------------------------
|
|
|
+ * 4 维保工上传检验结果
|
|
|
+ * 5 企业文员确认检验结果-合格 --> 不能算年检超期
|
|
|
+ * 6 企业文员确认检验结果-整改 --> 回到第二阶段
|
|
|
+ * 7 企业文员确认检验结果-不合格 --> 可以算年检超期
|
|
|
+ * --------------------------------
|
|
|
+ * 8 维保工上传年检报告和合格证
|
|
|
+ * 9 企业文员确认年检报告和合格证-合格
|
|
|
+ * 10 企业文员确认年检报告和合格证-不合格 -->停用电梯
|
|
|
* @param entity AnnualInspection
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("modify")
|
|
|
- public RestResponse modify(@Valid @RequestBody AnnualInspection entity){
|
|
|
+ public RestResponse modify(@Valid @RequestBody AnnualInspection entity) {
|
|
|
Long id = entity.getId();
|
|
|
Judge.id(id);
|
|
|
AnnualInspection old = annualInspectionService.getById(id);
|
|
@@ -118,63 +118,63 @@ public class AnnualInspectionController {
|
|
|
Integer stepStatus = entity.getStepStatus();
|
|
|
|
|
|
//0 --> 1 维保工确认年检计划
|
|
|
- Judge.notTrue(Judge.Inspection.statusNotStart(oldStepStatus) && !Judge.Inspection.sameNext(oldStepStatus,stepStatus),Judge.Inspection.confirm);
|
|
|
+ Judge.notTrue(Judge.Inspection.statusNotStart(oldStepStatus) && !Judge.Inspection.sameNext(oldStepStatus, stepStatus), Judge.Inspection.confirm);
|
|
|
//1 --> 2
|
|
|
- Judge.notTrue(Judge.Inspection.statusConfirm(oldStepStatus) && !Judge.Inspection.nextStatus(oldStepStatus,stepStatus),Judge.Inspection.selfcheckUpload);
|
|
|
+ Judge.notTrue(Judge.Inspection.statusConfirm(oldStepStatus) && !Judge.Inspection.nextStatus(oldStepStatus, stepStatus), Judge.Inspection.selfcheckUpload);
|
|
|
/**
|
|
|
* 2 维保工上传自检报告,选择自检时间 或者 文员设置 是否检查限速器和荷载年检设置,
|
|
|
* 文员也可以上传自检报告或者确认自检报告和自检时间,自检时间以最后设置的为准
|
|
|
*/
|
|
|
- if(Judge.Inspection.statusSelfcheck(oldStepStatus)){
|
|
|
+ if (Judge.Inspection.statusSelfcheck(oldStepStatus)) {
|
|
|
// 修改自检信息
|
|
|
- if(Judge.Inspection.sameStatus(oldStepStatus,stepStatus)){
|
|
|
- Judge.notNull(entity.getSelfcheckReportImg(),Judge.Inspection.selfcheckReportImg);
|
|
|
- Judge.notNull(entity.getSelfcheckDate(),Judge.Inspection.selfcheckDate);
|
|
|
+ if (Judge.Inspection.sameStatus(oldStepStatus, stepStatus)) {
|
|
|
+ Judge.notNull(entity.getSelfcheckReportImg(), Judge.Inspection.selfcheckReportImg);
|
|
|
+ Judge.notNull(entity.getSelfcheckDate(), Judge.Inspection.selfcheckDate);
|
|
|
//流转到下一个状态 2 --> 3
|
|
|
- }else if(Judge.Inspection.statusCheckConfirm(stepStatus)){
|
|
|
+ } else if (Judge.Inspection.statusCheckConfirm(stepStatus)) {
|
|
|
//3 企业文员确认现场检验时间,录入人员信息,政府质检,企业质检,联系电话
|
|
|
- Judge.notNull(entity.getCheckDate(),Judge.Inspection.checkDate);
|
|
|
- Judge.notNull(entity.getCheckResultImg(),Judge.Inspection.checkResultImg);
|
|
|
- Judge.notNull(entity.getInspector(),Judge.Inspection.inspector);
|
|
|
- Judge.notNull(entity.getOperator(),Judge.Inspection.operator);
|
|
|
- Judge.notNull(entity.getTelephone(),Judge.Inspection.telephone);
|
|
|
- }else {
|
|
|
+ Judge.notNull(entity.getCheckDate(), Judge.Inspection.checkDate);
|
|
|
+ Judge.notNull(entity.getCheckResultImg(), Judge.Inspection.checkResultImg);
|
|
|
+ Judge.notNull(entity.getInspector(), Judge.Inspection.inspector);
|
|
|
+ Judge.notNull(entity.getOperator(), Judge.Inspection.operator);
|
|
|
+ Judge.notNull(entity.getTelephone(), Judge.Inspection.telephone);
|
|
|
+ } else {
|
|
|
return RestResponse.fail(Judge.Inspection.checkConfirm);
|
|
|
}
|
|
|
}
|
|
|
// 3 --> 4 维保工上传检验结果
|
|
|
- Judge.notTrue(Judge.Inspection.statusCheckConfirm(oldStepStatus) && !Judge.Inspection.nextStatus(oldStepStatus,stepStatus),Judge.Inspection.checkConfirm);
|
|
|
+ Judge.notTrue(Judge.Inspection.statusCheckConfirm(oldStepStatus) && !Judge.Inspection.nextStatus(oldStepStatus, stepStatus), Judge.Inspection.checkConfirm);
|
|
|
//4 检查上传检验结果
|
|
|
- if(Judge.Inspection.statusCheckUpload(oldStepStatus)){
|
|
|
+ if (Judge.Inspection.statusCheckUpload(oldStepStatus)) {
|
|
|
//修改检验结果
|
|
|
- if(Judge.Inspection.sameStatus(oldStepStatus,stepStatus)){
|
|
|
- Judge.notNull(entity.getCheckResultImg(),Judge.Inspection.checkResultImg);
|
|
|
- Judge.notNull(entity.getCheckDate(),Judge.Inspection.checkDate);
|
|
|
+ if (Judge.Inspection.sameStatus(oldStepStatus, stepStatus)) {
|
|
|
+ Judge.notNull(entity.getCheckResultImg(), Judge.Inspection.checkResultImg);
|
|
|
+ Judge.notNull(entity.getCheckDate(), Judge.Inspection.checkDate);
|
|
|
//流转到下一个状态
|
|
|
- }else{
|
|
|
- /**
|
|
|
- * 5 企业文员确认检验结果-合格
|
|
|
- * 6 企业文员确认检验结果-整改
|
|
|
- * 7 企业文员确认检验结果-不合格
|
|
|
- */
|
|
|
- Judge.notTrue(!Judge.Inspection.inStatus(Judge.Inspection.STATUS_CHECK_QUALIFIED,stepStatus,Judge.Inspection.STATUS_CHECK_UNQUALIFIED),Judge.Inspection.checkConfirm);
|
|
|
+ } else {
|
|
|
+ /**
|
|
|
+ * 5 企业文员确认检验结果-合格
|
|
|
+ * 6 企业文员确认检验结果-整改
|
|
|
+ * 7 企业文员确认检验结果-不合格
|
|
|
+ */
|
|
|
+ Judge.notTrue(!Judge.Inspection.inStatus(Judge.Inspection.STATUS_CHECK_QUALIFIED, stepStatus, Judge.Inspection.STATUS_CHECK_UNQUALIFIED), Judge.Inspection.checkConfirm);
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 6 检验结果整改,回到阶段2
|
|
|
* (3 企业文员确认现场检验时间 录入人员信息,政府质检,企业质检,联系电话)
|
|
|
*/
|
|
|
- if(Judge.Inspection.statusCheckRectification(stepStatus)){
|
|
|
+ if (Judge.Inspection.statusCheckRectification(stepStatus)) {
|
|
|
entity.setStepStatus(Judge.Inspection.STATUS_CHECK_CONFIRM);
|
|
|
}
|
|
|
/**
|
|
|
* 5 企业文员确认检验结果-合格 --> 8 维保工上传年检报告和合格证
|
|
|
* 7 企业文员确认检验结果-不合格-->8 维保工上传年检报告和合格证
|
|
|
*/
|
|
|
- if(Judge.Inspection.statusCheckQualified(oldStepStatus) || Judge.Inspection.statusCheckUnqualified(oldStepStatus)){
|
|
|
- if(Judge.Inspection.statusCertificateReportUpload(stepStatus)){
|
|
|
- Judge.notTrue(StrUtil.hasEmpty(entity.getCertificateImgUrl(),entity.getAnnualInspectionImg()),Judge.Inspection.certificateReportUpload);
|
|
|
- }else {
|
|
|
+ if (Judge.Inspection.statusCheckQualified(oldStepStatus) || Judge.Inspection.statusCheckUnqualified(oldStepStatus)) {
|
|
|
+ if (Judge.Inspection.statusCertificateReportUpload(stepStatus)) {
|
|
|
+ Judge.notTrue(StrUtil.hasEmpty(entity.getCertificateImgUrl(), entity.getAnnualInspectionImg()), Judge.Inspection.certificateReportUpload);
|
|
|
+ } else {
|
|
|
return RestResponse.fail(Judge.Inspection.statusError);
|
|
|
}
|
|
|
}
|
|
@@ -182,27 +182,27 @@ public class AnnualInspectionController {
|
|
|
* 8 维保工上传年检报告和合格证--> 9 企业文员确认年检报告和合格证 -合格
|
|
|
* 8 维保工上传年检报告和合格证--> 10 企业文员确认年检报告和合格证 -不合格
|
|
|
*/
|
|
|
- if(Judge.Inspection.statusCertificateReportUpload(oldStepStatus)){
|
|
|
+ if (Judge.Inspection.statusCertificateReportUpload(oldStepStatus)) {
|
|
|
//修改年检报告和合格证
|
|
|
- if(Judge.Inspection.sameStatus(oldStepStatus,stepStatus)){
|
|
|
- Judge.notTrue(StrUtil.hasEmpty(entity.getCertificateImgUrl(),entity.getAnnualInspectionImg()),Judge.Inspection.certificateReportUpload);
|
|
|
- }else if(Judge.Inspection.statusCertificateReportQualified(stepStatus)){
|
|
|
+ if (Judge.Inspection.sameStatus(oldStepStatus, stepStatus)) {
|
|
|
+ Judge.notTrue(StrUtil.hasEmpty(entity.getCertificateImgUrl(), entity.getAnnualInspectionImg()), Judge.Inspection.certificateReportUpload);
|
|
|
+ } else if (Judge.Inspection.statusCertificateReportQualified(stepStatus)) {
|
|
|
//合格:文员确认年检报告并设置下次年检时间
|
|
|
- Judge.notNull(entity.getNextInspectionTime(),Judge.Inspection.nextInspectionTime);
|
|
|
+ Judge.notNull(entity.getNextInspectionTime(), Judge.Inspection.nextInspectionTime);
|
|
|
// 设置年检完成 status = 1
|
|
|
entity.setFinishTime(LocalDateTime.now());
|
|
|
entity.setStatus(1);
|
|
|
- }else if(Judge.Inspection.statusCertificateReportUnqualified(stepStatus)){
|
|
|
+ } else if (Judge.Inspection.statusCertificateReportUnqualified(stepStatus)) {
|
|
|
// 设置年检完成 status = 1
|
|
|
entity.setFinishTime(LocalDateTime.now());
|
|
|
entity.setStatus(1);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return RestResponse.fail(Judge.Inspection.statusError);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int stepName = Judge.Inspection.status2StepName(entity.getStepStatus());
|
|
|
- Judge.notTrue(stepName == -1,Judge.Inspection.statusError);
|
|
|
+ Judge.notTrue(stepName == -1, Judge.Inspection.statusError);
|
|
|
entity.setStepName(stepName);
|
|
|
|
|
|
boolean result = annualInspectionService.modify(entity);
|
|
@@ -211,15 +211,16 @@ public class AnnualInspectionController {
|
|
|
|
|
|
@GetMapping("show")
|
|
|
public BufferedImage show(@RequestParam("filename") String filename) throws IOException {
|
|
|
- if(StrUtil.isEmpty(filename)){
|
|
|
+ if (StrUtil.isEmpty(filename)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String fileurl = aliyunOSS.getObjectUrl(systemConfiguration.getBucketName(),filename);
|
|
|
+ String fileurl = aliyunOSS.getObjectUrl(systemConfiguration.getBucketName(), filename);
|
|
|
log.info("fileurl: " + fileurl);
|
|
|
File file = new File("download/" + filename);
|
|
|
- File down = aliyunOSS.getFile(systemConfiguration.getBucketName(),filename,file);
|
|
|
+ File down = aliyunOSS.getFile(systemConfiguration.getBucketName(), filename, file);
|
|
|
return null == down ? null : ImageIO.read(new FileInputStream(file));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 其他角色获取自己关联的项目的年检任务
|
|
|
* @param request InspectionRequest
|
|
@@ -227,7 +228,7 @@ public class AnnualInspectionController {
|
|
|
*/
|
|
|
@PostMapping("pageByUser")
|
|
|
@Judger(fields = {"userId"})
|
|
|
- public RestResponse pageByUser(@RequestBody InspectionRequest request){
|
|
|
+ public RestResponse pageByUser(@RequestBody InspectionRequest request) {
|
|
|
IPage<InspectionResponse> pages = annualInspectionService.pageByUser(request);
|
|
|
return RestResponse.success(pages);
|
|
|
}
|
|
@@ -239,7 +240,7 @@ public class AnnualInspectionController {
|
|
|
*/
|
|
|
@PostMapping("confirm")
|
|
|
@Judger(fields = {"id"})
|
|
|
- public RestResponse confirm(@RequestBody InspectionRequest request){
|
|
|
+ public RestResponse confirm(@RequestBody InspectionRequest request) {
|
|
|
AnnualInspection entity = annualInspectionService.getById(request.getId());
|
|
|
Judge.notNull(entity);
|
|
|
entity.setStepStatus(Judge.Inspection.STATUS_CONFIRM);
|
|
@@ -254,8 +255,8 @@ public class AnnualInspectionController {
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("selfcheck")
|
|
|
- @Judger(fields = {"id","selfcheckDate","selfcheckReportImg"})
|
|
|
- public RestResponse selfcheck(@RequestBody InspectionRequest request){
|
|
|
+ @Judger(fields = {"id", "selfcheckDate", "selfcheckReportImg"})
|
|
|
+ public RestResponse selfcheck(@RequestBody InspectionRequest request) {
|
|
|
AnnualInspection entity = annualInspectionService.getById(request.getId());
|
|
|
Judge.notNull(entity);
|
|
|
|
|
@@ -274,8 +275,8 @@ public class AnnualInspectionController {
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("check")
|
|
|
- @Judger(fields = {"id","checkDate","checkResultImg"})
|
|
|
- public RestResponse check(@RequestBody InspectionRequest request){
|
|
|
+ @Judger(fields = {"id", "checkDate", "checkResultImg"})
|
|
|
+ public RestResponse check(@RequestBody InspectionRequest request) {
|
|
|
AnnualInspection entity = annualInspectionService.getById(request.getId());
|
|
|
Judge.notNull(entity);
|
|
|
|
|
@@ -294,8 +295,8 @@ public class AnnualInspectionController {
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("finish")
|
|
|
- @Judger(fields = {"id","certificateImgUrl","annualInspectionImg"})
|
|
|
- public RestResponse finish(@RequestBody InspectionRequest request){
|
|
|
+ @Judger(fields = {"id", "certificateImgUrl", "annualInspectionImg"})
|
|
|
+ public RestResponse finish(@RequestBody InspectionRequest request) {
|
|
|
AnnualInspection entity = annualInspectionService.getById(request.getId());
|
|
|
Judge.notNull(entity);
|
|
|
|