劳务人员-准入台账信息

This commit is contained in:
guoshengxiong 2024-05-07 19:46:49 +08:00
parent 9c4a9cf981
commit 17098be966
19 changed files with 607 additions and 46 deletions

View File

@ -167,6 +167,16 @@ public class QualityInspectionRecordController {
return Result.ok();
}
@OperLog(operModul = "检查人撤回检查记录", operType = "检查人撤回检查记录", operDesc = "检查人撤回检查记录")
@ApiOperation(value = "检查人撤回检查记录", notes = "检查人撤回检查记录", httpMethod = "POST")
@PostMapping(value = "/revocation")
public Result revocation(@RequestBody QualityInspectionRecord xzSecurityQualityInspectionRecord) {
qualityInspectionRecordService.revocation(xzSecurityQualityInspectionRecord);
return Result.ok();
}
/**
* 编辑
*
@ -177,19 +187,8 @@ public class QualityInspectionRecordController {
@ApiOperation(value = "编辑质量检查记录信息", notes = "编辑质量检查记录信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<QualityInspectionRecord> edit(@RequestBody QualityInspectionRecord qualityInspectionRecord) {
Result<QualityInspectionRecord> result = new Result<QualityInspectionRecord>();
QualityInspectionRecord qualityInspectionRecordEntity = qualityInspectionRecordService.getById(qualityInspectionRecord.getId());
if (qualityInspectionRecordEntity == null) {
result.error500(MessageUtil.get("notFindErr"));
} else {
boolean ok = qualityInspectionRecordService.updateById(qualityInspectionRecord);
if (ok) {
result.successMsg(MessageUtil.get("editSucess"));
}
}
return result;
qualityInspectionRecordService.edit(qualityInspectionRecord);
return Result.ok();
}
/**

View File

@ -93,10 +93,10 @@ public class QualityInspectionRecord implements Serializable {
@ApiModelProperty(value = "紧急程度1一般2严重3紧要")
private java.lang.String urgentLevel;
/**
* 状态2待整改3待复查4待核验5合格
* 状态2待整改3待复查4待核验5合格6已撤回
*/
@Excel(name = "状态2待整改3待复查4待核验5合格", width = 15)
@ApiModelProperty(value = "状态2待整改3待复查4待核验5合格")
@Excel(name = "状态2待整改3待复查4待核验5合格6已撤回", width = 15)
@ApiModelProperty(value = "状态2待整改3待复查4待核验5合格6已撤回")
private java.lang.Integer status;
/**
* 通知人

View File

@ -61,4 +61,8 @@ public interface IQualityInspectionRecordService extends IService<QualityInspect
SectorVo countQualityInspectionRecordUrgentLevel(HashMap<String, Object> paramMap);
List<TrendOneVo> countQualityInspectionRecordRegion(HashMap<String, Object> paramMap);
void revocation(QualityInspectionRecord xzSecurityQualityInspectionRecord);
void edit(QualityInspectionRecord qualityInspectionRecord);
}

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gexin.fastjson.JSON;
import com.gexin.fastjson.TypeReference;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
@ -40,6 +41,8 @@ import com.zhgd.xmgl.modules.xz.entity.XzDeductScoreRecord;
import com.zhgd.xmgl.modules.xz.mapper.XzDeductScoreRecordMapper;
import com.zhgd.xmgl.push.config.PushPayloads;
import com.zhgd.xmgl.util.JxlExcelUtils;
import com.zhgd.xmgl.util.MessageUtil;
import com.zhgd.xmgl.util.NumberUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -308,10 +311,11 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
vo.setWorkerId(workerInfo.getId());
vo.setTypeName(item.getContent());
vo.setDeductScore(item.getDeductScore());
vo.setType(1);
vo.setType(3);
vo.setCreateDate(new Date());
vo.setCurScore(workerInfo.getSafeScore() - item.getDeductScore());
vo.setDeductReason(StrUtil.format("您在{}发现安全隐患({}-{})扣{}分", DateUtil.format(vo.getCreateDate(), "yyyy年MM月dd日HH:mm:ss"), "质量检査", vo.getTypeName() == null ? "" : vo.getTypeName(), item.getDeductScore()));
vo.setDeductReason(StrUtil.format("您在{}发现质量隐患({}-{})扣{}分", DateUtil.format(vo.getCreateDate(), "yyyy年MM月dd日HH:mm:ss"), "质量检査", vo.getTypeName() == null ? "" : vo.getTypeName(), item.getDeductScore()));
vo.setTypeTableId(hiddenDangerInspectRecord.getId());
xzDeductScoreRecordMapper.insert(vo);
}
@ -442,6 +446,82 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
return baseMapper.countQualityInspectionRecordRegion(paramMap);
}
@Override
public void revocation(QualityInspectionRecord xzSecurityQualityInspectionRecord) {
QualityInspectionRecord record = baseMapper.selectById(xzSecurityQualityInspectionRecord.getId());
if (record == null) {
throw new OpenAlertException("该数据不存在");
}
if (Objects.equals(record.getStatus(), 6)) {
return;
}
List<QualityRectifyRecord> xzSecurityQualityRectifyRecords = qualityRectifyRecordMapper.selectList(new LambdaQueryWrapper<QualityRectifyRecord>().eq(QualityRectifyRecord::getQualityId, record.getId()));
if (CollUtil.isNotEmpty(xzSecurityQualityRectifyRecords)) {
throw new OpenAlertException("该数据已整改,无法撤回");
}
record.setStatus(6);
baseMapper.updateById(record);
recoverScore(record);
}
@Override
public void edit(QualityInspectionRecord qualityInspectionRecord) {
QualityInspectionRecord xzSecurityQualityInspectionRecordEntity = getById(qualityInspectionRecord.getId());
if (xzSecurityQualityInspectionRecordEntity == null) {
throw new OpenAlertException(MessageUtil.get("notFindErr"));
}
boolean ok = updateById(qualityInspectionRecord);
deductScoreIf(qualityInspectionRecord);
}
private void recoverScore(QualityInspectionRecord hiddenDangerInspectRecord) {
if (hiddenDangerInspectRecord.getRecordType() == null || hiddenDangerInspectRecord.getRecordType() == 2) {
return;
}
Long inspectHiddenDangerItemRecordId = hiddenDangerInspectRecord.getDangerItemId();
DangerItemRecord item = dangerItemRecordMapper.selectById(inspectHiddenDangerItemRecordId);
if (item == null || item.getDeductScore() == null) {
return;
}
Double ds = item.getDeductScore();
if (ds == null || ds == 0) {
return;
}
Long changeUser = hiddenDangerInspectRecord.getChangeId();
if (changeUser == null) {
return;
}
SystemUser systemUser = systemUserMapper.selectById(changeUser);
if (systemUser == null) {
return;
}
WorkerInfo workerInfo = workerInfoMapper.selectById(systemUser.getWorkerId());
if (workerInfo == null) {
return;
}
//还原扣的分数
HashMap<String, Object> map = new HashMap<>();
map.put("id", workerInfo.getId());
map.put("deductScore", ds * -1);
workerInfoMapper.updateScore(map);
//不能超过100分
WorkerInfo w1 = workerInfoMapper.selectById(systemUser.getWorkerId());
if (NumberUtils.gt(w1.getSafeScore().toString(), "100")) {
w1.setSafeScore(100D);
workerInfoMapper.updateById(w1);
}
xzDeductScoreRecordMapper.delete(new LambdaQueryWrapper<XzDeductScoreRecord>()
.eq(XzDeductScoreRecord::getTypeTableId, hiddenDangerInspectRecord.getId())
.eq(XzDeductScoreRecord::getType, 3)
);
}
private void setWeekRatioData(AllAndWeekDataVO allAndWeekDataVO) {
long weekClose = allAndWeekDataVO.getWeekClose();
long weekNoClose = allAndWeekDataVO.getWeekNoClose();

View File

@ -501,6 +501,7 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl<AiAnaly
vo.setDeductReason(StrUtil.format("您在{}发现安全隐患({}-{})扣{}分", DateUtil.format(vo.getCreateDate(), "yyyy年MM月dd日HH:mm:ss"), "Al违章", vo.getTypeName() == null ? "" : vo.getTypeName(), deductScore));
vo.setProjectSn(record.getProjectSn());
vo.setWorkerId(wi.getId());
vo.setTypeTableId(taskProgressMaterialRel.getId());
xzDeductScoreRecordMapper.insert(vo);
} catch (Exception e) {
log.error("error", e);

View File

@ -0,0 +1,174 @@
package com.zhgd.xmgl.modules.xz.security.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.xz.security.entity.WorkerAccessRecord;
import com.zhgd.xmgl.modules.xz.security.entity.WorkerAccessRecord;
import com.zhgd.xmgl.modules.xz.security.service.IWorkerAccessRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.HashMap;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import com.zhgd.jeecg.common.api.vo.Result;
import org.apache.commons.collections.MapUtils;
import org.simpleframework.xml.core.Validate;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @Title: Controller
* @Description: 劳务人员-准入台账
* @author pds
* @date 2024-05-07
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/workerAccessRecord")
@Slf4j
@Api(tags = "劳务人员-准入台账相关Api")
public class WorkerAccessRecordController {
@Autowired
private IWorkerAccessRecordService workerAccessRecordService;
/**
* 分页列表查询
*
* @return
*/
@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<WorkerAccessRecord>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
return Result.success(workerAccessRecordService.queryPageList(paramMap));
}
/**
* 列表查询
*
* @return
*/
@ApiOperation(value = "列表查询劳务人员-准入台账信息", notes = "列表查询劳务人员-准入台账信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<List<WorkerAccessRecord>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
return Result.success(workerAccessRecordService.queryList(paramMap));
}
/**
* 添加
*
* @param workerAccessRecord
* @return
*/
@ApiOperation(value = "添加劳务人员-准入台账信息", notes = "添加劳务人员-准入台账信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<WorkerAccessRecord> add(@RequestBody @Validate WorkerAccessRecord workerAccessRecord) {
workerAccessRecordService.add(workerAccessRecord);
return Result.ok();
}
/**
* 编辑
*
* @param workerAccessRecord
* @return
*/
@ApiOperation(value = "编辑劳务人员-准入台账信息", notes = "编辑劳务人员-准入台账信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<WorkerAccessRecord> edit(@RequestBody WorkerAccessRecord workerAccessRecord) {
workerAccessRecordService.edit(workerAccessRecord);
return Result.ok();
}
/**
* 通过id删除
*
* @return
*/
@ApiOperation(value = "删除劳务人员-准入台账信息", notes = "删除劳务人员-准入台账信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "劳务人员-准入台账ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
@PostMapping(value = "/delete")
public Result<WorkerAccessRecord> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
workerAccessRecordService.delete(MapUtils.getString(map, "id"));
return Result.ok();
}
/**
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value = "通过id查询劳务人员-准入台账信息", notes = "通过id查询劳务人员-准入台账信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "劳务人员-准入台账ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById")
public Result<WorkerAccessRecord> queryById(@RequestParam(name = "id", required = true) String id) {
Result<WorkerAccessRecord> result = new Result<WorkerAccessRecord>();
WorkerAccessRecord workerAccessRecord = workerAccessRecordService.getById(id);
if (workerAccessRecord == null) {
result.error500("未找到对应实体");
} else {
result.setResult(workerAccessRecord);
result.setSuccess(true);
}
return result;
}
/**
* 导出excel
*
* @param request
* @param response
*/
@ApiOperation(value = "导出excel劳务人员-准入台账信息", notes = "导出excel劳务人员-准入台账信息", httpMethod = "POST")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<WorkerAccessRecord> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
WorkerAccessRecord partyMemberActivitySpeakCare = JSON.parseObject(deString, WorkerAccessRecord.class);
queryWrapper = QueryGenerator.initQueryWrapper(partyMemberActivitySpeakCare, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
log.error("error", e);
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<WorkerAccessRecord> pageList = workerAccessRecordService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "党员活动、学习讲话、党员关怀列表");
mv.addObject(NormalExcelConstants.CLASS, WorkerAccessRecord.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("党员活动、学习讲话、党员关怀列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
}

View File

@ -167,6 +167,14 @@ public class XzSecurityQualityInspectionRecordController {
return Result.ok();
}
@OperLog(operModul = "检查人撤回检查记录", operType = "检查人撤回检查记录", operDesc = "检查人撤回检查记录")
@ApiOperation(value = "检查人撤回检查记录", notes = "检查人撤回检查记录", httpMethod = "POST")
@PostMapping(value = "/revocation")
public Result revocation(@RequestBody XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord) {
qualityInspectionRecordService.revocation(xzSecurityQualityInspectionRecord);
return Result.ok();
}
/**
* 编辑
*
@ -177,19 +185,8 @@ public class XzSecurityQualityInspectionRecordController {
@ApiOperation(value = "编辑安全检查记录信息", notes = "编辑安全检查记录信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<XzSecurityQualityInspectionRecord> edit(@RequestBody XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord) {
Result<XzSecurityQualityInspectionRecord> result = new Result<XzSecurityQualityInspectionRecord>();
XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecordEntity = qualityInspectionRecordService.getById(xzSecurityQualityInspectionRecord.getId());
if (xzSecurityQualityInspectionRecordEntity == null) {
result.error500(MessageUtil.get("notFindErr"));
} else {
boolean ok = qualityInspectionRecordService.updateById(xzSecurityQualityInspectionRecord);
if (ok) {
result.successMsg(MessageUtil.get("editSucess"));
}
}
return result;
qualityInspectionRecordService.edit(xzSecurityQualityInspectionRecord);
return Result.ok();
}
/**

View File

@ -0,0 +1,75 @@
package com.zhgd.xmgl.modules.xz.security.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
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-05-07
* @version V1.0
*/
@Data
@TableName("worker_access_record")
@ApiModel(value = "WorkerAccessRecord实体类", description = "WorkerAccessRecord")
public class WorkerAccessRecord implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.Long id;
/**
* 人员类型
*/
@Excel(name = "人员类型", width = 15)
@ApiModelProperty(value = "人员类型")
private java.lang.String personType;
/**
* 企业名称
*/
@Excel(name = "企业名称", width = 15)
@ApiModelProperty(value = "企业名称")
private java.lang.String enterpriseName;
/**
* 班组或部门
*/
@Excel(name = "班组或部门", width = 15)
@ApiModelProperty(value = "班组或部门")
private java.lang.String teamDepartmentName;
/**
* 姓名
*/
@Excel(name = "姓名", width = 15)
@ApiModelProperty(value = "姓名")
private java.lang.String workerName;
private java.lang.String projectSn;
/**
* 创建时间 yyyy-MM-dd HH:mm:ss
*/
@Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime;
/**
* 更新时间 yyyy-MM-dd HH:mm:ss
*/
@Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
}

