Commit 8c6c8464 by zhangyu

部门

parent 67896135
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
<script src="${ctxStatic}/jquery-form/jquery-form.js" type="text/javascript"></script>
<title>航线管理部门列表</title>
<meta name="decorator" content="default"/>
<script verify="text/javascript">
function page(n, s) {
if (n) $("#pageNo").val(n);
if (s) $("#pageSize").val(s);
$("#searchForm").attr("action", "${ctx}/airline/verifyAdd/list");
$("#searchForm").submit();
return false;
}
var options = {
type: "POST",
url: urls,
dataType: 'json'
};
var url = "${ctx}/airline/sailingfile/upload";
var urls = url;
function upload(id) {
urls = url + "?id=" + id;
options = {
type: "POST",
url: urls,
dataType: 'json',
success: function (data) {
window.location.href = '${ctx}/airline/verify/list?message=成功';
}
};
$("#file").click();
}
</script>
</head>
<body>
<ul class="nav nav-tabs">
<li><a href="${ctx}/depart/depart/list">论证部门列表</a></li>
<shiro:hasPermission name="vrf:depart:edit">
<li><a href="${ctx}/depart/depart/form">新增论证部门</a></li>
</shiro:hasPermission>
<li class="active"><a href="${ctx}/airline/verifyAdd">航线管理部门列表</a></li>
</ul>
<sys:message content="${message}"/>
<div class="clearfix"></div>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>编号</th>
<th>论证类型</th>
<th>论证部门</th>
<shiro:hasPermission name="vrf:verify:edit">
<th>操作</th>
</shiro:hasPermission></tr>
</thead>
<tbody>
<c:forEach items="${page}" var="verify" varStatus="vs">
<tr>
<td>${verify.label}</td>
<td>${verify.valueType}</td>
<td>
<c:forEach items="${verify.dList}" var="depar" varStatus="ds">
${depar.departName}
</c:forEach>
</td>
</td>
<shiro:hasPermission name="vrf:verify:view">
<td>
<a href="${ctx}/airline/verifyAdd/form?type=${verify.valueType}&">添加</a>
<a href="${ctx}/airline/verifyAdd/form?id=${verify.valueType}&">编辑</a>
</td>
</shiro:hasPermission>
</tr>
</c:forEach>
</tbody>
</table>
<form style="display:none" id="form" action="dynamicFields.action?method=uploadFile" method="post"
enctype="multipart/form-data">
<input type="file" name="file" id="file" value=""/><br/>
<input type="submit" value="确认提交">
</form>
</body>
</html>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
<title>航线编辑</title>
<meta name="decorator" content="default"/>
<script type="text/javascript">
$(document).ready(function () {
$("#verifNo").focus();
$("#inputForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
var checkArr = document.getElementsByName('check');
console.log(checkArr);
var str ='';
for (var i = 0; i < checkArr.length; i++) {
if (checkArr[i].checked){
str = str+checkArr[i].value.toString()+' '
}
}
console.log(str);
console.log(typeof(str));
$('#list').val(str);
loading('正在提交,请稍等...');
form.submit();
},
errorContainer: "#messageBox",
errorPlacement: function (error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});
});
function changeCheck(item,e) {
console.log(222222);
item.check=e.check;
}
</script>
</head>
<body>
<ul class="nav nav-tabs">
<li class="active">航线编辑</li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="userDepartEntity" action="${ctx}/airline/verifyAdd/add" method="post" class="form-horizontal">
<form:input path="type" htmlEscape="false" value="${type}" maxlength="50" class="required" style="display:none"/>
<sys:message content="${message}"/>
<c:forEach items="${allList}" var="depar" varStatus="ds">
<input type="checkbox" name="check" value="${depar.id}" ${depar.check==true?'checked':""} />
${depar.departName}
</c:forEach>
</div>
<form:input path="list" htmlEscape="false" maxlength="50" id="list" style="display:none" />
<div class="form-actions">
<shiro:hasPermission name="vrf:verify:edit"><input id="btnSubmit" class="btn btn-primary" type="submit"
value="保 存"/>&nbsp;</shiro:hasPermission>
<a href="${ctx}/airline/verifyAdd"><input id="btnCancel" class="btn" type="button" value="返回"/></a>
</div>
</form:form>
</body>
</html>
\ No newline at end of file
......@@ -21,6 +21,7 @@
<shiro:hasPermission name="vrf:depart:edit">
<li><a href="${ctx}/depart/depart/form">新增论证部门</a></li>
</shiro:hasPermission>
<li><a href="${ctx}/airline/verifyAdd">航线管理部门列表</a></li>
</ul>
<form:form id="searchForm" modelAttribute="departEntity" action="${ctx}/depart/depart/list" method="post"
class="breadcrumb form-search ">
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ejweb.modules.airline.dao.VerifyDepartAddDao" >
<select id="findUserDeparList" resultType="com.ejweb.modules.depart.entity.UserDepartEntity">
SELECT
a.id,
a.is_verif,
a.is_risk,
a.depart_name
FROM foc_user_depart a
WHERE a.del_flag = '0'
</select>
<insert id="addUserDepartType" parameterType="com.ejweb.modules.depart.entity.AddDepartTypeDto">
insert into foc_user_depart_type(depart_id,type)
values
<foreach collection="dto.departIds" item="emp" separator=",">
(#{emp},#{dto.type})
</foreach>
</insert>
<delete id="deleteUserDepartType" parameterType="com.ejweb.modules.depart.entity.AddDepartTypeDto">
DELETE from foc_user_depart_type WHERE type=#{type}
</delete>
<!-- <select id="getUserDepartAll" resultType="com.ejweb.modules.depart.entity.UserDegetUserDepartTypepartEntity">
SELECT
f.id,
fu.depart_name,
f.type
FROM `foc_user_depart_type` f
INNER JOIN foc_user_depart fu on f.depart_id = fu.id AND fu.del_flag='0'
WHERE f.del_flag = '0'
<if test="isVerif != null and isVerif !=''">
AND is_verif=#{isVerif}
</if>
</select>-->
<select id="getUserDictAll" resultType="com.ejweb.modules.depart.entity.UserDictEntity">
SELECT
f.id,
f.value as valueType,
f.label
FROM `sys_dict` f
WHERE f.type = 'vrf_verify_type'
and f.del_flag = '0'
</select>
<select id="getUserDepartType" resultType="com.ejweb.modules.depart.entity.UserDepartTypeEntity">
SELECT
f.id,
fu.depart_name,
f.depart_id
FROM `foc_user_depart_type` f
INNER JOIN foc_user_depart fu on f.depart_id = fu.id AND fu.del_flag='0'
WHERE f.del_flag = '0'
<if test="valueType != null and valueType !=''">
AND f.type=#{valueType}
</if>
</select>
</mapper>
\ No newline at end of file
package com.ejweb.modules.airline.dao;
import com.ejweb.modules.depart.entity.AddDepartTypeDto;
import com.ejweb.modules.depart.entity.UserDepartEntity;
import com.ejweb.modules.depart.entity.UserDepartTypeEntity;
import com.ejweb.modules.depart.entity.UserDictEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* 论证部门Dao
* @author zhanglg
* @version 2016-08-24
*/
public interface VerifyDepartAddDao{
/**
*根据论证类type型查询 包含多少部门
* @param valueType
* @return
*/
public List<UserDepartTypeEntity> getUserDepartType(@Param("valueType")String valueType);
/**
* 查询所有论证类型
* @return
*/
public List<UserDictEntity> getUserDictAll();
/**
* 查询所有部门信息
* @return
*/
public List<UserDepartEntity> findUserDeparList();
/**
* 添加部门和类型关联信息
* @param addDepartTypeDto
* @return
*/
public Integer addUserDepartType(@Param("dto") AddDepartTypeDto addDepartTypeDto);
public Integer deleteUserDepartType(@Param("type") String type);
public List<UserDepartEntity> getUserDepartAll(String isVerif);
}
\ No newline at end of file
package com.ejweb.modules.airline.service;
import com.ejweb.core.service.CrudService;
import com.ejweb.modules.airline.dao.VerifyDao;
import com.ejweb.modules.airline.dao.VerifyDepartAddDao;
import com.ejweb.modules.airline.entity.VerifyEntity;
import com.ejweb.modules.depart.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* Verify Service
*
* @author zhanglg
* @version 2016-8-23
*/
@Service
@Transactional(readOnly = true)
public class VerifyAddService extends CrudService<VerifyDao, VerifyEntity> {
@Autowired
private VerifyDepartAddDao verifyDepartAddDao;
//查询所有的类型对应的部门
public List<UserDictDepartEntity> findUserDeparDictAllList() {
List<UserDictEntity> userDictAll = verifyDepartAddDao.getUserDictAll();
List<UserDictDepartEntity> dictlist = new ArrayList<>();
for (UserDictEntity ud : userDictAll) {
String valueType = ud.getValueType();
List<UserDepartTypeEntity> userDepartType = verifyDepartAddDao.getUserDepartType(valueType);
UserDictDepartEntity userDictEntity = new UserDictDepartEntity();
userDictEntity.setLabel(ud.getLabel());
userDictEntity.setValueType(ud.getValueType());
userDictEntity.setdList(userDepartType);
dictlist.add(userDictEntity);
}
return dictlist;
}
public List<UserDepartEntity> findAllList(UserDepartEntity userDepartEntity) {
//查询所有的部门
List<UserDepartEntity> allList = verifyDepartAddDao.findUserDeparList();
// 根据类型type值查询对应的部门信息
String type = userDepartEntity.getType();
List<UserDepartTypeEntity> byList = verifyDepartAddDao.getUserDepartType(type);
if (byList != null) {
for (UserDepartEntity udAll : allList) {
for (UserDepartTypeEntity udBy : byList) {
if (udAll.getId() == udBy.getDepartId() || udAll.getId().equals(udBy.getDepartId())) {
udAll.setCheck(true);
}
}
}
}
return allList;
}
public String addUserDepartType(UserDepartNoCheckVo userDepartEntity) {
AddDepartTypeDto addDepartTypeDto = new AddDepartTypeDto();
String type = userDepartEntity.getType();
String list = userDepartEntity.getList();
if (list==null||list==" "){
verifyDepartAddDao.addUserDepartType(addDepartTypeDto);
return "1";
}
String[] split = list.split(" ");
List<String> departIdList = new ArrayList<>();
for (String sp : split) {
departIdList.add(sp);
}
addDepartTypeDto.setType(type);
addDepartTypeDto.setDepartIds(departIdList);
if (type != null && type != "") {
List<UserDepartTypeEntity> byList = verifyDepartAddDao.getUserDepartType(type);
// 不为空先删除在添加
if(byList!=null){
verifyDepartAddDao.deleteUserDepartType(type);
}
verifyDepartAddDao.addUserDepartType(addDepartTypeDto);
}
return "1";
}
public List<UserDepartEntity> getUserDepart(String isVerif) {
return verifyDepartAddDao.getUserDepartAll(isVerif);
}
}
package com.ejweb.modules.airline.web;
import com.ejweb.core.base.BaseController;
import com.ejweb.modules.airline.service.VerifyAddService;
import com.ejweb.modules.depart.entity.UserDepartNoCheckVo;
import com.ejweb.modules.depart.entity.UserDepartEntity;
import com.ejweb.modules.depart.entity.UserDictDepartEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.util.List;
/**
* Verify Controller
*
* @author zhanglg
* @version 1.0
* @team IT Team
* @time 2016年8月30日
*/
@Controller
@RequestMapping(value = "${adminPath}/airline/verifyAdd")
public class VerifyAddController extends BaseController {
private final Logger LOG = LoggerFactory.getLogger(VerifyAddController.class);
@Autowired
private VerifyAddService verifyService;
@RequiresPermissions("vrf:verify:view")
@RequestMapping(value = {"list", ""})
public String list( Model model) {
List<UserDictDepartEntity> dictlist = verifyService.findUserDeparDictAllList();
model.addAttribute("page", dictlist);
return "modules/airline/userDepart";
}
@RequiresPermissions("vrf:verify:view")
@RequestMapping(value = "form")
public String form(@ModelAttribute("userDepartEntity") UserDepartEntity userDepartEntity, Model model) {
if (!beanValidator(model, userDepartEntity)) {
return form(userDepartEntity, model);
}
model.addAttribute("type", userDepartEntity.getType());
List<UserDepartEntity> allList = verifyService.findAllList(userDepartEntity);
model.addAttribute("allList",allList);
return "modules/airline/verifyUserForm";
}
@RequiresPermissions("vrf:verify:edit")
@RequestMapping(value = "add")
public String addUserDepartType(UserDepartNoCheckVo userDepartNoCheckVo, Model model, RedirectAttributes redirectAttributes) {
UserDepartEntity userDepartEntity =new UserDepartEntity();
if (!beanValidator(model, userDepartNoCheckVo)) {
return form(userDepartEntity, model);
}
String s = verifyService.addUserDepartType(userDepartNoCheckVo);
addMessage(redirectAttributes, "操作成功");
return "redirect:" + adminPath + "/airline/verifyAdd/list?repage";
}
/* @RequiresPermissions("vrf:verify:view")
@RequestMapping(value = "get")
public String getUserDepart(String isVerif) {
verifyService.getUserDepart(isVerif);
return null;
}*/
}
package com.ejweb.modules.depart.entity;
import com.ejweb.core.persistence.DataEntity;
import java.util.List;
/**
*
* 论证部门Entity
* @author zy
* @version 2019-12-19
*/
public class AddDepartTypeDto extends DataEntity<AddDepartTypeDto> {
private static final long serialVersionUID = 1L;
private String type;
private List<String> departIds;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<String> getDepartIds() {
return departIds;
}
public void setDepartIds(List<String> departIds) {
this.departIds = departIds;
}
}
\ No newline at end of file
package com.ejweb.modules.depart.entity;
import com.ejweb.core.persistence.DataEntity;
/**
*
* 论证部门Entity
* @author zy
* @version 2019-12-19
*/
public class UserDepartEntity extends DataEntity<UserDepartEntity> {
private static final long serialVersionUID = 1L;
private String id;
private String departName;
private String type;
private String list;
private Boolean check=false;
public Boolean getCheck() {
return check;
}
public void setCheck(Boolean check) {
this.check = check;
}
public String getList() {
return list;
}
public void setList(String list) {
this.list = list;
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
\ No newline at end of file
package com.ejweb.modules.depart.entity;
import com.ejweb.core.persistence.DataEntity;
/**
*
* 论证部门Entity
* @author zy
* @version 2019-12-19
*/
public class UserDepartNoCheckVo extends DataEntity<UserDepartNoCheckVo> {
private static final long serialVersionUID = 1L;
private String id;
private String departName;
private String type;
private String list;
public String getList() {
return list;
}
public void setList(String list) {
this.list = list;
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
\ No newline at end of file
package com.ejweb.modules.depart.entity;
import com.ejweb.core.persistence.DataEntity;
/**
*
* 论证部门Entity
* @author zy
* @version 2019-12-19
*/
public class UserDepartTypeEntity extends DataEntity<UserDepartTypeEntity> {
private static final long serialVersionUID = 1L;
private String id;
private String departName;
private String type;
private String departId;
public String getDepartId() {
return departId;
}
public void setDepartId(String departId) {
this.departId = departId;
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
\ No newline at end of file
package com.ejweb.modules.depart.entity;
import com.ejweb.core.persistence.DataEntity;
import java.util.List;
/**
*
* 论证部门和论证类型Entity
* @author zy
* @version 2019-12-19
*/
public class UserDictDepartEntity extends DataEntity<UserDictDepartEntity> {
private static final long serialVersionUID = 1L;
private String id;
private String label;
private String valueType;
private List<UserDepartTypeEntity> dList;
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValueType() {
return valueType;
}
public void setValueType(String valueType) {
this.valueType = valueType;
}
public List<UserDepartTypeEntity> getdList() {
return dList;
}
public void setdList(List<UserDepartTypeEntity> dList) {
this.dList = dList;
}
}
\ No newline at end of file
package com.ejweb.modules.depart.entity;
import com.ejweb.core.persistence.DataEntity;
/**
*
* 论证部门Entity
* @author zy
* @version 2019-12-19
*/
public class UserDictEntity extends DataEntity<UserDictEntity> {
private static final long serialVersionUID = 1L;
private String id;
private String label;
private String valueType;
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValueType() {
return valueType;
}
public void setValueType(String valueType) {
this.valueType = valueType;
}
}
\ No newline at end of file
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