yuansh 2 years ago
parent
commit
c46673ee4a

+ 2 - 2
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/mapper/TbTableInfoMapper.java

@@ -42,7 +42,7 @@ public interface TbTableInfoMapper extends BaseMapper<TbTableInfo> {
      * @param
      * @return
      */
-    @Select("select text_ from act_hi_varinst where PROC_INST_ID_ = #{procInstId} and name_ = #{columnName}")
-    String getColumnValueList(@Param("procInstId") String procInstId,@Param("columnName") String columnName);
+    @Select("select * from ${tableName} where id = #{id}")
+    Map<String,String> getColumnValueList(@Param("tableName") String tableName,@Param("id") String id);
 
 }

+ 7 - 4
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/activiti/listener/ListenerAnnualLeave.java

@@ -10,6 +10,8 @@ import org.jeecg.modules.system.mapper.SysUserMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.Map;
+
 /**
  * 流程监听,请假人实际请假时长,如果单位是天,要回写到员工档案年假里做扣减
  */
@@ -53,9 +55,10 @@ public class ListenerAnnualLeave implements TaskListener, JavaDelegate {
 		String category = delegateExecution.getVariableInstances().get(field_category).getTextValue();
 		String practical_leave = delegateExecution.getVariableInstances().get(field_practical).getTextValue();
 		String employe_name = delegateExecution.getVariableInstances().get(field_name).getTextValue();
-
-		if(StringUtils.isBlank(category) && StringUtils.isBlank(practical_leave)){
-			return;
+		String id = delegateExecution.getVariableInstances().get("id").getTextValue();
+		if(StringUtils.isBlank(practical_leave)){
+			Map<String,String> map = tbTableInfoMapper.getColumnValueList("employee_leave",id);
+			practical_leave = map.get(field_practical);
 		}
 
 		if(category.equals("2")){
@@ -68,7 +71,7 @@ public class ListenerAnnualLeave implements TaskListener, JavaDelegate {
 		}
 
 
-//		String regular_whether1 = tbTableInfoMapper.getColumnValueList(delegateExecution.getProcessInstanceId(),regular_whether);
+//		String regular_whether1 = tbTableInfoMapper.getColumnValueList(delegateExecution.getProcessInstanceId(),field_practical);
 //		if(StringUtils.isNotBlank(regular_whether1) && regular_whether1.equals("1")){
 //
 //			String regular_employee1 = tbTableInfoMapper.getColumnValueList(delegateExecution.getProcessInstanceId(),regular_employee);

+ 94 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/activiti/listener/ListenerMeeting.java

@@ -0,0 +1,94 @@
+package org.jeecg.modules.activiti.listener;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.activiti.engine.delegate.*;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.system.api.ISysBaseAPI;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.activiti.mapper.TbTableInfoMapper;
+import org.jeecg.modules.system.mapper.SysUserMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 流程监听,会议纪要发送消息至参会人
+ */
+@Component
+public class ListenerMeeting implements TaskListener, JavaDelegate {
+
+	private Expression json;
+	@Autowired
+	private ISysBaseAPI sysBaseAPI;
+
+	@Override
+	public void notify(DelegateTask delegateTask){
+		System.out.println("-------------1");
+	}
+
+	@Override
+	public void execute(DelegateExecution delegateExecution){
+
+		String jsonString = json.getExpressionText();
+		JSONObject jsonObject = JSON.parseObject(jsonString);
+		String msg_title = oConvertUtils.getString(jsonObject.get("msg_title")); // 会议纪要标题
+		String msg_content = oConvertUtils.getString(jsonObject.get("msg_content")); // 正文
+		String msg_user = oConvertUtils.getString(jsonObject.get("msg_user")); // 员工
+
+		System.out.println(msg_user);
+
+		if(StringUtils.isBlank(msg_user)){
+			return;
+		}
+
+		if(!delegateExecution.getVariableInstances().containsKey(msg_user)){
+			return;
+		}
+
+		String msg_user1 = delegateExecution.getVariableInstances().get(msg_user).getTextValue();
+		String msg_title1 = delegateExecution.getVariableInstances().get(msg_title).getTextValue();
+		String msg_content1 = delegateExecution.getVariableInstances().get(msg_content).getTextValue();
+
+		String msg_content12 = msg_content1.replace("\n","<br>");
+
+		String dmf = msg_user1.replace("[","");
+		String dmf2 = dmf.replace("]","");
+		String dmf3 = dmf2.replace("\"","");
+		String[] userList = dmf3.split(",");
+
+		HashMap<String,Object> taskParam = new HashMap<>();
+		LoginUser loginUser = sysBaseAPI.getUserByName("admin");
+
+		for (String o:userList){
+			sysBaseAPI.sendSysAnnouncement(loginUser,"admin",o,"会议纪要","<h2>会议主题:"+msg_title1+"</h2><br> <h3>会议内容:<br>"+msg_content12+"</h3>", CommonConstant.MSG_CATEGORY_2,taskParam);
+		}
+
+
+	}
+
+	public static void main(String[] args) {
+		String ss = "[\"lisi\",\"admin\",\"wxs\",\"T0116\",\"T0007\"]";
+
+		String dmf = ss.replace("[","");
+		String dmf2 = dmf.replace("]","");
+
+		String[] ssa = dmf2.split(",");
+		System.out.println(ssa);
+
+
+		System.out.println(dmf2);
+		List<String> aa = new ArrayList<>();
+		aa.add(0,"223232");
+		aa.add(1,"223232");
+
+		System.out.println(aa);
+	}
+
+}

+ 11 - 2
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -115,7 +115,11 @@ public class LoginController {
 		sysBaseAPI.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
 
 		String is_possess = getDeptHead(username,sysUser.getOrgCode());
-		sysUser.setIsPossess(is_possess);
+		if(is_possess.equals("0")){
+			sysUser.setIsPossess(2);
+		}else{
+			sysUser.setIsPossess(sysUser.getIdentity());
+		}
 
 		return result;
 	}
@@ -281,7 +285,12 @@ public class LoginController {
 		SysUser sysUser = sysUserService.getUserByName(username);
 
 		String is_possess = getDeptHead(username,orgCode);
-		sysUser.setIsPossess(is_possess);
+
+		if(is_possess.equals("0")){
+			sysUser.setIsPossess(2);
+		}else{
+			sysUser.setIsPossess(sysUser.getIdentity());
+		}
 
 		JSONObject obj = new JSONObject();
 		obj.put("userInfo", sysUser);

+ 39 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -160,6 +160,11 @@ public class SysUserController {
 				user.setUpdateTime(new Date());
 				//String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
 				user.setPassword(sysUser.getPassword());
+                String pa = checkInfo(user,sysUser);
+				if(pa.equals("1")){
+                    MyThread mt = new MyThread(user);
+                    mt.start();
+                }
 				String roles = jsonObject.getString("selectedroles");
                 String departs = jsonObject.getString("selecteddeparts");
 				sysUserService.editUserWithRole(user, roles);
@@ -173,6 +178,40 @@ public class SysUserController {
 		return result;
 	}
 
+    /**
+     * 检查通讯录是否有更新
+     * @param oldUser
+     * @param newUser
+     * @return
+     */
+	public String checkInfo(SysUser oldUser,SysUser newUser){
+//
+//        System.out.println(oldUser.getRealname() +"====="+ newUser.getRealname());
+//        System.out.println( oldUser.getWorkNo()  +"====="+  newUser.getWorkNo());
+//        System.out.println(oldUser.getPost()  +"====="+  newUser.getPost());
+//        System.out.println(oldUser.getPhone()  +"====="+  newUser.getPhone());
+//        System.out.println(oldUser.getNVirtualNo()  +"====="+ newUser.getNVirtualNo());
+//        System.out.println( oldUser.getNCompanyPhone()  +"====="+  newUser.getNCompanyPhone());
+//        System.out.println(oldUser.getNCompanyLine()  +"====="+  newUser.getNCompanyLine());
+//        System.out.println(oldUser.getTelephone()  +"====="+  newUser.getTelephone());
+//        System.out.println(oldUser.getEmail() +"====="+  newUser.getEmail());
+	    if(!oldUser.getRealname().equals(newUser.getRealname()) ||
+                !oldUser.getWorkNo() .equals( newUser.getWorkNo()) ||
+                !oldUser.getPost() .equals( newUser.getPost()) ||
+                !oldUser.getPhone() .equals( newUser.getPhone()) ||
+                !oldUser.getNVirtualNo() .equals( newUser.getNVirtualNo()) ||
+                !oldUser.getNCompanyPhone() .equals( newUser.getNCompanyPhone()) ||
+                !oldUser.getNCompanyLine() .equals( newUser.getNCompanyLine()) ||
+                !oldUser.getTelephone() .equals( newUser.getTelephone()) ||
+                !oldUser.getEmail() .equals( newUser.getEmail())
+
+        ){
+            return "1";
+        }
+
+	    return "0";
+    }
+
 	/**
 	 * 删除用户
 	 */

+ 1 - 1
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUser.java

@@ -337,5 +337,5 @@ public class SysUser implements Serializable {
     private java.lang.String belongingCompany;
 
     @TableField(exist = false)
-    private java.lang.String isPossess;//该用户是否有部门负责人 0否 1是
+    private java.lang.Integer isPossess;//该用户是否有部门负责人 0否 1是
 }