班组管理

This commit is contained in:
jjLv 2024-07-25 18:16:59 +08:00
parent 39e9350818
commit c3fc2a211f
10 changed files with 131 additions and 30 deletions

View File

@ -2,6 +2,7 @@ package com.bonus.aqgqj.basis.controller;
import com.bonus.aqgqj.annotation.DecryptAndVerify; import com.bonus.aqgqj.annotation.DecryptAndVerify;
import com.bonus.aqgqj.annotation.LogAnnotation; import com.bonus.aqgqj.annotation.LogAnnotation;
import com.bonus.aqgqj.base.entity.SelectEntity;
import com.bonus.aqgqj.basis.dao.CustomDao; import com.bonus.aqgqj.basis.dao.CustomDao;
import com.bonus.aqgqj.basis.entity.vo.BaseCustom; import com.bonus.aqgqj.basis.entity.vo.BaseCustom;
import com.bonus.aqgqj.basis.entity.vo.BaseTeam; import com.bonus.aqgqj.basis.entity.vo.BaseTeam;
@ -10,6 +11,7 @@ import com.bonus.aqgqj.basis.service.CustomService;
import com.bonus.aqgqj.basis.service.TeamService; import com.bonus.aqgqj.basis.service.TeamService;
import com.bonus.aqgqj.system.vo.EncryptedReq; import com.bonus.aqgqj.system.vo.EncryptedReq;
import com.bonus.aqgqj.utils.ServerResponse; import com.bonus.aqgqj.utils.ServerResponse;
import com.bonus.aqgqj.webResult.StringUtils;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -84,12 +86,9 @@ public class TeamController {
if (u != null) { if (u != null) {
return ServerResponse.createErroe("班组名称 “"+data.getData().getTeamName() + "” 已存在"); return ServerResponse.createErroe("班组名称 “"+data.getData().getTeamName() + "” 已存在");
} }
// if(StringHelper.isNotEmpty(data.getData().getCustomPhone())){
// BaseCustom u2 = customService.getCustomPhone(data.getData().getCustomPhone(),data.getData().getCustomId()); String teamTypeName = teamService.getTypeName(data.getData().getTeamTypeCode());
// if (u2 != null ) { data.getData().setTeamTypeName(teamTypeName);
// return ServerResponse.createErroe("手机号"+data.getData().getCustomPhone() + "已存在");
// }
// }
teamService.updateTeam(data.getData()); teamService.updateTeam(data.getData());
return ServerResponse.createBySuccessMsg("操作成功"); return ServerResponse.createBySuccessMsg("操作成功");
}catch (Exception e){ }catch (Exception e){
@ -108,6 +107,8 @@ public class TeamController {
if (u != null) { if (u != null) {
return ServerResponse.createErroe("客户名称 “"+data.getData().getTeamName() + "” 已存在"); return ServerResponse.createErroe("客户名称 “"+data.getData().getTeamName() + "” 已存在");
} }
String teamTypeName = teamService.getTypeName(data.getData().getTeamTypeCode());
data.getData().setTeamTypeName(teamTypeName);
teamService.add(data.getData()); teamService.add(data.getData());
return ServerResponse.createBySuccessMsg("操作成功"); return ServerResponse.createBySuccessMsg("操作成功");
}catch (Exception e){ }catch (Exception e){
@ -118,19 +119,41 @@ public class TeamController {
@PostMapping(value = "delById") @PostMapping(value = "delById")
@DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理 @DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "注销客户", operDesc = "系统级事件",operType="删除") @LogAnnotation(operModul = "基础管理-班组管理", operation = "删除班组", operDesc = "系统级事件",operType="删除")
@PreAuthorize("@pms.hasPermission('base:team:del')") @PreAuthorize("@pms.hasPermission('base:team:del')")
public ServerResponse delTeam(EncryptedReq<BaseTeam> data) { public ServerResponse delTeam(EncryptedReq<BaseTeam> data) {
try { try {
if (teamService.delTeam(data.getData().getTeamId())== 1){ if(data.getData().getCountuser()!=0){
return ServerResponse.createBySuccessMsg("注销成功"); return ServerResponse.createBySuccessMsg("该班组人数不为0无法删除");
}else { }else{
return ServerResponse.createErroe("注销失败"); if (teamService.delTeam(data.getData().getTeamId())== 1){
return ServerResponse.createBySuccessMsg("删除成功");
}else {
return ServerResponse.createErroe("删除失败");
}
} }
}catch (Exception e){ }catch (Exception e){
log.error(e.toString(),e); log.error(e.toString(),e);
} }
return ServerResponse.createErroe("操作失败"); return ServerResponse.createErroe("操作失败");
}
@PostMapping(value = "all")
@LogAnnotation(operModul = "班组成员配置", operation = "查询所有班组", operDesc = "系统级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:teamconfig:query')" )
public ServerResponse getAll() {
try {
String value = "team_type";
SelectEntity dict = teamService.teamValue(value);
List<SelectEntity> list = teamService.teamType(dict.getId());
return ServerResponse.createSuccess(list);
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
} }
} }

View File

@ -1,5 +1,6 @@
package com.bonus.aqgqj.basis.dao; package com.bonus.aqgqj.basis.dao;
import com.bonus.aqgqj.base.entity.SelectEntity;
import com.bonus.aqgqj.basis.entity.vo.BaseCustom; import com.bonus.aqgqj.basis.entity.vo.BaseCustom;
import com.bonus.aqgqj.basis.entity.vo.BaseTeam; import com.bonus.aqgqj.basis.entity.vo.BaseTeam;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -24,4 +25,10 @@ public interface TeamDao {
int add(BaseTeam team); int add(BaseTeam team);
int delTeam(Long teamId); int delTeam(Long teamId);
SelectEntity teamValue(String value);
List<SelectEntity> teamType(String id);
String getTypeName(String teamTypeId);
} }

View File

@ -14,6 +14,8 @@ public class BaseTeam extends PageEntity {
private String teamName; private String teamName;
private String teamTypeCode;
private String teamTypeName; private String teamTypeName;
private String teamLeader; private String teamLeader;

View File

@ -1,5 +1,6 @@
package com.bonus.aqgqj.basis.service; package com.bonus.aqgqj.basis.service;
import com.bonus.aqgqj.base.entity.SelectEntity;
import com.bonus.aqgqj.basis.entity.vo.BaseCustom; import com.bonus.aqgqj.basis.entity.vo.BaseCustom;
import com.bonus.aqgqj.basis.entity.vo.BaseTeam; import com.bonus.aqgqj.basis.entity.vo.BaseTeam;
import com.bonus.aqgqj.utils.ServerResponse; import com.bonus.aqgqj.utils.ServerResponse;
@ -25,4 +26,9 @@ public interface TeamService {
int delTeam(Long teamId); int delTeam(Long teamId);
SelectEntity teamValue(String value);
List<SelectEntity> teamType(String id);
String getTypeName(String teamTypeId);
} }

View File

@ -1,5 +1,6 @@
package com.bonus.aqgqj.basis.service.impl; package com.bonus.aqgqj.basis.service.impl;
import com.bonus.aqgqj.base.entity.SelectEntity;
import com.bonus.aqgqj.basis.dao.CustomDao; import com.bonus.aqgqj.basis.dao.CustomDao;
import com.bonus.aqgqj.basis.dao.TeamDao; import com.bonus.aqgqj.basis.dao.TeamDao;
import com.bonus.aqgqj.basis.entity.vo.BaseCustom; import com.bonus.aqgqj.basis.entity.vo.BaseCustom;
@ -91,4 +92,20 @@ public class TeamServiceImpl implements TeamService {
public int delTeam(Long teamId) { public int delTeam(Long teamId) {
return teamDao.delTeam(teamId); return teamDao.delTeam(teamId);
} }
@Override
public SelectEntity teamValue(String value) {
return teamDao.teamValue(value);
}
@Override
public List<SelectEntity> teamType(String id) {
return teamDao.teamType(id);
}
@Override
public String getTypeName(String teamTypeId) {
return teamDao.getTypeName(teamTypeId);
}
} }

View File

@ -4,6 +4,7 @@
<resultMap type="com.bonus.aqgqj.basis.entity.vo.BaseTeam" id="BaseTeamResult"> <resultMap type="com.bonus.aqgqj.basis.entity.vo.BaseTeam" id="BaseTeamResult">
<id property="teamId" column="id" /> <id property="teamId" column="id" />
<result property="teamName" column="team_name" /> <result property="teamName" column="team_name" />
<result property="teamTypeCode" column="team_type_code" />
<result property="teamTypeName" column="team_type_name" /> <result property="teamTypeName" column="team_type_name" />
<result property="teamLeader" column="team_leader" /> <result property="teamLeader" column="team_leader" />
<result property="teamLeaderPhone" column="team_leader_phone" /> <result property="teamLeaderPhone" column="team_leader_phone" />
@ -12,7 +13,7 @@
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
</resultMap> </resultMap>
<select id="list" parameterType="String" resultMap="BaseTeamResult"> <select id="list" parameterType="String" resultMap="BaseTeamResult">
select tt.id,tt.team_name,team_type_name,team_leader,team_leader_phone, count(su.team_id) as countuser,tt.create_time,tt.update_time select tt.id,tt.team_name,team_type_code,team_type_name,team_leader,team_leader_phone, count(su.team_id) as countuser,tt.create_time,tt.update_time
from tb_team tt from tb_team tt
left join sys_user su on su.team_id = tt.id and su.del_flag = 0 left join sys_user su on su.team_id = tt.id and su.del_flag = 0
<where> <where>
@ -31,19 +32,19 @@
</select> </select>
<select id="getTeamId" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseTeam" resultMap="BaseTeamResult"> <select id="getTeamId" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseTeam" resultMap="BaseTeamResult">
select id,team_name,team_type_name,team_leader,team_leader_phone,create_time,update_time select id,team_name,team_type_code,team_type_name,team_leader,team_leader_phone,create_time,update_time
from tb_team from tb_team
where del_flag=0 and id=#{teamId} where del_flag=0 and id=#{teamId}
</select> </select>
<select id="getTeam" resultMap="BaseTeamResult"> <select id="getTeam" resultMap="BaseTeamResult">
select id,team_name,team_type_name,team_leader,team_leader_phone,create_time,update_time select id,team_name,team_type_code,team_type_name,team_leader,team_leader_phone,create_time,update_time
from tb_team from tb_team
where team_name = #{teamName} and id != #{teamId} where team_name = #{teamName} and id != #{teamId}
</select> </select>
<select id="getAdd" resultMap="BaseTeamResult"> <select id="getAdd" resultMap="BaseTeamResult">
select id,team_name,team_type_name,team_leader,team_leader_phone,create_time,update_time select id,team_name,team_type_code,team_type_name,team_leader,team_leader_phone,create_time,update_time
from tb_team from tb_team
where team_name = #{teamName} where team_name = #{teamName}
</select> </select>
@ -57,6 +58,7 @@
<update id="update"> <update id="update">
update tb_team update tb_team
set team_name = #{teamName}, set team_name = #{teamName},
team_type_code = #{teamTypeCode},
team_type_name = #{teamTypeName}, team_type_name = #{teamTypeName},
team_leader = #{teamLeader}, team_leader = #{teamLeader},
team_leader_phone = #{teamLeaderPhone}, team_leader_phone = #{teamLeaderPhone},
@ -65,9 +67,9 @@
</update> </update>
<insert id="add" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseTeam" > <insert id="add" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseTeam" >
insert into tb_team(team_name,team_type_name,team_leader,team_leader_phone,create_time,del_flag insert into tb_team(team_name,team_type_code,team_type_name,team_leader,team_leader_phone,create_time,del_flag
)values ( )values (
#{teamName},#{teamTypeName},#{teamLeader},#{teamLeaderPhone},now(),0 #{teamName},#{teamTypeCode},#{teamTypeName},#{teamLeader},#{teamLeaderPhone},now(),0
) )
</insert> </insert>
@ -76,4 +78,24 @@
set del_flag = 1 set del_flag = 1
where id = #{teamId} where id = #{teamId}
</update> </update>
<select id="teamValue" resultType="com.bonus.aqgqj.base.entity.SelectEntity">
select id as id,dict_name as name
from sys_distinct
where dict_value = #{value}
</select>
<select id="teamType" resultType="com.bonus.aqgqj.base.entity.SelectEntity">
select dict_value as id,dict_name as name
from sys_distinct
where p_id = #{id}
group by dict_sort
</select>
<select id="getTypeName" resultType="java.lang.String">
select dict_name as name
from sys_distinct
where p_id = (select id from sys_distinct
where dict_value = 'team_type') and dict_value = #{teamTypeId}
</select>
</mapper> </mapper>

View File

@ -66,6 +66,7 @@ function initTable(dataList, limit, page) {
}, },
{field: "teamId", title: "ID", unresize: true, align: "center",hide:true}, {field: "teamId", title: "ID", unresize: true, align: "center",hide:true},
{field: "teamName", title: "班组名称", unresize: true, align: "center"}, {field: "teamName", title: "班组名称", unresize: true, align: "center"},
{field: "teamTypeCode", title: "班组id", unresize: true, align: "center",hide:true},
{field: "teamTypeName", title: "班组类型", unresize: true, align: "center"}, {field: "teamTypeName", title: "班组类型", unresize: true, align: "center"},
{field: "teamLeader", title: "班组负责人", unresize: true, align: "center"}, {field: "teamLeader", title: "班组负责人", unresize: true, align: "center"},
{field: "teamLeaderPhone", title: "联系方式", unresize: true, align: "center"}, {field: "teamLeaderPhone", title: "联系方式", unresize: true, align: "center"},
@ -144,9 +145,9 @@ function reloadData() {
// 新增/修改平台用户 // 新增/修改平台用户
function addData(teamId) { function addData(teamId) {
console.log() console.log()
let title = '新增客户' let title = '新增班组'
if (teamId) { if (teamId) {
title = '修改客户'; title = '修改班组';
} }
let param = { let param = {
'teamId': teamId 'teamId': teamId

View File

@ -4,7 +4,7 @@ let background, web, mobile, wx;
let data = [], appResList = []; let data = [], appResList = [];
// 角色下拉选 // 角色下拉选
let roleList; let roleList;
getTeamSelected()
function setParams(params) { function setParams(params) {
idParam = JSON.parse(params).teamId; idParam = JSON.parse(params).teamId;
console.log(idParam) console.log(idParam)
@ -67,6 +67,11 @@ function setFormData(data) {
// $("#customStatus").prop("checked", 0); // $("#customStatus").prop("checked", 0);
// //
// } // }
teamTypeCode = data.teamTypeCode
// $('#teamTypeCode').val(data.id)
// $('#teamTypeName option[value=' + data.teamTypeName + ']').attr('selected', true)
console.log(teamTypeCode)
form.render(); form.render();
@ -130,4 +135,29 @@ function closePage(type) {
if (type === 1) { if (type === 1) {
parent.reloadData() parent.reloadData()
} }
}
function getTeamSelected() {
let url = dataUrl + '/teams/all';
ajaxRequest(url, "POST", null, true, function () {
}, function (result) {
if (result.code === 200) {
setSelectValue(result.data, 'teamTypeCode');
// return result.data
} else {
layer.alert(result.msg, {icon: 2})
}
}, function (xhr) {
error(xhr)
});
}
/*下拉选表单赋值*/
function setSelectValue(list, selectName) {
let html = '<option value="" selected>请选择</option>';
$.each(list, function (index, item) {
html += '<option value="' + item.id + '">' + item.name + '</option>';
})
$('#' + selectName).empty().append(html);
layui.form.render();
} }

View File

@ -18,13 +18,6 @@
<div id="main-box"> <div id="main-box">
<form class="layui-form" onsubmit="return false;" lay-filter="formInfo"> <form class="layui-form" onsubmit="return false;" lay-filter="formInfo">
<input hidden id="id" name="id"> <input hidden id="id" name="id">
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>任务名称</label>
<div class="layui-input-inline">
<input class="layui-input" id="taskName" name="taskName" autocomplete="off"
lay-verify="required" maxlength="30">
</div>
</div>
<div class="layui-form-item" style="margin-top: 2%;"> <div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户名称</label> <label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户名称</label>
<div class="layui-input-inline"> <div class="layui-input-inline">

View File

@ -12,7 +12,7 @@
<script src="../../js/my/aes.js"></script> <script src="../../js/my/aes.js"></script>
<script src="../../js/select.js"></script> <script src="../../js/select.js"></script>
<script src="../../js/ajaxRequest.js"></script> <script src="../../js/ajaxRequest.js"></script>
<title>用户-新增/修改</title> <title>班组-新增/修改</title>
</head> </head>
<body> <body>
<div id="main-box"> <div id="main-box">
@ -28,8 +28,8 @@
<div class="layui-form-item" style="margin-top: 2%;"> <div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>班组类型</label> <label class="layui-form-label"><i style="padding: 0 10px;">*</i>班组类型</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input class="layui-input" id="teamTypeName" name="teamTypeName" autocomplete="off" <select id="teamTypeCode" lay-verify="required" name="teamTypeCode" class="form-control input-sm">
lay-verify="required" maxlength="20"> </select>
</div> </div>
</div> </div>
<div class="layui-form-item" style="margin-top: 2%;"> <div class="layui-form-item" style="margin-top: 2%;">