质量监督记录

This commit is contained in:
guoshengxiong 2024-10-14 19:08:46 +08:00
parent 7167f5a7ae
commit ba9f7b7207
7 changed files with 770 additions and 0 deletions

View File

@ -0,0 +1,186 @@
package com.zhgd.xmgl.modules.baotou.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.gexin.fastjson.JSON;
import com.zhgd.annotation.OperLog;
import com.zhgd.xmgl.modules.baotou.entity.QualitySupervise;
import com.zhgd.xmgl.modules.dangerous.entity.vo.ProjectInspectRecordCountVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import java.util.HashMap;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import org.apache.commons.collections.MapUtils;
import com.zhgd.xmgl.modules.baotou.entity.QualitySupervise;
import com.zhgd.xmgl.modules.baotou.service.IQualitySuperviseService;
import org.simpleframework.xml.core.Validate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
/**
* @Title: Controller
* @Description: 质量监督
* @author pds
* @date 2024-10-14
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/qualitySupervise")
@Slf4j
@Api(tags = "质量监督相关Api")
public class QualitySuperviseController {
@Autowired
private IQualitySuperviseService qualitySuperviseService;
/**
* 分页列表查询
* @return
*/
@OperLog(operModul = "质量监督管理", operType = "分页查询", operDesc = "分页列表查询质量监督信息")
@ApiOperation(value = "分页列表查询质量监督信息", notes = "分页列表查询质量监督信息", httpMethod="GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/page")
public Result<IPage<QualitySupervise>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(qualitySuperviseService.queryPageList(param));
}
/**
* 列表查询
* @return
*/
@OperLog(operModul = "质量监督管理", operType = "列表查询", operDesc = "列表查询质量监督信息")
@ApiOperation(value = "列表查询质量监督信息", notes = "列表查询质量监督信息", httpMethod="GET")
@GetMapping(value = "/list")
public Result<List<QualitySupervise>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(qualitySuperviseService.queryList(param));
}
/**
* 添加
* @param qualitySupervise
* @return
*/
@OperLog(operModul = "质量监督管理", operType = "添加", operDesc = "添加质量监督信息")
@ApiOperation(value = "添加质量监督信息", notes = "添加质量监督信息" , httpMethod="POST")
@PostMapping(value = "/add")
public Result<QualitySupervise> add(@RequestBody @Validate QualitySupervise qualitySupervise) {
qualitySuperviseService.add(qualitySupervise);
return Result.ok();
}
/**
* 编辑
* @param qualitySupervise
* @return
*/
@OperLog(operModul = "质量监督管理", operType = "编辑", operDesc = "编辑质量监督信息")
@ApiOperation(value = "编辑质量监督信息", notes = "编辑质量监督信息" , httpMethod="POST")
@PostMapping(value = "/edit")
public Result<QualitySupervise> edit(@RequestBody QualitySupervise qualitySupervise) {
qualitySuperviseService.edit(qualitySupervise);
return Result.ok();
}
/**
* 通过id删除
* @return
*/
@OperLog(operModul = "质量监督管理", operType = "删除", operDesc = "删除质量监督信息")
@ApiOperation(value = "删除质量监督信息", notes = "删除质量监督信息" , httpMethod="POST")
@ApiImplicitParam(name = "id", value = "质量监督ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
@PostMapping(value = "/delete")
public Result<QualitySupervise> delete(@ApiIgnore @RequestBody HashMap<String ,Object> map) {
qualitySuperviseService.delete(MapUtils.getString(map, "id"));
return Result.ok();
}
/**
* 通过id查询
* @param id
* @return
*/
@OperLog(operModul = "质量监督管理", operType = "通过id查询", operDesc = "通过id查询质量监督信息")
@ApiOperation(value = "通过id查询质量监督信息", notes = "通过id查询质量监督信息" , httpMethod="GET")
@ApiImplicitParam(name = "id", value = "质量监督ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById")
public Result<QualitySupervise> queryById(@RequestParam(name="id",required=true) String id) {
return Result.success(qualitySuperviseService.queryById(id));
}
@OperLog(operModul = "质量监督记录", operType = "", operDesc = "工作流添加质量监督记录")
@ApiOperation(value = "工作流添加质量监督记录", notes = "工作流添加质量监督记录", httpMethod = "GET")
@GetMapping(value = "/flow/add")
public Result addFromFlow(@ApiIgnore @RequestParam Map<String, Object> map) {
log.info("工作流添加质量监督记录:{}", com.gexin.fastjson.JSON.toJSONString(map));
try {
qualitySuperviseService.addFromFlow(map);
} catch (Exception e) {
log.error("工作流添加质量监督记录:", e);
}
return Result.ok();
}
@OperLog(operModul = "质量监督记录", operType = "", operDesc = "工作流更改质量监督记录状态")
@ApiOperation(value = "工作流更改质量监督记录状态", notes = "工作流更改质量监督记录状态", httpMethod = "GET")
@GetMapping(value = "/flow/set/status")
public Result setRectification(@ApiIgnore @RequestParam Map<String, Object> map) {
log.info("工作流更改质量监督记录为整改中:{}", JSON.toJSONString(map));
String instanceId = MapUtils.getString(map, "instanceId");
qualitySuperviseService.update(new LambdaUpdateWrapper<QualitySupervise>()
.set(QualitySupervise::getStatus, MapUtils.getInteger(map, "status"))
.eq(QualitySupervise::getInstanceId, instanceId)
);
return Result.ok();
}
@ApiOperation(value = "记录统计", notes = "记录统计", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "changeUser", value = "整改人", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "itemId", value = "子任务ID", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "engineeringId", value = "危大工程记录ID", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "createUser", value = "创建人", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "recordType", value = "类型1隐患问题2排查记录", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "reviewId", value = "复查人", paramType = "body", required = false, dataType = "String"),
// @ApiImplicitParam(name = "status", value = "状态1无需整改2待整改3待复查4合格", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectStartTime", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectEndTime", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/getProjectInspectRecordCount")
public Result<ProjectInspectRecordCountVo> getProjectInspectRecordCount(@RequestBody Map<String, Object> map) {
return Result.success(qualitySuperviseService.getProjectInspectRecordCount(map));
}
}

