commit
b06edbb9d2
17 changed files with 944 additions and 10 deletions
@ -0,0 +1,257 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.gnu.org/licenses/lgpl.html
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.energy.modules.inspection.controller; |
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.dayu.daf.core.log.annotation.ApiLog; |
||||||
|
import com.dayu.daf.core.tool.constant.DafConstant; |
||||||
|
import com.xkcoding.http.util.StringUtil; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import io.swagger.annotations.ApiParam; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import javax.validation.Valid; |
||||||
|
|
||||||
|
import com.dayu.daf.core.mp.support.Condition; |
||||||
|
import com.dayu.daf.core.mp.support.Query; |
||||||
|
import com.dayu.daf.core.tool.api.R; |
||||||
|
import com.dayu.daf.core.tool.utils.Func; |
||||||
|
import lombok.SneakyThrows; |
||||||
|
import org.apache.commons.codec.Charsets; |
||||||
|
import org.energy.modules.inspection.excel.InspectionPlanExcel; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.energy.modules.inspection.entity.InspectionPlan; |
||||||
|
import org.energy.modules.inspection.vo.InspectionPlanVO; |
||||||
|
import org.energy.modules.inspection.service.IInspectionPlanService; |
||||||
|
import com.dayu.daf.core.boot.ctrl.DafController; |
||||||
|
import springfox.documentation.annotations.ApiIgnore; |
||||||
|
|
||||||
|
import java.net.URLEncoder; |
||||||
|
import java.time.LocalDate; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 巡检计划 控制器 |
||||||
|
* |
||||||
|
* @author Daf |
||||||
|
* @since 2024-07-12 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/inspection/inspectionplan") |
||||||
|
@Api(value = "巡检计划", tags = "巡检计划接口") |
||||||
|
public class InspectionPlanController extends DafController { |
||||||
|
|
||||||
|
private IInspectionPlanService inspectionPlanService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 详情 |
||||||
|
*/ |
||||||
|
@GetMapping("/detail") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "详情", notes = "传入inspectionPlan") |
||||||
|
public R<InspectionPlan> detail(InspectionPlan inspectionPlan) { |
||||||
|
InspectionPlan detail = inspectionPlanService.getOne(Condition.getQueryWrapper(inspectionPlan)); |
||||||
|
return R.data(detail); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页 巡检计划 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
@ApiOperation(value = "分页", notes = "传入inspectionPlan") |
||||||
|
public R<IPage<InspectionPlan>> list(InspectionPlan inspectionPlan, Query query) { |
||||||
|
QueryWrapper<InspectionPlan> qw = new QueryWrapper<>(); |
||||||
|
qw.orderByAsc("plan_no"); |
||||||
|
if (StringUtil.isNotEmpty(inspectionPlan.getPlanNo())) { |
||||||
|
qw.lambda().like(InspectionPlan::getPlanNo, inspectionPlan.getPlanNo()); |
||||||
|
} |
||||||
|
if (StringUtil.isNotEmpty(inspectionPlan.getPlanName())) { |
||||||
|
qw.lambda().like(InspectionPlan::getPlanName, inspectionPlan.getPlanName()); |
||||||
|
} |
||||||
|
if (null != inspectionPlan.getStation()) { |
||||||
|
qw.lambda().eq(InspectionPlan::getStation, inspectionPlan.getStation()); |
||||||
|
} |
||||||
|
if (StringUtil.isNotEmpty(inspectionPlan.getPeriodType())) { |
||||||
|
qw.lambda().like(InspectionPlan::getPeriodType, inspectionPlan.getPeriodType()); |
||||||
|
} |
||||||
|
if (null != inspectionPlan.getPlanStatus()) { |
||||||
|
qw.lambda().eq(InspectionPlan::getPlanStatus, inspectionPlan.getPlanStatus()); |
||||||
|
} |
||||||
|
IPage<InspectionPlan> pages = inspectionPlanService.page(Condition.getPage(query), qw); |
||||||
|
return R.data(pages); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义分页 巡检计划 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
@ApiOperation(value = "分页", notes = "传入inspectionPlan") |
||||||
|
public R<IPage<InspectionPlanVO>> page(InspectionPlanVO inspectionPlan, Query query) { |
||||||
|
IPage<InspectionPlanVO> pages = inspectionPlanService.selectInspectionPlanPage(Condition.getPage(query), inspectionPlan); |
||||||
|
return R.data(pages); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增 巡检计划 |
||||||
|
*/ |
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
@ApiOperation(value = "新增", notes = "传入inspectionPlan") |
||||||
|
public R save(@Valid @RequestBody InspectionPlan inspectionPlan) { |
||||||
|
return R.status(inspectionPlanService.save(inspectionPlan)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改 巡检计划 |
||||||
|
*/ |
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperationSupport(order = 5) |
||||||
|
@ApiOperation(value = "修改", notes = "传入inspectionPlan") |
||||||
|
public R update(@Valid @RequestBody InspectionPlan inspectionPlan) { |
||||||
|
return R.status(inspectionPlanService.updateById(inspectionPlan)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增或修改 巡检计划 |
||||||
|
*/ |
||||||
|
@PostMapping("/submit") |
||||||
|
@ApiOperationSupport(order = 6) |
||||||
|
@ApiOperation(value = "新增或修改", notes = "传入inspectionPlan") |
||||||
|
public R submit(@Valid @RequestBody InspectionPlan inspectionPlan) { |
||||||
|
inspectionPlan.setPlanStatus(1); |
||||||
|
String date = LocalDate.now().toString().replace("-",""); |
||||||
|
String maxNo = inspectionPlanService.getMaxNo("'%" + date + "%'"); |
||||||
|
int number; |
||||||
|
if (StringUtil.isNotEmpty(maxNo)){ |
||||||
|
number = Integer.parseInt(maxNo.substring(9)); |
||||||
|
number++; |
||||||
|
}else{ |
||||||
|
number = 1; |
||||||
|
} |
||||||
|
String numFormat = String.format("%04d", number); |
||||||
|
String no = "J" + date + numFormat; |
||||||
|
inspectionPlan.setPlanNo(no); |
||||||
|
return R.status(inspectionPlanService.saveOrUpdate(inspectionPlan)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 巡检计划 |
||||||
|
*/ |
||||||
|
@PostMapping("/remove") |
||||||
|
@ApiOperationSupport(order = 7) |
||||||
|
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
||||||
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
||||||
|
return R.status(inspectionPlanService.deleteLogic(Func.toLongList(ids))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 生效 |
||||||
|
*/ |
||||||
|
@PostMapping("/takeEffect") |
||||||
|
@ApiOperationSupport(order = 8) |
||||||
|
@ApiOperation(value = "生效", notes = "传入ids") |
||||||
|
public R takeEffect(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
||||||
|
return this.updateInspectionPlan(1, "", ids); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 失效 |
||||||
|
*/ |
||||||
|
@PostMapping("/lapse") |
||||||
|
@ApiOperationSupport(order = 9) |
||||||
|
@ApiOperation(value = "失效", notes = "传入ids") |
||||||
|
public R lapse(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @ApiParam(value = "取消原因", required = true) @RequestParam String reason) { |
||||||
|
return this.updateInspectionPlan(0, reason, ids); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 生效OR失效 |
||||||
|
*/ |
||||||
|
public R updateInspectionPlan(Integer status, String reason, String ids) { |
||||||
|
List<InspectionPlan> list = new ArrayList<>(); |
||||||
|
for (String id : ids.split(",")) { |
||||||
|
InspectionPlan inspectionPlan = new InspectionPlan(); |
||||||
|
inspectionPlan.setId(Long.parseLong(id)); |
||||||
|
inspectionPlan.setCancelReason(reason); |
||||||
|
inspectionPlan.setPlanStatus(status); |
||||||
|
list.add(inspectionPlan); |
||||||
|
} |
||||||
|
return R.status(inspectionPlanService.updateBatchById(list)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 导出 |
||||||
|
*/ |
||||||
|
@SneakyThrows |
||||||
|
@GetMapping("export") |
||||||
|
@ApiOperationSupport(order = 10) |
||||||
|
@ApiOperation(value = "导出", notes = "传入") |
||||||
|
@ApiLog |
||||||
|
public void exportInspectionRoute(@ApiIgnore @RequestParam Map<String, Object> entity, HttpServletResponse response) { |
||||||
|
if (entity.containsKey("station_equal")) { |
||||||
|
entity.put("station_equal", Integer.parseInt((String) entity.get("station_equal"))); |
||||||
|
} |
||||||
|
if (entity.containsKey("planStatus_equal")) { |
||||||
|
entity.put("planStatus_equal", Integer.parseInt((String) entity.get("planStatus_equal"))); |
||||||
|
} |
||||||
|
QueryWrapper<InspectionPlan> queryWrapper = Condition.getQueryWrapper(entity, InspectionPlan.class); |
||||||
|
queryWrapper.lambda().eq(InspectionPlan::getIsDeleted, DafConstant.DB_NOT_DELETED); |
||||||
|
queryWrapper.orderByAsc("plan_no"); |
||||||
|
|
||||||
|
List<InspectionPlanExcel> list = inspectionPlanService.export(queryWrapper); |
||||||
|
response.setContentType("application/vnd.ms-excel"); |
||||||
|
response.setCharacterEncoding(Charsets.UTF_8.name()); |
||||||
|
String fileName = URLEncoder.encode("巡检计划数据导出", Charsets.UTF_8.name()); |
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
||||||
|
EasyExcel.write(response.getOutputStream(), InspectionPlanExcel.class).sheet("巡检计划").doWrite(list); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取路线编号 |
||||||
|
*/ |
||||||
|
@GetMapping("/getPlanList") |
||||||
|
@ApiOperationSupport(order = 11) |
||||||
|
@ApiOperation(value = "获取路线编号", notes = "获取路线编号") |
||||||
|
public R<List<InspectionPlan>> getPlanList() { |
||||||
|
List<InspectionPlan> routeList = inspectionPlanService.getPlanList(); |
||||||
|
return R.data(routeList); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取路线编号 |
||||||
|
*/ |
||||||
|
@GetMapping("/getDetail") |
||||||
|
@ApiOperationSupport(order = 12) |
||||||
|
@ApiOperation(value = "获取路线信息", notes = "获取路线信息") |
||||||
|
public R<InspectionPlan> getDetail(String planNo) { |
||||||
|
InspectionPlan detail = inspectionPlanService.getDetail("'" + planNo + "'"); |
||||||
|
return R.data(detail); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package org.energy.modules.inspection.dto; |
||||||
|
|
||||||
|
import org.energy.modules.inspection.entity.InspectionPlan; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
/** |
||||||
|
* 巡检计划数据传输对象实体类 |
||||||
|
* |
||||||
|
* @author Daf |
||||||
|
* @since 2024-07-12 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class InspectionPlanDTO extends InspectionPlan { |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,86 @@ |
|||||||
|
package org.energy.modules.inspection.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.dayu.daf.core.mp.base.BaseEntity; |
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
|
||||||
|
/** |
||||||
|
* 巡检计划实体类 |
||||||
|
* |
||||||
|
* @author Daf |
||||||
|
* @since 2024-07-12 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@TableName("i_inspection_plan") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@ApiModel(value = "InspectionPlan对象", description = "巡检计划") |
||||||
|
public class InspectionPlan extends BaseEntity { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 主键 |
||||||
|
*/ |
||||||
|
@JsonSerialize(using = ToStringSerializer.class) |
||||||
|
@ApiModelProperty(value = "主键") |
||||||
|
private Long id; |
||||||
|
/** |
||||||
|
* 计划编号 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "计划编号") |
||||||
|
private String planNo; |
||||||
|
/** |
||||||
|
* 计划名称 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "计划名称") |
||||||
|
private String planName; |
||||||
|
/** |
||||||
|
* 场站 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "场站") |
||||||
|
private Integer station; |
||||||
|
/** |
||||||
|
* 计划类型 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "计划类型") |
||||||
|
private String planType; |
||||||
|
/** |
||||||
|
* 周期类型 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "周期类型") |
||||||
|
private String periodType; |
||||||
|
/** |
||||||
|
* 周期值 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "周期值") |
||||||
|
private String periodValue; |
||||||
|
/** |
||||||
|
* 计划起始时间 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "计划起始时间") |
||||||
|
private String startTime; |
||||||
|
/** |
||||||
|
* 计划终了时间 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "计划终了时间") |
||||||
|
private String endTime; |
||||||
|
/** |
||||||
|
* 计划状态 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "计划状态") |
||||||
|
private Integer planStatus; |
||||||
|
/** |
||||||
|
* 取消原因 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "取消原因") |
||||||
|
private String cancelReason; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
package org.energy.modules.inspection.excel; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ColumnWidth(25) |
||||||
|
@HeadRowHeight(20) |
||||||
|
@ContentRowHeight(16) |
||||||
|
public class InspectionObjectExcel implements Serializable { |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty(value = "对象编号") |
||||||
|
private String objectNo; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "对象名称") |
||||||
|
private String objectNameExt; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "场站") |
||||||
|
private String stationsName; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "对象类型") |
||||||
|
private String objectType; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "对象区域") |
||||||
|
private String objectArea; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "对象状态") |
||||||
|
private String istatusName; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "KKS编号") |
||||||
|
private String kksNo; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "取消原因") |
||||||
|
private String cancelReason; |
||||||
|
} |
@ -0,0 +1,77 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.energy.modules.inspection.excel; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* EquipmentLedge model export |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ColumnWidth(25) |
||||||
|
@HeadRowHeight(20) |
||||||
|
@ContentRowHeight(16) |
||||||
|
public class InspectionPlanExcel implements Serializable { |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty(value = "计划编号") |
||||||
|
private String planNo; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "计划名称") |
||||||
|
private String planNme; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "场站") |
||||||
|
private String stationName; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "计划类型") |
||||||
|
private String planType; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "周期类型") |
||||||
|
private String periodType; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "周期值") |
||||||
|
private String periodValue; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "计划起始时间") |
||||||
|
private String startTime; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "计划终了时间") |
||||||
|
private String endTime; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "状态") |
||||||
|
private String planStatusName; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty(value = "取消原因") |
||||||
|
private String cancelReason; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,47 @@ |
|||||||
|
package org.energy.modules.inspection.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.energy.modules.inspection.entity.InspectionPlan; |
||||||
|
import org.energy.modules.inspection.entity.InspectionRoute; |
||||||
|
import org.energy.modules.inspection.excel.InspectionPlanExcel; |
||||||
|
import org.energy.modules.inspection.vo.InspectionPlanVO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 巡检计划 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Daf |
||||||
|
* @since 2024-07-12 |
||||||
|
*/ |
||||||
|
public interface InspectionPlanMapper extends BaseMapper<InspectionPlan> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义分页 |
||||||
|
* |
||||||
|
* @param page |
||||||
|
* @param inspectionPlan |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<InspectionPlanVO> selectInspectionPlanPage(IPage page, InspectionPlanVO inspectionPlan); |
||||||
|
|
||||||
|
List<InspectionPlanExcel> exportData(@Param("ew") Wrapper<InspectionPlan> queryWrapper); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取路线编号 |
||||||
|
*/ |
||||||
|
List<InspectionPlan> getPlanList(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取最大编号 |
||||||
|
*/ |
||||||
|
String getMaxNo(String date); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取路线的信息 |
||||||
|
*/ |
||||||
|
InspectionPlan getDetail(String planNo); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,61 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="org.energy.modules.inspection.mapper.InspectionPlanMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="inspectionPlanResultMap" type="org.energy.modules.inspection.entity.InspectionPlan"> |
||||||
|
<id column="id" property="id"/> |
||||||
|
<result column="status" property="status"/> |
||||||
|
<result column="create_time" property="createTime"/> |
||||||
|
<result column="create_user" property="createUser"/> |
||||||
|
<result column="update_time" property="updateTime"/> |
||||||
|
<result column="update_user" property="updateUser"/> |
||||||
|
<result column="is_deleted" property="isDeleted"/> |
||||||
|
<result column="plan_no" property="planNo"/> |
||||||
|
<result column="plan_name" property="planName"/> |
||||||
|
<result column="station" property="station"/> |
||||||
|
<result column="plan_type" property="planType"/> |
||||||
|
<result column="period_type" property="periodType"/> |
||||||
|
<result column="period_value" property="periodValue"/> |
||||||
|
<result column="start_time" property="startTime"/> |
||||||
|
<result column="end_time" property="endTime"/> |
||||||
|
<result column="plan_status" property="planStatus"/> |
||||||
|
<result column="cancel_reason" property="cancelReason"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
|
||||||
|
<select id="selectInspectionPlanPage" resultMap="inspectionPlanResultMap"> |
||||||
|
select * from i_inspection_plan where is_deleted = 0 |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="exportData" resultType="org.energy.modules.inspection.excel.InspectionPlanExcel"> |
||||||
|
SELECT plan_no, plan_name, plan_type, period_type, period_value, start_time, end_time, cancel_reason |
||||||
|
,CASE |
||||||
|
WHEN station = '1' THEN '景和光伏' |
||||||
|
WHEN station = '2' THEN '北沙一光伏' |
||||||
|
WHEN station = '3' THEN '北沙二光伏' |
||||||
|
WHEN station = '4' THEN '达坂城风电一场' |
||||||
|
ELSE '' |
||||||
|
END AS station_name |
||||||
|
,CASE |
||||||
|
WHEN plan_status = '1' THEN '已生效' |
||||||
|
WHEN plan_status = '0' THEN '未生效' |
||||||
|
ELSE '' |
||||||
|
END AS plan_status_name |
||||||
|
FROM i_inspection_plan ${ew.customSqlSegment} |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="getPlanList" resultMap="inspectionPlanResultMap"> |
||||||
|
select plan_no, plan_name, plan_type from i_inspection_plan where is_deleted = 0 and plan_status = '1' |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="getMaxNo" resultType="java.lang.String"> |
||||||
|
SELECT max(plan_no) |
||||||
|
FROM i_inspection_plan where plan_no like ${date} |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="getDetail" resultMap="inspectionPlanResultMap"> |
||||||
|
select plan_name, plan_type from i_inspection_plan where plan_no = ${plan_no} |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,55 @@ |
|||||||
|
package org.energy.modules.inspection.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import org.energy.modules.inspection.entity.InspectionPlan; |
||||||
|
import org.energy.modules.inspection.entity.InspectionRoute; |
||||||
|
import org.energy.modules.inspection.excel.InspectionPlanExcel; |
||||||
|
import org.energy.modules.inspection.vo.InspectionPlanVO; |
||||||
|
import com.dayu.daf.core.mp.base.BaseService; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 巡检计划 服务类 |
||||||
|
* |
||||||
|
* @author Daf |
||||||
|
* @since 2024-07-12 |
||||||
|
*/ |
||||||
|
public interface IInspectionPlanService extends BaseService<InspectionPlan> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义分页 |
||||||
|
* |
||||||
|
* @param page |
||||||
|
* @param inspectionPlan |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
IPage<InspectionPlanVO> selectInspectionPlanPage(IPage<InspectionPlanVO> page, InspectionPlanVO inspectionPlan); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取导出数据 |
||||||
|
* |
||||||
|
* @param queryWrapper |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<InspectionPlanExcel> export(Wrapper<InspectionPlan> queryWrapper); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取路线编号 |
||||||
|
*/ |
||||||
|
List<InspectionPlan> getPlanList(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取最大任务编号 |
||||||
|
* |
||||||
|
* @param date |
||||||
|
*/ |
||||||
|
String getMaxNo(String date); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取路线的信息 |
||||||
|
*/ |
||||||
|
InspectionPlan getDetail(String planNo); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package org.energy.modules.inspection.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import org.energy.modules.inspection.entity.InspectionPlan; |
||||||
|
import org.energy.modules.inspection.entity.InspectionRoute; |
||||||
|
import org.energy.modules.inspection.excel.InspectionPlanExcel; |
||||||
|
import org.energy.modules.inspection.vo.InspectionPlanVO; |
||||||
|
import org.energy.modules.inspection.mapper.InspectionPlanMapper; |
||||||
|
import org.energy.modules.inspection.service.IInspectionPlanService; |
||||||
|
import com.dayu.daf.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 巡检计划 服务实现类 |
||||||
|
* |
||||||
|
* @author Daf |
||||||
|
* @since 2024-07-12 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class InspectionPlanServiceImpl extends BaseServiceImpl<InspectionPlanMapper, InspectionPlan> implements IInspectionPlanService { |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<InspectionPlanVO> selectInspectionPlanPage(IPage<InspectionPlanVO> page, InspectionPlanVO inspectionPlan) { |
||||||
|
return page.setRecords(baseMapper.selectInspectionPlanPage(page, inspectionPlan)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<InspectionPlanExcel> export(Wrapper<InspectionPlan> queryWrapper) { |
||||||
|
List<InspectionPlanExcel> list = baseMapper.exportData(queryWrapper); |
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<InspectionPlan> getPlanList() { |
||||||
|
List<InspectionPlan> list = baseMapper.getPlanList(); |
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getMaxNo(String date){ |
||||||
|
String maxNo = baseMapper.getMaxNo(date); |
||||||
|
return maxNo; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public InspectionPlan getDetail(String planNo) { |
||||||
|
InspectionPlan detail = baseMapper.getDetail(planNo); |
||||||
|
return detail; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package org.energy.modules.inspection.vo; |
||||||
|
|
||||||
|
import org.energy.modules.inspection.entity.InspectionPlan; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
|
||||||
|
/** |
||||||
|
* 巡检计划视图实体类 |
||||||
|
* |
||||||
|
* @author Daf |
||||||
|
* @since 2024-07-12 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@ApiModel(value = "InspectionPlanVO对象", description = "巡检计划") |
||||||
|
public class InspectionPlanVO extends InspectionPlan { |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue