班组管理

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

View File

@ -1,5 +1,6 @@
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.BaseTeam;
import org.apache.ibatis.annotations.Mapper;
@ -24,4 +25,10 @@ public interface TeamDao {
int add(BaseTeam team);
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 teamTypeCode;
private String teamTypeName;
private String teamLeader;

View File

@ -1,5 +1,6 @@
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.BaseTeam;
import com.bonus.aqgqj.utils.ServerResponse;
@ -25,4 +26,9 @@ public interface TeamService {
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;
import com.bonus.aqgqj.base.entity.SelectEntity;
import com.bonus.aqgqj.basis.dao.CustomDao;
import com.bonus.aqgqj.basis.dao.TeamDao;
import com.bonus.aqgqj.basis.entity.vo.BaseCustom;
@ -91,4 +92,20 @@ public class TeamServiceImpl implements TeamService {
public int delTeam(Long 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">
<id property="teamId" column="id" />
<result property="teamName" column="team_name" />
<result property="teamTypeCode" column="team_type_code" />
<result property="teamTypeName" column="team_type_name" />
<result property="teamLeader" column="team_leader" />
<result property="teamLeaderPhone" column="team_leader_phone" />
@ -12,7 +13,7 @@
<result property="delFlag" column="del_flag" />
</resultMap>
<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
left join sys_user su on su.team_id = tt.id and su.del_flag = 0
<where>
@ -31,19 +32,19 @@
</select>
<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
where del_flag=0 and id=#{teamId}
</select>
<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
where team_name = #{teamName} and id != #{teamId}
</select>
<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
where team_name = #{teamName}
</select>
@ -57,6 +58,7 @@
<update id="update">
update tb_team
set team_name = #{teamName},
team_type_code = #{teamTypeCode},
team_type_name = #{teamTypeName},
team_leader = #{teamLeader},
team_leader_phone = #{teamLeaderPhone},
@ -65,9 +67,9 @@
</update>
<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 (
#{teamName},#{teamTypeName},#{teamLeader},#{teamLeaderPhone},now(),0
#{teamName},#{teamTypeCode},#{teamTypeName},#{teamLeader},#{teamLeaderPhone},now(),0
)
</insert>
@ -76,4 +78,24 @@
set del_flag = 1
where id = #{teamId}
</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>

View File

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

View File

@ -4,7 +4,7 @@ let background, web, mobile, wx;
let data = [], appResList = [];
// 角色下拉选
let roleList;
getTeamSelected()
function setParams(params) {
idParam = JSON.parse(params).teamId;
console.log(idParam)
@ -67,6 +67,11 @@ function setFormData(data) {
// $("#customStatus").prop("checked", 0);
//
// }
teamTypeCode = data.teamTypeCode
// $('#teamTypeCode').val(data.id)
// $('#teamTypeName option[value=' + data.teamTypeName + ']').attr('selected', true)
console.log(teamTypeCode)
form.render();
@ -131,3 +136,28 @@ function closePage(type) {
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">
<form class="layui-form" onsubmit="return false;" lay-filter="formInfo">
<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%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户名称</label>
<div class="layui-input-inline">

View File

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