包头bug修改
This commit is contained in:
parent
d7ac081008
commit
a7c2a25d77
@ -1,10 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.baotou.controller;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ProjectGroupUnit;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IDeviceUnitService;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IProjectGroupUnitService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -14,11 +18,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -33,6 +40,9 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Api(tags = "装置管理相关Api")
|
||||
public class DeviceUnitController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
IProjectGroupUnitService projectGroupUnitService;
|
||||
@Autowired
|
||||
private IDeviceUnitService deviceUnitService;
|
||||
|
||||
@ -132,5 +142,22 @@ public class DeviceUnitController {
|
||||
return Result.success(deviceUnitService.getEpcList(map));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "项目组的监理赋值给装置的新增字段监理", notes = "项目组的监理赋值给装置的新增字段监理", httpMethod = "GET")
|
||||
@GetMapping(value = "/setNewSupervisingUnitIds")
|
||||
public Result setNewSupervisingUnitIds(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
Map<Long, List<ProjectGroupUnit>> groupMap = projectGroupUnitService.list(null).stream().collect(Collectors.groupingBy(ProjectGroupUnit::getProjectGroupId));
|
||||
List<DeviceUnit> units = deviceUnitService.list();
|
||||
for (DeviceUnit unit : units) {
|
||||
if (StrUtil.isNotBlank(unit.getProjectGroupIds())) {
|
||||
for (String groupId : StrUtil.split(unit.getProjectGroupIds(), ",")) {
|
||||
List<ProjectGroupUnit> unitList = groupMap.get(Convert.toLong(groupId));
|
||||
if (unitList.size() > 0) {
|
||||
unit.setSupervisingUnitIds(StrUtil.join(",", unitList.stream().map(ProjectGroupUnit::getSupervisingUnitId).collect(Collectors.toList())));
|
||||
deviceUnitService.updateById(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.baotou.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
@ -140,4 +141,5 @@ public class ProjectGroupController {
|
||||
return Result.success(projectGroupService.getProjectGroupEnterpriseList(param));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -59,7 +59,6 @@ public class DeviceUnit implements Serializable {
|
||||
@ApiModelProperty(value="排序")
|
||||
private java.lang.Integer sort;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="监理单位ids")
|
||||
private java.lang.String supervisingUnitIds;
|
||||
/**监理单位名称*/
|
||||
@ -72,18 +71,21 @@ public class DeviceUnit implements Serializable {
|
||||
private java.lang.String epcContractorName;
|
||||
/**
|
||||
* 施工单位名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "施工单位名称")
|
||||
private java.lang.String constructionUnitName;
|
||||
/**
|
||||
* 项目组名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "项目组名称")
|
||||
private java.lang.String projectGroupName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "项目组管理id")
|
||||
private java.lang.Long projectGroupId;
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "施工单位名称")
|
||||
private java.lang.String constructionUnitName;
|
||||
/**
|
||||
* 项目组名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "项目组名称")
|
||||
private java.lang.String projectGroupName;
|
||||
// /**
|
||||
// * 这里是对应一个项目组的情况才能用
|
||||
// */
|
||||
// @TableField(exist = false)
|
||||
// @ApiModelProperty(value = "项目组管理id")
|
||||
// @Deprecated
|
||||
// private java.lang.Long projectGroupId;
|
||||
}
|
||||
|
||||
@ -99,15 +99,16 @@ public class ReturnTrainingApplication implements Serializable {
|
||||
private java.lang.String applicantUnitName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "单位安全负责人名称")
|
||||
private java.lang.String unitSafetyOfficerName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "申请人名称")
|
||||
private java.lang.String applicantName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "试卷名称")
|
||||
private java.lang.String paperName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "未考试人数")
|
||||
private java.lang.Integer notExamNum;
|
||||
|
||||
private java.lang.String unitSafetyOfficerName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "申请人名称")
|
||||
private java.lang.String applicantName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "试卷名称")
|
||||
private java.lang.String paperName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "未考试人数")
|
||||
private java.lang.Integer notExamNum;
|
||||
@TableField(exist = false)
|
||||
private java.lang.Long workerId;
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
group_concat(distinct pg.project_group_name) as project_group_name,
|
||||
group_concat(distinct ei.enterprise_name) as epc_contractor_name,
|
||||
group_concat(distinct ei3.enterprise_name) as construction_unit_name,
|
||||
group_concat(distinct pgu.supervising_unit_id) as supervising_unit_ids,
|
||||
group_concat(distinct ei4.enterprise_name) as supervising_unit_name
|
||||
<if test="param.accountType == '6'.toString() ">
|
||||
, group_concat(distinct pg.id) as project_group_ids
|
||||
@ -24,17 +23,17 @@
|
||||
,t.epc_contractor_ids
|
||||
,t.sort
|
||||
,t.id
|
||||
,pgu.project_group_id
|
||||
,t.supervising_unit_ids
|
||||
from
|
||||
device_unit t
|
||||
left join project_group pg on find_in_set(pg.id,t.project_group_ids)
|
||||
left join project_group_unit pgu on pg.id = pgu.project_group_id
|
||||
left join enterprise_info ei on find_in_set(ei.id,t.epc_contractor_ids)
|
||||
left join enterprise_info ei3 on find_in_set(ei3.id,t.construction_unit_ids)
|
||||
left join enterprise_info ei4 on find_in_set(ei4.id,pgu.supervising_unit_id)
|
||||
left join enterprise_info ei4 on find_in_set(ei4.id,t.supervising_unit_ids)
|
||||
where 1=1
|
||||
<if test="param.projectGroupId != null and param.projectGroupId != ''">
|
||||
and pgu.project_group_id = #{param.projectGroupId}
|
||||
and find_in_set(#{param.projectGroupId},t.project_group_ids)
|
||||
</if>
|
||||
<if test="param.projectSn != null and param.projectSn != ''">
|
||||
and t.project_sn = #{param.projectSn}
|
||||
|
||||
@ -33,7 +33,8 @@
|
||||
</select>
|
||||
|
||||
<select id="getBatchByPaper" resultType="com.zhgd.xmgl.modules.baotou.entity.ReturnTrainingApplication">
|
||||
select distinct t.*
|
||||
select distinct t.*,
|
||||
rtd.id as worker_id
|
||||
from return_training_application t
|
||||
join exam_paper ep on ep.id=t.paper_id
|
||||
join return_training_detail rtd on rtd.application_id = t.id
|
||||
@ -47,7 +48,7 @@
|
||||
<select id="getQualifierWorker" resultType="java.util.Map">
|
||||
select
|
||||
t.id
|
||||
,count(distinct etr.worker_card) qualifierNum
|
||||
,count(distinct etr.id) qualifierNum
|
||||
from return_training_application t
|
||||
join exam_train_record etr on etr.application_id=t.id
|
||||
where t.id in
|
||||
@ -63,7 +64,7 @@
|
||||
<select id="getNotExamWorker" resultType="java.util.Map">
|
||||
select
|
||||
t.id
|
||||
,count(distinct wad.id_card) notExamNum
|
||||
,count(distinct wad.id) notExamNum
|
||||
from return_training_application t
|
||||
join return_training_detail wad on wad.application_id=t.id
|
||||
where t.id in
|
||||
@ -71,8 +72,8 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
and not exists(
|
||||
select * from exam_train_record where application_id=t.id and worker_card=wad.id_card and application_type = 2
|
||||
and submit = 1
|
||||
SELECT * FROM exam_train_record etr
|
||||
WHERE etr.application_id = t.id AND etr.worker_id= wad.id AND etr.application_type = 2 AND etr.submit = 1
|
||||
)
|
||||
group by t.id
|
||||
</select>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
,etr.is_pass
|
||||
from return_training_detail t
|
||||
join return_training_application rta on rta.id=t.application_id
|
||||
left join exam_train_record etr on etr.application_id=rta.id and etr.worker_card=t.id_card and etr.submit = 1
|
||||
left join exam_train_record etr on etr.application_id=rta.id and t.id=etr.worker_id and etr.submit = 1
|
||||
LEFT JOIN worker_info a on a.id_card=t.id_card
|
||||
LEFT JOIN team_info b ON a.team_id = b.id
|
||||
LEFT JOIN department_info c ON a.department_id = c.id
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
<select id="getExamQualifierWorker" resultType="java.util.Map">
|
||||
select
|
||||
t.id
|
||||
,count(distinct etr.worker_card) examQualifierNum
|
||||
,count(distinct etr.id) examQualifierNum
|
||||
from worker_admission t
|
||||
join exam_train_record etr on etr.application_id=t.id
|
||||
where t.id in
|
||||
@ -84,7 +84,7 @@
|
||||
<select id="getNotExamWorker" resultType="java.util.Map">
|
||||
select
|
||||
t.id
|
||||
,count(distinct wad.id_card) notExamNum
|
||||
,count(distinct wad.id) notExamNum
|
||||
from worker_admission t
|
||||
join worker_admission_detail wad on wad.worker_admission_id=t.id
|
||||
where t.id in
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package com.zhgd.xmgl.modules.baotou.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ProjectGroup;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.vo.EnterpriseListVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
|
||||
@ -13,42 +14,53 @@ import java.util.List;
|
||||
/**
|
||||
* @Description: 装置管理
|
||||
* @author: pds
|
||||
* @date: 2024-08-06
|
||||
* @date: 2024-08-06
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IDeviceUnitService extends IService<DeviceUnit> {
|
||||
/**
|
||||
* 分页列表查询装置管理信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<DeviceUnit> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询装置管理信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<DeviceUnit> queryList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 添加装置管理信息
|
||||
*
|
||||
* @param deviceUnit 装置管理
|
||||
* @return
|
||||
*/
|
||||
void add(DeviceUnit deviceUnit);
|
||||
|
||||
/**
|
||||
* 编辑装置管理信息
|
||||
*
|
||||
* @param deviceUnit 装置管理
|
||||
* @return
|
||||
*/
|
||||
void edit(DeviceUnit deviceUnit);
|
||||
|
||||
/**
|
||||
* 根据id删除装置管理信息
|
||||
*
|
||||
* @param id 装置管理的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据id查询装置管理信息
|
||||
*
|
||||
* @param id 装置管理的id
|
||||
* @return
|
||||
*/
|
||||
@ -61,4 +73,12 @@ public interface IDeviceUnitService extends IService<DeviceUnit> {
|
||||
List<EnterpriseListVo> getEnterpriseList(HashMap<String, Object> param);
|
||||
|
||||
Page<EnterpriseListVo> getEnterprisePageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 编辑项目组检查装置的绑定关系是否满足
|
||||
*
|
||||
* @param oldProjectGroup
|
||||
* @param projectGroup
|
||||
*/
|
||||
void checkUnitBeUse(ProjectGroup oldProjectGroup, ProjectGroup projectGroup);
|
||||
}
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
package com.zhgd.xmgl.modules.baotou.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ProjectGroup;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.vo.CountEnterpriseVo;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.vo.EnterpriseListVo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ProjectGroup;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.vo.ProjectGroupEnterpriseVo;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -14,42 +12,53 @@ import java.util.Map;
|
||||
/**
|
||||
* @Description: 项目组管理
|
||||
* @author: pds
|
||||
* @date: 2024-08-06
|
||||
* @date: 2024-08-06
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IProjectGroupService extends IService<ProjectGroup> {
|
||||
/**
|
||||
* 分页列表查询项目组管理信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<ProjectGroup> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询项目组管理信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<ProjectGroup> queryList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 添加项目组管理信息
|
||||
*
|
||||
* @param projectGroup 项目组管理
|
||||
* @return
|
||||
*/
|
||||
void add(ProjectGroup projectGroup);
|
||||
|
||||
/**
|
||||
* 编辑项目组管理信息
|
||||
*
|
||||
* @param projectGroup 项目组管理
|
||||
* @return
|
||||
*/
|
||||
void edit(ProjectGroup projectGroup);
|
||||
|
||||
/**
|
||||
* 根据id删除项目组管理信息
|
||||
*
|
||||
* @param id 项目组管理的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据id查询项目组管理信息
|
||||
*
|
||||
* @param id 项目组管理的id
|
||||
* @return
|
||||
*/
|
||||
@ -57,7 +66,13 @@ public interface IProjectGroupService extends IService<ProjectGroup> {
|
||||
|
||||
void saveObj(ProjectGroup projectGroup);
|
||||
|
||||
/**
|
||||
* 列表查询项目组下的承包商信息(去重)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
ProjectGroupEnterpriseVo getProjectGroupEnterpriseList(HashMap<String, Object> param);
|
||||
|
||||
List<Map<String ,Object>> getTreeList(HashMap<String, Object> param);
|
||||
List<Map<String, Object>> getTreeList(HashMap<String, Object> param);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.zhgd.xmgl.modules.baotou.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -11,10 +13,13 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.constant.Cts;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ProjectGroup;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.UserDevGroup;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.vo.EnterpriseListVo;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.vo.ProjectGroupEnterpriseVo;
|
||||
import com.zhgd.xmgl.modules.baotou.mapper.DeviceUnitMapper;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IDeviceUnitService;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IProjectGroupService;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IProjectGroupUnitService;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IUserDevGroupService;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectEnterpriseService;
|
||||
@ -32,6 +37,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -63,6 +69,9 @@ public class DeviceUnitServiceImpl extends ServiceImpl<DeviceUnitMapper, DeviceU
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IDeviceUnitService deviceUnitService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IProjectGroupService projectGroupService;
|
||||
|
||||
@Override
|
||||
public IPage<DeviceUnit> queryPageList(HashMap<String, Object> param) {
|
||||
@ -224,4 +233,81 @@ public class DeviceUnitServiceImpl extends ServiceImpl<DeviceUnitMapper, DeviceU
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUnitBeUse(ProjectGroup oldProjectGroup, ProjectGroup projectGroup) {
|
||||
//Key是单位名称,val是装置名称
|
||||
Map<String, List<String>> useMap = new HashMap<>();
|
||||
Map<Long, EnterpriseInfo> enterpriseIdMap = BeanUtil.copyToList(enterpriseInfoService.getEnterpriseInfoList(new MapBuilder<String, Object>().put(Cts.PROJECT_SN, projectGroup.getProjectSn()).put(Cts.IGNORE_DATA_SCOPE, 1).build()), EnterpriseInfo.class)
|
||||
.stream().collect(Collectors.toMap(EnterpriseInfo::getId, Function.identity(), (o1, o2) -> o1));
|
||||
List<DeviceUnit> deviceUnits = deviceUnitService.queryList(new MapBuilder<String, Object>()
|
||||
.put("projectSn", projectGroup.getProjectSn())
|
||||
.put("projectGroupId", projectGroup.getId())
|
||||
.build());
|
||||
for (DeviceUnit unit : deviceUnits) {
|
||||
String supervisingUnitIds = unit.getSupervisingUnitIds();
|
||||
String epcContractorIds = unit.getEpcContractorIds();
|
||||
String constructionUnitIds = unit.getConstructionUnitIds();
|
||||
ProjectGroupEnterpriseVo vo = projectGroupService.getProjectGroupEnterpriseList(new MapBuilder<String, Object>()
|
||||
.put("projectGroupIds", unit.getProjectGroupIds())
|
||||
.put("supervisingUnitIds", supervisingUnitIds)
|
||||
.put("epcContractorIds", epcContractorIds)
|
||||
.build());
|
||||
if (StrUtil.isNotBlank(supervisingUnitIds)) {
|
||||
for (String id : StrUtil.split(supervisingUnitIds, ",")) {
|
||||
Long idLong = Convert.toLong(id);
|
||||
if (!vo.getSupervisingUnitIds().contains(idLong)) {
|
||||
String enterpriseName = enterpriseIdMap.get(idLong).getEnterpriseName();
|
||||
List<String> list = useMap.get(enterpriseName);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
list.add(unit.getDeviceUnitName());
|
||||
useMap.put(enterpriseName, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(epcContractorIds)) {
|
||||
for (String id : StrUtil.split(epcContractorIds, ",")) {
|
||||
Long idLong = Convert.toLong(id);
|
||||
if (!vo.getEpcContractorIds().contains(idLong)) {
|
||||
String enterpriseName = enterpriseIdMap.get(idLong).getEnterpriseName();
|
||||
List<String> list = useMap.get(enterpriseName);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
list.add(unit.getDeviceUnitName());
|
||||
useMap.put(enterpriseName, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(constructionUnitIds)) {
|
||||
for (String id : StrUtil.split(constructionUnitIds, ",")) {
|
||||
if (!vo.getConstructionUnitIds().contains(id)) {
|
||||
String enterpriseName = enterpriseIdMap.get(Convert.toLong(id)).getEnterpriseName();
|
||||
List<String> list = useMap.get(enterpriseName);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
list.add(unit.getDeviceUnitName());
|
||||
useMap.put(enterpriseName, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
StringBuilder errorSb = new StringBuilder("");
|
||||
if (CollUtil.isNotEmpty(useMap)) {
|
||||
for (Map.Entry<String, List<String>> entry : useMap.entrySet()) {
|
||||
if (StrUtil.isNotBlank(errorSb.toString())) {
|
||||
errorSb.append(",");
|
||||
}
|
||||
errorSb.append(entry.getKey());
|
||||
errorSb.append("已被");
|
||||
errorSb.append(StrUtil.join(",", entry.getValue()));
|
||||
errorSb.append("装置绑定");
|
||||
}
|
||||
throw new OpenAlertException("编辑失败," + errorSb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.zhgd.xmgl.modules.baotou.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -131,9 +130,11 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@DistributedLock(keyPrefix = "project_group:", key = "#projectGroup.projectSn", tryLok = true, lockTime = 0)
|
||||
public void saveObj(ProjectGroup projectGroup) {
|
||||
boolean update = false;
|
||||
Long id = projectGroup.getId();
|
||||
List<Long> oldSupervisingUnitIds = new ArrayList<>();
|
||||
if (id != null) {
|
||||
checkBeUsed(projectGroup);
|
||||
update = true;
|
||||
baseMapper.updateById(projectGroup);
|
||||
} else {
|
||||
baseMapper.insert(projectGroup);
|
||||
@ -147,33 +148,12 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
||||
projectGroupUnit.setProjectSn(projectGroup.getProjectSn());
|
||||
projectGroupUnitMapper.insert(projectGroupUnit);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBeUsed(ProjectGroup projectGroup) {
|
||||
List<DeviceUnit> deviceUnits = deviceUnitService.list(new LambdaQueryWrapper<DeviceUnit>()
|
||||
.apply("find_in_set({0},project_group_ids)", projectGroup.getId()));
|
||||
List<String> groupIds = deviceUnits.stream().flatMap(deviceUnit -> StrUtil.split(deviceUnit.getProjectGroupIds(), ",").stream()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(groupIds)) {
|
||||
List<ProjectGroupUnit> projectGroupUnits = projectGroupUnitMapper.selectList(new LambdaQueryWrapper<ProjectGroupUnit>().in(ProjectGroupUnit::getProjectGroupId, groupIds).ne(ProjectGroupUnit::getProjectGroupId, projectGroup.getId()));
|
||||
projectGroupUnits.addAll(projectGroup.getProjectGroupUnitList());
|
||||
List<String> gConstructionUnitIds = projectGroupUnits.stream().flatMap(projectGroupUnit -> StrUtil.split(projectGroupUnit.getConstructionUnitIds(), ",").stream()).collect(Collectors.toList());
|
||||
List<Long> gEpcContractorIds = projectGroupUnits.stream().map(ProjectGroupUnit::getEpcContractorId).collect(Collectors.toList());
|
||||
for (DeviceUnit u : deviceUnits) {
|
||||
String constructionUnitIds = u.getConstructionUnitIds();
|
||||
String epcContractorIds = u.getEpcContractorIds();
|
||||
// for (String constructionUnitId : StrUtil.split(constructionUnitIds, ",")) {
|
||||
// if (gConstructionUnitIds.stream().noneMatch(constructionUnitId::equals)) {
|
||||
// throw new OpenAlertException("编辑失败,解绑的施工单位已被装置使用!");
|
||||
// }
|
||||
// }
|
||||
// for (String epcContractorId : StrUtil.split(epcContractorIds, ",")) {
|
||||
// if (gEpcContractorIds.stream().noneMatch(s -> epcContractorId.equals(String.valueOf(s)))) {
|
||||
// throw new OpenAlertException("编辑失败,解绑的EPC承包商已被装置使用!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//编辑项目组检查装置的绑定关系是否满足
|
||||
if (update) {
|
||||
ProjectGroup oldPg = this.getById(id);
|
||||
deviceUnitService.checkUnitBeUse(oldPg, projectGroup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -107,6 +107,7 @@ public class ExamCourseCommentController {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
examCourseComment.setCreateBy(user.getUserId().toString());
|
||||
examCourseCommentService.save(examCourseComment);
|
||||
System.out.println();
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ package com.zhgd.xmgl.modules.exam.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -11,6 +13,8 @@ import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IReturnTrainingApplicationService;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IWorkerAdmissionService;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamAnswerQuestion;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamTrainRecord;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainRecordService;
|
||||
@ -27,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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;
|
||||
@ -37,7 +42,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Struct;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@ -53,8 +57,14 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Api(tags = "教育培训记录信息管理")
|
||||
public class ExamTrainRecordController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
IReturnTrainingApplicationService returnTrainingApplicationService;
|
||||
@Autowired
|
||||
private IExamTrainRecordService examTrainRecordService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IWorkerAdmissionService workerAdmissionService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -145,7 +155,6 @@ public class ExamTrainRecordController {
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@ -352,7 +361,8 @@ public class ExamTrainRecordController {
|
||||
mp.put("idCard", p.getIdCard());
|
||||
mp.put("typeName", p.getTypeName());
|
||||
mp.put("certificateNumber", p.getCertificateNumber());
|
||||
mp.put("issueCompany", p.getIssueCompany());
|
||||
List<String> ic = Arrays.asList("市场监督管理局", "应急管理局", "住房和城乡建设厅", "人力资源和社会保障部(厅)");
|
||||
mp.put("issueCompany", Convert.toInt(p.getIssueCompany()) != null ? CollUtil.get(ic, Convert.toInt(p.getIssueCompany()) - 1) : "");
|
||||
mp.put("issueTime", p.getIssueTime());
|
||||
mp.put("effectTime", p.getEffectTime());
|
||||
mp.put("enterpriseName", p.getEnterpriseName());
|
||||
|
||||
@ -498,7 +498,7 @@ public class ExamWorkerController {
|
||||
map.put("id", o.getId());
|
||||
map.put("time", DateUtil.formatDateTime(o.getApprovalTime()));
|
||||
map.put("applicationType", 2);
|
||||
map.put("workerId", null);
|
||||
map.put("workerId", o.getWorkerId());
|
||||
return map;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@ -168,6 +168,7 @@
|
||||
wc.photo_url as photo_url,
|
||||
es.name subject_name,
|
||||
p.name exam_paper_name
|
||||
,ec.exam_paper_id
|
||||
from exam_train_record ec
|
||||
join exam_paper p on ec.exam_paper_id = p.id
|
||||
join exam_subject es on p.subject_id = es.id
|
||||
@ -205,6 +206,7 @@
|
||||
wc.photo_url as photo_url,
|
||||
es.name subject_name,
|
||||
p.name exam_paper_name
|
||||
,ec.exam_paper_id
|
||||
from exam_train_record ec
|
||||
join exam_paper p on ec.exam_paper_id = p.id
|
||||
join exam_subject es on p.subject_id = es.id
|
||||
@ -212,7 +214,7 @@
|
||||
left join enterprise_info ei on ei.id=wi.enterprise_id
|
||||
left join (select wc1.* from worker_admission_certificate_detail wc1 join (select
|
||||
worker_admission_detail_id,certificate_number from worker_admission_certificate_detail group
|
||||
by worker_admission_detail_id)t on t.worker_admission_detail_id=wc1.id
|
||||
by worker_admission_detail_id)t on t.worker_admission_detail_id=wc1.worker_admission_detail_id
|
||||
where 1=1
|
||||
<if test="param.projectSn != null and param.projectSn != ''">
|
||||
and wc1.project_sn = #{param.projectSn}
|
||||
|
||||
@ -464,7 +464,7 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
trainRecord = new ExamTrainRecordVo();
|
||||
this.setQuestionsIf(paper, trainRecord);
|
||||
Long workerId = MapUtils.getLong(param, "workerId");
|
||||
trainRecord.setWorkerId(applicationType == 1 ? workerId : id);
|
||||
trainRecord.setWorkerId(workerId);
|
||||
trainRecord.setWorkerName(wn);
|
||||
trainRecord.setWorkerTeam(teamName);
|
||||
trainRecord.setWorkerType(typeName);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user