This commit is contained in:
zhangzhikang 2022-08-31 18:27:44 +08:00
commit 28f4558fa6
11 changed files with 111 additions and 11 deletions

View File

@ -323,6 +323,10 @@ public class ActivitiNoticeAspect {
private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = delegateTask.getVariables();
LOGGER.error("表单:{}", JSON.toJSONString(kv));
if(delegateTask.getId().equals(kv.get("autoApply"))){
LOGGER.error("------------自动审批通过,不通知------------");
return;
}
String key = null;
if (kv.containsKey("id")) {
key = kv.getOrDefault("id", "").toString();

View File

@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 定时获取视频资源的部门信息
* 定时获取视频资源的部门信息,成功后会执行获取摄像头通道信息
* @author ytl
* @Date 2022/7/29 9:45
**/

View File

@ -0,0 +1,27 @@
package io.renren.modules.monitor.task;
import io.renren.modules.job.task.ITask;
import io.renren.modules.sys.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 定期从金宏网获取并增量修改用户信息已存在的用户只修改 guid mobile ywMobile
* @author ytl
* @Date 2022/8/30 18:06
**/
@Component("getAndUpdateUserFromJhTask")
public class GetAndUpdateUserFromJhTask implements ITask {
@Autowired
private SysUserService userService;
@Override
public void run(String params) {
//先备份数据库表 sys_user
int i = userService.backSysUser();
if(i == 0){
userService.getUserInfoFromJH();
}
}
}

View File

@ -7,7 +7,6 @@ import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.common.utils.Result;
import io.renren.modules.notice.dao.SysNoticeDao;
import io.renren.modules.notice.dto.SysNoticeDTO;
import io.renren.modules.notice.entity.SysNoticeEntity;
@ -194,7 +193,12 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
//通过WebSocket提示选中用户有新通知
MessageData<String> message = new MessageData<String>().msg(notice.getTitle());
webSocketServer.sendMessage(finalUserIdList, message);
sendToYaweiUser(notice, finalUserIdList);
}, executor).thenRunAsync(() -> {
try {
sendToYaweiUser(notice, finalUserIdList);
} catch (Exception exception) {
logger.error("", exception);
}
}, executor);
}
}
@ -241,14 +245,14 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
exchangeCodes.append(ywMobile + ";");
}
}
if (userNames.charAt(userNames.length()-1) == ';') {
userNames.deleteCharAt(userNames.length()-1);
if (userNames.charAt(userNames.length() - 1) == ';') {
userNames.deleteCharAt(userNames.length() - 1);
}
if (userGuids.charAt(userGuids.length()-1) == ';') {
userGuids.deleteCharAt(userGuids.length()-1);
if (userGuids.charAt(userGuids.length() - 1) == ';') {
userGuids.deleteCharAt(userGuids.length() - 1);
}
if (exchangeCodes.charAt(exchangeCodes.length()-1) == ';') {
exchangeCodes.deleteCharAt(exchangeCodes.length()-1);
if (exchangeCodes.charAt(exchangeCodes.length() - 1) == ';') {
exchangeCodes.deleteCharAt(exchangeCodes.length() - 1);
}
@ -259,7 +263,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
" <InsertTodealByPollCode xmlns=\"http://tempuri.org/\">\n" +
String.format("<todealGuid>{%s}</todealGuid>\n", UUID.randomUUID().toString().toUpperCase()) +
String.format("<fileGuid>{%s}</fileGuid>\n", UUID.randomUUID().toString().toUpperCase()) +
String.format("<title>%s</title>\n",notice.getTitle()) +
String.format("<title>%s</title>\n", notice.getTitle()) +
" <docType>2</docType>\n" +
String.format("<receiveLocalPerson>%s</receiveLocalPerson>\n", userNames.toString()) +
String.format("<receiveLocalPersonGuid>%s</receiveLocalPersonGuid>\n", userGuids.toString()) +
@ -291,7 +295,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
logger.error("推送待办失败:" + body);
}
} catch (Exception e) {
logger.error("推送亚威待办失败", e);
logger.error("推送亚威待办失败", e);
}
}

View File

@ -129,6 +129,7 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}
@ -139,6 +140,7 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人重复,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}

View File

@ -130,6 +130,7 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}
@ -140,6 +141,7 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人重复,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}

View File

@ -222,6 +222,7 @@ public class CorrectionListenerV3 implements TaskListener, ExecutionListener, Ac
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}
@ -232,6 +233,7 @@ public class CorrectionListenerV3 implements TaskListener, ExecutionListener, Ac
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人重复,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}

View File

@ -126,6 +126,7 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}
@ -136,6 +137,7 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人重复,默认通过");
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId());
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}

View File

@ -176,4 +176,17 @@ public class SysUserController {
public Result getUserInfoFromJH() {
return sysUserService.getUserInfoFromJH();
}
@GetMapping("backSysUser")
@ApiOperation("手动执行备份sys_user表并从金宏获取用户信息增量更新到用户表中")
public Result backSysUser(){
int i = sysUserService.backSysUser();
if(i ==0){
sysUserService.getUserInfoFromJH();
return new Result().ok("更新用户已经执行");
}else{
return new Result().error();
}
}
}

View File

@ -61,4 +61,6 @@ public interface SysUserService extends BaseService<SysUserEntity> {
Result getUserInfoFromJH();
int backSysUser();
}

View File

@ -62,6 +62,15 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
@Value("${big_date.assignee_role_name}")
private String roleName; // 具备审批的角色名称
@Value("${spring.datasource.druid.url}")
private String url;
@Value("${spring.datasource.druid.username}")
private String username;
@Value("${spring.datasource.druid.password}")
private String password;
@Override
public PageData<SysUserDTO> page(Map<String, Object> params) {
//转换成like
@ -471,4 +480,37 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
}
}
@Override
public int backSysUser(){
int result = 1;
Process process = null;
String property = System.getProperty("os.name");
System.out.println(property);
StringBuilder strBuil = new StringBuilder();
String host = url.substring(url.indexOf("mysql"), url.indexOf("3306")).replace(":", "").replace("//", "").replace("mysql", "");
String dataName = url.substring(url.indexOf("3306"), url.indexOf("?")).replaceAll("/", "").replaceAll("3306", "");
strBuil.append("mysqldump -u").append(username).append(" -p").append(password)
.append(" -h").append(host).append(" -P3306 ").append(dataName).append(" sys_user > /data/services/sys_user.sql");
//String newCmdLinux = " mysqldump -uroot -pw@CmM1mBVQkPhdrc -h15.72.183.91 -P3306 share_platform sys_user > /data/services/sys_user.sql";
String newCmdLinux = strBuil.toString();
String newCmdWin = " cmd /c mysqldump -uroot -proot -h127.0.0.1 -P3306 share_platform sys_user > D:\\sys_user.sql";
try{
if (property.indexOf("Linux") != -1) {
// linux
process = Runtime.getRuntime().exec(new String[]{"bash", "-c", newCmdLinux});
} else {
// 本地win
process = Runtime.getRuntime().exec(newCmdWin);
}
//process.waitFor() == 0表示执行正常
result = process.waitFor();
}catch (Exception e){
e.printStackTrace();
}finally {
return result;
}
}
}