941497f7 康伟

kangwei: 移动端---巡检接口

1 个父辈 3a1d6e9b
正在显示 16 个修改的文件 包含 226 行增加18 行删除
......@@ -250,6 +250,13 @@ public class DateUtil {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
}
/***
* 获取当前时间
* @return
*/
public static String getCurrentDate(){
return formatDate(new Date(),null);
}
/***
* 字符串日期格式化
......
......@@ -74,7 +74,7 @@ public class DangerInspectInfoController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<DangerInspectInfo>> result = new Result<IPage<DangerInspectInfo>>();
QueryWrapper<DangerInspectInfo> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectInfo, req.getParameterMap());
QueryWrapper<DangerInspectInfo> queryWrapper = new QueryWrapper<>();//QueryGenerator.initQueryWrapper(dangerInspectInfo, req.getParameterMap());
Page<DangerInspectInfo> page = new Page<DangerInspectInfo>(pageNo, pageSize);
queryWrapper.eq("danger_id",dangerInspectInfo.getDangerId());
queryWrapper.orderByDesc("create_time");
......
......@@ -73,7 +73,7 @@ public class DangerInspectItemController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<DangerInspectItem>> result = new Result<IPage<DangerInspectItem>>();
QueryWrapper<DangerInspectItem> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectItem, req.getParameterMap());
QueryWrapper<DangerInspectItem> queryWrapper = new QueryWrapper<>();//QueryGenerator.initQueryWrapper(dangerInspectItem, req.getParameterMap());
Page<DangerInspectItem> page = new Page<DangerInspectItem>(pageNo, pageSize);
IPage<DangerInspectItem> pageList = dangerInspectItemService.page(page, queryWrapper);
queryWrapper.eq("inspect_obj_id", dangerInspectItem.getInspectObjId());
......
......@@ -73,7 +73,7 @@ public class DangerInspectionInfoController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<DangerInspectionInfo>> result = new Result<IPage<DangerInspectionInfo>>();
QueryWrapper<DangerInspectionInfo> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionInfo, req.getParameterMap());
QueryWrapper<DangerInspectionInfo> queryWrapper = new QueryWrapper<>();//QueryGenerator.initQueryWrapper(dangerInspectionInfo, req.getParameterMap());
Page<DangerInspectionInfo> page = new Page<DangerInspectionInfo>(pageNo, pageSize);
IPage<DangerInspectionInfo> pageList = dangerInspectionInfoService.page(page, queryWrapper);
result.setSuccess(true);
......
......@@ -73,7 +73,7 @@ public class DangerInspectionItemController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<DangerInspectionItem>> result = new Result<IPage<DangerInspectionItem>>();
QueryWrapper<DangerInspectionItem> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionItem, req.getParameterMap());
QueryWrapper<DangerInspectionItem> queryWrapper =new QueryWrapper<>();// QueryGenerator.initQueryWrapper(dangerInspectionItem, req.getParameterMap());
Page<DangerInspectionItem> page = new Page<DangerInspectionItem>(pageNo, pageSize);
queryWrapper.eq("inspect_obj_id",dangerInspectionItem.getInspectObjId());
queryWrapper.orderByDesc("create_time");
......
......@@ -73,8 +73,9 @@ public class DangerInspectionRecordController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<DangerInspectionRecord>> result = new Result<IPage<DangerInspectionRecord>>();
QueryWrapper<DangerInspectionRecord> queryWrapper = QueryGenerator.initQueryWrapper(dangerInspectionRecord, req.getParameterMap());
QueryWrapper<DangerInspectionRecord> queryWrapper = new QueryWrapper<>();//QueryGenerator.initQueryWrapper(dangerInspectionRecord, req.getParameterMap());
Page<DangerInspectionRecord> page = new Page<DangerInspectionRecord>(pageNo, pageSize);
queryWrapper.eq("danger_id", dangerInspectionRecord.getDangerId());
IPage<DangerInspectionRecord> pageList = dangerInspectionRecordService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
......
......@@ -4,6 +4,7 @@ import java.util.List;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.guest.util.DateUtil;
import com.skua.modules.safe.entity.*;
import com.skua.modules.safe.mapper.DangerInspectionItemMapper;
import com.skua.modules.safe.service.*;
......@@ -39,7 +40,6 @@ public class APPDangerInspectionController {
@Autowired
private IDangerInspectionItemService inspectionItemService ;//巡检对象,检查项
/**
* <pre>
* 扫描二维码进入:风险点详情
......@@ -60,6 +60,8 @@ public class APPDangerInspectionController {
if(inspection != null ){
dangerInspection.setLastInspectionTime( inspection.getReportDate() );
}else{
dangerInspection = new DangerLevelManage();
dangerInspection.setLastInspectionTime("");
}
if(dangerInspection==null) {
......@@ -127,8 +129,8 @@ public class APPDangerInspectionController {
return result;
}
@AutoLog(value = "巡查内容对象-保存")
@ApiOperation(value="巡查内容对象-保存", notes="巡查内容对象-保存")
@AutoLog(value = "风险巡检-提交巡检记录")
@ApiOperation(value="风险巡检-保存巡检记录", notes="风险巡检-保存巡检记录")
@PostMapping(value = "/saveInspectionInf")
public Result<DangerInspectInfo> updateDangerInspectionInfo(@RequestBody DangerInspectionInfo dangerInspectionInfo) {
Result<DangerInspectInfo> result = new Result<DangerInspectInfo>();
......@@ -141,14 +143,25 @@ public class APPDangerInspectionController {
}
return result;
}
@AutoLog(value = "结束巡检")
@ApiOperation(value="结束巡检", notes="结束巡检")
@AutoLog(value = "风险巡检-结束巡检")
@ApiOperation(value="风险巡检-结束巡检", notes="风险巡检-结束巡检")
@PostMapping(value = "/endInspection")
public Result<DangerInspectInfo> endInspection(@RequestParam(name="id",required=true) String id) {
Result<DangerInspectInfo> result = new Result<DangerInspectInfo>();
public Result<DangerInspectionRecord> endInspection(@RequestParam(name="id",required=true) String id) {
Result<DangerInspectionRecord> result = new Result<DangerInspectionRecord>();
try {
DangerInspectionRecord inspectionRecord = inspectionRecordService.getById(id);
if(inspectionRecord==null) {
result.error500("未找到对应实体");
}else {
inspectionRecord.setEndDate(DateUtil.getCurrentDate() ) ;
inspectionRecord.setStatus("2");//结束状态
inspectionRecordService.updateById(inspectionRecord);
result.setResult(inspectionRecord);
result.setSuccess(true);
}
//inspectionRecordService.(id);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
......@@ -157,5 +170,8 @@ public class APPDangerInspectionController {
return result;
}
/*************************************************************************************************/
//作废
}
......
package com.skua.modules.safe.controller.app;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.query.QueryGenerator;
import com.skua.modules.safe.entity.DangerInspectionRecord;
import com.skua.modules.safe.entity.DangerLevelManage;
import com.skua.modules.safe.service.IDangerInspectionItemService;
import com.skua.modules.safe.service.IDangerInspectionRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Slf4j
@Api(tags="隐患排查记录")
@RestController("appDangerInspectionRecordController")
@RequestMapping("/app/safe/dangerInspectionRecord")
public class APPDangerInspectionRecordController {
@Autowired
private IDangerInspectionRecordService dangerInspectionRecordService;
@Autowired
private IDangerInspectionRecordService inspectionRecordService ;//巡检对象
/**
* <pre>
* 分页列表查询
* </pre>
* @param dangerInspectionRecord
* @param pageNo
* @param pageSize
* @param req
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "隐患排查记录-分页列表查询")
@ApiOperation(value="隐患排查记录-分页列表查询", notes="隐患排查记录-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<DangerInspectionRecord>> queryPageList(DangerInspectionRecord dangerInspectionRecord,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<DangerInspectionRecord>> result = new Result<IPage<DangerInspectionRecord>>();
QueryWrapper<DangerInspectionRecord> queryWrapper = new QueryWrapper<DangerInspectionRecord>();// QueryGenerator.initQueryWrapper(dangerInspectionRecord, req.getParameterMap());
Page<DangerInspectionRecord> page = new Page<DangerInspectionRecord>(pageNo, pageSize);
queryWrapper.eq("danger_id", dangerInspectionRecord.getDangerId());
if(StringUtils.isNotBlank(dangerInspectionRecord.getStartTime())){
queryWrapper.ge("report_date", dangerInspectionRecord.getStartTime() ) ;
}
if(StringUtils.isNotBlank(dangerInspectionRecord.getEndTime())){
queryWrapper.le("report_date", dangerInspectionRecord.getEndTime() ) ;
}
// queryWrapper.eq("report_user", BaseContextHandler.getUserId());
IPage<DangerInspectionRecord> pageList = dangerInspectionRecordService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* <pre>
* 扫描二维码进入:风险点详情
* </pre>
* @param dangerInspectionRecord
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "扫描二维码进入:风险点详情")
@ApiOperation(value="扫描二维码进入:风险点详情", notes="扫描二维码进入:风险点详情")
@GetMapping(value = "/detail")
public Result<DangerLevelManage> queryById(DangerInspectionRecord dangerInspectionRecord) {
Result<DangerLevelManage> result = new Result<DangerLevelManage>();
DangerLevelManage dangerLevelManage = inspectionRecordService.queryListByDangerId(dangerInspectionRecord.getDangerId(),dangerInspectionRecord.getStartTime(),dangerInspectionRecord.getEndDate());
if(dangerLevelManage == null) {
result.error500("未找到对应实体");
}else {
result.setResult(dangerLevelManage);
result.setSuccess(true);
}
return result;
}
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="danger_inspect_item对象", description="风险检查项")
public class DangerInspectItem {
public class DangerInspectItem implements Serializable{
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
......
......@@ -25,7 +25,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="danger_inspection_info对象", description="巡检对象")
public class DangerInspectionInfo {
public class DangerInspectionInfo implements Serializable{
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
......
......@@ -23,7 +23,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="danger_inspection_item对象", description="风险检查项记录")
public class DangerInspectionItem {
public class DangerInspectionItem implements Serializable{
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
......@@ -46,6 +46,12 @@ public class DangerInspectionItem {
@Excel(name = "选项类型(0:选择,1 是否 2 文本)", width = 15)
@ApiModelProperty(value = "选项类型(0:选择,1 是否 2 文本)")
private String itemType;
/**选项状态(0:异常,1正常)*/
@Excel(name = "检查值", width = 15)
@ApiModelProperty(value = "检查值")
private String itemValue;
/**选项状态(0:异常,1正常)*/
@Excel(name = "选项状态(0:异常,1正常)", width = 15)
@ApiModelProperty(value = "选项状态(0:异常,1正常)")
......
......@@ -25,7 +25,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="danger_inspection_record对象", description="巡检记录")
public class DangerInspectionRecord {
public class DangerInspectionRecord implements Serializable{
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
......@@ -47,6 +47,14 @@ public class DangerInspectionRecord {
@Excel(name = "上报时间", width = 15)
@ApiModelProperty(value = "上报时间")
private String reportDate;
/**上报时间*/
@Excel(name = "结束时间", width = 15)
@ApiModelProperty(value = "结束时间")
private String endDate;
/**巡检状态(0:未开始,1:开始,2:结束,3:作废)*/
@Excel(name = "巡检状态(0:未开始,1:开始,2:结束,3:作废)", width = 15)
@ApiModelProperty(value = "巡检状态(0:未开始,1:开始,2:结束,3:作废)")
......@@ -83,4 +91,13 @@ public class DangerInspectionRecord {
@TableField(exist=false)
@ApiModelProperty(value = "巡检对象集合")
private List<DangerInspectionInfo> inspectionInfoList ;
@TableField(exist=false)
@ApiModelProperty(value = "条件:开始时间")
private String startTime;
@TableField(exist=false)
@ApiModelProperty(value = "条件:结束时间")
private String endTime;
}
......
......@@ -2,6 +2,8 @@ package com.skua.modules.safe.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -25,7 +27,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="danger_level_manage对象", description="风险分级管控清单")
public class DangerLevelManage {
public class DangerLevelManage implements Serializable{
/**id*/
@TableId(type = IdType.UUID)
......@@ -133,4 +135,8 @@ public class DangerLevelManage {
@ApiModelProperty(value = "上次巡检时间")
private String lastInspectionTime;
@TableField(exist=false)
@ApiModelProperty(value = "巡检内容对象集合")
private List<DangerInspectionInfo> inspectionInfoList;
}
......
......@@ -3,6 +3,7 @@ package com.skua.modules.safe.service;
import com.skua.modules.safe.entity.DangerInspectionInfo;
import com.skua.modules.safe.entity.DangerInspectionRecord;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.safe.entity.DangerLevelManage;
import java.util.List;
......@@ -26,4 +27,13 @@ public interface IDangerInspectionRecordService extends IService<DangerInspectio
* @return
*/
public DangerInspectionRecord startInspection(String dangerId, String status , String userId);
/***
* 查询巡查集合
* @param dangerId
* @param startTime
* @param endDate
* @return
*/
public DangerLevelManage queryListByDangerId(String dangerId, String startTime, String endDate);
}
......
......@@ -87,6 +87,7 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM
if(dangerInspectInfo.getItemList() != null ){
for(DangerInspectItem dangerInspectItem : dangerInspectInfo.getItemList()){
dangerInspectItem.setInspectObjId( dangerInspectInfo.getId() ) ;
dangerInspectItem.setDangerId( dangerInspectInfo.getDangerId());
inspectItemMapper.insert(dangerInspectItem) ;
}
}
......@@ -105,6 +106,7 @@ public class DangerInspectInfoServiceImpl extends ServiceImpl<DangerInspectInfoM
if(dangerInspectInfo.getItemList() != null ){
for(DangerInspectItem dangerInspectItem : dangerInspectInfo.getItemList()){
dangerInspectItem.setInspectObjId( dangerInspectInfo.getId() ) ;
dangerInspectItem.setDangerId( dangerInspectInfo.getDangerId());
inspectItemMapper.insert(dangerInspectItem) ;
}
}
......
......@@ -89,6 +89,7 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
inspectionInfo.setInspectMethod( dangerInspectInfo.getInspectMethod());
inspectionInfo.setInspectStandard( dangerInspectInfo.getInspectStandard() );
inspectionInfo.setReportUser( userId) ;
inspectionInfo.setInspectObjId( dangerInspectInfo.getId() );
dangerInspectionInfoMapper.insert(inspectionInfo);
//搜索检查内容对象,检查项目
......@@ -153,4 +154,46 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
return inspectionInfoList;
}
/***
* 查询巡查集合
* @param dangerId
* @param startTime
* @param endDate
* @return
*/
public DangerLevelManage queryListByDangerId(String dangerId, String startTime, String endDate){
DangerLevelManage dangerLevelManage = dangerLevelManageMapper.selectById(dangerId);
//巡查对象
LambdaQueryWrapper<DangerInspectionInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectionInfo>();
queryWrapper.eq(DangerInspectionInfo::getDangerId, dangerId);
queryWrapper.orderByAsc(DangerInspectionInfo::getCreateTime );
List<DangerInspectionInfo> inspectionInfoList = dangerInspectionInfoMapper.selectList(queryWrapper);
if(inspectionInfoList != null && !inspectionInfoList.isEmpty()){
LambdaQueryWrapper<DangerInspectionItem> queryItemWrapper = new LambdaQueryWrapper<DangerInspectionItem>();
List<DangerInspectionItem> itemList = null;
for( DangerInspectionInfo info : inspectionInfoList){
queryItemWrapper.eq(DangerInspectionItem::getInspectionInfoId, info.getId());
queryItemWrapper.orderByAsc(DangerInspectionItem::getCreateTime );
itemList = dangerInspectionItemMapper.selectList(queryItemWrapper);
if(itemList != null ) info.setInspectionItemList( itemList ) ;
}
dangerLevelManage.setInspectionInfoList( inspectionInfoList );
}
return dangerLevelManage;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!