Commit d2426e87 authored by 耿迪迪's avatar 耿迪迪

任务下发 gengdidi

parent 2343b553
package com.zehong.web.controller.operationMonitor;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.SysPost;
import com.zehong.system.service.ISysPostService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -33,6 +39,9 @@ public class TWorkOrderController extends BaseController
@Autowired
private ITWorkOrderService tWorkOrderService;
@Autowired
private ISysPostService iSysPostService;
/**
* 查询燃气任务列表
*/
......@@ -41,6 +50,7 @@ public class TWorkOrderController extends BaseController
public TableDataInfo list(TWorkOrder tWorkOrder)
{
startPage();
judgeUserRole(tWorkOrder);
List<TWorkOrder> list = tWorkOrderService.selectTWorkOrderList(tWorkOrder);
return getDataTable(list);
}
......@@ -53,11 +63,34 @@ public class TWorkOrderController extends BaseController
@GetMapping("/export")
public AjaxResult export(TWorkOrder tWorkOrder)
{
judgeUserRole(tWorkOrder);
List<TWorkOrder> list = tWorkOrderService.selectTWorkOrderList(tWorkOrder);
ExcelUtil<TWorkOrder> util = new ExcelUtil<TWorkOrder>(TWorkOrder.class);
return util.exportExcel(list, "燃气任务数据");
}
/**
* 判断用户角色
* @param tWorkOrder
*/
private void judgeUserRole(TWorkOrder tWorkOrder){
SysUser user = SecurityUtils.getLoginUser().getUser();
//获取用户所属单位
long enterpriseId = user.getDeptId();
//判断是否为政府用户
if(!"-2".equals(String.valueOf(enterpriseId))){
tWorkOrder.setWorkAssignEnterproseId(enterpriseId);
//判断是否为巡线员
List<Integer> postIds = iSysPostService.selectPostListByUserId(user.getUserId());
for(Integer postId : postIds){
SysPost postInfo = iSysPostService.selectPostById(postId.longValue());
if("se".equals(postInfo.getPostCode())){
tWorkOrder.setWorkAssignManId(user.getUserId());
}
}
}
}
/**
* 获取燃气任务详细信息
*/
......
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Set;
import com.zehong.framework.systemsetting.SystemSetting;
import com.zehong.system.service.ISysPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -44,6 +45,9 @@ public class SysLoginController
@Autowired
private SystemSetting systemSetting;
@Autowired
private ISysPostService iSysPostService;
/**
* 登录方法
*
......@@ -80,6 +84,7 @@ public class SysLoginController
ajax.put("roles", roles);
ajax.put("permissions", permissions);
ajax.put("systemSetting",systemSetting.getSystemWebSetting());
ajax.put("posts",iSysPostService.getPostListByUserId(user.getUserId()));
return ajax;
}
......
package com.zehong.web.controller.system;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.zehong.framework.systemsetting.SystemSetting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
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 org.springframework.web.multipart.MultipartFile;
import com.zehong.common.annotation.Log;
import com.zehong.common.constant.UserConstants;
......@@ -207,4 +202,19 @@ public class SysUserController extends BaseController
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUserStatus(user));
}
/**
* 根据企业获取巡线员
*
* @param enterpriseId 企业id
* @param postCode 岗位编码
* @return 巡线员信息
*/
@GetMapping("/getInspectionUsers")
public AjaxResult getInspectionUsers(@RequestParam(value = "enterpriseId") String enterpriseId, @RequestParam(value="postCode") String postCode){
Map<String,String> map = new HashMap<>();
map.put("enterpriseId",enterpriseId);
map.put("postCode",postCode);
return AjaxResult.success(userService.getInspectionUsers(map));
};
}
......@@ -45,6 +45,18 @@ public class TEnterpriseInfoController extends BaseController
return getDataTable(list);
}
/**
*查询所有企业信息
* @param tEnterpriseInfo
* @return
*/
@GetMapping("/enterpriseLists")
public TableDataInfo enterpriseLists(TEnterpriseInfo tEnterpriseInfo)
{
List<TEnterpriseInfo> list = tEnterpriseInfoService.selectTEnterpriseInfoList(tEnterpriseInfo);
return getDataTable(list);
}
/**
* 导出企业信息列表
*/
......
......@@ -83,6 +83,10 @@ public class SysUser extends BaseEntity
})
private SysDept dept;
/** 所属单位 */
@Excel(name = "所属单位", targetAttr = "enterpriseName", type = Type.EXPORT)
private String enterpriseName;
/** 角色对象 */
private List<SysRole> roles;
......@@ -300,6 +304,14 @@ public class SysUser extends BaseEntity
this.postIds = postIds;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -41,6 +41,13 @@ public interface SysPostMapper
*/
public List<Integer> selectPostListByUserId(Long userId);
/**
* 根据用户ID查询岗位信息
* @param userId 用户id
* @return
*/
List<SysPost> getPostListByUserId(Long userId);
/**
* 查询用户所属岗位组
*
......
package com.zehong.system.mapper;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.zehong.common.core.domain.entity.SysUser;
......@@ -108,4 +110,12 @@ public interface SysUserMapper
* @return 结果
*/
public SysUser checkEmailUnique(String email);
/**
* 根据企业获取巡线员
*
* @param map
* @return 巡线员信息
*/
List<SysUser> getInspectionUsers(Map<String,String> map);
}
......@@ -41,6 +41,13 @@ public interface ISysPostService
*/
public List<Integer> selectPostListByUserId(Long userId);
/**
* 根据用户ID查询岗位信息
* @param userId 用户id
* @return
*/
List<SysPost> getPostListByUserId(Long userId);
/**
* 校验岗位名称
*
......
package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.zehong.common.core.domain.entity.SysUser;
/**
......@@ -164,4 +166,12 @@ public interface ISysUserService
* @return 结果
*/
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
/**
* 根据企业获取巡线员
*
* @param map
* @return 巡线员信息
*/
List<SysUser> getInspectionUsers(Map<String,String> map);
}
......@@ -72,6 +72,16 @@ public class SysPostServiceImpl implements ISysPostService
return postMapper.selectPostListByUserId(userId);
}
/**
* 根据用户ID查询岗位信息
* @param userId 用户id
* @return
*/
@Override
public List<SysPost> getPostListByUserId(Long userId){
return postMapper.getPostListByUserId(userId);
}
/**
* 校验岗位名称是否唯一
*
......
......@@ -2,6 +2,8 @@ package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -460,4 +462,16 @@ public class SysUserServiceImpl implements ISysUserService
}
return successMsg.toString();
}
/**
* 根据企业获取巡线员
*
* @param map
* @return 巡线员信息
*/
@Override
public List<SysUser> getInspectionUsers(Map<String,String> map){
return userMapper.getInspectionUsers(map);
}
}
......@@ -2,6 +2,7 @@ package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TWorkOrderMapper;
......@@ -54,6 +55,7 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
public int insertTWorkOrder(TWorkOrder tWorkOrder)
{
tWorkOrder.setCreateTime(DateUtils.getNowDate());
tWorkOrder.setCreateBy(SecurityUtils.getUsername());
return tWorkOrderMapper.insertTWorkOrder(tWorkOrder);
}
......@@ -67,6 +69,7 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
public int updateTWorkOrder(TWorkOrder tWorkOrder)
{
tWorkOrder.setUpdateTime(DateUtils.getNowDate());
tWorkOrder.setUpdateBy(SecurityUtils.getUsername());
return tWorkOrderMapper.updateTWorkOrder(tWorkOrder);
}
......
......@@ -54,6 +54,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.user_id = #{userId}
</select>
<select id="getPostListByUserId" parameterType="Long" resultMap="SysPostResult">
select p.*
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
......
......@@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="enterpriseName" column="enterprise_name" />
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
......@@ -56,8 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, (CASE WHEN u.dept_id = '-2' THEN '政府部门'
ELSE enter.enterprise_name END)AS enterprise_name from sys_user u
LEFT JOIN t_enterprise_info enter ON u.dept_id = enter.enterprise_id
where u.del_flag = '0'
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
......@@ -74,9 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="deptId != null and deptId != 0">
<!--<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
</if>-->
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
......@@ -179,4 +181,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="getInspectionUsers" parameterType="java.util.Map" resultMap="SysUserResult">
SELECT
u.user_id,
u.dept_id,
u.user_name
FROM
sys_user u
LEFT JOIN sys_user_post up ON u.user_id = up.user_id
LEFT JOIN sys_post p ON up.post_id = p.post_id
<where>
<if test="enterpriseId != null and enterpriseId != 0">
AND u.dept_id = #{enterpriseId}
</if>
<if test="postCode !=null and postCode != ''">
AND p.post_code = #{postCode}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -9,6 +9,17 @@ export function listInfo(query) {
})
}
// 查询企业所有信息
export function enterpriseLists(query) {
return request({
url: '/regulation/info/enterpriseLists',
method: 'get',
params: query
})
}
// 查询企业信息详细
export function getInfo(enterpriseId) {
return request({
......
......@@ -51,3 +51,12 @@ export function exportPost(query) {
params: query
})
}
//查询所有岗位
export function optionselect(query) {
return request({
url: '/system/post/optionselect',
method: 'get',
params: query
})
}
......@@ -125,3 +125,17 @@ export function importTemplate() {
method: 'get'
})
}
//获取用户巡检员
export function getInspectionUsers(enterpriseId,postCode) {
const data = {
enterpriseId,
postCode
}
return request({
url: '/system/user/getInspectionUsers',
method: 'get',
params: data
})
}
......@@ -17,6 +17,7 @@
class="upload-file-uploader"
:class="{ hide: fileArr.length>0 ||addShow }"
ref="upload"
:disabled="readOnly"
>
<!-- 上传按钮 -->
<!-- <el-button size="mini" icon="" type="primary"></el-button> -->
......@@ -95,6 +96,7 @@ export default {
type: Boolean,
default: true,
},
readOnly: false
},
data() {
return {
......
......@@ -9,6 +9,8 @@ const user = {
roles: [],
permissions: [],
systemSetting:{},
posts: [],
enterpriseId: ''
},
mutations: {
......@@ -29,6 +31,12 @@ const user = {
},
SET_SYSTEMSETTING: (state, systemSetting) => {
state.systemSetting = systemSetting
},
SET_POSTS: (state, posts) => {
state.posts = posts
},
SET_ENTERPRISEID: (state,enterpriseId) =>{
state.enterpriseId = enterpriseId
}
},
......@@ -67,6 +75,8 @@ const user = {
commit('SET_AVATAR', avatar)
// 默认配置
commit('SET_SYSTEMSETTING', res.systemSetting)
commit('SET_POSTS',res.posts)
commit('SET_ENTERPRISEID',user.deptId)
console.log(res.systemSetting)
resolve(res)
}).catch(error => {
......
<template>
<el-dialog title="任务下发" :visible.sync="dialogVisible" width="900px" append-to-body>
<el-form ref="workForm" :model="workForm" label-width="80px">
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
props:{
workForm:{},
dialogVisible:false
},
data() {
return {
}
},
created() {
console.log("dsaadddd=============>",this.workForm)
},
methods: {
submitForm(){
},
cancel(){
}
}
}
</script>
<style lang="scss" scoped>
</style>
......@@ -2,7 +2,7 @@
<div class="app-container">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<!-- <el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
......@@ -24,9 +24,9 @@
@node-click="handleNodeClick"
/>
</div>
</el-col>
</el-col>-->
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-col :span="24" :xs="24">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="userName">
<el-input
......@@ -144,7 +144,7 @@
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="所属单位" align="center" key="enterpriseName" prop="enterpriseName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<template slot-scope="scope">
......@@ -214,8 +214,16 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
<el-form-item label="所属单位" prop="deptId">
<!--<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />-->
<el-select v-model="form.deptId" placeholder="请选择" @change="selectWorkUnit($event)">
<el-option
v-for="item in enterprises"
:key="item.enterpriseId"
:label="item.enterpriseName"
:value="item.enterpriseId"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
......@@ -349,12 +357,15 @@ import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { enterpriseLists } from "@/api/regulation/info";
import { optionselect } from "@/api/system/post";
export default {
name: "User",
components: { Treeselect },
data() {
return {
zzz:'',
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -389,8 +400,11 @@ export default {
sexOptions: [],
// 岗位选项
postOptions: [],
//企业选项
enterprises: [],
// 角色选项
roleOptions: [],
// 表单参数
form: {},
defaultProps: {
......@@ -467,7 +481,9 @@ export default {
},
created() {
this.getList();
this.getTreeselect();
this.getPosts();
//this.getTreeselect();
//this.getEnterpriseLists();
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
});
......@@ -563,9 +579,10 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.getTreeselect();
//this.getTreeselect();
this.getEnterpriseLists();
getUser().then(response => {
this.postOptions = response.posts;
//this.postOptions = response.posts;
this.roleOptions = response.roles;
this.open = true;
this.title = "添加用户";
......@@ -575,11 +592,13 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
//this.getTreeselect();
this.getEnterpriseLists();
const userId = row.userId || this.ids;
getUser(userId).then(response => {
this.form = response.data;
this.postOptions = response.posts;
this.getPosts();
//this.postOptions = response.posts;
this.roleOptions = response.roles;
this.form.postIds = response.postIds;
this.form.roleIds = response.roleIds;
......@@ -587,6 +606,7 @@ export default {
this.title = "修改用户";
this.form.password = "";
});
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
......@@ -674,6 +694,49 @@ export default {
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
//查询所属单位
getEnterpriseLists(){
enterpriseLists().then(response => {
this.enterprises = response.rows;
this.enterprises.push({
enterpriseId: -2,
enterpriseName: "政府部门",
isDel: null
})
});
},
//选取所属单位
selectWorkUnit(val){
this.getPosts();
},
//获取岗位
getPosts(){
this.postOptions = [];
console.log(this.form.deptId,'dkdfsdfkfkfkfkfdkfdkfkfkdkdfk')
if(this.form.deptId == "-2"){
this.postOptions.push(
{
"searchValue": null,
"createBy": "admin",
"createTime": "2022-01-10 16:22:37",
"updateBy": null,
"updateTime": null,
"remark": "",
"params": {},
"postId": 1,
"postCode": "zhengfu",
"postName": "县级指挥",
"postSort": "1",
"status": "0",
"flag": false
}
)
return;
}
optionselect().then(response =>{
this.postOptions = response.data;
})
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment