Commit 979f470024a2dcd0434847e3015d3b6dc7e2f35c

Authored by xujiahong
Exists in master

Merge branch 'master' of https://git.healthbaby.com.cn/jiangjiazhi/center.git

Showing 42 changed files

parent/base.common/src/main/java/com/lyms/base/common/dao/sys/SyncDataBasicMapper.java View file @ 979f470
  1 +package com.lyms.base.common.dao.sys;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.List;
  5 +
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import com.baomidou.mybatisplus.mapper.BaseMapper;
  9 +import com.lyms.base.common.entity.sys.SyncDataBasic;
  10 +
  11 +/**
  12 + * <p>
  13 + * Mapper接口
  14 + * </p>
  15 + *
  16 + * @author maliang
  17 + * @since 2017-03-15
  18 + */
  19 +@Repository
  20 +public interface SyncDataBasicMapper extends BaseMapper<SyncDataBasic> {
  21 +
  22 + public Integer deleteLogicById(Serializable id);
  23 +
  24 + /**
  25 + * <li>@Description: 批量更新
  26 + * <li>@param ids
  27 + * <li>@return
  28 + * <li>创建人:maliang
  29 + * <li>创建时间:2017年3月15日
  30 + * <li>修改人:
  31 + * <li>修改时间:
  32 + */
  33 + public Integer updateBatchByIds(List<Serializable> ids);
  34 +
  35 +}
parent/base.common/src/main/java/com/lyms/base/common/dao/sys/SyncDataBasicMapper.xml View file @ 979f470
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4 +<mapper namespace="com.lyms.base.common.dao.sys.SyncDataBasicMapper">
  5 +
  6 + <!-- 通用查询映射结果 -->
  7 + <resultMap id="BaseResultMap" type="com.lyms.base.common.entity.sys.SyncDataBasic">
  8 + <id column="ID" property="id" />
  9 + <result column="DATA" property="data" />
  10 + <result column="CREATE_TIME" property="createTime" />
  11 + <result column="IFSUC" property="ifsuc" />
  12 + </resultMap>
  13 +
  14 + <!-- 通用查询结果列 -->
  15 + <sql id="Base_Column_List">
  16 + ID AS id, DATA AS data, CREATE_TIME AS createTime, IFSUC AS ifsuc
  17 + </sql>
  18 +
  19 + <sql id="Base_table">
  20 + SYNC_DATA_BASIC
  21 + </sql>
  22 +
  23 +
  24 + <update id="updateBatchByIds" parameterType="list">
  25 + update from <include refid="Base_table" /> as sb set sb.ifsuc=1
  26 + where sb.id in
  27 + <foreach item="item" collection="ids" open="(" close=")" separator=",">
  28 + #{item}
  29 + </foreach>
  30 + </update>
  31 +
  32 +</mapper>
parent/base.common/src/main/java/com/lyms/base/common/entity/sys/SyncDataBasic.java View file @ 979f470
  1 +package com.lyms.base.common.entity.sys;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +
  6 +import com.baomidou.mybatisplus.annotations.TableField;
  7 +import com.baomidou.mybatisplus.annotations.TableId;
  8 +import com.baomidou.mybatisplus.annotations.TableName;
  9 +import com.lyms.sync.channel.ChannelData;
  10 +
  11 +/**
  12 + *
  13 + * <p>
  14 + * 用户、角色、权限、医院、部门等基础数据同步
  15 + * </p>
  16 + *
  17 + * @author maliang
  18 + * @since 2017-03-15
  19 + */
  20 +@TableName("SYNC_DATA_BASIC")
  21 +public class SyncDataBasic implements Serializable {
  22 +
  23 + private static final long serialVersionUID = 1L;
  24 +
  25 + /**
  26 + * 该ID 一定要与data 中的ID一致
  27 + */
  28 + @TableId(value = "ID")
  29 + private String id;
  30 + /**
  31 + * 数据对象 {@link ChannelData} json 数据格式
  32 + */
  33 + @TableField(value = "DATA")
  34 + private String data;
  35 + /**
  36 + * 创建时间
  37 + */
  38 + @TableField(value = "CREATE_TIME")
  39 + private Date createTime;
  40 + /**
  41 + * 数据上传是否成功
  42 + */
  43 + @TableField(value = "IFSUC")
  44 + private Integer ifsuc;
  45 +
  46 + public String getId() {
  47 + return id;
  48 + }
  49 +
  50 + public void setId(String id) {
  51 + this.id = id;
  52 + }
  53 +
  54 + public String getData() {
  55 + return data;
  56 + }
  57 +
  58 + public void setData(String data) {
  59 + this.data = data;
  60 + }
  61 +
  62 + public Date getCreateTime() {
  63 + return createTime;
  64 + }
  65 +
  66 + public void setCreateTime(Date createTime) {
  67 + this.createTime = createTime;
  68 + }
  69 +
  70 + public Integer getIfsuc() {
  71 + return ifsuc;
  72 + }
  73 +
  74 + public void setIfsuc(Integer ifsuc) {
  75 + this.ifsuc = ifsuc;
  76 + }
  77 +
  78 +}
parent/base.common/src/main/java/com/lyms/base/common/entity/user/SysUserDataPermissions.java View file @ 979f470
1 1 package com.lyms.base.common.entity.user;
2 2  
3   -import com.baomidou.mybatisplus.annotations.TableId;
  3 +import java.io.Serializable;
  4 +
4 5 import com.baomidou.mybatisplus.annotations.TableField;
5 6 import com.baomidou.mybatisplus.annotations.TableName;
6   -import java.io.Serializable;
7 7  
8 8 /**
9 9 * <p>
parent/base.common/src/main/java/com/lyms/base/common/enums/SyncParamEnum.java View file @ 979f470
... ... @@ -26,6 +26,37 @@
26 26 DEPART_INSERT(com.lyms.base.common.service.organ.impl.DepartmentsServiceImpl.class.getName(),"createDepart"),
27 27 DEPART_UPDATE(com.lyms.base.common.service.organ.impl.DepartmentsServiceImpl.class.getName(),"updateDepart"),
28 28 DEPART_DELETE(com.lyms.base.common.service.organ.impl.DepartmentsServiceImpl.class.getName(),"deleteDepartById"),
  29 +
  30 + //诊断
  31 + DIAGNOSE_CONF_INSERT(com.lyms.base.common.service.conf.impl.DiagnoseConfServiceImpl.class.getName(),"insert"),
  32 + DIAGNOSE_CONF_UPDATE(com.lyms.base.common.service.conf.impl.DiagnoseConfServiceImpl.class.getName(),"updateById"),
  33 + DIAGNOSE_CONF_DELETE(com.lyms.base.common.service.conf.impl.DiagnoseConfServiceImpl.class.getName(),"deleteLogicById"),
  34 +
  35 + DIAGNOSE_VERSION_INSERT(com.lyms.base.common.service.conf.impl.DiagnoseVersionServiceImpl.class.getName(),"insert"),
  36 + DIAGNOSE_VERSION_UPDATE(com.lyms.base.common.service.conf.impl.DiagnoseVersionServiceImpl.class.getName(),"updateById"),
  37 + DIAGNOSE_VERSION_DELETE(com.lyms.base.common.service.conf.impl.DiagnoseVersionServiceImpl.class.getName(),"deleteLogicById"),
  38 + DIAGNOSE_VERSION_COPY_INSERT(com.lyms.base.common.service.conf.impl.DiagnoseVersionServiceImpl.class.getName(),"copyInsert"),
  39 +
  40 + DIAGNOSE_SOURCE_INSERT(com.lyms.base.common.service.conf.impl.DiagnoseSourceServiceImpl.class.getName(),"insert"),
  41 + DIAGNOSE_SOURCE_UPDATE(com.lyms.base.common.service.conf.impl.DiagnoseSourceServiceImpl.class.getName(),"updateById"),
  42 + DIAGNOSE_SOURCE_DELETE(com.lyms.base.common.service.conf.impl.DiagnoseSourceServiceImpl.class.getName(),"deleteLogicById"),
  43 +
  44 +
  45 + //高危
  46 + HIGHRISK_CONF_INSERT(com.lyms.base.common.service.conf.impl.HighriskConfServiceImpl.class.getName(),"insert"),
  47 + HIGHRISK_CONF_UPDATE(com.lyms.base.common.service.conf.impl.HighriskConfServiceImpl.class.getName(),"updateById"),
  48 + HIGHRISK_CONF_DELETE(com.lyms.base.common.service.conf.impl.HighriskConfServiceImpl.class.getName(),"deleteLogicById"),
  49 +
  50 + HIGHRISK_VERSION_INSERT(com.lyms.base.common.service.conf.impl.HighriskVersionServiceImpl.class.getName(),"insert"),
  51 + HIGHRISK_VERSION_UPDATE(com.lyms.base.common.service.conf.impl.HighriskVersionServiceImpl.class.getName(),"updateById"),
  52 + HIGHRISK_VERSION_DELETE(com.lyms.base.common.service.conf.impl.HighriskVersionServiceImpl.class.getName(),"deleteLogicById"),
  53 + HIGHRISK_VERSION_COPY_INSERT(com.lyms.base.common.service.conf.impl.HighriskVersionServiceImpl.class.getName(),"copyInsert"),
  54 +
  55 + HIGHRISK_SOURCE_INSERT(com.lyms.base.common.service.conf.impl.HighriskSourceServiceImpl.class.getName(),"insert"),
  56 + HIGHRISK_SOURCE_UPDATE(com.lyms.base.common.service.conf.impl.HighriskSourceServiceImpl.class.getName(),"updateById"),
  57 + HIGHRISK_SOURCE_DELETE(com.lyms.base.common.service.conf.impl.HighriskSourceServiceImpl.class.getName(),"deleteLogicById"),
  58 +
  59 +
29 60 ;
30 61  
31 62  
parent/base.common/src/main/java/com/lyms/base/common/service/conf/DiagnoseMapsService.java View file @ 979f470
1 1 package com.lyms.base.common.service.conf;
2 2  
3   -import com.lyms.base.common.entity.conf.DiagnoseMaps;
4   -import com.lyms.base.common.entity.conf.HighriskMaps;
5   -import com.lyms.web.service.BaseService;
6 3 import java.io.Serializable;
7 4 import java.util.List;
  5 +
  6 +import com.lyms.base.common.entity.conf.DiagnoseMaps;
  7 +import com.lyms.web.service.BaseService;
8 8  
9 9 /**
10 10 * <p>
parent/base.common/src/main/java/com/lyms/base/common/service/conf/DiagnoseVersionService.java View file @ 979f470
... ... @@ -62,13 +62,14 @@
62 62 /**
63 63 * <li>@Description:复制一个版本
64 64 * <li>@param id
  65 + * <li>@param versionName
65 66 * <li>@return
66 67 * <li>创建人:方承
67 68 * <li>创建时间:2017年4月7日
68 69 * <li>修改人:
69 70 * <li>修改时间:
70 71 */
71   - public Integer copy(Serializable id);
  72 + public Integer copy(Serializable id,String versionName);
72 73  
73 74 }
parent/base.common/src/main/java/com/lyms/base/common/service/conf/HighriskVersionService.java View file @ 979f470
... ... @@ -62,13 +62,14 @@
62 62 /**
63 63 * <li>@Description:复制一个版本
64 64 * <li>@param id
  65 + * <li>@param versionName
65 66 * <li>@return
66 67 * <li>创建人:方承
67 68 * <li>创建时间:2017年4月6日
68 69 * <li>修改人:
69 70 * <li>修改时间:
70 71 */
71   - public Integer copy(Serializable id);
  72 + public Integer copy(Serializable id,String versionName);
72 73  
73 74 }
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/DiagnoseConfServiceImpl.java View file @ 979f470
1 1 package com.lyms.base.common.service.conf.impl;
2 2  
3 3 import com.lyms.base.common.entity.conf.DiagnoseConf;
  4 +import com.lyms.base.common.enums.SyncParamEnum;
4 5 import com.lyms.base.common.dao.conf.DiagnoseConfMapper;
5 6 import com.lyms.base.common.service.conf.DiagnoseConfService;
  7 +import com.lyms.base.common.utils.SyncComponent;
6 8 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
7 11 import org.springframework.stereotype.Service;
8 12 import java.io.Serializable;
9 13  
10 14  
... ... @@ -17,9 +21,34 @@
17 21 */
18 22 @Service
19 23 public class DiagnoseConfServiceImpl extends ServiceImpl<DiagnoseConfMapper, DiagnoseConf> implements DiagnoseConfService {
  24 +
  25 + @Autowired
  26 + private SyncComponent syncComponent;
20 27  
21 28 public Integer deleteLogicById(Serializable id){
22   - return baseMapper.deleteLogicById(id);
  29 + Integer tag = baseMapper.deleteLogicById(id);
  30 + if(tag > 0){
  31 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_CONF_DELETE, id);
  32 + }
  33 + return tag;
  34 + }
  35 +
  36 + @Override
  37 + public boolean insert(DiagnoseConf entity) {
  38 + boolean tag = super.insert(entity);
  39 + if(tag){
  40 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_CONF_INSERT, entity);
  41 + }
  42 + return tag;
  43 + }
  44 +
  45 + @Override
  46 + public boolean updateById(DiagnoseConf entity) {
  47 + boolean tag = super.updateById(entity);
  48 + if(tag){
  49 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_CONF_UPDATE, entity);
  50 + }
  51 + return tag;
23 52 }
24 53 }
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/DiagnoseMapsServiceImpl.java View file @ 979f470
1 1 package com.lyms.base.common.service.conf.impl;
2 2  
3   -import com.lyms.base.common.entity.conf.DiagnoseMaps;
4   -import com.lyms.base.common.entity.conf.HighriskMaps;
5   -import com.lyms.base.common.dao.conf.DiagnoseMapsMapper;
6   -import com.lyms.base.common.service.conf.DiagnoseMapsService;
7   -import com.baomidou.mybatisplus.service.impl.ServiceImpl;
8   -import org.springframework.stereotype.Service;
9 3 import java.io.Serializable;
10 4 import java.util.List;
  5 +
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +import com.baomidou.mybatisplus.service.impl.ServiceImpl;
  9 +import com.lyms.base.common.dao.conf.DiagnoseMapsMapper;
  10 +import com.lyms.base.common.entity.conf.DiagnoseMaps;
  11 +import com.lyms.base.common.service.conf.DiagnoseMapsService;
11 12  
12 13 /**
13 14 * <p>
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/DiagnoseSourceServiceImpl.java View file @ 979f470
... ... @@ -3,6 +3,7 @@
3 3 import java.io.Serializable;
4 4 import java.util.List;
5 5  
  6 +import org.springframework.beans.factory.annotation.Autowired;
6 7 import org.springframework.stereotype.Service;
7 8  
8 9 import com.baomidou.mybatisplus.mapper.EntityWrapper;
9 10  
... ... @@ -10,7 +11,9 @@
10 11 import com.lyms.base.common.dao.conf.DiagnoseSourceMapper;
11 12 import com.lyms.base.common.entity.conf.DiagnoseSource;
12 13 import com.lyms.base.common.enums.StatusEnum;
  14 +import com.lyms.base.common.enums.SyncParamEnum;
13 15 import com.lyms.base.common.service.conf.DiagnoseSourceService;
  16 +import com.lyms.base.common.utils.SyncComponent;
14 17 import com.lyms.exception.SystemException;
15 18 import com.lyms.util.StrUtils;
16 19  
... ... @@ -25,9 +28,37 @@
25 28 public class DiagnoseSourceServiceImpl extends ServiceImpl<DiagnoseSourceMapper, DiagnoseSource>
26 29 implements DiagnoseSourceService {
27 30  
28   - public Integer deleteLogicById(Serializable id) {
29   - return baseMapper.deleteLogicById(id);
30   - }
  31 + @Autowired
  32 + private SyncComponent syncComponent;
  33 +
  34 + @Override
  35 + public Integer deleteLogicById(Serializable id){
  36 + Integer tag = baseMapper.deleteLogicById(id);
  37 + if(tag > 0){
  38 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_SOURCE_DELETE, id);
  39 + }
  40 + return tag;
  41 + }
  42 +
  43 + @Override
  44 + public boolean insert(DiagnoseSource entity) {
  45 + String id = StrUtils.uuid();
  46 + entity.setId(id);
  47 + boolean tag = super.insert(entity);
  48 + if(tag){
  49 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_SOURCE_DELETE, entity);
  50 + }
  51 + return tag;
  52 + }
  53 +
  54 + @Override
  55 + public boolean updateById(DiagnoseSource entity) {
  56 + boolean tag = super.updateById(entity);
  57 + if(tag){
  58 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_SOURCE_DELETE, entity);
  59 + }
  60 + return tag;
  61 + }
31 62  
32 63 private void throwCheckException(DiagnoseSource diagnoseSource) throws SystemException {
33 64 if (diagnoseSource == null) {
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/DiagnoseVersionServiceImpl.java View file @ 979f470
... ... @@ -13,12 +13,12 @@
13 13 import com.lyms.base.common.dao.conf.DiagnoseVersionMapper;
14 14 import com.lyms.base.common.entity.conf.DiagnoseConf;
15 15 import com.lyms.base.common.entity.conf.DiagnoseVersion;
16   -import com.lyms.base.common.entity.conf.HighriskConf;
17   -import com.lyms.base.common.entity.conf.HighriskVersion;
18 16 import com.lyms.base.common.enums.StatusEnum;
  17 +import com.lyms.base.common.enums.SyncParamEnum;
19 18 import com.lyms.base.common.service.conf.DiagnoseVersionService;
  19 +import com.lyms.base.common.utils.SyncComponent;
20 20 import com.lyms.exception.SystemException;
21   -import com.lyms.util.DateTimeUtils;
  21 +import com.lyms.util.InstanceUtils;
22 22 import com.lyms.util.StrUtils;
23 23  
24 24 /**
25 25  
... ... @@ -37,10 +37,37 @@
37 37 @Autowired
38 38 private DiagnoseConfMapper confMapper;
39 39  
40   - public Integer deleteLogicById(Serializable id) {
41   - return baseMapper.deleteLogicById(id);
42   - }
  40 + @Autowired
  41 + private SyncComponent syncComponent;
  42 +
  43 + public Integer deleteLogicById(Serializable id){
  44 + Integer tag = baseMapper.deleteLogicById(id);
  45 + if(tag > 0){
  46 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_VERSION_DELETE, id);
  47 + }
  48 + return tag;
  49 + }
43 50  
  51 + @Override
  52 + public boolean insert(DiagnoseVersion entity) {
  53 + String id = StrUtils.uuid();
  54 + entity.setId(id);
  55 + boolean tag = super.insert(entity);
  56 + if(tag){
  57 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_VERSION_INSERT, entity);
  58 + }
  59 + return tag;
  60 + }
  61 +
  62 + @Override
  63 + public boolean updateById(DiagnoseVersion entity) {
  64 + boolean tag = super.updateById(entity);
  65 + if(tag){
  66 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_VERSION_UPDATE, entity);
  67 + }
  68 + return tag;
  69 + }
  70 +
44 71 private void throwCheckExecption(DiagnoseVersion diagnoseVersion) throws SystemException {
45 72 if (diagnoseVersion == null)
46 73 throw new SystemException("诊断信息不能为空");
47 74  
48 75  
49 76  
... ... @@ -96,18 +123,42 @@
96 123  
97 124 @Override
98 125 @Transactional
99   - public Integer copy(Serializable id) {
  126 + public Integer copy(Serializable id,String versionName) {
100 127 DiagnoseVersion version = baseMapper.selectById(id);
101 128 DiagnoseVersion newVersion = new DiagnoseVersion();
102   - String time = DateTimeUtils.getDateTime("yyyy_MM_dd_HH_mm_ss");
103   - String versionId = time;
104   - newVersion.setId(versionId);
105   - newVersion.setName(version.getName()+time);
  129 + String newVersionId = StrUtils.uuid();
  130 + newVersion.setId(newVersionId);
  131 + newVersion.setName(versionName);
106 132 Integer tag = baseMapper.insert(newVersion);
107 133 List<DiagnoseConf> confList = confMapper.selectList(new EntityWrapper<DiagnoseConf>().where("version_id={0}", version.getId()));
  134 + List<DiagnoseConf> newVersionConfList = InstanceUtils.newArrayList();
108 135 for(DiagnoseConf conf : confList){
109 136 conf.setId(StrUtils.uuid());
110   - conf.setVersionId(versionId);
  137 + conf.setVersionId(newVersionId);
  138 + confMapper.insert(conf);
  139 + newVersionConfList.add(conf);
  140 + }
  141 + if(tag >= 0){
  142 + syncComponent.addPushSyncOperation(SyncParamEnum.DIAGNOSE_VERSION_COPY_INSERT, newVersion,newVersionConfList);
  143 + }
  144 + return tag;
  145 + }
  146 +
  147 +
  148 + /**
  149 + * <li>@Description:插入一个新版本,用于中心复制版本,节点插入该版本
  150 + * <li>@param newVersion
  151 + * <li>@param newVersionConfList
  152 + * <li>@return
  153 + * <li>创建人:方承
  154 + * <li>创建时间:2017年5月4日
  155 + * <li>修改人:
  156 + * <li>修改时间:
  157 + */
  158 + @Transactional
  159 + private Integer copyInsert(DiagnoseVersion newVersion,List<DiagnoseConf> newVersionConfList){
  160 + Integer tag = baseMapper.insert(newVersion);
  161 + for(DiagnoseConf conf : newVersionConfList){
111 162 confMapper.insert(conf);
112 163 }
113 164 return tag;
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/HighriskConfServiceImpl.java View file @ 979f470
... ... @@ -13,7 +13,9 @@
13 13 import com.lyms.base.common.dao.conf.HighriskConfMapper;
14 14 import com.lyms.base.common.entity.conf.HighriskConf;
15 15 import com.lyms.base.common.enums.StatusEnum;
  16 +import com.lyms.base.common.enums.SyncParamEnum;
16 17 import com.lyms.base.common.service.conf.HighriskConfService;
  18 +import com.lyms.base.common.utils.SyncComponent;
17 19 import com.lyms.exception.SystemException;
18 20 import com.lyms.util.StrUtils;
19 21  
... ... @@ -32,11 +34,36 @@
32 34 @Autowired
33 35 private HighriskConfMapper confMapper;
34 36  
35   - @Override
36   - @Transactional
37   - public Integer deleteLogicById(Serializable id) {
38   - return null;
39   - }
  37 + @Autowired
  38 + private SyncComponent syncComponent;
  39 +
  40 + public Integer deleteLogicById(Serializable id){
  41 + Integer tag = baseMapper.deleteLogicById(id);
  42 + if(tag > 0){
  43 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_CONF_DELETE, id);
  44 + }
  45 + return tag;
  46 + }
  47 +
  48 + @Override
  49 + public boolean insert(HighriskConf entity) {
  50 + String id = StrUtils.uuid();
  51 + entity.setId(id);
  52 + boolean tag = super.insert(entity);
  53 + if(tag){
  54 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_CONF_INSERT, entity);
  55 + }
  56 + return tag;
  57 + }
  58 +
  59 + @Override
  60 + public boolean updateById(HighriskConf entity) {
  61 + boolean tag = super.updateById(entity);
  62 + if(tag){
  63 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_CONF_UPDATE, entity);
  64 + }
  65 + return tag;
  66 + }
40 67  
41 68 private void throwCheckException(HighriskConf highriskConf) throws SystemException {
42 69 if (highriskConf == null) {
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/HighriskSourceServiceImpl.java View file @ 979f470
... ... @@ -11,7 +11,9 @@
11 11 import com.lyms.base.common.dao.conf.HighriskSourceMapper;
12 12 import com.lyms.base.common.entity.conf.HighriskSource;
13 13 import com.lyms.base.common.enums.StatusEnum;
  14 +import com.lyms.base.common.enums.SyncParamEnum;
14 15 import com.lyms.base.common.service.conf.HighriskSourceService;
  16 +import com.lyms.base.common.utils.SyncComponent;
15 17 import com.lyms.exception.SystemException;
16 18 import com.lyms.util.StrUtils;
17 19  
... ... @@ -30,10 +32,36 @@
30 32 @Autowired
31 33 private HighriskSourceMapper sourceMapper;
32 34  
33   - @Override
34   - public Integer deleteLogicById(Serializable id) {
35   - return null;
36   - }
  35 + @Autowired
  36 + private SyncComponent syncComponent;
  37 +
  38 + public Integer deleteLogicById(Serializable id){
  39 + Integer tag = baseMapper.deleteLogicById(id);
  40 + if(tag > 0){
  41 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_SOURCE_DELETE, id);
  42 + }
  43 + return tag;
  44 + }
  45 +
  46 + @Override
  47 + public boolean insert(HighriskSource entity) {
  48 + String id = StrUtils.uuid();
  49 + entity.setId(id);
  50 + boolean tag = super.insert(entity);
  51 + if(tag){
  52 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_SOURCE_INSERT, entity);
  53 + }
  54 + return tag;
  55 + }
  56 +
  57 + @Override
  58 + public boolean updateById(HighriskSource entity) {
  59 + boolean tag = super.updateById(entity);
  60 + if(tag){
  61 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_SOURCE_UPDATE, entity);
  62 + }
  63 + return tag;
  64 + }
