Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

[user3] 4 лет назад
Родитель
Сommit
71913dc5ca

+ 7 - 0
src/main/java/com/jeeplus/modules/sys/dao/UserDao.java

@@ -244,4 +244,11 @@ public interface UserDao extends CrudDao<User> {
 	int updateUser(User user);
 	int updateUser(User user);
 
 
 	String findUserNo(String weChatId);
 	String findUserNo(String weChatId);
+
+	/**
+	 * 根据名称获取用户信息
+	 * @param name
+	 * @return
+	 */
+	User findUserByUserName(String name);
 }
 }

+ 9 - 0
src/main/java/com/jeeplus/modules/sys/service/SystemService.java

@@ -1567,4 +1567,13 @@ public class SystemService extends BaseService implements InitializingBean {
         user.setOffice(office);
         user.setOffice(office);
         return userDao.countByOffice(user);
         return userDao.countByOffice(user);
     }
     }
+
+    /**
+     * 根据用户名称查询用户信息
+     * @param name
+     * @return
+     */
+    public User findUserByUserName(String name) {
+        return userDao.findUserByUserName(name);
+    }
 }
 }

+ 16 - 0
src/main/java/com/jeeplus/modules/sys/web/UserController.java

@@ -1456,5 +1456,21 @@ public class UserController extends BaseController {
         return ajaxJson;
         return ajaxJson;
     }
     }
 
 
