Merge branch 'guoshengxiong' into guoshengxiongtemp

This commit is contained in:
guoshengxiong 2024-07-02 17:08:09 +08:00
commit f49f586297
23 changed files with 343 additions and 141 deletions

View File

@ -38,6 +38,7 @@ public class DictionaryItemServiceImpl extends ServiceImpl<DictionaryItemMapper,
* @param dictionaryEncoding
* @return
*/
@Override
public List<DictionaryItem> getDictList(String dictionaryEncoding, String projectSn) {
if (StringUtils.isNotBlank(projectSn)) {
String newEncoding = dictionaryEncoding + "_" + projectSn;

View File

@ -911,31 +911,33 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
if (!systemUser1.getXzProjectOrgId().toString().equals(systemUser.getXzProjectOrgId().toString())) {
// 判断是否存在工作流的流程中
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().unfinished().list();
Set<String> processDefinitionId = list.stream().map(l -> l.getProcessDefinitionId()).collect(Collectors.toSet());
Set<String> startUserIds = list.stream().map(l -> l.getStartUserId()).collect(Collectors.toSet());
List<WflowModels> models = wflowModelsMapper.selectList(Wrappers.<WflowModels>lambdaQuery()
.in(WflowModels::getProcessDefId, processDefinitionId));
List<String> modelName = new ArrayList<>();
for (WflowModels model : models) {
List<String> userIds = new ArrayList<>();
JSONObject process = JSONObject.parseObject(model.getProcess());
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
if (assignedUser1 != null) {
for (int i = 0; i < assignedUser1.size(); i++) {
JSONObject jsonObject = assignedUser1.getJSONObject(i);
userIds.add(jsonObject.getString("id"));
if (list.size() > 0) {
Set<String> processDefinitionId = list.stream().map(l -> l.getProcessDefinitionId()).collect(Collectors.toSet());
Set<String> startUserIds = list.stream().map(l -> l.getStartUserId()).collect(Collectors.toSet());
List<WflowModels> models = wflowModelsMapper.selectList(Wrappers.<WflowModels>lambdaQuery()
.in(WflowModels::getProcessDefId, processDefinitionId));
List<String> modelName = new ArrayList<>();
for (WflowModels model : models) {
List<String> userIds = new ArrayList<>();
JSONObject process = JSONObject.parseObject(model.getProcess());
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
if (assignedUser1 != null) {
for (int i = 0; i < assignedUser1.size(); i++) {
JSONObject jsonObject = assignedUser1.getJSONObject(i);
userIds.add(jsonObject.getString("id"));
}
}
getUserIds(process.getJSONObject("children"), userIds);
if (userIds.contains(systemUser.getUserId().toString())) {
modelName.add(model.getFormName());
}
}
getUserIds(process.getJSONObject("children"), userIds);
if (userIds.contains(systemUser.getUserId().toString())) {
modelName.add(model.getFormName());
if (startUserIds.contains(systemUser.getUserId().toString())) {
throw new OpenAlertException("该人员有正在进行中的审批流程,不可修改组织机构信息,请完成流程后再进行修改");
}
if (modelName.size() > 0) {
throw new OpenAlertException("该人员有正在进行中的审批流程,不可修改组织机构信息,请完成流程后再进行修改");
}
}
if (startUserIds.contains(systemUser.getUserId().toString())) {
throw new OpenAlertException("该人员有正在进行中的审批流程,不可修改组织机构信息,请完成流程后再进行修改");
}
if (modelName.size() > 0) {
throw new OpenAlertException("该人员有正在进行中的审批流程,不可修改组织机构信息,请完成流程后再进行修改");
}
}
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper<>();
@ -1249,107 +1251,109 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
String id = MapUtils.getString(map, "id");
// 判断是否存在工作流的流程中
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().unfinished().list();
Set<String> processDefinitionId = list.stream().map(l -> l.getProcessDefinitionId()).collect(Collectors.toSet());
StringBuilder stringBuilder = new StringBuilder("该人员有正在进行中的");
List<String> modelName = new ArrayList<>();
if (processDefinitionId.size() > 0) {
Set<String> startUserIds = list.stream().map(l -> l.getStartUserId()).collect(Collectors.toSet());
if (list.size() > 0) {
Set<String> processDefinitionId = list.stream().map(l -> l.getProcessDefinitionId()).collect(Collectors.toSet());
StringBuilder stringBuilder = new StringBuilder("该人员有正在进行中的");
List<String> modelName = new ArrayList<>();
if (processDefinitionId.size() > 0) {
List<WflowModels> models = wflowModelsMapper.selectList(Wrappers.<WflowModels>lambdaQuery()
.in(WflowModels::getProcessDefId, processDefinitionId));
for (WflowModels model : models) {
List<String> userIds = new ArrayList<>();
JSONObject process = JSONObject.parseObject(model.getProcess());
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
if (assignedUser1 != null) {
for (int i = 0; i < assignedUser1.size(); i++) {
JSONObject jsonObject = assignedUser1.getJSONObject(i);
userIds.add(jsonObject.getString("id"));
Set<String> startUserIds = list.stream().map(l -> l.getStartUserId()).collect(Collectors.toSet());
if (processDefinitionId.size() > 0) {
List<WflowModels> models = wflowModelsMapper.selectList(Wrappers.<WflowModels>lambdaQuery()
.in(WflowModels::getProcessDefId, processDefinitionId));
for (WflowModels model : models) {
List<String> userIds = new ArrayList<>();
JSONObject process = JSONObject.parseObject(model.getProcess());
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
if (assignedUser1 != null) {
for (int i = 0; i < assignedUser1.size(); i++) {
JSONObject jsonObject = assignedUser1.getJSONObject(i);
userIds.add(jsonObject.getString("id"));
}
}
getUserIds(process.getJSONObject("children"), userIds);
if (userIds.contains(id)) {
modelName.add(model.getFormName());
}
}
getUserIds(process.getJSONObject("children"), userIds);
if (userIds.contains(id)) {
modelName.add(model.getFormName());
if (modelName.size() > 0 || startUserIds.contains(id)) {
stringBuilder.append("审批流程");
}
}
if (modelName.size() > 0 || startUserIds.contains(id)) {
stringBuilder.append("审批流程");
}
// 判断是否存在安全检查中
List<XzSecurityQualityInspectionRecord> xzSecurityQualityInspectionRecords = xzSecurityQualityInspectionRecordService.list(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
.ne(XzSecurityQualityInspectionRecord::getStatus, 5)
.ne(XzSecurityQualityInspectionRecord::getStatus, 6)
.and(item -> item.eq(XzSecurityQualityInspectionRecord::getChangeId, id)
.or().eq(XzSecurityQualityInspectionRecord::getReviewId, id)
.or().eq(XzSecurityQualityInspectionRecord::getVerifyManId, id)
.or().eq(XzSecurityQualityInspectionRecord::getInspectManId, id)));
if (xzSecurityQualityInspectionRecords.size() > 0) {
if (stringBuilder.length() > 10) {
stringBuilder.append("");
}
stringBuilder.append("安全检查台账");
}
}
// 判断是否存在安全检查中
List<XzSecurityQualityInspectionRecord> xzSecurityQualityInspectionRecords = xzSecurityQualityInspectionRecordService.list(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
.ne(XzSecurityQualityInspectionRecord::getStatus, 5)
.ne(XzSecurityQualityInspectionRecord::getStatus, 6)
.and(item -> item.eq(XzSecurityQualityInspectionRecord::getChangeId, id)
.or().eq(XzSecurityQualityInspectionRecord::getReviewId, id)
.or().eq(XzSecurityQualityInspectionRecord::getVerifyManId, id)
.or().eq(XzSecurityQualityInspectionRecord::getInspectManId, id)));
if (xzSecurityQualityInspectionRecords.size() > 0) {
if (stringBuilder.length() > 10) {
stringBuilder.append("");
// 判断是否存在质量检查中
List<QualityInspectionRecord> qualityInspectionRecords = qualityInspectionRecordService.list(Wrappers.<QualityInspectionRecord>lambdaQuery()
.ne(QualityInspectionRecord::getStatus, 5)
.ne(QualityInspectionRecord::getStatus, 6)
.and(item -> item.eq(QualityInspectionRecord::getChangeId, id)
.or().eq(QualityInspectionRecord::getReviewId, id)
.or().eq(QualityInspectionRecord::getVerifyManId, id)
.or().eq(QualityInspectionRecord::getInspectManId, id)));
if (qualityInspectionRecords.size() > 0) {
if (stringBuilder.length() > 10) {
stringBuilder.append("");
}
stringBuilder.append("质量检查台账");
}
stringBuilder.append("安全检查台账");
}
// 判断是否存在质量检查中
List<QualityInspectionRecord> qualityInspectionRecords = qualityInspectionRecordService.list(Wrappers.<QualityInspectionRecord>lambdaQuery()
.ne(QualityInspectionRecord::getStatus, 5)
.ne(QualityInspectionRecord::getStatus, 6)
.and(item -> item.eq(QualityInspectionRecord::getChangeId, id)
.or().eq(QualityInspectionRecord::getReviewId, id)
.or().eq(QualityInspectionRecord::getVerifyManId, id)
.or().eq(QualityInspectionRecord::getInspectManId, id)));
if (qualityInspectionRecords.size() > 0) {
if (stringBuilder.length() > 10) {
stringBuilder.append("");
}
stringBuilder.append("质量检查台账");
}
List<XzCheckingRoute> checkingPointList = xzCheckingRouteService.list(Wrappers.<XzCheckingRoute>lambdaQuery()
.apply("find_in_set({0}, inspect_user_ids)", id)
.or()
.apply("find_in_set({0}, notice_user_ids)", id));
label:
for (XzCheckingRoute xzCheckingRoute : checkingPointList) {
List<XzCheckingRouteTask> xzCheckingRouteTasks = xzCheckingRouteTaskService.list(Wrappers.<XzCheckingRouteTask>lambdaQuery()
.eq(XzCheckingRouteTask::getXzCheckingRouteId, xzCheckingRoute.getId()));
for (XzCheckingRouteTask xzCheckingRouteTask : xzCheckingRouteTasks) {
List<CheckingPointInfo> checkingPointInfos = checkingPointInfoService.list(Wrappers.<CheckingPointInfo>lambdaQuery()
.eq(CheckingPointInfo::getXzCheckingRouteTaskId, xzCheckingRouteTask.getId())
.eq(CheckingPointInfo::getCheckingPointUserId, id));
if (checkingPointInfos == null || checkingPointInfos.size() == 0) {
if (stringBuilder.length() > 10) {
stringBuilder.append("");
List<XzCheckingRoute> checkingPointList = xzCheckingRouteService.list(Wrappers.<XzCheckingRoute>lambdaQuery()
.apply("find_in_set({0}, inspect_user_ids)", id)
.or()
.apply("find_in_set({0}, notice_user_ids)", id));
label:
for (XzCheckingRoute xzCheckingRoute : checkingPointList) {
List<XzCheckingRouteTask> xzCheckingRouteTasks = xzCheckingRouteTaskService.list(Wrappers.<XzCheckingRouteTask>lambdaQuery()
.eq(XzCheckingRouteTask::getXzCheckingRouteId, xzCheckingRoute.getId()));
for (XzCheckingRouteTask xzCheckingRouteTask : xzCheckingRouteTasks) {
List<CheckingPointInfo> checkingPointInfos = checkingPointInfoService.list(Wrappers.<CheckingPointInfo>lambdaQuery()
.eq(CheckingPointInfo::getXzCheckingRouteTaskId, xzCheckingRouteTask.getId())
.eq(CheckingPointInfo::getCheckingPointUserId, id));
if (checkingPointInfos == null || checkingPointInfos.size() == 0) {
if (stringBuilder.length() > 10) {
stringBuilder.append("");
}
stringBuilder.append("巡检任务");
break label;
}
stringBuilder.append("巡检任务");
break label;
}
}
}
if (stringBuilder.length() > 10) {
throw new CustomException(stringBuilder + ",请完成流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
}
// 判断是否有参与到流程审批中
List<WflowModels> modelList = wflowModelsMapper.selectList(null);
modelName = new ArrayList<>();
for (WflowModels model : modelList) {
List<String> userIds = new ArrayList<>();
JSONObject process = JSONObject.parseObject(model.getProcess());
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
if (assignedUser1 != null) {
for (int i = 0; i < assignedUser1.size(); i++) {
JSONObject jsonObject = assignedUser1.getJSONObject(i);
userIds.add(jsonObject.getString("id"));
if (stringBuilder.length() > 10) {
throw new CustomException(stringBuilder + ",请完成流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
}
// 判断是否有参与到流程审批中
List<WflowModels> modelList = wflowModelsMapper.selectList(null);
modelName = new ArrayList<>();
for (WflowModels model : modelList) {
List<String> userIds = new ArrayList<>();
JSONObject process = JSONObject.parseObject(model.getProcess());
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
if (assignedUser1 != null) {
for (int i = 0; i < assignedUser1.size(); i++) {
JSONObject jsonObject = assignedUser1.getJSONObject(i);
userIds.add(jsonObject.getString("id"));
}
}
getUserIds(process.getJSONObject("children"), userIds);
if (userIds.contains(id)) {
modelName.add(model.getFormName());
}
}
getUserIds(process.getJSONObject("children"), userIds);
if (userIds.contains(id)) {
modelName.add(model.getFormName());
if (modelName.size() > 0) {
throw new CustomException("该人员有参与工作流流程审批,请调整流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
}
}
if (modelName.size() > 0) {
throw new CustomException("该人员有参与工作流流程审批,请调整流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
}
String projectSn = MapUtils.getString(map, "projectSn");
SystemUser systemUser = getById(id);
if (systemUser == null) {

View File

@ -25,13 +25,20 @@
</select>
<select id="getTrainRecordsByWorkerId" resultType="com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo">
select if(et.course_id is null,ec.start_exam_time,r.begin_time) as start_exam_time,
if(et.course_id is null,ec.score,null) as score,
if(et.course_id is null,ec.is_pass, null) as is_pass,
select ec.start_exam_time as start_exam_time,
ec.score as score,
ec.is_pass as is_pass,
et.title
from exam_train et
left join exam_train_record ec on ec.train_id = et.id and ec.total_score is not null
where ec.worker_id = #{workerId} and et.project_sn=#{projectSn}
union all
select r.begin_time as start_exam_time,
null as score,
null as is_pass,
et.title
from exam_train et
left join exam_train_record ec on ec.train_id = et.id and ec.score is not null
left join exam_course_record r on r.train_id=et.id and r.begin_time is not null
where ec.worker_id = #{workerId} and ec.project_sn=#{projectSn}
where r.worker_id = #{workerId} and et.project_sn=#{projectSn}
</select>
</mapper>

View File

@ -59,6 +59,7 @@ public class ProjectEnterpriseController {
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "cbsProjectType", value = "项目类型(字典)", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "isCountMainEnterprise", value = "1是总包", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/list")
public Result<IPage<EnterpriseInfo>> queryPageList(@RequestBody Map<String, Object> map) {

View File

@ -142,6 +142,9 @@
#{item}
</foreach>
</if>
<if test="param.isCountMainEnterprise == '1'.toString()">
and b.parent_project_enterprise_id = 0
</if>
order by b.sort_num
</select>

View File

@ -10,10 +10,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -114,5 +111,14 @@ public class QualityRegionController {
return Result.success(qualityRegionService.queryById(map));
}
@OperLog(operModul = "区域管理", operType = "查询", operDesc = "查询项目子账号绑定的唯一区域")
@ApiOperation(value = "查询项目子账号绑定的唯一区域", notes = "查询项目子账号绑定的唯一区域", httpMethod = "GET")
@GetMapping(value = "/queryBindRegion")
public Result<QualityRegion> queryBindRegion() {
return Result.success(qualityRegionService.queryBindRegion());
}
}

View File

@ -88,6 +88,8 @@ public class QualityRegion implements Serializable {
private Date createTime;
@ApiModelProperty(value = "祖级列表")
private java.lang.String ancestors;
@ApiModelProperty(value = "区域的项目子账号id")
private java.lang.Long belongUserId;
@TableField(exist = false)
private List<QualityRegion> children;

View File

@ -50,4 +50,6 @@ public interface QualityRegionMapper extends BaseMapper<QualityRegion> {
* @return
*/
List<QualityRegion> selectBySnAndNumberOneList(@Param("sn") String projectSn, @Param("regionSet") Set<String> regionSet);
List<QualityRegion> queryBindRegion(Map<String, Object> map);
}

View File

@ -102,4 +102,11 @@
</foreach>
</if>
</select>
<select id="queryBindRegion" resultType="com.zhgd.xmgl.modules.quality.entity.QualityRegion">
select qr.*
from quality_region qr
join system_user su on qr.belong_user_id=su.user_id
where su.user_id=#{userId} and su.account_type=6
</select>
</mapper>

View File

@ -49,4 +49,6 @@ public interface IQualityRegionService extends IService<QualityRegion> {
* @return
*/
QualityRegion queryById(Map<String, Object> map);
QualityRegion queryBindRegion();
}

View File

@ -23,6 +23,7 @@ import com.zhgd.xmgl.modules.quality.service.IQualityRegionService;
import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareRecord;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.ListUtils;
import com.zhgd.xmgl.util.MessageUtil;
import org.apache.commons.collections.MapUtils;
@ -269,6 +270,17 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
return qualityRegion;
}
@Override
public QualityRegion queryBindRegion() {
HashMap<String, Object> map = new HashMap<>();
map.put("userId", SecurityUtils.getUser().getUserId());
List<QualityRegion> qualityRegions = baseMapper.queryBindRegion(map);
if (qualityRegions.size() > 1) {
throw new OpenAlertException("此账号绑定过多区域");
}
return qualityRegions.size() == 0 ? null : qualityRegions.get(0);
}
private void deleteRegion(Long id) {
QueryWrapper<QualityRegion> queryWrapper = new QueryWrapper();
queryWrapper.lambda().eq(QualityRegion::getParentRegion, id);

View File

@ -209,13 +209,14 @@
parameterType="java.util.Map">
SELECT COUNT(1) as alarmNum,
DATE_FORMAT(w1.create_time, '%Y-%m-%d') as date,
w1.alarm_type as alarmType
w1.alarm_type as alarmType,
w1.project_sn
from ai_analyse_hard_ware_alarm_record w1
INNER JOIN project a ON w1.project_sn = a.project_sn
LEFT JOIN company cp ON a.company_sn = cp.company_sn
INNER JOIN company b ON cp.parent_id = b.company_id
Left JOIN company f ON b.parent_id = f.company_id
where 1 = 1
where w1.is_pushed = 1
<if test="param.timeUnit == 'today'.toString()">
and w1.create_time &gt;= CONCAT(DATE_FORMAT(now(), '%Y-%m-%d'), ' 00:00:00')
</if>

View File

@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.worker.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.DataScope;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.WorkerSafeEducation;
import com.zhgd.xmgl.modules.worker.entity.dto.EduTypeCountDTO;
@ -35,6 +36,7 @@ public interface WorkerSafeEducationMapper extends BaseMapper<WorkerSafeEducatio
List<EntityMap> selectWorkerSafeEducationByIDCardList(Map<String, Object> map);
@DataScope(includeTable = "worker_info")
int getProjectSafeEducationPersonToltal(Map<String, Object> map);
List<EntityMap> exportExcelWorkerEducation(WorkerSafeEducation workerSafeEducation);

View File

@ -2587,6 +2587,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
for (JSONObject jo : list3) {
rtList.add(new TrainRecordVo(DateUtil.formatDate(DateUtil.parse(jo.getString("study_time"))), jo.getString("edu_course_name"), jo.getDouble("score"), getIsPass(jo.getInteger("is_qualified"))));
}
rtList.sort((o1, o2) -> o2.getDate().compareTo(o1.getDate()));
return rtList;
}

View File

@ -284,7 +284,7 @@ public class XzSecurityQualityInspectionRecordController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "inspectStartTime", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectEndTime", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "isStatsByWeek", value = "按周统计统计一个月1-7号算一周类推1是", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isStatsByWeek", value = "按周统计本月统计一个月1-7号算一周类推1是", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/selectQualityStatisticsNumList")
public Result<List<XzSecurityQualityInspectionRecordTotalVo>> selectQualityStatisticsNumList(@RequestBody Map<String, Object> map) {

View File

@ -185,6 +185,9 @@
and t.status != 6
<include refid="whereCondition">
</include>
<if test="param.isStatsByWeek == '1'.toString()">
and t.inspect_time <![CDATA[>=]]> concat(date_format(current_date,'%Y-%m'),'-01 00:00:00')
</if>
<if test="param.isStatsByWeek == '1'.toString()">
group by whichWeekOfMonth
</if>

View File

@ -197,14 +197,12 @@ public class XzFlowController {
total.put("running", processInstanceVos.stream().filter(l -> l.getFinishTime() == null).count());
total.put("complete", processInstanceVos.stream().filter(l -> l.getFinishTime() != null).count());
resultMap.put("total", total);
List<String> formIds = wflowModels.stream().map(p -> p.getFormId()).collect(Collectors.toList());
List<Map<String, Object>> resultList = new ArrayList<>();
for (String formId : formIds) {
for (WflowModels wflowModel : wflowModels) {
Map<String, Object> map = new HashMap<>();
List<WflowModelHistorys> collect = wflowModelHistorys.stream().filter(w -> w.getFormId().equals(formId)).collect(Collectors.toList());
map.put("name", collect.get(collect.size() - 1).getFormName());
List<ProcessInstanceVo> typeList = processInstanceVos.stream().filter(p -> p.getFormId().equals(formId)).collect(Collectors.toList());
long count = processInstanceVos.stream().filter(p -> p.getFormId().equals(formId)).count();
map.put("name", wflowModel.getFormName());
List<ProcessInstanceVo> typeList = processInstanceVos.stream().filter(p -> p.getFormId().equals(wflowModel.getFormId())).collect(Collectors.toList());
long count = processInstanceVos.stream().filter(p -> p.getFormId().equals(wflowModel.getFormId())).count();
int number = (int) count;
map.put("num", number);
map.put("ratio", processInstanceVos.size() == 0 ? 0 : new BigDecimal(number).divide(new BigDecimal(processInstanceVos.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));

View File

@ -115,7 +115,7 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
private void querySelfEnterpriseIfSub(QueryWrapper<XzEmergencyRecord> queryWrapper) {
UserInfo user = SecurityUtils.getUser();
if (Objects.equals(user.getAccountType(), ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
queryWrapper.apply(" ei.id = (select enterprise_id from xz_emergency_push where find_in_set({0},emergency_manager_id))", user.getUserId());
queryWrapper.apply(" ei.id in (select enterprise_id from xz_emergency_push where find_in_set({0},emergency_manager_id))", user.getUserId());
}
}

View File

@ -247,20 +247,8 @@ public class XzHikvisionSyncServiceImpl extends ServiceImpl<XzHikvisionSyncMappe
List<UfaceDev> ufaceDevs = ufaceDevMapper.selectList(qw);
ThreadLocalUtil.addInKey(Cts.TL_HK_SYNC_ID, id);
projectUfaceConfigService.buildAndSendOneWorkerAndDevForHk(ufaceDevs, workerInfo, xzHikvisionSync.getOperate(), xzHikvisionSync.getDeviceSn(), projectSn, true);
String redisKey = Cts.HK_SYNC_AUTH_SUCCESS_KEY + id;
Object success = redisRepository.get(redisKey);
redisRepository.del(redisKey);
//if (!Objects.equals(success,1)) {
// throw new OpenAlertException("重试失败");
//}
//return;
}
}
//XzHikvisionSync xzHikvisionSync1 = baseMapper.selectById(id);
//if (!Objects.equals(xzHikvisionSync1.getIsSuccess(), 1)) {
// throw new OpenAlertException("重试失败");
//}
}
}

View File

@ -1,22 +1,34 @@
package com.zhgd.xmgl.modules.xz.special.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.enums.ParamEnum;
import com.zhgd.xmgl.modules.worker.service.impl.UserEnterpriseServiceImpl;
import com.zhgd.xmgl.modules.xz.special.entity.*;
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialByFinalStatusVo;
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo;
import com.zhgd.xmgl.modules.xz.special.service.IXzBlindPlatePlugSafeService;
import com.zhgd.xmgl.modules.xz.special.service.*;
import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.NumberUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@RestController
@RequestMapping("/xmgl/xzSpecial")
@ -24,7 +36,24 @@ import java.util.Map;
@Api(tags = "星纵-特种作业统计Api")
public class CountApiController {
@Autowired
private IXzBlindPlatePlugSafeService xzBlindPlatePlugSafeService;
IXzBlindPlatePlugSafeService xzBlindPlatePlugSafeService;
@Resource
IXzGroundSafetService iXzGroundSafetService;
@Resource
IXzHighJobSafeService iXzHighJobSafeService;
@Resource
IXzHoistSafetyWorkService iXzHoistSafetyWorkService;
@Resource
IXzLimitSpaceSafeService iXzLimitSpaceSafeService;
@Resource
IXzOpenCircuitSafeService iXzOpenCircuitSafeService;
@Resource
IXzSpecialOperationFireSafetyService iXzSpecialOperationFireSafetyService;
@Resource
IXzTemporaryElectricitySafeService xzTemporaryElectricitySafeService;
@Lazy
@Autowired
private UserEnterpriseServiceImpl userEnterpriseService;
@ApiOperation(value = "统计特殊作业数量", notes = "统计特殊作业数量", httpMethod = "POST")
@ApiImplicitParams({
@ -35,5 +64,107 @@ public class CountApiController {
return Result.success(xzBlindPlatePlugSafeService.countAllSpecial(param));
}
@ApiOperation(value = "统计特殊作业情况", notes = "统计特殊作业情况", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/countSpecialByFinalStatus")
public Result<CountSpecialByFinalStatusVo> countSpecialByFinalStatus(@ApiIgnore @RequestBody Map<String, Object> param) {
String projectSn = MapUtils.getString(param, "projectSn");
List<String> enterpriseIds = userEnterpriseService.getEnterpriseIdsIfSubProject();
Integer accountType = SecurityUtils.getUser().getAccountType();
boolean isSubAccount = Objects.equals(accountType, ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue());
ArrayList<CountSpecialByFinalStatusVo.GroupByType> groupByTypes = new ArrayList<>();
List<XzBlindPlatePlugSafe> n1 = xzBlindPlatePlugSafeService.list(new LambdaQueryWrapper<XzBlindPlatePlugSafe>()
.eq(XzBlindPlatePlugSafe::getProjectSn, projectSn)
.in(isSubAccount, XzBlindPlatePlugSafe::getJobApplicationUnit, enterpriseIds)
);
List<XzGroundSafet> n2 = iXzGroundSafetService.list(new LambdaQueryWrapper<XzGroundSafet>()
.eq(XzGroundSafet::getProjectSn, projectSn)
.in(isSubAccount, XzGroundSafet::getJobApplicationUnit, enterpriseIds)
);
List<XzHighJobSafe> n3 = iXzHighJobSafeService.list(new LambdaQueryWrapper<XzHighJobSafe>()
.eq(XzHighJobSafe::getProjectSn, projectSn)
.in(isSubAccount, XzHighJobSafe::getJobApplicationUnit, enterpriseIds)
);
List<XzHoistSafetyWork> n4 = iXzHoistSafetyWorkService.list(new LambdaQueryWrapper<XzHoistSafetyWork>()
.eq(XzHoistSafetyWork::getProjectSn, projectSn)
.in(isSubAccount, XzHoistSafetyWork::getJobApplicationUnit, enterpriseIds)
);
List<XzLimitSpaceSafe> n5 = iXzLimitSpaceSafeService.list(new LambdaQueryWrapper<XzLimitSpaceSafe>()
.eq(XzLimitSpaceSafe::getProjectSn, projectSn)
.in(isSubAccount, XzLimitSpaceSafe::getJobApplicationUnit, enterpriseIds)
);
List<XzOpenCircuitSafe> n6 = iXzOpenCircuitSafeService.list(new LambdaQueryWrapper<XzOpenCircuitSafe>()
.eq(XzOpenCircuitSafe::getProjectSn, projectSn)
.in(isSubAccount, XzOpenCircuitSafe::getJobApplicationUnit, enterpriseIds)
);
List<XzSpecialOperationFireSafety> n7 = iXzSpecialOperationFireSafetyService.list(new LambdaQueryWrapper<XzSpecialOperationFireSafety>()
.eq(XzSpecialOperationFireSafety::getProjectSn, projectSn)
.in(isSubAccount, XzSpecialOperationFireSafety::getJobApplicationUnit, enterpriseIds)
);
List<XzTemporaryElectricitySafe> n8 = xzTemporaryElectricitySafeService.list(new LambdaQueryWrapper<XzTemporaryElectricitySafe>()
.eq(XzTemporaryElectricitySafe::getProjectSn, projectSn)
.in(isSubAccount, XzTemporaryElectricitySafe::getJobApplicationUnit, enterpriseIds)
);
CountSpecialByFinalStatusVo.GroupByType byType1 = new CountSpecialByFinalStatusVo.GroupByType();
byType1.setName("盲板抽堵作业");
byType1.setNum((long) n1.size());
byType1.setComplete(n1.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType1);
CountSpecialByFinalStatusVo.GroupByType byType2 = new CountSpecialByFinalStatusVo.GroupByType();
byType2.setName("动土作业");
byType2.setNum((long) n2.size());
byType2.setComplete(n2.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType2);
CountSpecialByFinalStatusVo.GroupByType byType3 = new CountSpecialByFinalStatusVo.GroupByType();
byType3.setName("高处作业");
byType3.setNum((long) n3.size());
byType3.setComplete(n3.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType3);
CountSpecialByFinalStatusVo.GroupByType byType4 = new CountSpecialByFinalStatusVo.GroupByType();
byType4.setName("吊装安全作业");
byType4.setNum((long) n4.size());
byType4.setComplete(n4.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType4);
CountSpecialByFinalStatusVo.GroupByType byType5 = new CountSpecialByFinalStatusVo.GroupByType();
byType5.setName("受限空间作业");
byType5.setNum((long) n5.size());
byType5.setComplete(n5.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType5);
CountSpecialByFinalStatusVo.GroupByType byType6 = new CountSpecialByFinalStatusVo.GroupByType();
byType6.setName("断路作业");
byType6.setNum((long) n6.size());
byType6.setComplete(n6.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType6);
CountSpecialByFinalStatusVo.GroupByType byType7 = new CountSpecialByFinalStatusVo.GroupByType();
byType7.setName("动火作业");
byType7.setNum((long) n7.size());
byType7.setComplete(n7.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType7);
CountSpecialByFinalStatusVo.GroupByType byType8 = new CountSpecialByFinalStatusVo.GroupByType();
byType8.setName("临时用电作业");
byType8.setNum((long) n8.size());
byType8.setComplete(n8.stream().filter(b -> Objects.equals(b.getFinalAcceptanceStatus(), 2)).count());
groupByTypes.add(byType8);
long sum = groupByTypes.stream().map(CountSpecialByFinalStatusVo.GroupByType::getNum).mapToLong(value -> value).sum();
Long running = 0L;
Long complete = 0L;
for (CountSpecialByFinalStatusVo.GroupByType type : groupByTypes) {
type.setRunning(type.getNum() - type.getComplete());
running += type.getRunning();
complete += type.getComplete();
type.setRatio(NumberUtils.occupyRate(type.getNum(), sum, 2));
}
CountSpecialByFinalStatusVo rtVo = new CountSpecialByFinalStatusVo();
CountSpecialByFinalStatusVo.Total total = new CountSpecialByFinalStatusVo.Total();
total.setRunning(running);
total.setComplete(complete);
rtVo.setTotal(total);
rtVo.setGroupByType(groupByTypes);
return Result.success(rtVo);
}
}

View File

@ -0,0 +1,27 @@
package com.zhgd.xmgl.modules.xz.special.entity.vo;
import lombok.Data;
import java.util.List;
@Data
public class CountSpecialByFinalStatusVo {
private Total total;
private List<GroupByType> groupByType;
@Data
public static class Total {
private Long running;
private Long complete;
}
@Data
public static class GroupByType {
private String name;
private Long running;
private Long num;
private Long complete;
private Double ratio;
}
}

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.xz.special.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.xz.special.entity.XzBlindPlatePlugSafe;
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialByFinalStatusVo;
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo;
import java.util.HashMap;
@ -71,4 +72,5 @@ public interface IXzBlindPlatePlugSafeService extends IService<XzBlindPlatePlugS
* @return
*/
List<CountSpecialVo> countAllSpecial(Map<String, Object> param);
}

View File

@ -13,6 +13,7 @@ import com.zhgd.xmgl.modules.worker.service.IUserEnterpriseService;
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord;
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
import com.zhgd.xmgl.modules.xz.special.entity.XzBlindPlatePlugSafe;
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialByFinalStatusVo;
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo;
import com.zhgd.xmgl.modules.xz.special.mapper.XzBlindPlatePlugSafeMapper;
import com.zhgd.xmgl.modules.xz.special.mapper.XzGasAnalyzeMapper;
@ -151,6 +152,7 @@ public class XzBlindPlatePlugSafeServiceImpl extends ServiceImpl<XzBlindPlatePlu
return rtList;
}
private void fillEmtpy(CountSpecialVo vo) {
if (vo.getTotalNum() == null) {
vo.setTotalNum(0);