View File

@ -0,0 +1,149 @@
package com.zhgd.xmgl.modules.baotou.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: 质量监督
* @author pds
* @date 2024-10-14
* @version V1.0
*/
@Data
@TableName("quality_supervise")
@ApiModel(value="QualitySupervise实体类",description="QualitySupervise")
public class QualitySupervise implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="id")
private java.lang.Long id ;
/**合同模式1EPC;2E+P+C*/
@ApiModelProperty(value="合同模式1EPC;2E+P+C")
private java.lang.Integer contractModel ;
/**下发层级*/
@ApiModelProperty(value="下发层级")
private java.lang.String deliveryLevel ;
/**质量监督机构*/
@ApiModelProperty(value="质量监督机构")
private java.lang.String qualitySupervisionAgency ;
/**签发人*/
@ApiModelProperty(value="签发人")
private java.lang.Long issuer ;
/**签发日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="签发日期")
private java.util.Date issuingDate ;
/**联系人*/
@ApiModelProperty(value="联系人")
private java.lang.String contactPerson ;
/**联系人电话*/
@ApiModelProperty(value="联系人电话")
private java.lang.String contactPhoneNumber ;
/**装置id*/
@ApiModelProperty(value="装置id")
private java.lang.Long deviceId ;
/**建设管理单位*/
@ApiModelProperty(value="建设管理单位")
private java.lang.Long projectGroupId ;
/**监理单位id*/
@ApiModelProperty(value="监理单位id")
private java.lang.Long supervisingUnitId ;
/**EPC承包商id*/
@ApiModelProperty(value="EPC承包商id")
private java.lang.Long epcContractorId ;
/**设计单位id*/
@ApiModelProperty(value="设计单位id")
private java.lang.Long designEnterpriseId ;
/**施工承包商id*/
@ApiModelProperty(value="施工承包商id")
private java.lang.Long constructionUnitId ;
/**检测单位*/
@ApiModelProperty(value="检测单位")
private java.lang.Long testingUnit ;
/**质量问题事实描述*/
@ApiModelProperty(value="质量问题事实描述")
private java.lang.String qualityDescription ;
/**质量问题处置要求*/
@ApiModelProperty(value="质量问题处置要求")
private java.lang.String qualityHandlingRequirement ;
/**上传图片*/
@ApiModelProperty(value="上传图片")
private java.lang.String picUrl ;
/**上传附件*/
@ApiModelProperty(value="上传附件")
private java.lang.String fileUrl ;
/**整改时限*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="整改时限")
private java.util.Date changeLimitTime ;
/**工作流实例id*/
@ApiModelProperty(value="工作流实例id")
private java.lang.String instanceId ;
/**所属项目SN*/
@ApiModelProperty(value="所属项目SN")
private java.lang.String projectSn ;
/**创建时间*/
@ApiModelProperty(value="创建时间")
private java.util.Date createDate ;
/**更新时间*/
@ApiModelProperty(value="更新时间")
private java.util.Date updateDate ;
/**状态2待整改3整改中5合格6已撤回*/
@ApiModelProperty(value="状态2待整改3整改中5合格6已撤回")
private java.lang.Integer status ;
/**检查时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="检查时间")
private java.util.Date inspectTime ;
/**单位id*/
@ApiModelProperty(value="单位id")
private java.lang.Long enterpriseId ;
/**检查人id*/
@ApiModelProperty(value="检查人id")
private java.lang.Long inspectManId ;
@TableField(exist = false)
@ApiModelProperty(value="签发人名称")
private java.lang.String issuerName ;
@TableField(exist = false)
@ApiModelProperty(value="装置名称")
private java.lang.String deviceName ;
@TableField(exist = false)
@ApiModelProperty(value="建设管理单位名称")
private java.lang.String projectGroupName ;
@TableField(exist = false)
@ApiModelProperty(value="监理单位名称")
private java.lang.String supervisingUnitName ;
@TableField(exist = false)
@ApiModelProperty(value="EPC承包商名称")
private java.lang.String epcContractorName ;
@TableField(exist = false)
@ApiModelProperty(value="设计单位名称")
private java.lang.String designEnterpriseName ;
@TableField(exist = false)
@ApiModelProperty(value="施工承包商名称")
private java.lang.String constructionUnitName ;
@TableField(exist = false)
@ApiModelProperty(value="检测单位名称")
private java.lang.String testingUnitName ;
@TableField(exist = false)
@ApiModelProperty(value="单位名称")
private java.lang.String enterpriseName ;
@TableField(exist = false)
@ApiModelProperty(value="检查人名称")
private java.lang.String inspectManName ;
}