+    /**
+     * 验证工号是否重复
+     * @param oldNo
+     * @param no
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "getUserByName")
+    public AjaxJson getUserByName(String name) {
+        AjaxJson ajaxJson = new AjaxJson();
+        if(StringUtils.isNotBlank(name)){
+            User user = systemService.findUserByUserName(name);
+            ajaxJson.put("data",user);
+        }
+        return ajaxJson;
+    }
 
 
 }
 }

+ 52 - 2
src/main/java/com/jeeplus/modules/workclientinfo/service/WorkClientInfoService.java

@@ -185,8 +185,58 @@ public class WorkClientInfoService extends CrudService<WorkClientInfoDao, WorkCl
      * @return
      * @return
      */
      */
     public Page<WorkClientInfo> findPage(Page<WorkClientInfo> page, WorkClientInfo workClientInfo) {
     public Page<WorkClientInfo> findPage(Page<WorkClientInfo> page, WorkClientInfo workClientInfo) {
-//        workClientInfo.setOfficeId(UserUtils.getSelectOffice().getId());
-//        workClientInfo.getSqlMap().put("dsf", dataScopeFilter(workClientInfo.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_CLIENT_INFO.getValue()));
+        workClientInfo.setOfficeId(UserUtils.getSelectOffice().getId());
+        workClientInfo.getSqlMap().put("dsf", dataScopeFilter(workClientInfo.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_CLIENT_INFO.getValue()));
+        long t1 = System.currentTimeMillis();
+        //根据项目类型获取对应的客户id个数
+        int count = workClientInfoDao.queryCount(workClientInfo);
+        page.setCount(count);
+        long t2 = System.currentTimeMillis();
+        logger.info("查询客户总数耗时:{}",t2-t1);
+        page.setCountFlag(false);
+        workClientInfo.setPage(page);
+        List<WorkClientInfo> list = findList(workClientInfo);
+        //根据客户id查询客户的相关客户类型
+        for (WorkClientInfo clientInfo: list) {
+            clientInfo.setJobTypeStr(workClientInfoDao.getJobTypeStr(clientInfo.getId()));
+        }
+        long t3 = System.currentTimeMillis();
+        logger.info("查询客户列表耗时:{}",t3-t2);
+        if(list!=null && list.size()>0){
+            for (int i = 0; i < list.size(); i++) {
+                WorkClientInfo entity = list.get(i);
+                List<WorkClientLinkman> linkmanList = findLinkmanList(entity);
+                entity.setWorkClientLinkmanList(linkmanList);
+                if(linkmanList!=null && linkmanList.size()>0){
+                    StringBuilder builder = new StringBuilder();
+                    for (int j = 0; j < linkmanList.size(); j++) {
+                        builder.append(linkmanList.get(j).getName());
+                        if(j<linkmanList.size()-1){
+                            builder.append(",");
+                        }
+                    }
+                    entity.setLinkManNames(builder.toString());
+                }
+                List<WorkClientBank> bankList = findBankList(entity);
+                entity.setWorkClientBankList(bankList);
+            }
+        }
+        long t4 = System.currentTimeMillis();
+        logger.info("查询客户详情耗时:{}",t4-t3);
+        logger.info("查询客户总耗时:{}",t4-t1);
+        page.setList(list);
+        return page;
+    }
+
+
+
+    /**
+     * 获取一个客户信息
+     * @param page 分页对象
+     * @param workClientInfo
+     * @return
+     */
+    public Page<WorkClientInfo> findPageByContract(Page<WorkClientInfo> page, WorkClientInfo workClientInfo) {
         long t1 = System.currentTimeMillis();
         long t1 = System.currentTimeMillis();
         //根据项目类型获取对应的客户id个数
         //根据项目类型获取对应的客户id个数
         int count = workClientInfoDao.queryCount(workClientInfo);
         int count = workClientInfoDao.queryCount(workClientInfo);

+ 3 - 7
src/main/java/com/jeeplus/modules/workclientinfo/web/WorkClientInfoController.java

@@ -86,14 +86,10 @@ public class WorkClientInfoController extends BaseController {
 	@RequestMapping(value = {"list", ""})
 	@RequestMapping(value = {"list", ""})
 	public String list(WorkClientInfo workClientInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
 	public String list(WorkClientInfo workClientInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
 
 
-		if(StringUtils.isNotBlank(workClientInfo.getCreateId())){
-			User selectUser = UserUtils.get(workClientInfo.getCreateId());
-			model.addAttribute("createName", selectUser.getName());
-		}else{
-			if(StringUtils.isNotBlank(workClientInfo.getCreateNameStr())){
-				model.addAttribute("createName", workClientInfo.getCreateNameStr());
-			}
+		if(StringUtils.isNotBlank(workClientInfo.getCreateNameStr())){
+			model.addAttribute("createName", workClientInfo.getCreateNameStr());
 		}
 		}
+
 		WorkClientLinkman workClientLinkman = workClientInfo.getWorkClientLinkman();
 		WorkClientLinkman workClientLinkman = workClientInfo.getWorkClientLinkman();
 		if(workClientLinkman != null){
 		if(workClientLinkman != null){
 			workClientLinkman.setId("");
 			workClientLinkman.setId("");

+ 2 - 2
src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java

@@ -357,8 +357,8 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 			workContractInfo.setTotalContractIds(","+workContractInfo.getTotalContractIds()+",");
 			workContractInfo.setTotalContractIds(","+workContractInfo.getTotalContractIds()+",");
 		}
 		}
 		String companyId = UserUtils.getUser().getComId();
 		String companyId = UserUtils.getUser().getComId();
-//		workContractInfo.getSqlMap().put("dsf", dataScopeFilter(workContractInfo.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_CONTRACT_INFO.getValue()));
-		workContractInfo.getSqlMap().put("dsf","and (a.company_id='"+companyId+"')");
+		workContractInfo.getSqlMap().put("dsf", dataScopeFilter(workContractInfo.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_CONTRACT_INFO.getValue()));
+		//workContractInfo.getSqlMap().put("dsf","and (a.company_id='"+companyId+"')");
 		int count = dao.queryCount(workContractInfo);
 		int count = dao.queryCount(workContractInfo);
 		page.setCount(count);
 		page.setCount(count);
 		page.setCountFlag(false);
 		page.setCountFlag(false);

+ 2 - 1
src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractInfoController.java

@@ -917,6 +917,7 @@ public class WorkContractInfoController extends BaseController {
                 workContractInfo.setCreateName(name);
                 workContractInfo.setCreateName(name);
                 workContractInfo.setCreateCompany(comId);
                 workContractInfo.setCreateCompany(comId);
                 workContractInfo.setCompanyId(comId);
                 workContractInfo.setCompanyId(comId);
+                workContractInfo.setOfficeId(UserUtils.getSelectOffice().getId());
                 List<WorkClientAttachment> list = workContractInfo.getWorkAttachments();
                 List<WorkClientAttachment> list = workContractInfo.getWorkAttachments();
                 List<WorkClientAttachment> list1 = new ArrayList<>();
                 List<WorkClientAttachment> list1 = new ArrayList<>();
                 List<WorkClientAttachment> list2 = new ArrayList<>();
                 List<WorkClientAttachment> list2 = new ArrayList<>();
@@ -1463,7 +1464,7 @@ public class WorkContractInfoController extends BaseController {
      */
      */
     @RequestMapping(value = "selectclientAhref")
     @RequestMapping(value = "selectclientAhref")
     public String selectclientAhref(WorkClientInfo client, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String searchLabel1, String searchKey1, HttpServletRequest request, HttpServletResponse response, Model model) {
     public String selectclientAhref(WorkClientInfo client, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String searchLabel1, String searchKey1, HttpServletRequest request, HttpServletResponse response, Model model) {
-        Page<WorkClientInfo> page = workClientInfoService.findPage(new Page<WorkClientInfo>(request, response), client);
+        Page<WorkClientInfo> page = workClientInfoService.findPageByContract(new Page<WorkClientInfo>(request, response), client);
         try {
         try {
             fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
             fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
             fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
             fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");

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

@@ -1176,5 +1176,15 @@
 		where id = #{id}
 		where id = #{id}
 	</update>
 	</update>
 
 
+	<!-- 根据登录名查询用户 -->
+	<select id="findUserByUserName" resultType="User" parameterType="User">
+		SELECT
+		<include refid="userColumns"/>
+		FROM sys_user a
+		LEFT JOIN sys_office s ON s.id = a.company_id
+		LEFT JOIN sys_office o ON o.id = a.office_id
+		LEFT JOIN sys_office bo ON bo.id = o.branch_office
+		WHERE a.name = #{name} AND a.del_flag = 0
+	</select>
 
 
 </mapper>
 </mapper>

+ 3 - 2
src/main/resources/mappings/modules/workclientinfo/WorkClientInfoDao.xml

@@ -164,10 +164,10 @@
                 AND a.create_date &lt; #{endDate}
                 AND a.create_date &lt; #{endDate}
             </if>
             </if>
 			<if test="(createId != null and createId != '') or (createNameStr != null and createNameStr != '')">
 			<if test="(createId != null and createId != '') or (createNameStr != null and createNameStr != '')">
-				AND (a.create_by = #{createId} or su.name = #{createNameStr})
+				AND (a.create_by = #{createId} or su.name like concat('%',#{createNameStr},'%'))
 			</if>
 			</if>
             AND a.company_id = #{currentUser.company.id}
             AND a.company_id = #{currentUser.company.id}
-
+			${sqlMap.dsf}
 			<choose>
 			<choose>
 				<when test="jobTypeShow !=null and jobTypeShow !=''">
 				<when test="jobTypeShow !=null and jobTypeShow !=''">
 					AND c.job_type_id = #{jobTypeShow}
 					AND c.job_type_id = #{jobTypeShow}
@@ -241,6 +241,7 @@
 				AND (a.create_by = #{createId} or su.name = #{createNameStr})
 				AND (a.create_by = #{createId} or su.name = #{createNameStr})
 			</if>
 			</if>
             AND a.company_id = #{currentUser.company.id}
             AND a.company_id = #{currentUser.company.id}
+			${sqlMap.dsf}
             <choose>
             <choose>
 				<when test="jobTypeShow !=null and jobTypeShow !=''">
 				<when test="jobTypeShow !=null and jobTypeShow !=''">
 					AND c.job_type_id = #{jobTypeShow}
 					AND c.job_type_id = #{jobTypeShow}

+ 3 - 3
src/main/resources/mappings/modules/workcontractinfo/WorkContractInfoDao.xml

@@ -316,7 +316,7 @@
 					</otherwise>
 					</otherwise>
 				</choose>
 				</choose>
 			</if>
 			</if>
-			${sqlMap.dsf}
+			AND a.company_id = #{currentUser.company.id} ${sqlMap.dsf}
 		</where>
 		</where>
 		<choose>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -933,7 +933,7 @@
 			#{contractFee},
 			#{contractFee},
 			#{contractSpecial},
 			#{contractSpecial},
 			#{contractState},
 			#{contractState},
-			#{chargeCompany},
+			#{officeId},
 			#{contractFileId},
 			#{contractFileId},
 			#{contractRole},
 			#{contractRole},
 			#{applyView},
 			#{applyView},
@@ -990,7 +990,7 @@
 			contract_fee = #{contractFee},
 			contract_fee = #{contractFee},
 			contract_special = #{contractSpecial},
 			contract_special = #{contractSpecial},
 			contract_state = #{contractState},
 			contract_state = #{contractState},
-			office_id = #{chargeCompany},
+			office_id = #{officeId},
 			contract_file_id = #{contractFileId},
 			contract_file_id = #{contractFileId},
 			contract_role = #{contractRole},
 			contract_role = #{contractRole},
 			apply_view = #{applyView},
 			apply_view = #{applyView},

+ 1 - 1
src/main/webapp/WEB-INF/tags/sys/inquireselectUserNotReadolny.tag

@@ -25,7 +25,7 @@
 	<input id="${id}Id" name="${name}" class="${cssClass}" type="hidden" value="${value}"/>
 	<input id="${id}Id" name="${name}" class="${cssClass}" type="hidden" value="${value}"/>
 	<div class="input-group">
 	<div class="input-group">
 		<input id="${id}Name" name="${labelName}" type="text" value="${labelValue}" data-msg-required="${dataMsgRequired}"
 		<input id="${id}Name" name="${labelName}" type="text" value="${labelValue}" data-msg-required="${dataMsgRequired}"
-		class="${cssClass}" style="${cssStyle}"/>
+		class="${cssClass}" style="${cssStyle}" onblur="cBlur(this)"/>
 		<span class="input-group-btn">
 		<span class="input-group-btn">
 	       		 <button type="button"  id="${id}Button" class="btn <c:if test="${fn:contains(cssClass, 'input-sm')}"> btn-sm </c:if><c:if test="${fn:contains(cssClass, 'input-lg')}"> btn-lg </c:if>  btn-primary ${disabled} ${hideBtn ? 'hide' : ''}"><i class="fa fa-search"></i>
 	       		 <button type="button"  id="${id}Button" class="btn <c:if test="${fn:contains(cssClass, 'input-sm')}"> btn-sm </c:if><c:if test="${fn:contains(cssClass, 'input-lg')}"> btn-lg </c:if>  btn-primary ${disabled} ${hideBtn ? 'hide' : ''}"><i class="fa fa-search"></i>
 	             </button>
 	             </button>

+ 25 - 0
src/main/webapp/webpage/modules/workclientinfo/workClientInfoList.jsp

@@ -104,6 +104,31 @@
 				layer.close(index);
 				layer.close(index);
 			});
 			});
 		}
 		}
+
+		function cBlur(obj) {
+			var id = $("#createId").val();
+			if(undefined != obj.value && null != obj.value && '' != obj.value){
+				$.ajax({
+					url:'${ctx}/sys/user/getUserByName?name='+obj.value,
+					type:"post",
+					success:function(data){
+						var user = data.body.data;
+						if(undefined == user || null == user || '' == user){
+							$("#createId").val("");
+						}else{
+							if(data.body.data.id != id){
+								if(undefined != id && null != id && '' != id){
+									$("#createId").val("");
+								}
+							}
+						}
+					}
+				});
+			}else{
+				$("#createId").val("");
+			}
+
+		}
 	</script>
 	</script>
 </head>
 </head>
 <body class="gray-bg">
 <body class="gray-bg">

+ 1 - 1
src/main/webapp/webpage/modules/workstaff/workStaffBasicInfoForm.jsp

@@ -1182,7 +1182,7 @@
                                     <input id="certificateList${varStatus.index}_issuingAuthority" name="certificateList[${varStatus.index}].issuingAuthority" class="form-control" value="${certificate.issuingAuthority}"/>
                                     <input id="certificateList${varStatus.index}_issuingAuthority" name="certificateList[${varStatus.index}].issuingAuthority" class="form-control" value="${certificate.issuingAuthority}"/>
                                 </td>
                                 </td>
 
 
-                                <td class="text-left op-td">
+                                <td  class="text-center op-td">
                                     <a class="op-btn op-btn-add" title="上传" onclick="this_upload_file_button('certificateList${varStatus.index}_file')"><i class="fa fa-plus"></i>&nbsp;上传</a><span id="certificateList${varStatus.index}_fileName1"><c:if test="${not empty certificate.filePath}"><img src="${certificate.filePath}" width="24" height="24" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${certificate.filePath}','90%','90%')" alt=""></c:if></span>
                                     <a class="op-btn op-btn-add" title="上传" onclick="this_upload_file_button('certificateList${varStatus.index}_file')"><i class="fa fa-plus"></i>&nbsp;上传</a><span id="certificateList${varStatus.index}_fileName1"><c:if test="${not empty certificate.filePath}"><img src="${certificate.filePath}" width="24" height="24" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${certificate.filePath}','90%','90%')" alt=""></c:if></span>
                                     <input id="certificateList${varStatus.index}_file" name="certificateList[${varStatus.index}].file" style="display:none" type="file" onchange="changeFileName(this,1)"/>
                                     <input id="certificateList${varStatus.index}_file" name="certificateList[${varStatus.index}].file" style="display:none" type="file" onchange="changeFileName(this,1)"/>
                                 </td>
                                 </td>