37 65  
38 66 private void throwCheckException(HighriskSource highriskSource) throws SystemException {
39 67 if (highriskSource == null) {
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/HighriskVersionServiceImpl.java View file @ 979f470
... ... @@ -14,9 +14,11 @@
14 14 import com.lyms.base.common.entity.conf.HighriskConf;
15 15 import com.lyms.base.common.entity.conf.HighriskVersion;
16 16 import com.lyms.base.common.enums.StatusEnum;
  17 +import com.lyms.base.common.enums.SyncParamEnum;
17 18 import com.lyms.base.common.service.conf.HighriskVersionService;
  19 +import com.lyms.base.common.utils.SyncComponent;
18 20 import com.lyms.exception.SystemException;
19   -import com.lyms.util.DateTimeUtils;
  21 +import com.lyms.util.InstanceUtils;
20 22 import com.lyms.util.StrUtils;
21 23  
22 24 /**
23 25  
... ... @@ -36,11 +38,37 @@
36 38 @Autowired
37 39 private HighriskConfMapper confMapper;
38 40  
39   - @Override
40   - public Integer deleteLogicById(Serializable id) {
41   - return null;
42   - }
  41 + @Autowired
  42 + private SyncComponent syncComponent;
  43 +
  44 + public Integer deleteLogicById(Serializable id){
  45 + Integer tag = baseMapper.deleteLogicById(id);
  46 + if(tag > 0){
  47 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_VERSION_DELETE, id);
  48 + }
  49 + return tag;
  50 + }
43 51  
  52 + @Override
  53 + public boolean insert(HighriskVersion entity) {
  54 + String id = StrUtils.uuid();
  55 + entity.setId(id);
  56 + boolean tag = super.insert(entity);
  57 + if(tag){
  58 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_VERSION_INSERT, entity);
  59 + }
  60 + return tag;
  61 + }
  62 +
  63 + @Override
  64 + public boolean updateById(HighriskVersion entity) {
  65 + boolean tag = super.updateById(entity);
  66 + if(tag){
  67 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_VERSION_UPDATE, entity);
  68 + }
  69 + return tag;
  70 + }
  71 +
44 72 @Override
45 73 @Transactional
46 74 public boolean enable(Serializable id) {
47 75  
48 76  
49 77  
... ... @@ -96,18 +124,41 @@
96 124  
97 125 @Override
98 126 @Transactional
99   - public Integer copy(Serializable id) {
  127 + public Integer copy(Serializable id,String versionName) {
100 128 HighriskVersion version = baseMapper.selectById(id);
101 129 HighriskVersion newVersion = new HighriskVersion();
102   - String time = DateTimeUtils.getDateTime("yyyy_MM_dd_HH_mm_ss");
103   - String versionId = time;
104   - newVersion.setId(versionId);
105   - newVersion.setName(version.getName()+time);
  130 + String newVersionId = StrUtils.uuid();
  131 + newVersion.setId(newVersionId);
  132 + newVersion.setName(versionName);
106 133 Integer tag = baseMapper.insert(newVersion);
107 134 List<HighriskConf> confList = confMapper.selectList(new EntityWrapper<HighriskConf>().where("version_id={0}", version.getId()));
  135 + List<HighriskConf> newVersionConfList = InstanceUtils.newArrayList();
108 136 for(HighriskConf conf : confList){
109 137 conf.setId(StrUtils.uuid());
110   - conf.setVersionId(versionId);
  138 + conf.setVersionId(newVersionId);
  139 + confMapper.insert(conf);
  140 + newVersionConfList.add(conf);
  141 + }
  142 + if(tag >= 0){
  143 + syncComponent.addPushSyncOperation(SyncParamEnum.HIGHRISK_VERSION_COPY_INSERT, newVersion,newVersionConfList);
  144 + }
  145 + return tag;
  146 + }
  147 +
  148 + /**
  149 + * <li>@Description:插入一个新版本,用于中心复制版本,节点插入该版本
  150 + * <li>@param newVersion
  151 + * <li>@param newVersionConfList
  152 + * <li>@return
  153 + * <li>创建人:方承
  154 + * <li>创建时间:2017年5月4日
  155 + * <li>修改人:
  156 + * <li>修改时间:
  157 + */
  158 + @Transactional
  159 + private Integer copyInsert(HighriskVersion newVersion,List<HighriskConf> newVersionConfList){
  160 + Integer tag = baseMapper.insert(newVersion);
  161 + for(HighriskConf conf : newVersionConfList){
111 162 confMapper.insert(conf);
112 163 }
113 164 return tag;
parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java View file @ 979f470
... ... @@ -3,7 +3,6 @@
3 3 import java.io.Serializable;
4 4  
5 5 import com.baomidou.mybatisplus.plugins.Page;
6   -import com.lyms.base.common.entity.organ.OrganGroup;
7 6 import com.lyms.base.common.entity.organ.Organizations;
8 7 import com.lyms.exception.SystemException;
9 8 import com.lyms.web.service.BaseService;
parent/base.common/src/main/java/com/lyms/base/common/service/organ/SysOrganizationsConfService.java View file @ 979f470
1 1 package com.lyms.base.common.service.organ;
2 2  
3 3 import java.io.Serializable;
4   -import java.util.List;
5   -import java.util.Map;
6 4  
7 5 import com.lyms.base.common.entity.organ.SysOrganizationsConf;
8 6 import com.lyms.web.service.BaseService;
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganGroupServiceImpl.java View file @ 979f470
... ... @@ -15,7 +15,6 @@
15 15 import com.lyms.base.common.entity.organ.OrganGroup;
16 16 import com.lyms.base.common.entity.organ.OrganGroupMaps;
17 17 import com.lyms.base.common.enums.SyncParamEnum;
18   -import com.lyms.base.common.service.organ.OrganGroupMapsService;
19 18 import com.lyms.base.common.service.organ.OrganGroupService;
20 19 import com.lyms.base.common.utils.SyncComponent;
21 20 import com.lyms.exception.SystemException;
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/SysOrganizationsConfServiceImpl.java View file @ 979f470
1 1 package com.lyms.base.common.service.organ.impl;
2 2  
3   -import com.lyms.base.common.entity.organ.SysOrganizationsConf;
  3 +import java.io.Serializable;
  4 +
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +import com.baomidou.mybatisplus.service.impl.ServiceImpl;
4 8 import com.lyms.base.common.dao.organ.SysOrganizationsConfMapper;
  9 +import com.lyms.base.common.entity.organ.SysOrganizationsConf;
5 10 import com.lyms.base.common.service.organ.SysOrganizationsConfService;
6   -import com.baomidou.mybatisplus.service.impl.ServiceImpl;
7   -import org.springframework.stereotype.Service;
8   -import java.io.Serializable;
9   -import java.util.List;
10   -import java.util.Map;
11 11  
12 12 /**
13 13 * <p>
parent/base.common/src/main/java/com/lyms/base/common/service/role/impl/RolesServiceImpl.java View file @ 979f470
... ... @@ -8,6 +8,7 @@
8 8 import org.springframework.transaction.annotation.Transactional;
9 9  
10 10 import com.baomidou.mybatisplus.mapper.EntityWrapper;
  11 +import com.baomidou.mybatisplus.mapper.SqlHelper;
11 12 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
12 13 import com.lyms.base.common.dao.role.RolesMapper;
13 14 import com.lyms.base.common.entity.role.RolePermissionMaps;
14 15  
15 16  
... ... @@ -36,17 +37,21 @@
36 37  
37 38 public Integer deleteLogicById(Serializable id) {
38 39 Integer tag = baseMapper.deleteLogicById(id);
39   - syncComponent.addPushSyncOperation(SyncParamEnum.ROLE_DELETE, id);
  40 + if(tag > 0 ){
  41 + syncComponent.addPushSyncOperation(SyncParamEnum.ROLE_DELETE, id);
  42 + }
40 43 return tag;
41 44 }
42 45  
43 46 @Override
44 47 @Transactional
45 48 public boolean createRole(Roles role, List<RolePermissionMaps> rpList) {
46   - baseMapper.insert(role);
  49 + Integer tag = baseMapper.insert(role);
47 50 sysRolePermissionMapsService.insertBatch(rpList);
48   - syncComponent.addPushSyncOperation(SyncParamEnum.ROLE_INSERT, role,rpList);
49   - return true;
  51 + if(tag > 0 ){
  52 + syncComponent.addPushSyncOperation(SyncParamEnum.ROLE_INSERT, role,rpList);
  53 + }
  54 + return SqlHelper.retBool(tag);
50 55 }
51 56  
52 57 @Override
53 58  
... ... @@ -54,12 +59,14 @@
54 59 public boolean updateRole(Roles role, List<RolePermissionMaps> rpList) {
55 60 EntityWrapper<RolePermissionMaps> ew = new EntityWrapper<RolePermissionMaps>();
56 61 ew.where("role_id={0}", role.getId());
57   - baseMapper.updateById(role);
  62 + Integer tag = baseMapper.updateById(role);
58 63 sysRolePermissionMapsService.delete(ew);
59 64 if (!rpList.isEmpty()) {
60 65 sysRolePermissionMapsService.insertBatch(rpList);
61 66 }
62   - syncComponent.addPushSyncOperation(SyncParamEnum.ROLE_UPDATE, role,rpList);
  67 + if(tag > 0 ){
  68 + syncComponent.addPushSyncOperation(SyncParamEnum.ROLE_UPDATE, role,rpList);
  69 + }
63 70 return true;
64 71 }
65 72  
parent/base.common/src/main/java/com/lyms/base/common/service/sys/SyncDataBasicService.java View file @ 979f470
  1 +package com.lyms.base.common.service.sys;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.List;
  5 +
  6 +import com.lyms.base.common.entity.sys.SyncDataBasic;
  7 +import com.lyms.base.common.enums.SyncParamEnum;
  8 +import com.lyms.sync.channel.ChannelData;
  9 +import com.lyms.web.service.BaseService;
  10 +
  11 +/**
  12 + * <p>
  13 + * 数据同步模块
  14 + * </p>
  15 + *
  16 + * @author maliang
  17 + * @since 2017-03-15
  18 + */
  19 +public interface SyncDataBasicService extends BaseService<SyncDataBasic> {
  20 +
  21 + /**
  22 + * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除
  23 + * <li>@param id 删除主键id
  24 + * <li>@return 大于0修改成功,否则为失败
  25 + */
  26 + public Integer deleteLogicById(Serializable id);
  27 +
  28 + /**
  29 + * <li>@Description:更新同步成功的数据
  30 + * <li>@param ids
  31 + * <li>@return
  32 + * <li>创建人:maliang
  33 + * <li>创建时间:2017年3月15日
  34 + * <li>修改人:
  35 + * <li>修改时间:
  36 + */
  37 + public Boolean updateBasic(List<Serializable> ids);
  38 +
  39 + /**
  40 + * 获取一条数据
  41 + * <li>@Description:TODO(方法描述)
  42 + * <li>@return
  43 + * <li>创建人:maliang
  44 + * <li>创建时间:2017年3月15日
  45 + * <li>修改人:
  46 + * <li>修改时间:
  47 + */
  48 + public ChannelData selectOne();
  49 +
  50 + public Boolean updateBasic(Serializable id);
  51 + /**
  52 + * <li>@Description:向同步库插入一个需要提交给center的同步任务
  53 + * <li>@param syncParamConf
  54 + * <li>@param dataObjects 对象方法参数列表
  55 + * <li>@return
  56 + * <li>创建人:方承
  57 + * <li>创建时间:2017年4月11日
  58 + * <li>修改人:
  59 + * <li>修改时间:
  60 + */
  61 + public boolean addSyncData(SyncParamEnum syncParamConf,Object ...dataObjects);
  62 +
  63 +}
parent/base.common/src/main/java/com/lyms/base/common/service/sys/impl/SyncDataBasicServiceImpl.java View file @ 979f470
  1 +package com.lyms.base.common.service.sys.impl;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  12 +import com.baomidou.mybatisplus.service.impl.ServiceImpl;
  13 +import com.lyms.base.common.dao.sys.SyncDataBasicMapper;
  14 +import com.lyms.base.common.entity.sys.SyncDataBasic;
  15 +import com.lyms.base.common.enums.SyncParamEnum;
  16 +import com.lyms.base.common.service.sys.SyncDataBasicService;
  17 +import com.lyms.sync.ParamsAdpter;
  18 +import com.lyms.sync.channel.ChannelData;
  19 +import com.lyms.util.JsonUtils;
  20 +import com.lyms.util.StrUtils;
  21 +
  22 +/**
  23 + * <p>
  24 + * 用户、角色、权限、医院、部门等基础数据同步 服务实现类
  25 + * </p>
  26 + *
  27 + * @author maliang
  28 + * @since 2017-03-15
  29 + */
  30 +@Service
  31 +public class SyncDataBasicServiceImpl extends ServiceImpl<SyncDataBasicMapper, SyncDataBasic>
  32 + implements SyncDataBasicService {
  33 +
  34 + @Autowired
  35 + private SyncDataBasicMapper basicMapper;
  36 +
  37 + public Integer deleteLogicById(Serializable id) {
  38 + return baseMapper.deleteLogicById(id);
  39 + }
  40 +
  41 + @Override
  42 + @Transactional
  43 + public Boolean updateBasic(List<Serializable> ids) {
  44 + Integer tag = basicMapper.updateBatchByIds(ids);
  45 + return tag >= 1 ? Boolean.TRUE : Boolean.FALSE;
  46 + }
  47 +
  48 + @Override
  49 + public Boolean updateBasic(Serializable id) {
  50 + SyncDataBasic dataBasic = baseMapper.selectById(id);
  51 + dataBasic.setIfsuc(1);
  52 + Integer tag = baseMapper.updateById(dataBasic);
  53 + return tag >= 1;
  54 + }
  55 +
  56 + @Override
  57 + public ChannelData selectOne() {
  58 + EntityWrapper<SyncDataBasic> ew = new EntityWrapper<SyncDataBasic>();
  59 + ew.where("ifsuc=0");
  60 + List<SyncDataBasic> datas = baseMapper.selectList(ew);
  61 +
  62 + // 单条同步,避免过于复杂的消息回执
  63 + SyncDataBasic basic = datas != null && datas.size() > 0 ? datas.get(0) : null;
  64 + if (basic != null) {
  65 + ChannelData data = JsonUtils.jsonToBean(basic.getData(), ChannelData.class);
  66 + return data;
  67 + }
  68 + return ChannelData.emtpy();
  69 + }
  70 +
  71 + @Override
  72 + public boolean addSyncData(SyncParamEnum syncParamConf, Object... dataObjects) {
  73 + SyncDataBasic entity = new SyncDataBasic();
  74 + String uid = StrUtils.uuid();
  75 + entity.setId(uid);
  76 + Date now = new Date();
  77 + entity.setCreateTime(now);
  78 +
  79 + ChannelData cdata = new ChannelData();
  80 + cdata.setAck(true);
  81 + ParamsAdpter adpter = ParamsAdpter.builder();
  82 + for(Object param : dataObjects){
  83 + adpter.push(param);
  84 + }
  85 + cdata.setData(adpter.toJsonString());
  86 + cdata.setId(uid);
  87 + cdata.setLoop(false);
  88 + cdata.setRemoteClazz(syncParamConf.getRemoteClazz());
  89 + cdata.setRemoteMethod(syncParamConf.getRemoteMethod());
  90 + cdata.setTs(now.getTime());
  91 +
  92 + entity.setData(cdata.toJsonString());
  93 + Integer tag = baseMapper.insert(entity);
  94 + return tag >= 1 ? true : false;
  95 + }
  96 +
  97 +}
parent/base.common/src/main/java/com/lyms/base/common/service/user/impl/UsersServiceImpl.java View file @ 979f470
... ... @@ -87,15 +87,16 @@
87 87 this.initPwd(user);
88 88  
89 89 Integer tag = userMapper.insert(user);
90   -
91   - String[] dataPermissionArray = user.getDataOrgIds().split(",");
92   - if (dataPermissionArray != null && dataPermissionArray.length > 0) {
93   - for (String orgid : dataPermissionArray) {
94   - SysUserDataPermissions dataEntity = new SysUserDataPermissions();
95   - dataEntity.setId(StrUtils.uuid());
96   - dataEntity.setOrgId(orgid);
97   - dataEntity.setUserId(user.getId());
98   - sysUserDataPermissionsMapper.insert(dataEntity);
  90 + if(StrUtils.isNotEmpty(user.getDataOrgIds())){
  91 + String[] dataPermissionArray = user.getDataOrgIds().split(",");
  92 + if (dataPermissionArray != null && dataPermissionArray.length > 0) {
  93 + for (String orgid : dataPermissionArray) {
  94 + SysUserDataPermissions dataEntity = new SysUserDataPermissions();
  95 + dataEntity.setId(StrUtils.uuid());
  96 + dataEntity.setOrgId(orgid);
  97 + dataEntity.setUserId(user.getId());
  98 + sysUserDataPermissionsMapper.insert(dataEntity);
  99 + }
99 100 }
100 101 }
101 102 if (userRoleMapsList != null && !userRoleMapsList.isEmpty()) {
parent/base.common/src/main/java/com/lyms/base/common/utils/SyncComponent.java View file @ 979f470
... ... @@ -5,13 +5,15 @@
5 5 import org.slf4j.Logger;
6 6 import org.slf4j.LoggerFactory;
7 7 import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.beans.factory.annotation.Value;
8 9 import org.springframework.stereotype.Component;
9 10  
  11 +import com.alibaba.fastjson.JSONObject;
10 12 import com.baomidou.mybatisplus.mapper.EntityWrapper;
11   -import com.lyms.base.common.conf.SyncConf;
12 13 import com.lyms.base.common.entity.organ.OrganGroup;
13 14 import com.lyms.base.common.enums.SyncParamEnum;
14 15 import com.lyms.base.common.service.organ.OrganGroupService;
  16 +import com.lyms.base.common.service.sys.SyncDataBasicService;
15 17 import com.lyms.sync.ParamsAdpter;
16 18 import com.lyms.sync.SyncCenter;
17 19 import com.lyms.util.CollectionUtils;
... ... @@ -28,7 +30,15 @@
28 30  
29 31 @Autowired
30 32 private OrganGroupService organGroupService;
31   -
  33 + @Autowired
  34 + private SyncDataBasicService syncDataBasicService;
  35 +
  36 + @Value("${isCenterOperateSyncToNode}")
  37 + private boolean isCenterOperateSyncToNode;
  38 +
  39 + @SuppressWarnings("unused")
  40 + private boolean isNodeOperateSyncToCenter = false;
  41 +
32 42 private List<String> getAllGroupIpList() {
33 43 List<String> ipList = InstanceUtils.newArrayList();
34 44 List<OrganGroup> list = organGroupService.selectList(new EntityWrapper<OrganGroup>().where("ifDel=0"));
... ... @@ -53,8 +63,7 @@
53 63 * <li>修改时间:
54 64 */
55 65 public boolean addPushSyncOperation(SyncParamEnum syncParamConf, Object... data) {
56   - if(SyncConf.isCenterOperateSyncToNode){
57   - log.debug("添加推送队列");
  66 + if(isCenterOperateSyncToNode){
58 67 List<String> ipList = getAllGroupIpList();
59 68 ParamsAdpter adpter = null;
60 69 if (data != null && data.length > 0) {
... ... @@ -65,6 +74,7 @@
65 74 }
66 75 for (String ip : ipList) {
67 76 String id = StrUtils.uuid();
  77 + log.info("====》 添加推送队列:【{}】【{}】【{}】【{}】",ip,syncParamConf.getRemoteClazz(),syncParamConf.getRemoteMethod(),JSONObject.toJSONString(adpter));
68 78 center.pushTmp(id, ip, syncParamConf.getRemoteClazz(), syncParamConf.getRemoteMethod(), adpter);
69 79 }
70 80 return true;
parent/center.manager/src/main/java/com/lyms/cm/controller/conf/DiagnoseVersionController.java View file @ 979f470
... ... @@ -123,10 +123,12 @@
123 123 *
124 124 * @return
125 125 */
126   - @RequestMapping(value = "/{id}/copy", method = { RequestMethod.GET, RequestMethod.POST })
  126 + @RequestMapping(value = "/copy", method = { RequestMethod.GET, RequestMethod.POST })
127 127 @ResponseBody
128   - public AjaxResult copy(@PathVariable String id, AjaxResult ajaxResult){
129   - int tag = diagnoseVersionService.copy(id);
  128 + public AjaxResult copy(AjaxResult ajaxResult){
  129 + String id = getParameter("perId");
  130 + String versionName = getParameter("versionName");
  131 + int tag = diagnoseVersionService.copy(id,versionName);
130 132 return handleAjaxResult(ajaxResult, tag, "复制");
131 133 }
132 134  
parent/center.manager/src/main/java/com/lyms/cm/controller/conf/HighriskVersionController.java View file @ 979f470
... ... @@ -123,10 +123,12 @@
123 123 *
124 124 * @return
125 125 */
126   - @RequestMapping(value = "/{id}/copy", method = { RequestMethod.GET, RequestMethod.POST })
  126 + @RequestMapping(value = "/copy", method = { RequestMethod.GET, RequestMethod.POST })
127 127 @ResponseBody
128   - public AjaxResult copy(@PathVariable String id, AjaxResult ajaxResult){
129   - int tag = highriskVersionService.copy(id);
  128 + public AjaxResult copy(AjaxResult ajaxResult){
  129 + String id = getParameter("perId");
  130 + String versionName = getParameter("versionName");
  131 + int tag = highriskVersionService.copy(id,versionName);
130 132 return handleAjaxResult(ajaxResult, tag, "复制");
131 133 }
132 134  
parent/center.manager/src/main/java/com/lyms/cm/job/SyncFixJob.java View file @ 979f470
... ... @@ -60,7 +60,7 @@
60 60 pullUrlList = InstanceUtils.newArrayList();
61 61 for(OrganGroup entity : groupList){
62 62 if(StrUtils.isNotEmpty(entity.getPulladdress()) && entity.getPulladdress().startsWith("http")){
63   - LOG.info("添加固定拉取远程任务:pullAddress={}",entity.getPulladdress());
  63 + LOG.info("添加固定拉取远程任务:医院组={},pullAddress={}",entity.getName(),entity.getPulladdress());
64 64 if( !pullUrlList.contains(entity.getPulladdress().trim()) ){
65 65 pullUrlList.add(entity.getPulladdress().trim());
66 66 center.pushFix(StrUtils.uuid(), entity.getPulladdress().trim(), remoteClazz, remoteMethod, null);
... ... @@ -73,7 +73,7 @@
73 73 }
74 74 reset.set(true);
75 75 // 拉取远端数据
76   - LOG.debug("执行拉取远程数据任务...");
  76 + //LOG.debug("执行拉取远程数据任务...");
77 77 final Work work = center.buildWork();
78 78 try {
79 79 work.pullFix(new SyncCallback() {
80 80  
81 81  
82 82  
... ... @@ -81,17 +81,19 @@
81 81 public void callBack(Object object) {
82 82 if (object instanceof ChannelData) {
83 83 ChannelData oldData = (ChannelData) object;
84   - if (oldData != null && StringUtils.isNotBlank(oldData.getId())) {
  84 + if (oldData != null && StringUtils.isNotEmpty(oldData.getId())) {
85 85 // 任务发送执行
86   - LOG.info("拉取到本地任务: " + ToStringBuilder.reflectionToString(oldData));
  86 + //LOG.info("拉取到本地任务: " + ToStringBuilder.reflectionToString(oldData));
87 87 String result = HttpUtils.REMOTE.post(oldData);
88   - LOG.info("返回结果: " + result);
  88 + //LOG.info("返回结果: " + result);
89 89 if (StringUtils.isBlank(result))
90 90 return;
91 91 ChannelData data = JsonUtils.jsonToBean(result, ChannelData.class);
92 92 // 处理回执消息
93 93 if (data != null && data.getAck() && StrUtils.isNotEmpty(data.getRemoteClazz()) && StrUtils.isNotEmpty(data.getRemoteMethod())) {
94 94 // 拉取到数据执行本地方法
  95 + LOG.info("拉取到本地任务: " + ToStringBuilder.reflectionToString(oldData));
  96 + LOG.info("返回结果: " + result);
95 97 System.out.println("执行: " + ToStringBuilder.reflectionToString(data));
96 98 Object handlResult = SyncHandler.handler(data);
97 99 // 要求处理成功都必须返回true | false;
parent/center.manager/src/main/java/com/lyms/cm/job/SyncTmpJob.java View file @ 979f470
... ... @@ -35,7 +35,7 @@
35 35 }
36 36 reset.set(true);
37 37 // 拉取远端数据
38   - LOG.debug("执行推送远程数据任务...");
  38 + //LOG.debug("执行推送远程数据任务...");
39 39 final Work work = center.buildWork();
40 40 try {
41 41 work.pullTmp(new SyncCallback() {
parent/center.manager/src/main/resources/dev/redis.properties View file @ 979f470
1   -redis.host1=119.90.57.26
  1 +#redis.host1=119.90.57.26
  2 +#redis.port1=6379
  3 +#redis.password1=Lyms123456
  4 +redis.host1=127.0.0.1
2 5 redis.port1=6379
3   -redis.password1=Lyms123456
  6 +redis.password1=
4 7 #redis.host1=127.0.0.1
5 8 #redis.port1=6379
6 9 #redis.password1=Lyms123456
parent/center.manager/src/main/resources/xml/app-datasource.xml View file @ 979f470
... ... @@ -74,8 +74,7 @@
74 74 <property name="dataSource" ref="dynamicDataSource" />
75 75 <property name="plugins">
76 76 <array>
77   - <bean id="paginationInterceptor"
78   - class="com.baomidou.mybatisplus.plugins.PaginationInterceptor">
  77 + <bean id="paginationInterceptor" class="com.baomidou.mybatisplus.plugins.PaginationInterceptor">
79 78 <property name="dialectType" value="mysql" />
80 79 <!-- <property name="dialectClazz" value="com.baomidou.mybatisplus.plugins.pagination.dialects.MySqlDialect" /> -->
81 80 </bean>
parent/center.manager/src/main/webapp/WEB-INF/views/conf/diagnose/version_list.html View file @ 979f470
... ... @@ -21,7 +21,7 @@
21 21 <div id="toolbar">
22 22 <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
23 23 <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
24   - <button class="btn btn-info " type="button" onclick="copy();"><i class="fa fa-paste"></i> 复制</button>
  24 + <button class="btn btn-info " type="button" onclick="copyVer();"><i class="fa fa-paste"></i> 复制</button>
25 25 <!--
26 26 <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
27 27 -->
... ... @@ -52,6 +52,36 @@
52 52 if(id){
53 53 fullWindow("修改诊断版本", APP.PATH + controllerRequestMappint + id + "/toEdit");
54 54 }
  55 +}
  56 +
  57 +function copyVer(){
  58 + var val = getSingleSelectedValue("dataTable","id");
  59 + if(val){
  60 + var name = getSingleSelectedValue("dataTable","name");
  61 + layer.open({
  62 + type: 1 //Page层类型
  63 + ,area: ['530px', '300px']
  64 + ,title: '复制诊断版本'
  65 + ,shade: 0.6 //遮罩透明度
  66 + ,maxmin: true //允许全屏最小化
  67 + ,anim: 2 //0-6的动画形式,-1不开启
  68 + ,content: "<div class='col-sm-11 col-sm-offset-1'>" +
  69 + "<form class='form-horizontal m-t navbar-form navbar-left' id='validForm'>" +
  70 + "<div class='form-group'><label class='col-sm-5 control-label'>将要复制的版本名称:</label><div class='col-sm-5'><input type='hidden' name='perId' value='"+val+"'/>" +
  71 + "<input type='text' class='form-control w-lg' value='"+name+"' disabled></div></div>" +
  72 + "<div class='form-group'><label class='col-sm-6 control-label'>版本名称:</label><div class='col-sm-5'>" +
  73 + "<input type='text' class='form-control w-lg' placeholder='版本名称' name='versionName' required></div></div>" +
  74 + "<div class='col-sm-offset-9'><a onclick='saveVersion()' class='btn btn-primary navbar-btn'>提交</a></div></form></div>"
  75 + });
  76 + }else{
  77 + msg("请选择需要复制的数据");
  78 + }
  79 +}
  80 +function saveVersion(){
  81 + if($('#validForm').valid()){
  82 + var data = $('#validForm').serialize();
  83 + ajaxPost(APP.PATH +'/diagnoseVersion/copy',data);
  84 + }
55 85 }
56 86 function copy() {
57 87 var val = getSelectedValue("dataTable","id");
parent/center.manager/src/main/webapp/WEB-INF/views/conf/highrisk/version_list.html View file @ 979f470
... ... @@ -21,7 +21,7 @@
21 21 <div id="toolbar">
22 22 <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
23 23 <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
24   - <button class="btn btn-info " type="button" onclick="copy();"><i class="fa fa-paste"></i> 复制</button>
  24 + <button class="btn btn-info " type="button" onclick="copyVer();"><i class="fa fa-paste"></i> 复制</button>
25 25 <!--
26 26 <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
27 27 -->
28 28  
29 29  
... ... @@ -53,25 +53,36 @@
53 53 fullWindow("修改高危版本", APP.PATH + controllerRequestMappint + id + "/toEdit");
54 54 }
55 55 }
56   -function copy() {
57   - var val = getSelectedValue("dataTable","id");
  56 +
  57 +function copyVer(){
  58 + var val = getSingleSelectedValue("dataTable","id");
58 59 if(val){
59   - layer.confirm('确定复制选中的数据', {
60   - btn: ['确定','取消'] //按钮
61   - }, function(){
62   - url = APP.PATH + controllerRequestMappint + val + "/copy";
63   - ajaxPost(url,null,function(r){
64   - if(r.success){
65   - reloadGrid("dataTable");
66   - }
67   - msg(r.message);
68   - });
69   - }, function(){
70   -
71   - });
  60 + var name = getSingleSelectedValue("dataTable","name");
  61 + layer.open({
  62 + type: 1 //Page层类型
  63 + ,area: ['530px', '300px']
  64 + ,title: '复制高危版本'
  65 + ,shade: 0.6 //遮罩透明度
  66 + ,maxmin: true //允许全屏最小化
  67 + ,anim: 2 //0-6的动画形式,-1不开启
  68 + ,content: "<div class='col-sm-11 col-sm-offset-1'>" +
  69 + "<form class='form-horizontal m-t navbar-form navbar-left' id='validForm'>" +
  70 + "<div class='form-group'><label class='col-sm-5 control-label'>将要复制的版本名称:</label><div class='col-sm-5'><input type='hidden' name='perId' value='"+val+"'/>" +
  71 + "<input type='text' class='form-control w-lg' value='"+name+"' disabled></div></div>" +
  72 + "<div class='form-group'><label class='col-sm-6 control-label'>版本名称:</label><div class='col-sm-5'>" +
  73 + "<input type='text' class='form-control w-lg' placeholder='版本名称' name='versionName' required></div></div>" +
  74 + "<div class='col-sm-offset-9'><a onclick='saveVersion()' class='btn btn-primary navbar-btn'>提交</a></div></form></div>"
  75 + });
72 76 }else{
73 77 msg("请选择需要复制的数据");
74 78 }
  79 +}
  80 +
  81 +function saveVersion(){
  82 + if($('#validForm').valid()){
  83 + var data = $('#validForm').serialize();
  84 + ajaxPost(APP.PATH +'/highriskVersion/copy',data);
  85 + }
75 86 }
76 87  
77 88 function del(){
parent/center.manager/src/test/java/center/manager/test/user/WorkTest.java View file @ 979f470
... ... @@ -4,6 +4,7 @@
4 4 import org.junit.Test;
5 5 import org.springframework.beans.factory.annotation.Autowired;
6 6  
  7 +import com.lyms.spring.PropertiesUtil;
7 8 import com.lyms.sync.ParamsAdpter;
8 9 import com.lyms.sync.SyncCallback;
9 10 import com.lyms.sync.SyncCenter;
... ... @@ -21,6 +22,11 @@
21 22  
22 23 @Autowired
23 24 public SyncCenter center;
  25 +
  26 + @Test
  27 + public void get(){
  28 + System.out.println(PropertiesUtil.getString("isCenterOperateSyncToNode"));
  29 + }
24 30  
25 31 /**
26 32 * <li>@Description:测试往固定任务队列中添加任务
... ... @@ -30,7 +36,7 @@
30 36 * <li>修改人:
31 37 * <li>修改时间:
32 38 */
33   - @Test
  39 + //@Test
34 40 public void pushFix() {
35 41 String id = StrUtils.uuid();
36 42 String remote = "http://127.0.0.1:8080/hospital.web/remote/sync";
... ... @@ -47,7 +53,7 @@
47 53 * <li>修改人:
48 54 * <li>修改时间:
49 55 */
50   - @Test
  56 + //@Test
51 57 public void pushTmp() {
52 58 String id = StrUtils.uuid();
53 59 String remote = "http://127.0.0.1:9090/hospital.web/remote/sync";
... ... @@ -60,7 +66,7 @@
60 66 center.pushFix(id, remote, remoteClazz, remoteMethod, null);
61 67 }
62 68  
63   - @Test
  69 + //@Test
64 70 public void pull() {
65 71 center.pull(true, new SyncCallback() {
66 72 @Override
parent/hospital.web/src/main/java/com/lyms/hospital/controller/RouterController.java View file @ 979f470
... ... @@ -5,6 +5,8 @@
5 5 import javax.servlet.http.HttpServletRequest;
6 6  
7 7 import org.apache.commons.lang3.builder.ToStringBuilder;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
8 10 import org.springframework.http.MediaType;
9 11 import org.springframework.web.bind.annotation.RequestMapping;
10 12 import org.springframework.web.bind.annotation.RestController;
11 13  
... ... @@ -25,11 +27,13 @@
25 27 @RestController
26 28 @RequestMapping("/remote")
27 29 public class RouterController extends BaseController {
  30 +
  31 + private static final Logger log = LoggerFactory.getLogger(RouterController.class);
28 32  
29 33 @RequestMapping(value = "/pull", produces = { MediaType.APPLICATION_JSON_VALUE })
30 34 public Object pull(HttpServletRequest request) throws ClassNotFoundException, IOException {
31 35 ChannelData data = SyncUtils.conver(request);
32   - System.out.println("接受到数据: " + ToStringBuilder.reflectionToString(data));
  36 + log.debug("节点数据被中心拉取:" + ToStringBuilder.reflectionToString(data));
33 37 Object handResult = SyncHandler.handler(data);
34 38 if (data.getLoop()) {
35 39 data = (ChannelData) handResult;
... ... @@ -43,7 +47,7 @@
43 47 @RequestMapping(value = "/push", produces = { MediaType.APPLICATION_JSON_VALUE })
44 48 public Object push(HttpServletRequest request) throws ClassNotFoundException, IOException {
45 49 ChannelData data = SyncUtils.conver(request);
46   - System.out.println("接受到数据: " + ToStringBuilder.reflectionToString(data));
  50 + log.debug("中心推送数据到节点:" + ToStringBuilder.reflectionToString(data));
47 51 Object handResult = SyncHandler.handler(data);
48 52 if (data.getLoop()) {
49 53 data = (ChannelData) handResult;
parent/hospital.web/src/main/java/com/lyms/hospital/dao/sys/SyncDataBasicMapper.java View file @ 979f470
1   -package com.lyms.hospital.dao.sys;
2   -
3   -import java.io.Serializable;
4   -import java.util.List;
5   -
6   -import org.springframework.stereotype.Repository;
7   -
8   -import com.baomidou.mybatisplus.mapper.BaseMapper;
9   -import com.lyms.hospital.entity.sys.SyncDataBasic;
10   -
11   -/**
12   - * <p>
13   - * Mapper接口
14   - * </p>
15   - *
16   - * @author maliang
17   - * @since 2017-03-15
18   - */
19   -@Repository
20   -public interface SyncDataBasicMapper extends BaseMapper<SyncDataBasic> {
21   -
22   - public Integer deleteLogicById(Serializable id);
23   -
24   - /**
25   - * <li>@Description: 批量更新
26   - * <li>@param ids
27   - * <li>@return
28   - * <li>创建人:maliang
29   - * <li>创建时间:2017年3月15日
30   - * <li>修改人:
31   - * <li>修改时间:
32   - */
33   - public Integer updateBatchByIds(List<Serializable> ids);
34   -
35   -}
parent/hospital.web/src/main/java/com/lyms/hospital/dao/sys/SyncDataBasicMapper.xml View file @ 979f470
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3   -"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
4   -<mapper namespace="com.lyms.hospital.dao.sys.SyncDataBasicMapper">
5   -
6   - <!-- 通用查询映射结果 -->
7   - <resultMap id="BaseResultMap" type="com.lyms.hospital.entity.sys.SyncDataBasic">
8   - <id column="ID" property="id" />
9   - <result column="DATA" property="data" />
10   - <result column="CREATE_TIME" property="createTime" />
11   - <result column="IFSUC" property="ifsuc" />
12   - </resultMap>
13   -
14   - <!-- 通用查询结果列 -->
15   - <sql id="Base_Column_List">
16   - ID AS id, DATA AS data, CREATE_TIME AS createTime, IFSUC AS ifsuc
17   - </sql>
18   -
19   - <sql id="Base_table">
20   - SYNC_DATA_BASIC
21   - </sql>
22   -
23   -
24   - <update id="updateBatchByIds" parameterType="list">
25   - update from <include refid="Base_table" /> as sb set sb.ifsuc=1
26   - where sb.id in
27   - <foreach item="item" collection="ids" open="(" close=")" separator=",">
28   - #{item}
29   - </foreach>
30   - </update>
31   -
32   -</mapper>
parent/hospital.web/src/main/java/com/lyms/hospital/entity/sys/SyncDataBasic.java View file @ 979f470
1   -package com.lyms.hospital.entity.sys;
2   -
3   -import java.io.Serializable;
4   -import java.util.Date;
5   -
6   -import com.baomidou.mybatisplus.annotations.TableField;
7   -import com.baomidou.mybatisplus.annotations.TableId;
8   -import com.baomidou.mybatisplus.annotations.TableName;
9   -import com.lyms.sync.channel.ChannelData;
10   -
11   -/**
12   - *
13   - * <p>
14   - * 用户、角色、权限、医院、部门等基础数据同步
15   - * </p>
16   - *
17   - * @author maliang
18   - * @since 2017-03-15
19   - */
20   -@TableName("SYNC_DATA_BASIC")
21   -public class SyncDataBasic implements Serializable {
22   -
23   - private static final long serialVersionUID = 1L;
24   -
25   - /**
26   - * 该ID 一定要与data 中的ID一致
27   - */
28   - @TableId(value = "ID")
29   - private String id;
30   - /**
31   - * 数据对象 {@link ChannelData} json 数据格式
32   - */
33   - @TableField(value = "DATA")
34   - private String data;
35   - /**
36   - * 创建时间
37   - */
38   - @TableField(value = "CREATE_TIME")
39   - private Date createTime;
40   - /**
41   - * 数据上传是否成功
42   - */
43   - @TableField(value = "IFSUC")
44   - private Integer ifsuc;
45   -
46   - public String getId() {
47   - return id;
48   - }
49   -
50   - public void setId(String id) {
51   - this.id = id;
52   - }
53   -
54   - public String getData() {
55   - return data;
56   - }
57   -
58   - public void setData(String data) {
59   - this.data = data;
60   - }
61   -
62   - public Date getCreateTime() {
63   - return createTime;
64   - }
65   -
66   - public void setCreateTime(Date createTime) {
67   - this.createTime = createTime;
68   - }
69   -
70   - public Integer getIfsuc() {
71   - return ifsuc;
72   - }
73   -
74   - public void setIfsuc(Integer ifsuc) {
75   - this.ifsuc = ifsuc;
76   - }
77   -
78   -}
parent/hospital.web/src/main/java/com/lyms/hospital/service/sys/SyncDataBasicService.java View file @ 979f470
1   -package com.lyms.hospital.service.sys;
2   -
3   -import java.io.Serializable;
4   -import java.util.List;
5   -
6   -import com.lyms.base.common.enums.SyncParamEnum;
7   -import com.lyms.hospital.entity.sys.SyncDataBasic;
8   -import com.lyms.sync.channel.ChannelData;
9   -import com.lyms.web.service.BaseService;
10   -
11   -/**
12   - * <p>
13   - * 数据同步模块
14   - * </p>
15   - *
16   - * @author maliang
17   - * @since 2017-03-15
18   - */
19   -public interface SyncDataBasicService extends BaseService<SyncDataBasic> {
20   -
21   - /**
22   - * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除
23   - * <li>@param id 删除主键id
24   - * <li>@return 大于0修改成功,否则为失败
25   - */
26   - public Integer deleteLogicById(Serializable id);
27   -
28   - /**
29   - * <li>@Description:更新同步成功的数据
30   - * <li>@param ids
31   - * <li>@return
32   - * <li>创建人:maliang
33   - * <li>创建时间:2017年3月15日
34   - * <li>修改人:
35   - * <li>修改时间:
36   - */
37   - public Boolean updateBasic(List<Serializable> ids);
38   -
39   - /**
40   - * 获取一条数据
41   - * <li>@Description:TODO(方法描述)
42   - * <li>@return
43   - * <li>创建人:maliang
44   - * <li>创建时间:2017年3月15日
45   - * <li>修改人:
46   - * <li>修改时间:
47   - */
48   - public ChannelData selectOne();
49   -
50   - public Boolean updateBasic(Serializable id);
51   - /**
52   - * <li>@Description:向同步库插入一个需要提交给center的同步任务
53   - * <li>@param syncParamConf
54   - * <li>@param dataObjects 对象方法参数列表
55   - * <li>@return
56   - * <li>创建人:方承
57   - * <li>创建时间:2017年4月11日
58   - * <li>修改人:
59   - * <li>修改时间:
60   - */
61   - public boolean addSyncData(SyncParamEnum syncParamConf,Object ...dataObjects);
62   -
63   -}
parent/hospital.web/src/main/java/com/lyms/hospital/service/sys/impl/SyncDataBasicServiceImpl.java View file @ 979f470
1   -package com.lyms.hospital.service.sys.impl;
2   -
3   -import java.io.Serializable;
4   -import java.util.Date;
5   -import java.util.List;
6   -
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.stereotype.Service;
9   -import org.springframework.transaction.annotation.Transactional;
10   -
11   -import com.baomidou.mybatisplus.mapper.EntityWrapper;
12   -import com.baomidou.mybatisplus.service.impl.ServiceImpl;
13   -import com.lyms.base.common.enums.SyncParamEnum;
14   -import com.lyms.hospital.dao.sys.SyncDataBasicMapper;
15   -import com.lyms.hospital.entity.sys.SyncDataBasic;
16   -import com.lyms.hospital.service.sys.SyncDataBasicService;
17   -import com.lyms.sync.ParamsAdpter;
18   -import com.lyms.sync.channel.ChannelData;
19   -import com.lyms.util.JsonUtils;
20   -import com.lyms.util.StrUtils;
21   -
22   -/**
23   - * <p>
24   - * 用户、角色、权限、医院、部门等基础数据同步 服务实现类
25   - * </p>
26   - *
27   - * @author maliang
28   - * @since 2017-03-15
29   - */
30   -@Service
31   -public class SyncDataBasicServiceImpl extends ServiceImpl<SyncDataBasicMapper, SyncDataBasic>
32   - implements SyncDataBasicService {
33   -
34   - @Autowired
35   - private SyncDataBasicMapper basicMapper;
36   -
37   - public Integer deleteLogicById(Serializable id) {
38   - return baseMapper.deleteLogicById(id);
39   - }
40   -
41   - @Override
42   - @Transactional
43   - public Boolean updateBasic(List<Serializable> ids) {
44   - Integer tag = basicMapper.updateBatchByIds(ids);
45   - return tag >= 1 ? Boolean.TRUE : Boolean.FALSE;
46   - }
47   -
48   - @Override
49   - public Boolean updateBasic(Serializable id) {
50   - SyncDataBasic dataBasic = baseMapper.selectById(id);
51   - dataBasic.setIfsuc(1);
52   - Integer tag = baseMapper.updateById(dataBasic);
53   - return tag >= 1;
54   - }
55   -
56   - @Override
57   - public ChannelData selectOne() {
58   - EntityWrapper<SyncDataBasic> ew = new EntityWrapper<SyncDataBasic>();
59   - ew.where("ifsuc=0");
60   - List<SyncDataBasic> datas = baseMapper.selectList(ew);
61   -
62   - // 单条同步,避免过于复杂的消息回执
63   - SyncDataBasic basic = datas != null && datas.size() > 0 ? datas.get(0) : null;
64   - if (basic != null) {
65   - ChannelData data = JsonUtils.jsonToBean(basic.getData(), ChannelData.class);
66   - return data;
67   - }
68   - return ChannelData.emtpy();
69   - }
70   -
71   - @Override
72   - public boolean addSyncData(SyncParamEnum syncParamConf, Object... dataObjects) {
73   - SyncDataBasic entity = new SyncDataBasic();
74   - String uid = StrUtils.uuid();
75   - entity.setId(uid);
76   - Date now = new Date();
77   - entity.setCreateTime(now);
78   -
79   - ChannelData cdata = new ChannelData();
80   - cdata.setAck(true);
81   - ParamsAdpter adpter = ParamsAdpter.builder();
82   - for(Object param : dataObjects){
83   - adpter.push(param);
84   - }
85   - cdata.setData(adpter.toJsonString());
86   - cdata.setId(uid);
87   - cdata.setLoop(false);
88   - cdata.setRemoteClazz(syncParamConf.getRemoteClazz());
89   - cdata.setRemoteMethod(syncParamConf.getRemoteMethod());
90   - cdata.setTs(now.getTime());
91   -
92   - entity.setData(cdata.toJsonString());
93   - Integer tag = baseMapper.insert(entity);
94   - return tag >= 1 ? true : false;
95   - }
96   -
97   -}
parent/hospital.web/src/main/resources/dev/conf.properties View file @ 979f470
1 1 token.prefix=token:user:
  2 +isCenterOperateSyncToNode=false
parent/hospital.web/src/main/resources/xml/app-datasource.xml View file @ 979f470
... ... @@ -61,8 +61,16 @@
61 61 </property>
62 62 </bean>
63 63  
64   - <bean id="sqlSessionFactory"
65   - class="com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean">
  64 + <!-- 自定义注入器 -->
  65 + <bean id="deleteLogicByIdSqlInjector" class="com.lyms.mybatis.DeleteLogicByIdSqlInjector" />
  66 + <!-- 注入配置 -->
  67 + <bean id="globalConfig" class="com.baomidou.mybatisplus.entity.GlobalConfiguration">
  68 + <property name="sqlInjector" ref="deleteLogicByIdSqlInjector" />
  69 + </bean>
  70 +
  71 + <bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean">
  72 + <!-- 自定义注入 deleteByIdForYn 方法 -->
  73 + <property name="globalConfig" ref="globalConfig" />
66 74 <property name="dataSource" ref="dynamicDataSource" />
67 75 <property name="plugins">
68 76 <array>
... ... @@ -83,21 +91,6 @@
83 91 </property>
84 92 <!-- <property name="typeAliasesPackage" value="com.lyms.base.common.entity" /> -->
85 93 <property name="typeAliasesPackage" value="com.lyms.base.common.entity" />
86   -
87   - <!-- MP 全局配置注入 -->
88   - <property name="globalConfig" ref="globalConfig" />
89   - </bean>
90   -
91   - <bean id="globalConfig" class="com.baomidou.mybatisplus.entity.GlobalConfiguration">
92   - <!-- MP 主键策略配置 AUTO->`0`("数据库ID自增") INPUT->`1`(用户输入ID") ID_WORKER->`2`("全局唯一ID")
93   - UUID->`3`("全局唯一ID") -->
94   - <property name="idType" value="3" />
95   - <!-- MYSQL->`mysql` ORACLE->`oracle` DB2->`db2` H2->`h2` HSQL->`hsql` SQLITE->`sqlite`
96   - POSTGRE->`postgresql` SQLSERVER2005->`sqlserver2005` SQLSERVER->`sqlserver` -->
97   - <!-- Oracle需要添加该项 -->
98   - <!-- <property name="dbType" value="oracle" /> -->
99   - <!-- 全局表为下划线命名设置 true -->
100   - <!-- <property name="dbColumnUnderline" value="true" /> -->
101 94 </bean>
102 95  
103 96 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
parent/hospital.web/src/test/java/test/hospital/sync/SyncTest.java View file @ 979f470
... ... @@ -5,7 +5,7 @@
5 5  
6 6 import com.lyms.base.common.entity.user.Users;
7 7 import com.lyms.base.common.enums.SyncParamEnum;
8   -import com.lyms.hospital.service.sys.SyncDataBasicService;
  8 +import com.lyms.base.common.service.sys.SyncDataBasicService;
9 9 import com.lyms.util.DateTimeUtils;
10 10  
11 11 import test.hospital.BaseServiceTest;