View File

@ -93,11 +93,11 @@ public class XzSecurityQualityInspectionRecord implements Serializable {
@ApiModelProperty(value = "紧急程度1一般2严重3紧要")
private String urgentLevel;
/**
* 状态2待整改3待复查4待核验5合格
* 状态2待整改3待复查4待核验5合格6已撤回
*/
@Excel(name = "状态2待整改3待复查4待核验5合格", width = 15)
@ApiModelProperty(value = "状态2待整改3待复查4待核验5合格")
private Integer status;
@Excel(name = "状态2待整改3待复查4待核验5合格6已撤回", width = 15)
@ApiModelProperty(value = "状态2待整改3待复查4待核验5合格6已撤回")
private java.lang.Integer status;
/**
* 通知人
*/

View File

@ -0,0 +1,16 @@
package com.zhgd.xmgl.modules.xz.security.mapper;
import com.zhgd.xmgl.modules.xz.security.entity.WorkerAccessRecord;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 劳务人员-准入台账
* @author pds
* @date 2024-05-07
* @version V1.0
*/
@Mapper
public interface WorkerAccessRecordMapper extends BaseMapper<WorkerAccessRecord> {
}

View File

@ -0,0 +1,4 @@
<?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.xz.security.mapper.WorkerAccessRecordMapper">
</mapper>

View File

@ -0,0 +1,27 @@
package com.zhgd.xmgl.modules.xz.security.service;
import com.zhgd.xmgl.modules.xz.security.entity.WorkerAccessRecord;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.HashMap;
import java.util.List;
/**
* @Description: 劳务人员-准入台账
* @author pds
* @date 2024-05-07
* @version V1.0
*/
public interface IWorkerAccessRecordService extends IService<WorkerAccessRecord> {
IPage<WorkerAccessRecord> queryPageList(HashMap<String, Object> paramMap);
List<WorkerAccessRecord> queryList(HashMap<String, Object> paramMap);
void add(WorkerAccessRecord workerAccessRecord);
void edit(WorkerAccessRecord workerAccessRecord);
void delete(String id);
}

View File

@ -64,4 +64,8 @@ public interface IXzSecurityQualityInspectionRecordService extends IService<XzSe
List<StatsByChangeIdVo> statsByChangeId(Map<String, Object> paramMap);
void revocation(XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord);
void edit(XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord);
}

