6c8e9266 康伟

kangwei : 隐患排查接口

1 个父辈 496ff743
正在显示 18 个修改的文件 包含 238 行增加135 行删除
......@@ -14,6 +14,7 @@ import com.skua.core.service.ISequenceService;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.entity.PurchasePlan;
import com.skua.modules.erp.entity.PurchasePlanItem;
import com.skua.modules.erp.service.IPurchaseMaterialService;
import com.skua.modules.erp.service.IPurchasePlanService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -53,8 +54,6 @@ import io.swagger.annotations.ApiOperation;
public class PurchasePlanController {
@Autowired
private IPurchasePlanService purchasePlanService;
@Autowired
private IPurchaseMaterialService purchaseMaterialService;
@AutoLog(value = "erp采购计划表-分页列表查询")
@ApiOperation(value="erp采购计划表-分页列表查询", notes="erp采购计划表-分页列表查询")
......@@ -283,15 +282,15 @@ public class PurchasePlanController {
@AutoLog(value = "erp采购计划表-按物料统计列表")
@ApiOperation(value="erp采购计划表-按物料统计列表", notes="erp采购计划表-按物料统计列表")
@GetMapping(value = "/statisticsList")
public Result<IPage<PurchaseMaterial>> statisticsList(PurchasePlanSearchVO purchasePlanSearchVO,
public Result<IPage<PurchasePlanItem>> statisticsList(PurchasePlanSearchVO purchasePlanSearchVO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>();
Page<PurchaseMaterial> page = new Page<PurchaseMaterial>(pageNo, pageSize);
Result<IPage<PurchasePlanItem>> result = new Result<IPage<PurchasePlanItem>>();
Page<PurchasePlanItem> page = new Page<PurchasePlanItem>(pageNo, pageSize);
//purchasePlanSearchVO.setDepats();
purchasePlanSearchVO.setDeparts(BaseContextHandler.getDeparts());
IPage<PurchaseMaterial> pageList = purchaseMaterialService.statisticsPage(page,purchasePlanSearchVO);
IPage<PurchasePlanItem> pageList = purchasePlanService.statisticsPage(page,purchasePlanSearchVO);
result.setSuccess(true);
result.setResult(pageList);
return result;
......@@ -300,15 +299,15 @@ public class PurchasePlanController {
@AutoLog(value = "erp采购计划表-统计详情")
@ApiOperation(value="erp采购计划表-统计详情", notes="erp采购计划表-统计详情")
@GetMapping(value = "/statisticsDetail")
public Result<IPage<PurchaseMaterial>> statisticsDetail(PurchasePlanSearchVO purchasePlanSearchVO,
public Result<IPage<PurchasePlanItem>> statisticsDetail(PurchasePlanSearchVO purchasePlanSearchVO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>();
Result<IPage<PurchasePlanItem>> result = new Result<IPage<PurchasePlanItem>>();
Page<PurchaseMaterial> page = new Page<PurchaseMaterial>(pageNo, pageSize);
Page<PurchasePlanItem> page = new Page<PurchasePlanItem>(pageNo, pageSize);
purchasePlanSearchVO.setDeparts(BaseContextHandler.getDeparts());
IPage<PurchaseMaterial> pageList = purchaseMaterialService.statisticsPageBySparepartId(page,purchasePlanSearchVO);
IPage<PurchasePlanItem> pageList = purchasePlanService.statisticsPageBySparepartId(page,purchasePlanSearchVO);
result.setSuccess(true);
result.setResult(pageList);
return result;
......
......@@ -42,6 +42,9 @@ public class PurchasePlanItem implements Serializable{
/**物料编号*/
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料名称")
private String sparepartName;
@ApiModelProperty(value = "物料编号")
//@Dict(dictTable = "equipment_sparepart_supplies", dicCode="id", dicText = "sparepart_name")
private String sparepartId;
......@@ -84,6 +87,9 @@ public class PurchasePlanItem implements Serializable{
@ApiModelProperty(value = "物料类别名称")
private String sparepartTypeName;
@ApiModelProperty(value = "物料名称")
private String sparepartName;
@TableField(exist=false)
@ApiModelProperty(value = "所属厂站名称")
private String departName;
}
......
......@@ -40,20 +40,6 @@ public interface PurchaseMaterialMapper extends BaseMapper<PurchaseMaterial> {
IPage<PurchaseMaterial> queryByPage(@Param("page")Page<PurchaseMaterial> page, @Param("goodCode")String goodCode, @Param("departId")String departId);
/***
* 统计分页
* @param page
* @param purchasePlanSearchVO
* @return
*/
IPage<PurchaseMaterial> statisticsPage(@Param("page")Page<PurchaseMaterial> page, @Param("ev")PurchasePlanSearchVO purchasePlanSearchVO);
/***
* 查询某一物料的的采购计划物料清单
* @param page
* @return
*/
IPage<PurchaseMaterial> statisticsPageBySparepartId(@Param("page")Page<PurchaseMaterial> page, @Param("ev")PurchasePlanSearchVO purchasePlanSearchVO);
/***
* 根据货号查询采购合同物料清单
* @param goodCode
* @param departId
......
......@@ -2,6 +2,11 @@ package com.skua.modules.erp.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.entity.PurchasePlanItem;
import com.skua.modules.erp.vo.PurchasePlanSearchVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.erp.entity.PurchasePlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -11,4 +16,20 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface PurchasePlanMapper extends BaseMapper<PurchasePlan> {
/***
* 统计分页
* @param page
* @param purchasePlanSearchVO
* @return
*/
IPage<PurchasePlanItem> statisticsPage(Page<PurchasePlanItem> page, @Param("ev") PurchasePlanSearchVO purchasePlanSearchVO);
/***
* 查询某一物料的的采购计划物料清单
* @param page
* @return
*/
IPage<PurchasePlanItem> statisticsPageBySparepartId(Page<PurchasePlanItem> page, @Param("ev")PurchasePlanSearchVO purchasePlanSearchVO);
}
......
......@@ -22,7 +22,7 @@
<select id="queryByPage" resultType="com.skua.modules.erp.entity.PurchaseMaterial">
select ss.sparepart_code,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', aaa.*
from (
select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id and pc.departs like '%13%'
select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id
<if test="goodCode != null and goodCode != ''">
AND m.good_code like concat('%', #{goodCode}, '%')
</if>
......@@ -38,7 +38,7 @@
<select id="queryByList" resultType="com.skua.modules.erp.entity.PurchaseMaterial">
select ss.sparepart_code,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', aaa.*
from (
select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id and pc.departs like '%13%'
select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id
<if test="goodCode != null and goodCode != ''">
AND m.good_code like concat('%', #{goodCode}, '%')
</if>
......@@ -51,55 +51,5 @@
left join ajh_supplier_manage sm on sm.id = aaa.supplier_id
</select>
<!-- 统计查询-->
<select id="statisticsPage" resultType="com.skua.modules.erp.entity.PurchaseMaterial">
select ss.sparepart_name,ss.sparepart_type,ss.specification,ss.measuring_unit, aaa.* from (
select pi.sparepart_id,sum(pi.purchase_num ) as 'purchase_num' , sum(pi.total_price) 'total_price'
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where
pp.id = pi.plan_id
<if test="ev.applyYear != null ">
and pp.apply_year = #{ev.applyYear}
</if>
<if test="ev.departId != null ">
and pp.depart_id = #{ev.departId}
</if>
<if test="ev.startTime != null ">
and pp.apply_time &gt;= #{ev.startTime}
</if>
<if test="ev.endTime != null ">
and pp.apply_time &lt;= #{ev.startTime}
</if>
and pp.depart_id in (#{departs})
-- and pi.sparepart_name like '%%' and pi.sparepart_type ='123'
group by pi.sparepart_id
)aaa
left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id
</select>
<select id="statisticsPageBySparepartId" resultType="com.skua.modules.erp.entity.PurchaseMaterial">
select st.item_text as 'sparepart_type_name' , d.depart_name , aaa.*
from (
select pi.* ,pp.depart_id
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where
pp.id = pi.plan_id and pp.sparepart_id=#{ev.sparepartId}
<if test="ev.applyYear != null ">
and pp.apply_year = #{ev.applyYear}
</if>
<if test="ev.departId != null ">
and pp.depart_id = #{ev.departId}
</if>
<if test="ev.startTime != null ">
and pp.apply_time &gt;= #{ev.startTime}
</if>
<if test="ev.endTime != null ">
and pp.apply_time &lt;= #{ev.startTime}
</if>
and pp.depart_id in (#{departs})
)aaa
left join equipment_sparepart_type st on st.id = aaa.sparepart_type
left join sys_depart d on d.id = aaa.depart_id
</select>
</mapper>
\ No newline at end of file
......
......@@ -2,4 +2,64 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.erp.mapper.PurchasePlanMapper">
<!-- 统计查询-->
<select id="statisticsPage" resultType="com.skua.modules.erp.entity.PurchasePlanItem">
select ss.sparepart_name,ss.sparepart_type,ss.specification,ss.measuring_unit, aaa.* from (
select pi.sparepart_id,sum(pi.purchase_num ) as 'purchase_num' , sum(pi.total_price) 'total_price'
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where
pp.id = pi.plan_id
<if test="ev.sparepartType != null and ev.sparepartType != '' ">
and pi.sparepart_type = #{ev.sparepartType}
</if> <if test="ev.sparepartName != null and ev.sparepartName != '' ">
AND pi.sparepart_name like concat('%', #{ev.sparepartName}, '%')
</if>
<if test="ev.applyYear != null and ev.applyYear != '' ">
and pp.apply_year = #{ev.applyYear}
</if>
<if test="ev.departId != null and ev.departId!= ''">
and pp.depart_id = #{ev.departId}
</if>
<if test="ev.startTime != null and ev.startTime!= ''">
and pp.apply_time &gt;= #{ev.startTime}
</if>
<if test="ev.endTime != null and ev.endTime != ''">
and pp.apply_time &lt;= #{ev.endTime}
</if>
group by pi.sparepart_id
)aaa
left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id
</select>
<select id="statisticsPageBySparepartId" resultType="com.skua.modules.erp.entity.PurchasePlanItem">
select st.item_text as 'sparepart_type_name' , d.depart_name , aaa.*
from (
select pi.* ,pp.depart_id
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where pp.id = pi.plan_id and pi.sparepart_id=#{ev.sparepartId}
<if test="ev.sparepartType != null and ev.sparepartType != '' ">
and pi.sparepart_type = #{ev.sparepartType}
</if> <if test="ev.sparepartName != null and ev.sparepartName != '' ">
AND pi.sparepart_name like concat('%', #{ev.sparepartName}, '%')
</if>
<if test="ev.applyYear != null and ev.applyYear != '' ">
and pp.apply_year = #{ev.applyYear}
</if>
<if test="ev.departId != null and ev.departId!= ''">
and pp.depart_id = #{ev.departId}
</if>
<if test="ev.startTime != null and ev.startTime!= ''">
and pp.apply_time &gt;= #{ev.startTime}
</if>
<if test="ev.endTime != null and ev.endTime != ''">
and pp.apply_time &lt;= #{ev.endTime}
</if>
)aaa
left join equipment_sparepart_type st on st.id = aaa.sparepart_type
left join sys_depart d on d.id = aaa.depart_id
</select>
<!-- and pp.depart_id in (#{ev.departs})-->
</mapper>
\ No newline at end of file
......
package com.skua.modules.erp.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.entity.ERPPurchaseContract;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.entity.PurchasePlanItem;
import com.skua.modules.erp.vo.PurchaseContractVO;
import com.skua.modules.erp.vo.PurchasePlanSearchVO;
import java.util.List;
......@@ -50,4 +54,7 @@ public interface IEROPurchaseContractService extends IService<ERPPurchaseContrac
* @param purchaseContractVO
*/
public void auditPurchaseContract(PurchaseContractVO purchaseContractVO);
}
......
......@@ -31,18 +31,5 @@ public interface IPurchaseMaterialService extends IService<PurchaseMaterial> {
*/
List<PurchaseMaterial> queryMaterialByGoodCode(String goodCode, String departId);
/***
* 统计分页:按照物料分组
* @param page
* @param purchasePlanSearchVO
* @return
*/
IPage<PurchaseMaterial> statisticsPage(Page<PurchaseMaterial> page, PurchasePlanSearchVO purchasePlanSearchVO);
/***
* 查询某一物料的的采购计划物料清单
* @param page
* @return
*/
IPage<PurchaseMaterial> statisticsPageBySparepartId(Page<PurchaseMaterial> page, PurchasePlanSearchVO purchasePlanSearchVO);
}
......
package com.skua.modules.erp.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.entity.PurchasePlan;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.entity.PurchasePlanItem;
import com.skua.modules.erp.vo.PurchasePlanSearchVO;
import com.skua.modules.erp.vo.PurchasePlanVO;
import java.util.List;
......@@ -52,4 +55,20 @@ public interface IPurchasePlanService extends IService<PurchasePlan> {
* @param purchasePlanVO
*/
public void auditPurchasePlan(PurchasePlanVO purchasePlanVO);
/***
* 统计分页:按照物料分组
* @param page
* @param purchasePlanSearchVO
* @return
*/
IPage<PurchasePlanItem> statisticsPage(Page<PurchasePlanItem> page, PurchasePlanSearchVO purchasePlanSearchVO);
/***
* 查询某一物料的的采购计划物料清单
* @param page
* @return
*/
IPage<PurchasePlanItem> statisticsPageBySparepartId(Page<PurchasePlanItem> page, PurchasePlanSearchVO purchasePlanSearchVO);
}
......
......@@ -38,22 +38,5 @@ public class PurchaseMaterialServiceImpl extends ServiceImpl<PurchaseMaterialMap
return this.baseMapper.queryByList(goodCode,departId);
}
/***
* 统计分页
* @param page
* @param purchasePlanSearchVO
* @return
*/
public IPage<PurchaseMaterial> statisticsPage(Page<PurchaseMaterial> page, PurchasePlanSearchVO purchasePlanSearchVO){
return this.baseMapper.statisticsPage(page,purchasePlanSearchVO);
}
/***
* 查询某一物料的的采购计划物料清单
* @param page
* @return
*/
public IPage<PurchaseMaterial> statisticsPageBySparepartId(Page<PurchaseMaterial> page, PurchasePlanSearchVO purchasePlanSearchVO){
return this.baseMapper.statisticsPageBySparepartId(page,purchasePlanSearchVO);
}
}
......
package com.skua.modules.erp.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.erp.entity.ApproveRecord;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.entity.PurchasePlan;
import com.skua.modules.erp.entity.PurchasePlanItem;
import com.skua.modules.erp.mapper.ApproveRecordMapper;
import com.skua.modules.erp.mapper.PurchasePlanItemMapper;
import com.skua.modules.erp.mapper.PurchasePlanMapper;
import com.skua.modules.erp.service.IPurchasePlanService;
import com.skua.modules.erp.vo.PurchasePlanSearchVO;
import com.skua.modules.erp.vo.PurchasePlanVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -145,4 +149,23 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
}
}
/***
* 统计分页
* @param page
* @param purchasePlanSearchVO
* @return
*/
public IPage<PurchasePlanItem> statisticsPage(Page<PurchasePlanItem> page, PurchasePlanSearchVO purchasePlanSearchVO){
return this.baseMapper.statisticsPage(page,purchasePlanSearchVO);
}
/***
* 查询某一物料的的采购计划物料清单
* @param page
* @return
*/
public IPage<PurchasePlanItem> statisticsPageBySparepartId(Page<PurchasePlanItem> page, PurchasePlanSearchVO purchasePlanSearchVO){
return this.baseMapper.statisticsPageBySparepartId(page,purchasePlanSearchVO);
}
}
......
......@@ -60,14 +60,18 @@ public class APPDangerInspectionController {
DangerLevelManageVO dangerLevelManageVO = new DangerLevelManageVO();// dangerInspection ;
BeanUtils.copyProperties(dangerInspection , dangerLevelManageVO);
//查询:上次巡检时间
DangerInspectionRecord inspectionRecord = inspectionRecordService.queryOneByDangerId( id,null ,BaseContextHandler.getUserId());//根据分线点编号,获取巡检最后一条记录
//查询:上次巡检时间(查询还有未完成的巡检记录)
DangerInspectionRecord inspectionRecord = inspectionRecordService.queryOneByDangerId( id,"1" ,BaseContextHandler.getUserId());//根据分线点编号,获取巡检最后一条记录
if(inspectionRecord == null ){//查询完成的数据
inspectionRecord = inspectionRecordService.queryOneByDangerId( id,"2" ,BaseContextHandler.getUserId());//根据分线点编号,获取巡检最后一条记录
}
if(inspectionRecord != null ){
dangerLevelManageVO.setLastInspectionTime( inspectionRecord.getReportDate() );
dangerLevelManageVO.setLastInspectionStatus( inspectionRecord.getStatus());
dangerLevelManageVO.setLastInspectionRecordId( inspectionRecord.getId() );
String dangerId = id;
if( !"2".equals(inspectionRecord.getStatus()) ){
List<DangerInspectionInfo> inspectionInfoList = inspectionRecordService.queryInspectionInfoByDangerId(dangerId ,BaseContextHandler.getUserId());
List<DangerInspectionInfo> inspectionInfoList = inspectionRecordService.queryListByInspectionRecordId(inspectionRecord.getId() ,BaseContextHandler.getUserId());
dangerLevelManageVO.setInspectionInfoList( inspectionInfoList ) ;
}
}
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -39,27 +40,31 @@ public class DangerInspectionRecord implements Serializable{
@Excel(name = "风险等级编号", width = 15)
@ApiModelProperty(value = "风险等级编号")
private String dangerId;
/**风险等级编号*/
@Excel(name = "风险等级名称", width = 15)
@ApiModelProperty(value = "风险等级名称")
private String dangerName;
/**风险点类型*/
@Excel(name = "风险点类型", width = 15)
@ApiModelProperty(value = "风险点类型")
@Dict(dicCode = "dangerType")
private String dangerType;
/**上报人(用户id)*/
@Excel(name = "上报人(用户id)", width = 15)
@ApiModelProperty(value = "上报人(用户id)")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String reportUser;
/**上报时间*/
@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:作废)")
......
......@@ -2,6 +2,7 @@ package com.skua.modules.safe.mapper;
import java.util.List;
import com.skua.modules.safe.vo.DangerLevelManageVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.safe.entity.DangerInspectionRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -16,4 +17,11 @@ public interface DangerInspectionRecordMapper extends BaseMapper<DangerInspectio
* @param dangerInspection
*/
public void batchSaveInspectionInfo(DangerInspectionRecord dangerInspection);
/***
* 获取巡查对象与风险点对象
* @param inspectionRecordId
* @return
*/
public DangerLevelManageVO queryDangerLevelAndInspectionRecord(@Param("inspectionRecordId") String inspectionRecordId);
}
......
......@@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.safe.mapper.DangerInspectionRecordMapper">
<select id="queryDangerLevelAndInspectionRecord" resultType="com.skua.modules.safe.vo.DangerLevelManageVO">
select ir.id 'last_inspection_record_id',ir.report_date 'start_time' , ir.end_date 'end_time' ,
u.realname 'report_user' , d.depart_name , m.*
from danger_inspection_record ir
left join sys_user u on ir.report_user = u.id
left join danger_level_manage m on ir.danger_id = m.id
left join sys_depart d on m.depart_id = d.id
where ir.id = #{inspectionRecordId}
</select>
</mapper>
\ No newline at end of file
......
......@@ -40,12 +40,12 @@ public interface IDangerInspectionRecordService extends IService<DangerInspectio
/***
* 根据检查编号,获取用户的巡检检查集合
* @param dangerId
* 根据检查对象编号,获取用户的巡检检查集合
* @param repordId
* @param userId
* @return
*/
public List<DangerInspectionInfo> queryInspectionInfoByDangerId(String dangerId ,String userId);
public List<DangerInspectionInfo> queryListByInspectionRecordId(String repordId,String userId);
/***
* 根据巡检记录编号获取巡检对象集合
......
......@@ -43,7 +43,7 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
public DangerInspectionRecord queryOneByDangerId(String dangerId,String status,String userId){
LambdaQueryWrapper<DangerInspectionRecord> queryWrapper = new LambdaQueryWrapper<DangerInspectionRecord>();
queryWrapper.eq(DangerInspectionRecord::getDangerId, dangerId);
if(status != null ){
if(status != null && status.length() > 0 ){
queryWrapper.eq(DangerInspectionRecord::getStatus , status);
}
queryWrapper.eq(DangerInspectionRecord::getReportUser , userId);
......@@ -65,18 +65,19 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
@Transactional
public DangerInspectionRecord startInspection(String dangerId,String status , String userId){
DangerInspectionRecord dangerInspection = queryOneByDangerId(dangerId ,status ,userId );
if(dangerInspection == null ){
DangerInspectionRecord dangerInspectionRecord = queryOneByDangerId(dangerId ,status ,userId );
if(dangerInspectionRecord == null ){
DangerLevelManage dangerLevelManage = dangerLevelManageMapper.selectById(dangerId );
dangerInspection = new DangerInspectionRecord();
dangerInspection.setDepartId(dangerLevelManage.getDepartId());
dangerInspection.setDangerName(dangerLevelManage.getDangerName() );//风险等级名称
dangerInspection.setDangerId( dangerId );
dangerInspection.setStatus( status);
dangerInspection.setReportUser( userId );
dangerInspection.setReportDate(DateUtil.getCurrentDate());
dangerInspectionRecord = new DangerInspectionRecord();
dangerInspectionRecord.setDepartId(dangerLevelManage.getDepartId());
dangerInspectionRecord.setDangerName(dangerLevelManage.getDangerName() );//风险等级名称
dangerInspectionRecord.setDangerType( dangerLevelManage.getDangerType() );//风险类型
dangerInspectionRecord.setDangerId( dangerId );
dangerInspectionRecord.setStatus( status);
dangerInspectionRecord.setReportUser( userId );
dangerInspectionRecord.setReportDate(DateUtil.getCurrentDate());
this.baseMapper.insert( dangerInspection ) ;
this.baseMapper.insert( dangerInspectionRecord ) ;
//添加检查对象
//批量插入检查内容对象
......@@ -94,7 +95,7 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
inspectionInfo = new DangerInspectionInfo();
// ( depart_id , user_id, danger_id , inspect_obj_id,inspect_name,inspect_standard , inspect_method,report_user, )
inspectionInfo.setDepartId(dangerLevelManage.getDepartId() ) ;
inspectionInfo.setInspectionRecordId( dangerInspection.getId());
inspectionInfo.setInspectionRecordId( dangerInspectionRecord.getId());
inspectionInfo.setDangerId( dangerInspectInfo.getDangerId() );
inspectionInfo.setInspectName( dangerInspectInfo.getInspectName() );
inspectionInfo.setInspectMethod( dangerInspectInfo.getInspectMethod());
......@@ -145,9 +146,9 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
// 添加检查对象的检查项目
}
List<DangerInspectionInfo> inspectionInfoList = queryInspectionInfoByDangerId( dangerId ,userId);
dangerInspection.setInspectionInfoList( inspectionInfoList ) ;
return dangerInspection;
List<DangerInspectionInfo> inspectionInfoList = queryListByInspectionRecordId( dangerInspectionRecord.getId() ,userId);
dangerInspectionRecord.setInspectionInfoList( inspectionInfoList ) ;
return dangerInspectionRecord;
}
/***
......@@ -156,7 +157,7 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
* @param userId
* @return
*/
public List<DangerInspectionInfo> queryInspectionInfoByDangerId(String dangerId ,String userId){
/* public List<DangerInspectionInfo> queryInspectionInfoByDangerId(String dangerId ,String userId){
LambdaQueryWrapper<DangerInspectionInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectionInfo>();
queryWrapper.eq(DangerInspectionInfo::getReportUser, userId);
queryWrapper.eq(DangerInspectionInfo::getDangerId, dangerId);
......@@ -164,6 +165,22 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
List<DangerInspectionInfo> inspectionInfoList = dangerInspectionInfoMapper.selectList( queryWrapper) ;
return inspectionInfoList;
}*/
/**
* 根据巡检对象编号获取用户的巡检检查集合
* @param inspectionRecordId
* @param userId
* @return
*/
public List<DangerInspectionInfo> queryListByInspectionRecordId(String inspectionRecordId ,String userId){
LambdaQueryWrapper<DangerInspectionInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectionInfo>();
queryWrapper.eq(DangerInspectionInfo::getReportUser, userId);
queryWrapper.eq(DangerInspectionInfo::getInspectionRecordId, inspectionRecordId);
queryWrapper.orderByAsc( DangerInspectionInfo::getCreateTime );
List<DangerInspectionInfo> inspectionInfoList = dangerInspectionInfoMapper.selectList( queryWrapper) ;
return inspectionInfoList;
}
/***
......@@ -172,13 +189,14 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect
* @return
*/
public DangerLevelManageVO queryListByRecordId(String inspectionRecordId){
DangerInspectionRecord dangerInspectionRecord = this.baseMapper.selectById(inspectionRecordId);
/* DangerInspectionRecord dangerInspectionRecord = this.baseMapper.selectById(inspectionRecordId);
DangerLevelManageVO dangerLevelManageVO = new DangerLevelManageVO();
DangerLevelManage dangerLevelManage = null;//
if(dangerInspectionRecord != null ){
dangerLevelManage = dangerLevelManageMapper.selectById(dangerInspectionRecord.getDangerId());
BeanUtils.copyProperties(dangerLevelManage, dangerLevelManageVO);
}
}*/
DangerLevelManageVO dangerLevelManageVO = this.baseMapper.queryDangerLevelAndInspectionRecord(inspectionRecordId);
//巡查对象
LambdaQueryWrapper<DangerInspectionInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectionInfo>();
......
package com.skua.modules.safe.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.modules.safe.entity.DangerInspectionInfo;
import com.skua.modules.safe.entity.DangerLevelManage;
import io.swagger.annotations.ApiModel;
......@@ -27,7 +28,23 @@ public class DangerLevelManageVO extends DangerLevelManage {
@ApiModelProperty(value = "上次巡检状态 ")
private String lastInspectionStatus;
@ApiModelProperty(value = "上次巡检编号 ")
private String lastInspectionRecordId;
@ApiModelProperty(value = "巡检内容对象集合")
private List<DangerInspectionInfo> inspectionInfoList;
@TableField(exist=false)
@ApiModelProperty(value = "开始时间")
private String startTime;
@TableField(exist=false)
@ApiModelProperty(value = "结束时间")
private String endTime;
@TableField(exist=false)
@ApiModelProperty(value = "巡检人员")
private String reportUser;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!