班组管理功能开发

This commit is contained in:
liang.chao 2025-07-22 17:10:28 +08:00
parent 72ade4a49e
commit acacc5f98e
13 changed files with 142 additions and 20 deletions

View File

@ -68,4 +68,5 @@ public class OrganizationalBean {
private String title; private String title;
private String orgType; private String orgType;
private Integer pParentId;
} }

View File

@ -15,6 +15,8 @@ public class TeamGroupBean {
// 所属项目 // 所属项目
private String project; private String project;
private String projectId; private String projectId;
private String pParentId;
private String parentId;
// 班组名称 // 班组名称
private String teamGroupName; private String teamGroupName;
// 班组长 // 班组长

View File

@ -187,4 +187,8 @@ public interface OrganizationalDao{
List<OrganizationalBean> getProjectSelect(OrganizationalBean bean); List<OrganizationalBean> getProjectSelect(OrganizationalBean bean);
int getUser(OrganizationalBean bean); int getUser(OrganizationalBean bean);
int addData2(OrganizationalBean bean);
Integer getpParentId(OrganizationalBean bean);
} }

View File

@ -54,4 +54,6 @@ public interface TeamGroupDao {
TeamGroupBean selectTeamLeaser(TeamGroupBean groupBean); TeamGroupBean selectTeamLeaser(TeamGroupBean groupBean);
List<TeamGroupBean> getTeamGroupPersons(TeamGroupBean teamGroupBean); List<TeamGroupBean> getTeamGroupPersons(TeamGroupBean teamGroupBean);
String getSubContractorName(TeamGroupBean groupBean);
} }

View File