View File

@ -0,0 +1,85 @@
package com.zhgd.xmgl.modules.xz.security.service.impl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.xz.security.entity.WorkerAccessRecord;
import com.zhgd.xmgl.modules.xz.security.mapper.WorkerAccessRecordMapper;
import com.zhgd.xmgl.modules.xz.security.service.IWorkerAccessRecordService;
import org.springframework.stereotype.Service;
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.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.HashMap;
import java.util.List;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: 劳务人员-准入台账
* @author pds
* @date 2024-05-07
* @version V1.0
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class WorkerAccessRecordServiceImpl extends ServiceImpl<WorkerAccessRecordMapper, WorkerAccessRecord> implements IWorkerAccessRecordService {
@Autowired
private WorkerAccessRecordMapper workerAccessRecordMapper;
@Override
public IPage<WorkerAccessRecord> queryPageList(HashMap<String, Object> paramMap) {
QueryWrapper<WorkerAccessRecord> queryWrapper = getQueryWrapper(paramMap);
Page<WorkerAccessRecord> page = PageUtil.getPage(paramMap);
IPage<WorkerAccessRecord> pageList = this.page(page, queryWrapper);
pageList.setRecords(dealList(pageList.getRecords()));
return pageList;
}
@Override
public List<WorkerAccessRecord> queryList(HashMap<String, Object> paramMap) {
QueryWrapper<WorkerAccessRecord> queryWrapper = getQueryWrapper(paramMap);
return dealList(this.list(queryWrapper));
}
private QueryWrapper<WorkerAccessRecord> getQueryWrapper(HashMap<String, Object> paramMap) {
String alias = "";
QueryWrapper<WorkerAccessRecord> queryWrapper = QueryGenerator.initPageQueryWrapper(WorkerAccessRecord.class, paramMap, alias);
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(WorkerAccessRecord::getCreateTime));
return queryWrapper;
}
private List<WorkerAccessRecord> dealList(List<WorkerAccessRecord> list) {
return list;
}
@Override
public void add(WorkerAccessRecord workerAccessRecord) {
workerAccessRecord.setId(null);
baseMapper.insert(workerAccessRecord);
}
@Override
public void edit(WorkerAccessRecord workerAccessRecord) {
WorkerAccessRecord oldWorkerAccessRecord = baseMapper.selectById(workerAccessRecord.getId());
if (oldWorkerAccessRecord == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.updateById(workerAccessRecord);
}
@Override
public void delete(String id) {
WorkerAccessRecord workerAccessRecord = baseMapper.selectById(id);
if (workerAccessRecord == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.deleteById(id);
}
}

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gexin.fastjson.JSON;
import com.gexin.fastjson.TypeReference;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
@ -40,6 +41,8 @@ import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityQualityRectifyRecordMa
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
import com.zhgd.xmgl.push.config.PushPayloads;
import com.zhgd.xmgl.util.JxlExcelUtils;
import com.zhgd.xmgl.util.MessageUtil;
import com.zhgd.xmgl.util.NumberUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -311,6 +314,7 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
vo.setCreateDate(new Date());
vo.setCurScore(workerInfo.getSafeScore() - item.getDeductScore());
vo.setDeductReason(StrUtil.format("您在{}发现安全隐患({}-{})扣{}分", DateUtil.format(vo.getCreateDate(), "yyyy年MM月dd日HH:mm:ss"), "安全检査", vo.getTypeName() == null ? "" : vo.getTypeName(), item.getDeductScore()));
vo.setTypeTableId(hiddenDangerInspectRecord.getId());
xzDeductScoreRecordMapper.insert(vo);
}
@ -446,6 +450,81 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
return baseMapper.statsByChangeId(paramMap);
}
@Override
public void revocation(XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord) {
XzSecurityQualityInspectionRecord record = baseMapper.selectById(xzSecurityQualityInspectionRecord.getId());
if (record == null) {
throw new OpenAlertException("该数据不存在");
}
if (Objects.equals(record.getStatus(), 6)) {
return;
}
List<XzSecurityQualityRectifyRecord> xzSecurityQualityRectifyRecords = xzSecurityQualityRectifyRecordMapper.selectList(new LambdaQueryWrapper<XzSecurityQualityRectifyRecord>().eq(XzSecurityQualityRectifyRecord::getQualityId, record.getId()));
if (CollUtil.isNotEmpty(xzSecurityQualityRectifyRecords)) {
throw new OpenAlertException("该数据已整改,无法撤回");
}
record.setStatus(6);
baseMapper.updateById(record);
recoverScore(record);
}
@Override
public void edit(XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord) {
XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecordEntity = getById(xzSecurityQualityInspectionRecord.getId());
if (xzSecurityQualityInspectionRecordEntity == null) {
throw new OpenAlertException(MessageUtil.get("notFindErr"));
}
boolean ok = updateById(xzSecurityQualityInspectionRecord);
deductScoreIf(xzSecurityQualityInspectionRecord);
}
private void recoverScore(XzSecurityQualityInspectionRecord hiddenDangerInspectRecord) {
if (hiddenDangerInspectRecord.getRecordType() == null || hiddenDangerInspectRecord.getRecordType() == 2) {
return;
}
Long inspectHiddenDangerItemRecordId = hiddenDangerInspectRecord.getDangerItemId();
XzSecurityDangerItemRecord item = xzSecurityDangerItemRecordMapper.selectById(inspectHiddenDangerItemRecordId);
if (item == null || item.getDeductScore() == null) {
return;
}
Double ds = item.getDeductScore();
if (ds == null || ds == 0) {
return;
}
Long changeUser = hiddenDangerInspectRecord.getChangeId();
if (changeUser == null) {
return;
}
SystemUser systemUser = systemUserMapper.selectById(changeUser);
if (systemUser == null) {
return;
}
WorkerInfo workerInfo = workerInfoMapper.selectById(systemUser.getWorkerId());
if (workerInfo == null) {
return;
}
//还原扣的分数
HashMap<String, Object> map = new HashMap<>();
map.put("id", workerInfo.getId());
map.put("deductScore", ds * -1);
workerInfoMapper.updateScore(map);
//不能超过100分
WorkerInfo w1 = workerInfoMapper.selectById(systemUser.getWorkerId());
if (NumberUtils.gt(w1.getSafeScore().toString(), "100")) {
w1.setSafeScore(100D);
workerInfoMapper.updateById(w1);
}
xzDeductScoreRecordMapper.delete(new LambdaQueryWrapper<XzDeductScoreRecord>()
.eq(XzDeductScoreRecord::getTypeTableId, hiddenDangerInspectRecord.getId())
.eq(XzDeductScoreRecord::getType, 1)
);
}
private void setWeekRatioData(XzSecurityAllAndWeekDataVO allAndWeekDataVO) {
long weekClose = allAndWeekDataVO.getWeekClose();
long weekNoClose = allAndWeekDataVO.getWeekNoClose();

View File

@ -52,10 +52,10 @@ public class XzDeductScoreRecord implements Serializable {
private java.lang.Double curScore;
/**
* 1安全检查 2AI违章
* 1安全检查 2AI违章 3质量
*/
@Excel(name = "1安全检查 2AI违章", width = 15)
@ApiModelProperty(value = "1安全检查 2AI违章")
@Excel(name = "1安全检查 2AI违章 3质量", width = 15)
@ApiModelProperty(value = "1安全检查 2AI违章 3质量")
private java.lang.Integer type;
/**
* 违章类型名称或隐患类型名称
@ -85,4 +85,6 @@ public class XzDeductScoreRecord implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private java.util.Date updateDate;
@ApiModelProperty(value = "1安全检查 2AI违章 的表id")
private Long typeTableId;
}

View File

@ -43,8 +43,8 @@ public class GeTuiConfig {
apiConfiguration.setMasterSecret(masterSecret);
// 接口调用前缀请查看文档: 接口调用规范 -> 接口前缀, 可不填写appId
apiConfiguration.setDomain(baseUrl);
ApiHelper apiHelper=null;
PushApiHelper pushApiHelper=new PushApiHelper();
ApiHelper apiHelper = null;
PushApiHelper pushApiHelper = new PushApiHelper();
try {
apiHelper = ApiHelper.build(apiConfiguration);
// 创建对象建议复用目前有PushApiStatisticApiUserApi
@ -53,8 +53,9 @@ public class GeTuiConfig {
// 实例化ApiHelper对象用于创建接口对象
pushApiHelper.setPushApi(pushApi);
pushApiHelper.setUserApi(userApi);
}catch (Exception e){
log.error("初始话个推失败"+e.getMessage());
log.error("初始话个推成功");
} catch (Exception e) {
log.error("初始话个推失败" + e.getMessage());
}
return pushApiHelper;
}

View File

@ -2,6 +2,7 @@ package com.zhgd.xmgl.push.controller;
import com.getui.push.v2.sdk.common.ApiResult;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.push.config.GeTuiConfig;
import com.zhgd.xmgl.push.service.UniPushService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -10,7 +11,9 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -27,6 +30,9 @@ import java.util.Map;
public class UniPushController {
@Autowired
private UniPushService uniPushService;
@Lazy
@Autowired
private GeTuiConfig geTuiConfig;
@ApiOperation(value = "消息推送", notes = "消息推送", httpMethod = "POST")
@ApiImplicitParams({
@ -36,7 +42,7 @@ public class UniPushController {
@ApiImplicitParam(name = "payload", value = "payload", paramType = "body", required = false, dataType = "String"),
})
@PostMapping("/pushMess")
public Result pushMessage(@RequestBody Map<String,Object> map) {
public Result pushMessage(@RequestBody Map<String, Object> map) {
Result<String> result=new Result();
try {
ApiResult apiResult = uniPushService.pushToSingleByAlias(MapUtils.getString(map, "alias"), MapUtils.getString(map, "title"), MapUtils.getString(map, "content"), MapUtils.getString(map, "payload"));
@ -87,13 +93,20 @@ public class UniPushController {
if (apiResult.isSuccess()){
result.successMsg("操作成功");
result.data(apiResult.getData());
}else{
} else {
result.error500(apiResult.getMsg());
}
}catch (Exception e){
} catch (Exception e) {
log.error("error", e);
result.error500("操作失败");
}
return result;
}
@ApiOperation(value = "初始化uniPush", notes = "初始化uniPush", httpMethod = "POST")
@PostMapping(value = "/initUniPush")
public Result initUniPush(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
geTuiConfig.pushApiHelper();
return Result.ok();
}
}

View File

@ -47,7 +47,7 @@ public class UniPushServiceImpl implements UniPushService {
audience.addAlias(alias);// cid
audience.addCid(alias);// cid
pushDTO.setAudience(audience);
if (pushApiHelper != null) {
if (pushApiHelper != null && pushApiHelper.getPushApi() != null) {
pushApiHelper.getPushApi().pushToSingleByCid(pushDTO);
// 进行cid单推
ApiResult<Map<String, Map<String, String>>> apiResult = pushApiHelper.getPushApi().pushToSingleByCid(pushDTO);