Commit 2d1e8c99 by liuzz

手术分级数据全量推送,修改手术分级的时候更新推送相关绑定数据

parent 27e1a554
package com.wechat.common.webserviceClient; package com.wechat.common.webserviceClient;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import javax.xml.namespace.QName; import lombok.extern.slf4j.Slf4j;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call; import org.apache.axis.client.Call;
import org.apache.axis.client.Service; import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType; import org.apache.axis.encoding.XMLType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
@Component @Component
@Slf4j
public class XhWebServiceClient { public class XhWebServiceClient {
protected final Logger logger = LoggerFactory.getLogger(XhWebServiceClient.class);
public static String SubWebService(String map) throws Exception { public static String SubWebService(String map) throws Exception {
String requestXml = JSONObject.toJSON(map).toString(); String requestXml = JSONObject.toJSON(map).toString();
System.out.println("调用esb发布数据集服务:" + requestXml); log.info("调用esb发布数据集服务:{}", requestXml);
String responseXml = ""; String responseXml = "";
try { try {
...@@ -33,7 +33,7 @@ public class XhWebServiceClient { ...@@ -33,7 +33,7 @@ public class XhWebServiceClient {
return (String)call.invoke(new Object[]{requestXml}); return (String)call.invoke(new Object[]{requestXml});
} catch (ServiceException var8) { } catch (ServiceException var8) {
var8.printStackTrace(); var8.printStackTrace();
System.out.println("调用发布数据接口异常:" + var8.getMessage()); log.error("调用发布数据接口异常:{}", var8.getMessage());
throw new ServiceException("请求webservice服务异常", var8); throw new ServiceException("请求webservice服务异常", var8);
} }
} }
...@@ -63,14 +63,5 @@ public class XhWebServiceClient { ...@@ -63,14 +63,5 @@ public class XhWebServiceClient {
} }
} }
public static void main(String[] args) {
String xml = "{\"parameters\":{\"pagerecord\":\"9999\",\"sharedatacode\":\"S00014\",\"pageno\":\"1\",\"ORGCODE\":\"66\",\"Reservationid\":\"P00202007030311380926074\"}}";
try {
new XhWebServiceClient();
SubWebService(xml);
} catch (Exception var3) {
var3.printStackTrace();
}
}
} }
...@@ -8,17 +8,11 @@ import com.wechat.framework.web.domain.AjaxResult; ...@@ -8,17 +8,11 @@ import com.wechat.framework.web.domain.AjaxResult;
import com.wechat.framework.web.page.TableDataInfo; import com.wechat.framework.web.page.TableDataInfo;
import com.wechat.project.basis.domain.Operation; import com.wechat.project.basis.domain.Operation;
import com.wechat.project.basis.service.IOperationService; import com.wechat.project.basis.service.IOperationService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import java.util.List;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping({"/basis/operationDict"}) @RequestMapping({"/basis/operationDict"})
...@@ -62,6 +56,11 @@ public class OperationController extends BaseController { ...@@ -62,6 +56,11 @@ public class OperationController extends BaseController {
return this.toAjax(this.operationService.insertOperation(operation)); return this.toAjax(this.operationService.insertOperation(operation));
} }
/**
* 更新手术等级
* @param operation
* @return
*/
@PreAuthorize("@ss.hasPermi('basis:operationDict:edit')") @PreAuthorize("@ss.hasPermi('basis:operationDict:edit')")
@Log( @Log(
title = "手术字典", title = "手术字典",
......
package com.wechat.project.basis.mapper; package com.wechat.project.basis.mapper;
import com.wechat.project.basis.domain.Operation; import com.wechat.project.basis.domain.Operation;
import com.wechat.project.operation.domain.EmpLinkOperation;
import java.util.List; import java.util.List;
public interface OperationMapper { public interface OperationMapper {
...@@ -19,4 +21,25 @@ public interface OperationMapper { ...@@ -19,4 +21,25 @@ public interface OperationMapper {
int deleteOperationByCode(String opsCode); int deleteOperationByCode(String opsCode);
int selectCountOperation(String opsCode); int selectCountOperation(String opsCode);
/**
* 查询所有绑定过的此手术的信息
* @param opsCode
* @return
*/
List<EmpLinkOperation> selectBindOperationEmp(String opsCode);
/**
* 查询所有
* @param opsCode
* @return
*/
List<EmpLinkOperation> selectAllOperationEmp();
/**
* 手术分级修改之后对绑定数据进行更新
* @param operation
* @return
*/
int updateEmpLinkById(EmpLinkOperation operation);
} }
package com.wechat.project.basis.service.impl; package com.wechat.project.basis.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.wechat.common.utils.DateUtils; import com.wechat.common.utils.DateUtils;
import com.wechat.project.basis.domain.DataSourceByPT; import com.wechat.common.webserviceClient.XhWebServiceClient;
import com.wechat.project.basis.domain.Dept; import com.wechat.project.basis.domain.*;
import com.wechat.project.basis.domain.DeptMainInfo;
import com.wechat.project.basis.domain.Emp;
import com.wechat.project.basis.domain.MainParameters;
import com.wechat.project.basis.domain.Operation;
import com.wechat.project.basis.domain.OperationMainInfo;
import com.wechat.project.basis.domain.PTResponse;
import com.wechat.project.basis.domain.UserMainInfo;
import com.wechat.project.basis.mapper.DeptMapper; import com.wechat.project.basis.mapper.DeptMapper;
import com.wechat.project.basis.mapper.EmpMapper; import com.wechat.project.basis.mapper.EmpMapper;
import com.wechat.project.basis.mapper.OperationMapper; import com.wechat.project.basis.mapper.OperationMapper;
import com.wechat.project.basis.service.IOperationService; import com.wechat.project.basis.service.IOperationService;
import java.util.List; import com.wechat.project.operation.domain.EmpLinkOperation;
import com.wechat.project.operation.domain.OperationAuthMain;
import com.wechat.project.operation.domain.OperationAuthToPlatform;
import com.wechat.project.operation.domain.PlatformParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
@Slf4j
public class OperationServiceImpl implements IOperationService { public class OperationServiceImpl implements IOperationService {
@Autowired @Autowired
private OperationMapper operationMapper; private OperationMapper operationMapper;
...@@ -199,7 +201,44 @@ public class OperationServiceImpl implements IOperationService { ...@@ -199,7 +201,44 @@ public class OperationServiceImpl implements IOperationService {
@Override @Override
public int updateOperation(Operation operation) { public int updateOperation(Operation operation) {
return this.operationMapper.updateOperation(operation); Operation oldOperation = selectOperationById(operation.getId());
this.operationMapper.updateOperation(operation);
// 更新手术等级是需要重新发送给平台消息的
// 查询已经绑定过此手术的所有授权
// 判断是否更新了手术分级
if (!StrUtil.equals(operation.getOpsName(),oldOperation.getOpsName()) || !StrUtil.equals(operation.getOperationLevel(),oldOperation.getOperationLevel())) {
List<EmpLinkOperation> empLinkOperations = operationMapper.selectBindOperationEmp(operation.getOpsCode());
OperationAuthMain operationAuthMain = new OperationAuthMain();
PlatformParam platformParam = new PlatformParam();
platformParam.setDatasetcode("D02950");
platformParam.setSourceid("SSFJ");
platformParam.setSourcetype("U");
empLinkOperations.forEach(empLinkOperation -> {
// 更新手术信息
empLinkOperation.setOperationName(operation.getOpsName());
empLinkOperation.setOperationLevel(operation.getOperationLevel());
empLinkOperation.setSpell(operation.getSpell());
operationMapper.updateEmpLinkById(empLinkOperation);
// 平台消息推送
try {
OperationAuthToPlatform operationAuthToPlatform = new OperationAuthToPlatform();
operationAuthToPlatform.setCreateTime(DateUtils.getTime());
operationAuthToPlatform.setEmpCode(empLinkOperation.getEmpCode());
operationAuthToPlatform.setMainKey(empLinkOperation.getEmpCode() + "_" + empLinkOperation.getOperationCode());
operationAuthToPlatform.setOpsCode(empLinkOperation.getOperationCode());
operationAuthToPlatform.setOpsLevel(empLinkOperation.getOperationLevel());
operationAuthToPlatform.setOpsName(empLinkOperation.getOperationName());
operationAuthToPlatform.setSpell(empLinkOperation.getSpell());
operationAuthMain.setParam(platformParam);
operationAuthMain.setOperationAuthToPlatforms(CollectionUtil.toList(operationAuthToPlatform));
String result = XhWebServiceClient.SubWebService(JSON.toJSONString(operationAuthMain));
log.info("手术分级联动授权更新平台发布结果:{}",result);
}catch (Exception e){
log.error("平台消息推送失败",e);
}
});
}
return 1;
} }
@Override @Override
......
...@@ -10,17 +10,11 @@ import com.wechat.project.basis.domain.Operation; ...@@ -10,17 +10,11 @@ import com.wechat.project.basis.domain.Operation;
import com.wechat.project.operation.domain.AddOperationAuth; import com.wechat.project.operation.domain.AddOperationAuth;
import com.wechat.project.operation.domain.EmpLinkOperation; import com.wechat.project.operation.domain.EmpLinkOperation;
import com.wechat.project.operation.service.IEmpLinkOperationService; import com.wechat.project.operation.service.IEmpLinkOperationService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import java.util.List;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping({"/operation/operationLevel"}) @RequestMapping({"/operation/operationLevel"})
...@@ -96,6 +90,11 @@ public class EmpLinkOperationController extends BaseController { ...@@ -96,6 +90,11 @@ public class EmpLinkOperationController extends BaseController {
return this.getDataTable(list); return this.getDataTable(list);
} }
/**
* 获取未关联手术
* @param empLinkOperation
* @return
*/
@GetMapping({"/getUnLinkOperation"}) @GetMapping({"/getUnLinkOperation"})
public TableDataInfo selectUnLinkOperation(EmpLinkOperation empLinkOperation) { public TableDataInfo selectUnLinkOperation(EmpLinkOperation empLinkOperation) {
this.startPage(); this.startPage();
...@@ -112,6 +111,11 @@ public class EmpLinkOperationController extends BaseController { ...@@ -112,6 +111,11 @@ public class EmpLinkOperationController extends BaseController {
return this.getDataTable(list); return this.getDataTable(list);
} }
/**
* 删除手术授权
* @param addOperationAuth
* @return
*/
@PostMapping({"/deleteEmpLinkOperationByModel"}) @PostMapping({"/deleteEmpLinkOperationByModel"})
public AjaxResult deleteEmpLinkOperationByModel(@RequestBody AddOperationAuth addOperationAuth) { public AjaxResult deleteEmpLinkOperationByModel(@RequestBody AddOperationAuth addOperationAuth) {
return this.toAjax(this.empLinkOperationService.deleteEmpLinkOperationByModel(addOperationAuth)); return this.toAjax(this.empLinkOperationService.deleteEmpLinkOperationByModel(addOperationAuth));
......
package com.wechat.project.operation.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.wechat.common.utils.DateUtils;
import com.wechat.common.webserviceClient.XhWebServiceClient;
import com.wechat.framework.web.controller.BaseController;
import com.wechat.framework.web.domain.AjaxResult;
import com.wechat.project.basis.mapper.OperationMapper;
import com.wechat.project.operation.domain.*;
import com.wechat.project.operation.service.IEmpLinkOperationService;
import com.wechat.project.system.domain.SysMenu;
import com.wechat.project.system.domain.vo.RouterVo;
import com.wechat.project.system.mapper.SysMenuMapper;
import com.wechat.project.system.service.ISysMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping({"/open"})
@Slf4j
public class OpenController extends BaseController {
@Autowired
private IEmpLinkOperationService empLinkOperationService;
@Autowired
private OperationMapper operationMapper;
@Autowired
private SysMenuMapper menuMapper;
@Autowired
private ISysMenuService menuService;
public static volatile int flag = 0;
@GetMapping({"/init"})
public AjaxResult initAllEmpLink() {
if (flag == 1){
return AjaxResult.success("初始化任务正在执行,请不要重复调用");
}
flag = 1;
new Thread(()->{
OperationAuthMain operationAuthMain = new OperationAuthMain();
PlatformParam platformParam = new PlatformParam();
platformParam.setDatasetcode("D02950");
platformParam.setSourceid("SSFJ");
platformParam.setSourcetype("U");
try {
List<EmpLinkOperation> linkOperations = operationMapper.selectAllOperationEmp();
linkOperations.forEach(operation -> {
OperationAuthToPlatform operationAuthToPlatform = new OperationAuthToPlatform();
operationAuthToPlatform.setCreateTime(DateUtils.getTime());
operationAuthToPlatform.setEmpCode(operation.getEmpCode());
operationAuthToPlatform.setMainKey(operation.getEmpCode() + "_" + operation.getOperationCode());
operationAuthToPlatform.setOpsCode(operation.getOperationCode());
operationAuthToPlatform.setOpsLevel(operation.getOperationLevel());
operationAuthToPlatform.setOpsName(operation.getOperationName());
operationAuthToPlatform.setSpell(operation.getSpell());
operationAuthMain.setParam(platformParam);
operationAuthMain.setOperationAuthToPlatforms(CollectionUtil.toList(operationAuthToPlatform));
String result = null;
try {
result = XhWebServiceClient.SubWebService(JSON.toJSONString(operationAuthMain));
} catch (Exception e) {
log.error("平台消息推送失败",e);
}
log.info("手术分级联动授权更新平台发布结果:{}",result);
});
}catch (Exception e){
log.error("初始化授权失败",e);
}finally {
flag = 0;
}
}).start();
return AjaxResult.success("正在推送数据,请不要重复刷新或调用");
}
@GetMapping({"/test"})
public AjaxResult test(){
List<SysMenu> menus = this.menuMapper.selectMenuTreeAll();
List<SysMenu> childPerms = this.getChildPerms(menus, 0);
List<RouterVo> routerVos = this.menuService.buildMenus(childPerms);
log.info(routerVos.toString());
return AjaxResult.success();
}
public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) {
List<SysMenu> returnList = new ArrayList<>();
for (SysMenu t : list) {
if (t.getParentId() == (long)parentId) {
this.recursionFn(list, t);
returnList.add(t);
}
}
return returnList;
}
private void recursionFn(List<SysMenu> list, SysMenu t) {
List<SysMenu> childList = this.getChildList(list, t);
t.setChildren(childList);
for (SysMenu tChild : childList) {
if (this.hasChild(list, tChild)) {
for (SysMenu n : childList) {
this.recursionFn(list, n);
}
}
}
}
private boolean hasChild(List<SysMenu> list, SysMenu t) {
return this.getChildList(list, t).size() > 0;
}
private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) {
List<SysMenu> tlist = new ArrayList<>();
for (SysMenu n : list) {
if (n.getParentId() == t.getMenuId()) {
tlist.add(n);
}
}
return tlist;
}
}
...@@ -9,16 +9,12 @@ import com.wechat.project.system.domain.vo.RouterVo; ...@@ -9,16 +9,12 @@ import com.wechat.project.system.domain.vo.RouterVo;
import com.wechat.project.system.mapper.SysMenuMapper; import com.wechat.project.system.mapper.SysMenuMapper;
import com.wechat.project.system.mapper.SysRoleMenuMapper; import com.wechat.project.system.mapper.SysRoleMenuMapper;
import com.wechat.project.system.service.ISysMenuService; import com.wechat.project.system.service.ISysMenuService;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class SysMenuServiceImpl implements ISysMenuService { public class SysMenuServiceImpl implements ISysMenuService {
public static final String PREMISSION_STRING = "perms[\"{0}\"]"; public static final String PREMISSION_STRING = "perms[\"{0}\"]";
...@@ -189,7 +185,7 @@ public class SysMenuServiceImpl implements ISysMenuService { ...@@ -189,7 +185,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
List<SysMenu> tlist = new ArrayList<>(); List<SysMenu> tlist = new ArrayList<>();
for (SysMenu n : list) { for (SysMenu n : list) {
if (n.getParentId() == t.getMenuId()) { if (Objects.equals(n.getParentId(), t.getMenuId())) {
tlist.add(n); tlist.add(n);
} }
} }
...@@ -198,6 +194,6 @@ public class SysMenuServiceImpl implements ISysMenuService { ...@@ -198,6 +194,6 @@ public class SysMenuServiceImpl implements ISysMenuService {
} }
private boolean hasChild(List<SysMenu> list, SysMenu t) { private boolean hasChild(List<SysMenu> list, SysMenu t) {
return this.getChildList(list, t).size() > 0; return !this.getChildList(list, t).isEmpty();
} }
} }
...@@ -86,5 +86,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -86,5 +86,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCountOperation" parameterType="String" resultType="int"> <select id="selectCountOperation" parameterType="String" resultType="int">
select count(id) from operation where ops_code = #{opsCode} select count(id) from operation where ops_code = #{opsCode}
</select> </select>
<select id="selectBindOperationEmp" resultType="com.wechat.project.operation.domain.EmpLinkOperation">
SELECT
id,
operation_code AS operationCode,
operation_name AS operationName,
emp_code AS empCode,
emp_name AS empName,
operation_level AS operationLevel,
spell
FROM
emp_link_operation
WHERE
operation_code = #{opsCode}
</select>
<update id="updateEmpLinkById">
update emp_link_operation
<trim prefix="SET" suffixOverrides=",">
<if test="operationName != null and operationName != ''">operation_name = #{operationName},</if>
<if test="operationLevel != null and operationLevel != ''">operation_level = #{operationLevel},</if>
<if test="spell != null and spell != ''">spell = #{spell},</if>
</trim>
where id = #{id}
</update>
<select id="selectAllOperationEmp" resultType="com.wechat.project.operation.domain.EmpLinkOperation">
SELECT
id,
operation_code AS operationCode,
operation_name AS operationName,
emp_code AS empCode,
emp_name AS empName,
operation_level AS operationLevel,
spell
FROM
emp_link_operation
</select>
</mapper> </mapper>
\ 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