View File

@ -0,0 +1,55 @@
package com.zhgd.xmgl.modules.baotou.mapper;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import com.zhgd.xmgl.modules.baotou.entity.QualitySupervise;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.dangerous.entity.vo.ProjectInspectRecordCountVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 质量监督
* @author pds
* @date 2024-10-14
* @version V1.0
*/
@Mapper
public interface QualitySuperviseMapper extends BaseMapper<QualitySupervise> {
/**
* 分页列表查询质量监督信息
*
* @param page
* @param queryWrapper
* @param param
* @return
*/
IPage<QualitySupervise> queryList(Page<QualitySupervise> page, @Param(Constants.WRAPPER) QueryWrapper<QualitySupervise> queryWrapper, @Param("param") HashMap<String, Object> param);
/**
* 列表查询质量监督信息
*
* @param queryWrapper
* @param param
* @return
*/
List<QualitySupervise> queryList(@Param(Constants.WRAPPER) QueryWrapper<QualitySupervise> queryWrapper, @Param("param") HashMap<String, Object> param);
/**
* 通过id查询质量监督信息
*
* @param id
* @return
*/
QualitySupervise queryById(String id);
ProjectInspectRecordCountVo getProjectInspectRecordCount(Map<String, Object> map);
}

View File

@ -0,0 +1,109 @@
<?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="com.zhgd.xmgl.modules.baotou.mapper.QualitySuperviseMapper">
<select id="queryList" resultType="com.zhgd.xmgl.modules.baotou.entity.QualitySupervise">
select * from(select t.*,
du.device_unit_name as device_name,
pg.project_group_name,
ei1.enterprise_name as supervising_unit_name,
ei2.enterprise_name as epc_contractor_name,
ei4.enterprise_name as design_enterprise_name,
ei3.enterprise_name as construction_unit_name,
ei5.enterprise_name as testing_unit_name,
ei0.enterprise_name,
su1.real_name as issuer_name,
su3.real_name as inspect_man_name
from quality_supervise t
left join project_group pg on t.project_group_id = pg.id
left join enterprise_info ei0 on ei0.id = t.enterprise_id
left join enterprise_info ei1 on ei1.id = t.supervising_unit_id
left join enterprise_info ei2 on ei2.id = t.epc_contractor_id
left join enterprise_info ei3 on ei3.id = t.construction_unit_id
left join enterprise_info ei4 on ei4.id = t.design_enterprise_id
left join enterprise_info ei5 on ei5.id = t.testing_unit
left join device_unit du on du.id=t.device_id
left join system_user su1 on su1.user_id=t.issuer
left join system_user su3 on su3.user_id=t.inspect_man_id
where 1=1
<if test="param.instanceIds != null and param.instanceIds != '' and param.instanceIds.size > 0">
and t.instance_id in
<foreach item="item" index="index" collection="param.instanceIds"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
) t
${ew.customSqlSegment}
</select>
<select id="queryById" resultType="com.zhgd.xmgl.modules.baotou.entity.QualitySupervise">
select * from(select t.*,
du.device_unit_name as device_name,
pg.project_group_name,
ei1.enterprise_name as supervising_unit_name,
ei2.enterprise_name as epc_contractor_name,
ei4.enterprise_name as design_enterprise_name,
ei3.enterprise_name as construction_unit_name,
ei5.enterprise_name as testing_unit_name,
ei0.enterprise_name,
su1.real_name as issuer_name,
su3.real_name as inspect_man_name
from quality_supervise t
left join project_group pg on t.project_group_id = pg.id
left join enterprise_info ei0 on ei0.id = t.enterprise_id
left join enterprise_info ei1 on ei1.id = t.supervising_unit_id
left join enterprise_info ei2 on ei2.id = t.epc_contractor_id
left join enterprise_info ei3 on ei3.id = t.construction_unit_id
left join enterprise_info ei4 on ei4.id = t.design_enterprise_id
left join enterprise_info ei5 on ei5.id = t.testing_unit
left join device_unit du on du.id=t.device_id
left join system_user su1 on su1.user_id=t.issuer
left join system_user su3 on su3.user_id=t.inspect_man_id
) t
where t.id = #{id}
</select>
<select id="getProjectInspectRecordCount"
resultType="com.zhgd.xmgl.modules.dangerous.entity.vo.ProjectInspectRecordCountVo">
select tp.*
<!--,round(IFNULL(TRUNCATE(IFNULL(rectifyCompleteNum, 0) / IFNULL(inspectNum, 0), 4), 0) * 100,
2) completeRatio,
round(IFNULL(TRUNCATE(IFNULL(closeNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2) closeRatio,
tp.totalNum - tp.weekInspectNum - tp.monthInspectNum AS otherInspectNum--> <!--其他数量,就是除了月、周的检查数量-->
from (
SELECT
IFNULL(SUM((CASE WHEN a.status != 6 THEN 1 ELSE 0 END)), 0) totalNum,
<!--IFNULL(SUM((CASE WHEN a.record_type = 2 THEN 1 ELSE 0 END)), 0) investigateNum,
IFNULL(SUM((CASE WHEN a.record_type = 1 THEN 1 ELSE 0 END)), 0) inspectNum,-->
IFNULL(SUM((CASE WHEN a.status = 5 THEN 1 ELSE 0 END)), 0) closeNum,
IFNULL(SUM((CASE WHEN a.status = 5 THEN 1 ELSE 0 END)), 0) rectifyCompleteNum,
IFNULL(SUM((CASE WHEN a.status = 2 OR a.status = 3 THEN 1 ELSE 0 END)), 0) notCloseNum,
IFNULL(SUM((CASE
WHEN (a.status = 2 OR a.status = 3)
AND now() > a.change_limit_time THEN 1
ELSE 0 END)), 0) overdueNotCloseNum,
IFNULL(SUM((CASE
WHEN a.status = 2 AND DATE_FORMAT(now(), "%Y-%m-%d") > a.change_limit_time THEN 1
ELSE 0 END)),
0) overdueRectificationNum,
IFNULL(SUM((CASE WHEN a.status = 2 THEN 1 ELSE 0 END)), 0) rectificationNum,
IFNULL(SUM((CASE WHEN a.status = 3 THEN 1 ELSE 0 END)), 0) rectificatingNum,
IFNULL(SUM((CASE WHEN a.status != 2 and a.status != 6 THEN 1 ELSE 0 END)), 0) rectificationDoneNum,
IFNULL(SUM((CASE WHEN a.status != 1 THEN 1 ELSE 0 END)), 0) dangerNum,
IFNULL(SUM((CASE WHEN a.status = 3 THEN 1 ELSE 0 END)), 0) reviewNum
<!--,IFNULL(SUM((CASE WHEN tr.frequency_type = 3 THEN 1 ELSE 0 END)), 0) weekInspectNum, &lt;!&ndash;周检查数量&ndash;&gt;
IFNULL(SUM((CASE WHEN tr.frequency_type = 4 THEN 1 ELSE 0 END)), 0) monthInspectNum &lt;!&ndash;月检查数量&ndash;&gt;-->
from quality_supervise a
WHERE a.project_sn = #{projectSn}
<if test="status != null and status != ''">
and a.status = #{status}
</if>
<if test="inspectStartTime != null and inspectStartTime != ''">
and a.inspect_time >= CONCAT(DATE_FORMAT(#{inspectStartTime}, "%Y-%m-%d"), ' 00:00:00')
</if>
<if test="inspectEndTime != null and inspectEndTime != ''">
and a.inspect_time &lt;= CONCAT(DATE_FORMAT(#{inspectEndTime}, "%Y-%m-%d"), ' 23:59:59')
</if>
) tp
</select>
</mapper>

View File

@ -0,0 +1,59 @@
package com.zhgd.xmgl.modules.baotou.service;
import com.zhgd.xmgl.modules.baotou.entity.QualitySupervise;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.xmgl.modules.dangerous.entity.vo.ProjectInspectRecordCountVo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: 质量监督
* @author pds
* @date 2024-10-14
* @version V1.0
*/
public interface IQualitySuperviseService extends IService<QualitySupervise> {
/**
* 分页列表查询质量监督信息
* @param param 参数map
* @return
*/
IPage<QualitySupervise> queryPageList(HashMap<String, Object> param);
/**
* 列表查询质量监督信息
* @param param 参数map
* @return
*/
List<QualitySupervise> queryList(HashMap<String, Object> param);
/**
* 添加质量监督信息
* @param qualitySupervise 质量监督
* @return
*/
void add(QualitySupervise qualitySupervise);
/**
* 编辑质量监督信息
* @param qualitySupervise 质量监督
* @return
*/
void edit(QualitySupervise qualitySupervise);
/**
* 根据id删除质量监督信息
* @param id 质量监督的id
* @return
*/
void delete(String id);
/**
* 根据id查询质量监督信息
* @param id 质量监督的id
* @return
*/
QualitySupervise queryById(String id);
void addFromFlow(Map<String, Object> map);
ProjectInspectRecordCountVo getProjectInspectRecordCount(Map<String, Object> map);
}

View File

@ -0,0 +1,211 @@
package com.zhgd.xmgl.modules.baotou.service.impl;
import java.util.Date;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.call.SanjiangDataCall;
import com.zhgd.xmgl.modules.baotou.entity.QualitySupervise;
import com.zhgd.xmgl.modules.baotou.mapper.QualityProblemMapper;
import com.zhgd.xmgl.modules.baotou.mapper.QualitySuperviseMapper;
import com.zhgd.xmgl.modules.baotou.security.mapper.XzSecurityDangerItemRecordMapper;
import com.zhgd.xmgl.modules.baotou.service.IQualitySuperviseService;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
import com.zhgd.xmgl.modules.dangerous.entity.vo.ProjectInspectRecordCountVo;
import com.zhgd.xmgl.modules.dangerous.mapper.DangerousEngineeringRecordMapper;
import com.zhgd.xmgl.modules.exam.service.IExamTrainService;
import com.zhgd.xmgl.modules.video.mapper.AiAnalyseHardWareAlarmRecordMapper;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoAuditRecordMapper;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService;
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
import com.zhgd.xmgl.modules.xz.mapper.XzDeductScoreRecordMapper;
import com.zhgd.xmgl.modules.xz.mapper.XzTaskProgressContentMapper;
import com.zhgd.xmgl.modules.xz.special.service.CountApiService;
import com.zhgd.xmgl.util.FlowSeviceUtil;
import com.zhgd.xmgl.util.FlowUtil;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.apache.commons.collections.MapUtils;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @Description: 质量监督
* @author pds
* @date 2024-10-14
* @version V1.0
*/
@Service
public class QualitySuperviseServiceImpl extends ServiceImpl<QualitySuperviseMapper, QualitySupervise> implements IQualitySuperviseService {
@Autowired
SanjiangDataCall sanjiangDataCall;
@Autowired
XzSecurityDangerItemRecordMapper xzSecurityDangerItemRecordMapper;
@Autowired
SystemUserMapper systemUserMapper;
@Autowired
WorkerInfoMapper workerInfoMapper;
@Autowired
XzDeductScoreRecordMapper xzDeductScoreRecordMapper;
@Autowired
AiAnalyseHardWareAlarmRecordMapper aiAnalyseHardWareAlarmRecordMapper;
@Autowired
XzTaskProgressContentMapper xzTaskProgressContentMapper;
@Autowired
DangerousEngineeringRecordMapper dangerousEngineeringRecordMapper;
@Autowired
WorkerInfoAuditRecordMapper workerInfoAuditRecordMapper;
@Autowired
XzSecurityDangerItemRecordMapper dangerItemRecordMapper;
@Autowired
WorkerInfoServiceImpl workerInfoService;
@Lazy
@Autowired
SystemUserServiceImpl systemUserService;
@Lazy
@Autowired
CountApiService countApiService;
@Lazy
@Autowired
IExamTrainService examTrainService;
@Lazy
@Autowired
IEnterpriseInfoService enterpriseInfoService;
@Lazy
@Autowired
RuntimeService runtimeService;
@Autowired
FlowSeviceUtil flowSeviceUtil;
@Autowired
private QualitySuperviseMapper qualitySuperviseMapper;
@Autowired
private QualityProblemMapper qualityProblemMapper;
@Autowired
private ProcessInstanceService processService;
@Override
public IPage<QualitySupervise> queryPageList(HashMap<String, Object> param) {
QueryWrapper<QualitySupervise> queryWrapper = this.getQueryWrapper(param);
if (Objects.equals(MapUtils.getInteger(param, "isMyTodo"), 1)) {
List<String> instanceIds = flowSeviceUtil.getMyTodoInstanceIds("wf67072b923afc947a1a819313",MapUtils.getString(param,"projectSn"));
param.put("instanceIds", instanceIds);
}
Page<QualitySupervise> page = PageUtil.getPage(param);
IPage<QualitySupervise> pageList = baseMapper.queryList(page, queryWrapper, param);
pageList.setRecords(this.dealList(pageList.getRecords()));
return pageList;
}
@Override
public List<QualitySupervise> queryList(HashMap<String, Object> param) {
QueryWrapper<QualitySupervise> queryWrapper = getQueryWrapper(param);
return dealList(baseMapper.queryList(queryWrapper, param));
}
private QueryWrapper<QualitySupervise> getQueryWrapper(HashMap<String, Object> param) {
QueryWrapper<QualitySupervise> queryWrapper = QueryGenerator.initPageQueryWrapper(QualitySupervise.class, param, true);
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(QualitySupervise::getId));
return queryWrapper;
}
private List<QualitySupervise> dealList(List<QualitySupervise> list) {
return list;
}
@Override
public void add(QualitySupervise qualitySupervise) {
qualitySupervise.setId(null);
baseMapper.insert(qualitySupervise);
}
@Override
public void edit(QualitySupervise qualitySupervise) {
QualitySupervise oldQualitySupervise = baseMapper.selectById(qualitySupervise.getId());
if (oldQualitySupervise == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.updateById(qualitySupervise);
}
@Override
public void delete(String id) {
QualitySupervise qualitySupervise = baseMapper.selectById(id);
if (qualitySupervise == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.deleteById(id);
}
@Override
public QualitySupervise queryById(String id) {
QualitySupervise entity = baseMapper.queryById(id);
if (entity == null) {
throw new OpenAlertException("未找到对应实体");
}
return entity;
}
@Override
public void addFromFlow(Map<String, Object> map) {
String instanceId = FlowUtil.getString(map, "instanceId");
ProcessProgressVo instanceProgress = processService.getInstanceProgress(null, instanceId);
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
Map<String, Object> formData = instanceProgress.getFormData();
List<ProcessProgressVo.ProgressNode> progress = instanceProgress.getProgress();
ProcessProgressVo.ProgressNode node = progress.get(progress.size() - 1);
OrgUser user = node.getUser();
String projectSn = processInstance.getTenantId();
SystemUser user1 = systemUserService.getById(user.getId());
WorkerInfo info = workerInfoService.getById(user1.getWorkerId());
QualitySupervise record = new QualitySupervise();
record.setContractModel(Objects.equals(FlowUtil.getString(formData, "field6263895325071"), "EPC") ? 1 : 2);
record.setDeliveryLevel(FlowUtil.getString(formData, "field5089995326471"));
record.setQualitySupervisionAgency(FlowUtil.getString(formData,"field4427127220717"));
record.setIssuer(FlowUtil.getPullDownLong(formData,"field6606727229026"));
record.setIssuingDate(FlowUtil.getDate(formData,"field1013227240565"));
record.setContactPerson(FlowUtil.getString(formData,"field6427495431488"));
record.setContactPhoneNumber(FlowUtil.getString(formData,"field2045027293082"));
record.setDeviceId(FlowUtil.getPullDownLong(formData,"field8461427261832"));
record.setProjectGroupId(FlowUtil.getPullDownLong(formData,"field2236827437883"));
record.setSupervisingUnitId(FlowUtil.getPullDownLong(formData,"field4800627374284"));
record.setEpcContractorId(FlowUtil.getPullDownLong(formData,"field7608927385682"));
record.setDesignEnterpriseId(FlowUtil.getPullDownLong(formData,"field3317527412133"));
record.setConstructionUnitId(FlowUtil.getPullDownLong(formData,"field8417827396166"));
record.setTestingUnit(FlowUtil.getPullDownLong(formData,"field9019727475232"));
record.setQualityDescription(FlowUtil.getString(formData,"field5217527483082"));
record.setQualityHandlingRequirement(FlowUtil.getString(formData,"field3613727494350"));
record.setPicUrl(FlowUtil.getJSONString(formData,"field4163295310790"));
record.setFileUrl(FlowUtil.getJSONString(formData,"field1531195312272"));
record.setChangeLimitTime(FlowUtil.getDate(formData,"field5732403118189"));
record.setInstanceId(instanceId);
record.setProjectSn(projectSn);
record.setCreateDate(new Date());
record.setUpdateDate(new Date());
record.setStatus(2);
record.setInspectTime(FlowUtil.getDate(formData,"field3424903116326"));
record.setEnterpriseId(Optional.ofNullable(info).map(WorkerInfo::getEnterpriseId).orElse(null));
record.setInspectManId(Long.valueOf(processInstance.getStartUserId()));
baseMapper.insert(record);
}
@Override
public ProjectInspectRecordCountVo getProjectInspectRecordCount(Map<String, Object> map) {
return baseMapper.getProjectInspectRecordCount(map);
}
}

View File

@ -81,6 +81,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http.authorizeRequests()
//请求路径允许访问
.antMatchers("/xmgl/hat/httpAlarmServer").permitAll()
.antMatchers("/xmgl/qualitySupervise/flow/**").permitAll()
.antMatchers("/xmgl/civilizeConstruction/flow/**").permitAll()
.antMatchers("/xmgl/qualityProblem/flow/**").permitAll()
.antMatchers("/xmgl/xzSecurityQualityInspectionRecord/flow/**").permitAll()