@ -230,7 +230,8 @@ public class OrganizationalServiceImpl implements OrganizationalService {
ar.setResMsg("外包商退场暂未开放!"); ar.setResMsg("外包商退场暂未开放!");
return ar; return ar;
} }
Integer pParentId = mapper.getpParentId(bean);
bean.setPParentId(pParentId);
int num = mapper.userOutData(bean); int num = mapper.userOutData(bean);
// mapper.theTeamExits(bean); // mapper.theTeamExits(bean);
if (num > 0) { if (num > 0) {
@ -366,8 +367,13 @@ public class OrganizationalServiceImpl implements OrganizationalService {
ar.setFailMsg("该班组名称已存在"); ar.setFailMsg("该班组名称已存在");
return ar; return ar;
} }
int num;
if (StringUtils.isBlank(bean.getParentId())) {
num = mapper.addData2(bean);
} else {
num = mapper.addData(bean);
}
int num = mapper.addData(bean);
if (num > 0) { if (num > 0) {
// 新增班组类型 // 新增班组类型
mapper.insetTeamGroupType(bean); mapper.insetTeamGroupType(bean);

View File

@ -75,12 +75,6 @@ public class PersonServiceImpl implements PersonService {
public AjaxRes updatePerson(PersonBean o) { public AjaxRes updatePerson(PersonBean o) {
AjaxRes ar = new AjaxRes(); AjaxRes ar = new AjaxRes();
try { try {
// 先查询该人员手机号是否有重复
Integer count = dao.getPerSonByPhone(o);
if (count > 0) {
ar.setFailMsg("该手机号已存在");
return ar;
}
o.setDeptId(StringUtils.isBlank(o.getDeptId()) ? "0" : o.getDeptId()); o.setDeptId(StringUtils.isBlank(o.getDeptId()) ? "0" : o.getDeptId());
dao.deletePersonRole(o.getId()); dao.deletePersonRole(o.getId());
dao.updatePerson(o); dao.updatePerson(o);
@ -89,7 +83,7 @@ public class PersonServiceImpl implements PersonService {
} catch (Exception e) { } catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.printStackTrace(); e.printStackTrace();
ar.setFailMsg("修改失败"); ar.setFailMsg("修改失败,该手机号已存在");
} }
return ar; return ar;
} }

View File

@ -1,6 +1,8 @@
package com.bonus.gs.sub.evaluate.evaluate.service; package com.bonus.gs.sub.evaluate.evaluate.service;
import com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean;
import com.bonus.gs.sub.evaluate.evaluate.beans.TeamGroupBean; import com.bonus.gs.sub.evaluate.evaluate.beans.TeamGroupBean;
import com.bonus.gs.sub.evaluate.evaluate.dao.OrganizationalDao;
import com.bonus.gs.sub.evaluate.evaluate.dao.TeamGroupDao; import com.bonus.gs.sub.evaluate.evaluate.dao.TeamGroupDao;
import com.bonus.gs.sub.evaluate.manager.utils.AesCbcUtils; import com.bonus.gs.sub.evaluate.manager.utils.AesCbcUtils;
import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes; import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
@ -27,16 +29,25 @@ public class TeamGroupServiceImpl implements TeamGroupService {
@Autowired @Autowired
private TeamGroupDao teamGroupDao; private TeamGroupDao teamGroupDao;
@Autowired
private OrganizationalDao mapper;
@Override @Override
public List<TeamGroupBean> getTeamGroupList(TeamGroupBean teamGroupBean) { public List<TeamGroupBean> getTeamGroupList(TeamGroupBean teamGroupBean) {
if (!UserUtil.getLoginUser().getRoleId().equals("1")){ if (!UserUtil.getLoginUser().getRoleId().equals("1")) {
teamGroupBean.setUserId(Integer.parseInt(String.valueOf(UserUtil.getLoginUser().getId()))); teamGroupBean.setUserId(Integer.parseInt(String.valueOf(UserUtil.getLoginUser().getId())));
} }
List<TeamGroupBean> teamGroupList = teamGroupDao.getTeamGroupList(teamGroupBean); List<TeamGroupBean> teamGroupList = teamGroupDao.getTeamGroupList(teamGroupBean);
for (TeamGroupBean groupBean : teamGroupList) { for (TeamGroupBean groupBean : teamGroupList) {
/*if ((StringUtils.isBlank(groupBean.getParentId()) && groupBean.getStatus() == 0) || StringUtils.isBlank(groupBean.getSubContractor())) {
groupBean.setSubContractor(teamGroupDao.getSubContractorName(groupBean));
}*/
if (groupBean.getStatus() == 0) {
// groupBean.setSubContractor(teamGroupDao.getSubContractorName(groupBean));
groupBean.setProject(null);
}
TeamGroupBean bean = teamGroupDao.selectTeamLeaser(groupBean); TeamGroupBean bean = teamGroupDao.selectTeamLeaser(groupBean);
if (bean != null){ if (bean != null) {
groupBean.setName(bean.getName()); groupBean.setName(bean.getName());
String phone = bean.getPhone(); String phone = bean.getPhone();
if (StringUtils.isNotBlank(phone)) { if (StringUtils.isNotBlank(phone)) {
@ -49,6 +60,15 @@ public class TeamGroupServiceImpl implements TeamGroupService {
@Override @Override
public void updaTeteamGroup(TeamGroupBean teamGroupBean) { public void updaTeteamGroup(TeamGroupBean teamGroupBean) {
if (StringUtils.isNotBlank(teamGroupBean.getParentId())) {
// 根据外包商id(project_assignment)和项目id获取组织架构(pm_org_info)中外包商id
OrganizationalBean organizationalBean = new OrganizationalBean();
organizationalBean.setParentId(teamGroupBean.getParentId());
organizationalBean.setId(teamGroupBean.getPParentId());
String id = mapper.getsubcontractorId(organizationalBean);
teamGroupBean.setParentId(id);
teamGroupBean.setStatus(1);
}
teamGroupDao.updaTeteamGroup(teamGroupBean); teamGroupDao.updaTeteamGroup(teamGroupBean);
Integer i = teamGroupDao.selectTeteamType(teamGroupBean); Integer i = teamGroupDao.selectTeteamType(teamGroupBean);
if (i > 0) { if (i > 0) {

View File

@ -70,7 +70,7 @@
<!--更新 退场--> <!--更新 退场-->
<update id="userOutData"> <update id="userOutData">
update pm_org_info update pm_org_info
set status=2 set status = 0,p_parent_id = #{pParentId}
where id = #{id} where id = #{id}
</update> </update>
<update id="updateDept"> <update id="updateDept">
@ -234,6 +234,39 @@
insert into team_person(team_id, name, id_card, phone,sex,work_type,face_url,is_team_leader) insert into team_person(team_id, name, id_card, phone,sex,work_type,face_url,is_team_leader)
values (#{id}, #{userName},#{idCard}, #{userPhone}, #{sex}, #{workType}, #{faceUrl}, #{isTeamLeader}) values (#{id}, #{userName},#{idCard}, #{userPhone}, #{sex}, #{workType}, #{faceUrl}, #{isTeamLeader})
</insert> </insert>
<insert id="addData2" useGeneratedKeys="true" keyProperty="id">
insert into pm_org_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="level != null">level,</if>
<if test="parentId != null and parentId != ''">parent_id,</if>
<if test="userName != null">user_name,</if>
<if test="userId != null and userId != ''">user_id,</if>
<if test="idCard != null">id_card,</if>
<if test="sex != null">sex,</if>
<if test="userPhone != null">user_phone,</if>
<if test="orgType != null">org_type,</if>
<if test="lkId != null">lk_id,</if>
<if test="tableSource != null">table_source,</if>
<if test="id != null and id != ''">p_parent_id,</if>
status
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="level != null">#{level},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="userName != null">#{userName},</if>
<if test="userId != null and userId != ''">#{userId},</if>
<if test="idCard != null and idCard != ''">#{idCard},</if>
<if test="sex != null">#{sex},</if>
<if test="userPhone != null and userPhone != ''">#{userPhone},</if>
<if test="orgType != null">#{orgType},</if>
<if test="lkId != null">#{lkId},</if>
<if test="tableSource != null">#{tableSource},</if>
<if test="id != null and id != ''">#{id},</if>
0
</trim>
</insert>
<select id="getUserList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean"> <select id="getUserList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean">
select NAME userName, LOGIN_NAME idCard, SEX, TELPHONE userPhone, dept_id tableId select NAME userName, LOGIN_NAME idCard, SEX, TELPHONE userPhone, dept_id tableId
FROM gs_exam.pm_user FROM gs_exam.pm_user
@ -326,4 +359,18 @@
from team_person from team_person
where id_card = #{idCard} or phone = #{userPhone} where id_card = #{idCard} or phone = #{userPhone}
</select> </select>
<select id="getpParentId" resultType="java.lang.Integer">
SELECT
lk_id
FROM
pm_org_info
WHERE
id in (
SELECT
parent_id
FROM
pm_org_info
WHERE
id = #{id})
</select>
</mapper> </mapper>

View File

@ -23,7 +23,15 @@
</update> </update>
<update id="updaTeteamGroup"> <update id="updaTeteamGroup">
update pm_org_info set name = #{teamGroupName} where id = #{id} UPDATE pm_org_info
SET name = #{teamGroupName}
<if test="parentId != null and parentId != ''">
, parent_id = #{parentId}
</if>
<if test="status != null">
, status = #{status}
</if>
WHERE id = #{id}
</update> </update>
<update id="updateTeamPerson"> <update id="updateTeamPerson">
update team_person set name = #{name},id_card = #{idCard},phone = #{phone},sex = #{sex},work_type = #{workType},face_url = #{faceUrl} update team_person set name = #{name},id_card = #{idCard},phone = #{phone},sex = #{sex},work_type = #{workType},face_url = #{faceUrl}
@ -46,6 +54,8 @@
poi3.user_id as userId, poi3.user_id as userId,
poi.NAME teamGroupName, poi.NAME teamGroupName,
poi.id as id, poi.id as id,
poi.parent_id as parentId,
poi.p_parent_id as pParentId,
poi.status as status, poi.status as status,
td.id as teamTypeId, td.id as teamTypeId,
td.val teamType, td.val teamType,
@ -59,7 +69,6 @@
left join team_person tp on poi.id = tp.team_id left join team_person tp on poi.id = tp.team_id
WHERE WHERE
poi.`level` = 5 poi.`level` = 5
AND poi.`status` IN (1,2)
<if test="userId != null "> <if test="userId != null ">
and poi3.user_id = #{userId} and poi3.user_id = #{userId}
</if> </if>
@ -174,4 +183,9 @@
phone phone
FROM team_person WHERE team_id = #{id} and is_team_leader = 0 FROM team_person WHERE team_id = #{id} and is_team_leader = 0
</select> </select>
<select id="getSubContractorName" resultType="java.lang.String">
SELECT pa.enterpriseName FROM pm_org_info poi
left join project_assignment pa on poi.p_parent_id = pa.id
WHERE poi.p_parent_id = #{pParentId} limit 1
</select>
</mapper> </mapper>

View File

@ -68,8 +68,12 @@ function initTable() {
{field: "corporateName", align: "center", title: "法人"}, {field: "corporateName", align: "center", title: "法人"},
{ field: 'phone', title: '法人联系方式', width: '15%', align: "center", { field: 'phone', title: '法人联系方式', width: '15%', align: "center",
templet: function (d) { templet: function (d) {
if (d.phone) {
let phone = decryptCBC(d.phone); let phone = decryptCBC(d.phone);
return maskSensitiveInfo(phone, "phone"); return maskSensitiveInfo(phone, "phone");
} else {
return "";
}
} }
}, },
{ {

View File

@ -7,6 +7,10 @@ function setParams(obj, layerIndex) {
objParam = JSON.parse(obj); objParam = JSON.parse(obj);
window.layerIndex = layerIndex; window.layerIndex = layerIndex;
getTeamGroupType(objParam.teamTypeId); getTeamGroupType(objParam.teamTypeId);
if (objParam.status == 0){
$("#projectDiv").css("display", "");
getPromanagerSelect(objParam.pparentId);
}
// 字段回显 // 字段回显
$("#teamGroupName").val(objParam.teamGroupName); $("#teamGroupName").val(objParam.teamGroupName);
id = objParam.id; id = objParam.id;
@ -25,7 +29,19 @@ function setParams(obj, layerIndex) {
function saveData2() { function saveData2() {
$("#formSubmit").trigger("click"); $("#formSubmit").trigger("click");
} }
// 根据外包商获取项目下拉数据(支持传参)
function getPromanagerSelect(subContractorId) {
$.ajax({
type: 'POST',
url: ctxPath + '/organizational/getProjectBySubContractor',
data: {
id: subContractorId
},
success: function (data) {
setSelectValue(data.obj, 'project');
}
});
}
// 提交 // 提交
function updateName(data, id) { function updateName(data, id) {
let loadingMsg = layer.msg("正在提交保存,请稍等...", { let loadingMsg = layer.msg("正在提交保存,请稍等...", {
@ -38,6 +54,8 @@ function updateName(data, id) {
id: id, id: id,
teamGroupName: data.field.teamGroupName, teamGroupName: data.field.teamGroupName,
teamType: data.field.teamType, teamType: data.field.teamType,
parentId: data.field.project,
pparentId: objParam.pparentId,
}; };
// console.log(JSON.stringify(data)+"data") // console.log(JSON.stringify(data)+"data")
$.ajax({ $.ajax({

View File

@ -102,10 +102,10 @@
</div> </div>
<!-- 所属项目 --> <!-- 所属项目 -->
<div class="layui-form-item" style="margin-top: 1%;"> <div class="layui-form-item" style="margin-top: 1%;">
<label class="layui-form-label"><span class="required_icon">*</span>所属项目</label> <label class="layui-form-label"><span class="required_icon"></span>所属项目</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select id="project" name="project" class="layui-select" lay-search <select id="project" name="project" class="layui-select" lay-search
lay-verify="required" style="height: 36px;"></select> style="height: 36px;"></select>
</div> </div>
</div> </div>
<!-- 班组类型 --> <!-- 班组类型 -->

View File

@ -78,6 +78,16 @@
</div> </div>
</div> </div>
<div style="width: 100%;height: 100%;display: none;" id="projectDiv">
<div class="layui-form-item" style="margin-top: 1%;display: flex;width: 100%">
<label class="layui-form-label"><span class="required_icon"></span>所属项目</label>
<div class="layui-input-inline" style="width: 200px;">
<select id="project" name="project" class="layui-select" lay-search
style="height: 36px;"></select>
</div>
</div>
</div>
<button type="submit" id="formSubmit" class="layui-btn" lay-submit="" lay-filter="formData" <button type="submit" id="formSubmit" class="layui-btn" lay-submit="" lay-filter="formData"
style="display: none;"></button> style="display: none;"></button>
</form> </form>