Bladeren bron

添加入职登记中的校审人员选择功能,修改项目报告三级校审中的总审人员指定

user5 4 jaren geleden
bovenliggende
commit
f5247c8e5e

+ 16 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageService.java

@@ -1103,7 +1103,22 @@ public class RuralProjectMessageService extends CrudService<RuralProjectMessageD
             projectReportDataService.save(projectReportData);
         }
         //总工
-        List<User> bzshbs = UserUtils.getByRoleActivityEnname("bzshb",3,recordsOffice.getId(),"12",projectReportData.getCreateBy());
+        List<User> bzshbsList = UserUtils.getByRoleActivityEnname("bzshb",3,recordsOffice.getId(),"12",projectReportData.getCreateBy());
+        List<User> bzshbs = new ArrayList<>();
+        //判断总工数据是否为空
+        if(bzshbsList.size()>0){
+            for (User zgUser: bzshbsList) {
+                //判断当前登陆人对应的总审人员的id和遍历的人员id相对比  相同的则留用
+                if(zgUser.getId().equals(user.getAuditUserId())){
+                    bzshbs.add(zgUser);
+                }
+            }
+            if(bzshbs.size()==0){
+                return "流程总审审批人不能为空,请联系管理员!";
+            }
+        }else{
+            return "流程总审审批人不能为空,请联系管理员!";
+        }
         //盖章人
         //List<User> gzrs = UserUtils.getByRoleActivityEnname("gzr",3,recordsOffice.getId(),"12",projectReportData.getCreateBy());
         if (com.jeeplus.common.utils.StringUtils.isNotBlank(workActivityMenu.getId())) {

+ 10 - 1
src/main/java/com/jeeplus/modules/sys/entity/User.java

@@ -101,6 +101,7 @@ public class User extends DataEntity<User> {
     private WorkStaffBasicInfo basicInfo;
 
     private String weChatId;
+    private String auditUserId;  //总审人员id
 
 	public String getWeChatId() {
 		return weChatId;
@@ -578,7 +579,15 @@ public class User extends DataEntity<User> {
     public void setFirstFlag(String firstFlag) {
         this.firstFlag = firstFlag;
     }
-    //	public String getPosition() {
+
+	public String getAuditUserId() {
+		return auditUserId;
+	}
+
+	public void setAuditUserId(String auditUserId) {
+		this.auditUserId = auditUserId;
+	}
+	//	public String getPosition() {
 //		return position;
 //	}
 //

+ 8 - 0
src/main/java/com/jeeplus/modules/sys/service/UserService.java

@@ -538,4 +538,12 @@ public class UserService extends BaseController {
     public void updateUser(User user){
         userDao.updateUser(user);
     }
+
+
+
+    public List<User> getAuditUserList(){
+        Office recordsOffice =officeService.get(UserUtils.getUser().getOffice());
+        List<User> userList = UserUtils.getByRoleActivityEnname("bzshb",3,recordsOffice.getId(),"12",UserUtils.getUser());
+        return userList;
+    }
 }

+ 8 - 0
src/main/java/com/jeeplus/modules/workstaff/dao/WorkStaffBasicInfoDao.java

@@ -74,4 +74,12 @@ public interface WorkStaffBasicInfoDao extends CrudDao<WorkStaffBasicInfo> {
      * @return
      */
     int updateOfficeByUserId(@Param("userId") String userId,@Param("officeId") String officeId);
+
+
+    /**
+     * 变更员工总审人员信息
+     * @param workStaffBasicInfo
+     * @return
+     */
+    Integer updateAuditUser(WorkStaffBasicInfo workStaffBasicInfo);
 }

+ 20 - 0
src/main/java/com/jeeplus/modules/workstaff/entity/WorkStaffBasicInfo.java

@@ -6,6 +6,7 @@ package com.jeeplus.modules.workstaff.entity;
 import com.jeeplus.modules.sys.entity.Office;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.jeeplus.modules.sys.entity.Area;
@@ -96,6 +97,9 @@ public class WorkStaffBasicInfo extends DataEntity<WorkStaffBasicInfo> {
     private String userName;
     private String errInfo;
 
+    private String auditUserId;   //总审人员id
+    private String auditUserName;   //总审人员名称
+
 	//劳动关系临时属性
 	private String relationshipStatus;
     public List<WorkStaffEducation> getEducationList() {
@@ -716,4 +720,20 @@ public class WorkStaffBasicInfo extends DataEntity<WorkStaffBasicInfo> {
 	public void setRoleName(String roleName) {
 		this.roleName = roleName;
 	}
+
+	public String getAuditUserId() {
+		return auditUserId;
+	}
+
+	public void setAuditUserId(String auditUserId) {
+		this.auditUserId = auditUserId;
+	}
+
+	public String getAuditUserName() {
+		return auditUserName;
+	}
+
+	public void setAuditUserName(String auditUserName) {
+		this.auditUserName = auditUserName;
+	}
 }

+ 16 - 0
src/main/java/com/jeeplus/modules/workstaff/service/WorkStaffBasicInfoService.java

@@ -241,6 +241,22 @@ public class WorkStaffBasicInfoService extends CrudService<WorkStaffBasicInfoDao
         }
 	}
 
+
+    /**
+     * 变更员工总审人员信息
+     * @param workStaffBasicInfo
+     */
+	@Transactional(readOnly = false)
+	public Integer updateAuditUser(WorkStaffBasicInfo workStaffBasicInfo) {
+        Integer result = dao.updateAuditUser(workStaffBasicInfo);
+        //同步修改sys_user表中的name
+        User user = new User();
+        user.setId(workStaffBasicInfo.getUserId());
+        user.setAuditUserId(workStaffBasicInfo.getAuditUserId());
+        userService.updateUser(user);
+        return result;
+	}
+
     /**
      * 我的信息-用户维护档案信息,
      * @param workStaffBasicInfo

+ 51 - 1
src/main/java/com/jeeplus/modules/workstaff/web/WorkStaffBasicInfoController.java

@@ -16,7 +16,9 @@ import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.sys.entity.Role;
+import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.service.RoleService;
+import com.jeeplus.modules.sys.service.UserService;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.sysimportinfo.entity.SysImportInfo;
@@ -73,6 +75,8 @@ public class WorkStaffBasicInfoController extends BaseController {
     private SysImportInfoService sysImportInfoService;
     @Autowired
     private  RoleService roleService;
+	@Autowired
+	private UserService userService;
     @Autowired
 	private WeChatCallbackService weChatCallbackService;
 
@@ -95,7 +99,8 @@ public class WorkStaffBasicInfoController extends BaseController {
 	@RequiresPermissions("workstaff:workStaffBasicInfo:list")
 	@RequestMapping(value = {"list", ""})
 	public String list(WorkStaffBasicInfo workStaffBasicInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<WorkStaffBasicInfo> page = workStaffBasicInfoService.findPage(new Page<WorkStaffBasicInfo>(request, response), workStaffBasicInfo); 
+		Page<WorkStaffBasicInfo> page = workStaffBasicInfoService.findPage(new Page<WorkStaffBasicInfo>(request, response), workStaffBasicInfo);
+		List<WorkStaffBasicInfo> list = page.getList();
 		model.addAttribute("page", page);
 		return "modules/workstaff/workStaffBasicInfoList";
 	}
@@ -274,6 +279,51 @@ public class WorkStaffBasicInfoController extends BaseController {
 	}
 
 	/**
+	 * 修改员工总审人员信息
+	 * @param workStaffBasicInfo
+	 * @param model
+	 * @param redirectAttributes
+	 * @param request
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value = "updateAuditUser")
+	@ResponseBody
+	public Map<String,Object> updateAuditUser(WorkStaffBasicInfo workStaffBasicInfo) throws Exception{
+		Map map = new HashMap();
+		WorkStaffBasicInfo t = workStaffBasicInfoService.get(workStaffBasicInfo.getId());//从数据库取出记录的值
+		MyBeanUtils.copyBeanNotNull2Bean(workStaffBasicInfo, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+		Integer result = workStaffBasicInfoService.updateAuditUser(t);//保存
+		if(result == 1){
+			map.put("msg","修改成功");
+		}else{
+			map.put("msg","修改失败");
+		}
+		return map;
+	}
+
+	/**
+	 * 查询总审人员信息
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value = "getAuditUserList")
+	@ResponseBody
+	public List<Map<String,Object>> getAuditUserList(){
+		List<Map<String,Object>> mapList = new ArrayList<>();
+		List<User> auditUserList = userService.getAuditUserList();
+		if(auditUserList.size()>0){
+			for (User user : auditUserList) {
+				Map map = new HashMap();
+				map.put("name",user.getId());
+				map.put("value",user.getName());
+				mapList.add(map);
+			}
+		}
+		return mapList;
+	}
+
+	/**
 	 * 保存员工信息
 	 */
 	@RequestMapping(value = "saveAchive")

+ 4 - 0
src/main/resources/mappings/modules/sys/UserDao.xml

@@ -88,6 +88,7 @@
 		a.update_date,
 		a.del_flag,
 		a.first_flag AS "firstFlag",
+		a.audit_user_id AS "auditUserId",
 		s.name AS "company.name",
 		s.parent_id AS "company.parent.id",
 		s.parent_ids AS "company.parentIds",
@@ -1114,6 +1115,9 @@
 			<if test="office!=null  and office.id != null and office.id != ''">
 				office_id = #{office.id}
 			</if>
+			<if test="auditUserId!=null  and auditUserId != null and auditUserId != ''">
+				audit_user_id = #{auditUserId}
+			</if>
 		</set>
 		where id = #{id}
 	</update>

+ 9 - 1
src/main/resources/mappings/modules/workstaff/WorkStaffBasicInfoDao.xml

@@ -48,7 +48,8 @@
 		jg.pay AS "salary",
 		a.achive_id AS "achiveId",
 		nativePlace.name AS "nativePlace.name",
-		a.try_end_time AS "tryEndTime"
+		a.try_end_time AS "tryEndTime",
+		a.audit_user_id AS "auditUserId"
 <!--		ur.role_id AS "roleId",-->
 <!--		r.name AS "roleName"-->
 	</sql>
@@ -60,8 +61,6 @@
 		LEFT JOIN sys_user u ON u.id = a.create_by
 		LEFT JOIN sys_area nativePlace ON nativePlace.id = a.native_place
 		LEFT JOIN work_job_grade jg ON jg.id = a.job_grade
 	</sql>
 
 	<select id="get" resultType="WorkStaffBasicInfo" >
@@ -157,8 +156,10 @@
 	<select id="findList" resultType="WorkStaffBasicInfo" >
 		SELECT 
 			<include refid="workStaffBasicInfoColumns"/>
+		,su.name as "auditUserName"
 		FROM work_staff_basic_info a
 		<include refid="workStaffBasicInfoJoins"/>
+		LEFT JOIN sys_user su ON su.id = a.audit_user_id
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			<if test="company != null and company.id != null and company.id != ''">
@@ -629,5 +630,10 @@
 		set office_id = #{officeId}
 		where user_id = #{userId}
 	</update>
+	<update id="updateAuditUser">
+		update work_staff_basic_info
+		set audit_user_id = #{auditUserId}
+		where user_id = #{userId}
+	</update>
 
 </mapper>

File diff suppressed because it is too large
+ 660 - 1
src/main/webapp/static/layui/lay/modules/table.js


+ 75 - 5
src/main/webapp/webpage/modules/workstaff/workStaffBasicInfoList.jsp

@@ -93,6 +93,7 @@
             <form:form id="searchForm" modelAttribute="workStaffBasicInfo" action="${ctx}/workstaff/workStaffBasicInfo/" method="post" class="form-inline">
                 <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                 <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+                <input type="hidden" input="params" value="">
                 <table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
                 <div class="commonQuery">
                     <div class="layui-item query athird">
@@ -182,7 +183,7 @@
                     <button class="nav-btn nav-btn-refresh" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i>&nbsp;刷新</button>
                     <div style="clear: both;"></div>
                 </div>
-                <table class="oa-table layui-table" id="contentTable"></table>
+                <table class="oa-table layui-table" id="contentTable" lay-filter="tableEvent"></table>
 
                 <!-- 分页代码 -->
                 <table:page page="${page}"></table:page>
@@ -192,10 +193,25 @@
     </div>
     <div id="changewidth"></div>
 </div>
-<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
+<script type="text/javascript" src="${ctxStatic}/layui/layui.js"></script>
+<script charset="utf-8" src="${ctxStatic}/kindeditor/plugins/tableEdit/tableEdit.js"></script>
 <script>
-    layui.use('table', function(){
-        layui.table.render({
+    $(document).ready(function() {
+
+        window.params;
+        $.ajax({
+            url:"${ctx}/workstaff/workStaffBasicInfo/getAuditUserList",
+            type:"post",
+            success:function(data){
+                params = data;
+            }
+        });
+
+    });
+    layui.use(['table','tableEdit','layer'], function () {
+        var table = layui.table,tableEdit = layui.tableEdit,$ = layui.$;
+
+        var cols = layui.table.render({
             limit:${ page.pageSize }
             ,elem: '#contentTable'
             ,page: false
@@ -211,11 +227,22 @@
                         "<span title=" + d.name + ">" + d.name + "</span></a>";
                     return xml;
                 }}
-                ,{field:'idCard',align:'center', title: '身份证号码',minWidth:150}
+                ,{field:'idCard',align:'center', title: '身份证号码',minWidth:150,edit: 'text'}
                 ,{field:'mobile',align:'center', title: '移动电话', minWidth:100}
                 ,{field:'office',align:'center', title: '部门', minWidth:100}
                 // ,{field:'role',align:'center', title: '岗位', minWidth:100}
                 ,{field:'jobGrade',align:'center', title: '职级', minWidth:100}
+                ,{field:'auditUserName',align:'center', title: '校审人员', minWidth:100
+                    ,event:'auditUserId',config:{type:'select',data:params,verify:true}
+                    ,templet:function (d) {
+                        if(d.auditUserName){
+                            if(d.auditUserName.value){
+                                return  d.auditUserName.value;
+                            }
+                            return  d.auditUserName;
+                        }
+                        return ''
+                    }}
                 ,{field:'status',align:'center', title: '员工状态', minWidth:80}
                 ,{field:'entryDate', align:'center',sort:true,title: '入职日期',width:100}
                 ,{field:'op',align:'center',title:"操作",width:130,templet:function(d){
@@ -237,6 +264,8 @@
                 {
                     "index":"${index.index+1}"
                     ,"id":"${workStaffBasicInfo.id}"
+                    ,"auditUserId":"${workStaffBasicInfo.auditUserId}"
+                    ,"auditUserName":"${workStaffBasicInfo.auditUserName}"
                     <%--,"role":"${workStaffBasicInfo.roleName}"--%>
                     ,"no":"<c:out value="${workStaffBasicInfo.no}" escapeXml="true"/>"
                     ,"name":"<c:out value="${workStaffBasicInfo.name}" escapeXml="false"/>"
@@ -252,6 +281,47 @@
                 </c:forEach>
                 </c:if>
             ]
+        }).config.cols;
+
+        /**
+         * 参数cols是table.render({})中的cols属性值
+         * aop代理是基于event点击事件进行操作的,
+         * 因此cols中务必开启event点击事件!
+         **/
+        var aopTable = tableEdit.aopObj(cols); //获取一个aop对象
+        /**
+         * 注意:
+         * 1、 aopTable.on('tool(xxx)',function (obj) {})
+         * 2、 table.on('tool(yyy)',function (obj) {})
+         * 如果1中的xxx与2中的yyy字符串相同时,
+         * 不能同时用,用了会造成后调用者覆盖前调用者。
+         * 应该直接用1来代替2,因为1中包含了2中的事件。
+         * 如果不相同,则可以同时使用。
+         **/
+        aopTable.on('tool(tableEvent)',function (obj) {
+            var field = obj.field; //单元格字段
+            console.log(field);
+            var value = obj.value; //修改后的值
+            console.log(value);
+            var data = obj.data; //当前行旧数据
+            console.log(data);
+            var event = obj.event; //当前单元格事件属性值
+            console.log(event);
+            var update = {};
+            update[field] = value;
+            //把value更新到行中
+            obj.update(update);
+
+            $.ajax({
+                type:'post',
+                url:"${ctx}/workstaff/workStaffBasicInfo/updateAuditUser",
+                data:{"id":data.id,"auditUserId":value.name},
+                dataType:"json",
+                success:function(data){
+                    var data = data;
+                    parent.layer.msg(data.msg,{icon:1});
+                }
+            });
         });
 
     })