Commit 203aa68619d5c769fa87321f1298efecb37e8fb5

Authored by xujiahong
Exists in master

Merge branch 'master' of

https://git.healthbaby.com.cn/jiangjiazhi/center.git

Conflicts:
	parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/impl/DiagnoseInfoServiceImpl.java

Showing 67 changed files

parent/base.common/src/main/java/com/lyms/base/common/dao/conf/DiagnoseMapsMapper.xml View file @ 203aa68
... ... @@ -6,14 +6,14 @@
6 6 <resultMap id="BaseResultMap" type="com.lyms.base.common.entity.conf.DiagnoseMaps">
7 7 <result column="ID" property="id" />
8 8 <result column="DIAGNOSE_ID" property="diagnoseId" />
9   - <result column="SOURCE_ID" property="sourceId" />
  9 + <result column="CONF_ID" property="confId" />
10 10 </resultMap>
11 11  
12 12 <!-- 通用查询映射结果 -->
13 13 <resultMap id="MapsResultMap" type="com.lyms.base.common.entity.conf.DiagnoseMaps">
14 14 <result column="ID" property="id" />
15 15 <result column="DIAGNOSE_ID" property="diagnoseId" />
16   - <result column="SOURCE_ID" property="sourceId" />
  16 + <result column="CONF_ID" property="confId" />
17 17 <result column="NAME" property="name" />
18 18 <result column="GROUPNAME" property="groupname" />
19 19 <result column="GROUPORDER" property="grouporder" />
20 20  
21 21  
22 22  
... ... @@ -22,20 +22,19 @@
22 22  
23 23 <!-- 通用查询结果列 -->
24 24 <sql id="Base_Column_List">
25   - ID AS id, DIAGNOSE_ID AS diagnoseId, SOURCE_ID AS sourceId
  25 + ID AS id, DIAGNOSE_ID AS diagnoseId, CONF_ID AS confId
26 26 </sql>
27 27  
28 28 <!-- 关系查询结果列 -->
29 29 <sql id="Maps_Column_List">
30   - m.ID AS id, m.DIAGNOSE_ID AS diagnoseId, m.SOURCE_ID AS sourceId,
  30 + m.ID AS id, m.DIAGNOSE_ID AS diagnoseId, m.CONF_ID AS confId,
31 31 NAME AS name, GROUPNAME AS groupname, GROUPORDER AS grouporder, ITEMORDER AS itemorder
32 32 </sql>
33 33  
34   - <!-- 根据uid获取用户的权限列表-->
35 34 <select id="selectByDiagnoseId" resultMap="MapsResultMap">
36 35 select
37 36 <include refid="Maps_Column_List"></include>
38   - from DIAGNOSE_MAPS m left join DIAGNOSE_CONF c on m.SOURCE_ID = c.SOURCE_ID where m.DIAGNOSE_ID = #{id}
  37 + from DIAGNOSE_MAPS m left join DIAGNOSE_CONF c on m.CONF_ID = c.ID where m.DIAGNOSE_ID = #{id}
39 38 </select>
40 39 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/dao/conf/HighriskMapsMapper.xml View file @ 203aa68
... ... @@ -6,14 +6,14 @@
6 6 <resultMap id="BaseResultMap" type="com.lyms.base.common.entity.conf.HighriskMaps">
7 7 <result column="ID" property="id" />
8 8 <result column="DIAGNOSE_ID" property="diagnoseId" />
9   - <result column="SOURCE_ID" property="sourceId" />
  9 + <result column="CONF_ID" property="confId" />
10 10 </resultMap>
11 11  
12 12 <!-- 通用查询映射结果 -->
13 13 <resultMap id="HighriskMapsResult" type="com.lyms.base.common.entity.conf.HighriskMaps">
14 14 <result column="ID" property="id" />
15 15 <result column="DIAGNOSE_ID" property="diagnoseId" />
16   - <result column="SOURCE_ID" property="sourceId" />
  16 + <result column="CONF_ID" property="confId" />
17 17 <result column="NAME" property="name" />
18 18 <result column="COLORCODE" property="colorcode" />
19 19 <result column="COLORTEXT" property="colortext" />
20 20  
21 21  
22 22  
... ... @@ -24,21 +24,20 @@
24 24  
25 25 <!-- 通用查询结果列 -->
26 26 <sql id="Base_Column_List">
27   - ID AS id, DIAGNOSE_ID AS diagnoseId, SOURCE_ID AS sourceId
  27 + ID AS id, DIAGNOSE_ID AS diagnoseId, CONF_ID AS confId
28 28 </sql>
29 29  
30 30 <!-- 关系查询结果列 -->
31 31 <sql id="Maps_Column_List">
32   - m.ID AS id, m.DIAGNOSE_ID AS diagnoseId, m.SOURCE_ID AS sourceId,
  32 + m.ID AS id, m.DIAGNOSE_ID AS diagnoseId, m.CONF_ID AS confId,
33 33 NAME AS name, COLORCODE AS colorcode, COLORTEXT AS colortext, GROUPORDER AS grouporder,
34 34 ITEMORDER AS itemorder, GRADE AS grade
35 35 </sql>
36 36  
37   - <!-- 根据uid获取用户的权限列表-->
38 37 <select id="selectByDiagnoseId" resultMap="HighriskMapsResult">
39 38 select
40 39 <include refid="Maps_Column_List"></include>
41   - from HIGHRISK_MAPS m left join HIGHRISK_CONF c on m.SOURCE_ID = c.SOURCE_ID where m.DIAGNOSE_ID = #{id}
  40 + from HIGHRISK_MAPS m left join HIGHRISK_CONF c on m.CONF_ID = c.ID where m.DIAGNOSE_ID = #{id}
42 41 </select>
43 42 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/dao/content/ContentArticlesMapper.xml View file @ 203aa68
... ... @@ -35,8 +35,8 @@
35 35 </sql>
36 36  
37 37 <select id="getArticlesPage" resultMap="BaseResultMap" parameterType="com.lyms.base.common.vo.content.AricleSearchDTO">
38   - select ca.ID,ca.CATEGORY_ID,ca.CONTENT,ca.CONTENT_TYPE,ca.`ENABLE`,ca.INTRODUCTION,ca.LINK,ca.TITLE,ca.TYPE,group_concat(cat.TAGS_IDS ) as tagIds,cc.`NAME` as categoryName
39   - from CONTENT_ARTICLES ca join CONTENT_ARTICLES_TAGS cat on ca.ID = cat.ARTICLES_ID join CONTENT_CATEGORIES cc on ca.CATEGORY_ID = cc.ID
  38 + select ca.ID,ca.CATEGORY_ID,ca.CONTENT,ca.CONTENT_TYPE,ca.`ENABLE`,ca.INTRODUCTION,ca.LINK,ca.TITLE,ca.TYPE,group_concat(cat.TAGS_IDS ) as tagIds,cc.`NAME` as categoryName,ca.STATUS as status
  39 + from CONTENT_ARTICLES ca LEFT join CONTENT_ARTICLES_TAGS cat on ca.ID = cat.ARTICLES_ID left join CONTENT_CATEGORIES cc on ca.CATEGORY_ID = cc.ID
40 40 <where>
41 41 <if test="columnId !=null">
42 42 and ca.CATEGORY_ID = #{columnId}
43 43  
44 44  
... ... @@ -50,12 +50,17 @@
50 50 and ca.TITlE like concat('%',#{title},'%')
51 51 </if>
52 52  
  53 + <if test="status!=null">
  54 + and ca.STATUS = #{status}
  55 + </if>
  56 +
53 57 <if test="tagId!=null">
54 58 and cat.TAGS_IDS like concat('%,',#{tagId},',%')
55 59 </if>
56   -
  60 + AND ca.IFDEL = 0
57 61 </where>
58 62 GROUP BY ca.ID
  63 + order by ca.CREATE_TIME DESC
59 64 </select>
60 65 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/dao/content/ContentCategoriesMapper.xml View file @ 203aa68
... ... @@ -31,8 +31,12 @@
31 31 <if test="name!=null">
32 32 and `NAME` = #{name}
33 33 </if>
  34 + <if test="name==null">
  35 + AND LEVEL = 0
  36 + </if>
  37 + AND IFDEL = 0
34 38 </where>
35   -
  39 + order by CREATE_TIME DESC
36 40 </select>
37 41  
38 42 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/dao/content/ContentMessageTemplateMapper.xml View file @ 203aa68
... ... @@ -38,8 +38,10 @@
38 38 <if test="tagId!=null">
39 39 and t.TAGS_IDS LIKE concat("%,",#{tagId},",%")
40 40 </if>
  41 + AND m.IFDEL = 0
41 42 </where>
42 43 GROUP BY m.ID
  44 + order by CREATE_TIME DESC
43 45 </select>
44 46  
45 47 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/dao/content/ContentTagsMapper.xml View file @ 203aa68
... ... @@ -30,7 +30,12 @@
30 30 <if test="name !=null">
31 31 AND `TAG_NAME` LIKE concat('%',#{name},"%")
32 32 </if>
  33 +
  34 + <if test="name == null">
  35 + AND LEVEL = 0
  36 + </if>
33 37 AND IFDEL = 0
  38 + order by CREATE_TIME DESC ;
34 39 </where>
35 40 </select>
36 41 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/dao/sys/SyncDataBasicMapper.java View file @ 203aa68
... ... @@ -32,5 +32,7 @@
32 32 */
33 33 public Integer updateBatchByIds(List<Serializable> ids);
34 34  
  35 + public Integer errorCountAdd(Serializable id);
  36 +
35 37 }
parent/base.common/src/main/java/com/lyms/base/common/dao/sys/SyncDataBasicMapper.xml View file @ 203aa68
... ... @@ -9,11 +9,12 @@
9 9 <result column="DATA" property="data" />
10 10 <result column="CREATE_TIME" property="createTime" />
11 11 <result column="IFSUC" property="ifsuc" />
  12 + <result column="ERROR_COUNT" property="errorCount" />
12 13 </resultMap>
13 14  
14 15 <!-- 通用查询结果列 -->
15 16 <sql id="Base_Column_List">
16   - ID AS id, DATA AS data, CREATE_TIME AS createTime, IFSUC AS ifsuc
  17 + ID AS id, DATA AS data, CREATE_TIME AS createTime, IFSUC AS ifsuc,ERROR_COUNT AS errorCount
17 18 </sql>
18 19  
19 20 <sql id="Base_table">
20 21  
... ... @@ -22,11 +23,17 @@
22 23  
23 24  
24 25 <update id="updateBatchByIds" parameterType="list">
25   - update from <include refid="Base_table" /> as sb set sb.ifsuc=1
  26 + update <include refid="Base_table" /> as sb set sb.ifsuc=1
26 27 where sb.id in
27 28 <foreach item="item" collection="ids" open="(" close=")" separator=",">
28 29 #{item}
29 30 </foreach>
  31 + </update>
  32 +
  33 +
  34 + <update id="errorCountAdd">
  35 + update SYNC_DATA_BASIC set ERROR_COUNT= ERROR_COUNT + 1
  36 + where id = #{id}
30 37 </update>
31 38  
32 39 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/entity/conf/DiagnoseMaps.java View file @ 203aa68
... ... @@ -31,8 +31,8 @@
31 31 /**
32 32 * 诊断项资源ID
33 33 */
34   - @TableField(value="SOURCE_ID")
35   - private String sourceId;
  34 + @TableField(value="CONF_ID")
  35 + private String confId;
36 36  
37 37  
38 38 public String getId() {
39 39  
... ... @@ -51,13 +51,14 @@
51 51 this.diagnoseId = diagnoseId;
52 52 }
53 53  
54   - public String getSourceId() {
55   - return sourceId;
56   - }
  54 + public String getConfId() {
  55 + return confId;
  56 + }
57 57  
58   - public void setSourceId(String sourceId) {
59   - this.sourceId = sourceId;
60   - }
  58 + public void setConfId(String confId) {
  59 + this.confId = confId;
  60 + }
  61 +
61 62  
62 63 }
parent/base.common/src/main/java/com/lyms/base/common/entity/conf/HighriskMaps.java View file @ 203aa68
... ... @@ -31,8 +31,8 @@
31 31 /**
32 32 * 高危项定义资源表ID
33 33 */
34   - @TableField(value="SOURCE_ID")
35   - private String sourceId;
  34 + @TableField(value="CONF_ID")
  35 + private String confId;
36 36  
37 37 @TableField(value = "NAME")
38 38 private String name;
39 39  
... ... @@ -79,13 +79,13 @@
79 79 this.diagnoseId = diagnoseId;
80 80 }
81 81  
82   - public String getSourceId() {
83   - return sourceId;
84   - }
  82 + public String getConfId() {
  83 + return confId;
  84 + }
85 85  
86   - public void setSourceId(String sourceId) {
87   - this.sourceId = sourceId;
88   - }
  86 + public void setConfId(String confId) {
  87 + this.confId = confId;
  88 + }
89 89  
90 90 public String getName() {
91 91 return name;
parent/base.common/src/main/java/com/lyms/base/common/entity/content/ContentArticles.java View file @ 203aa68
... ... @@ -170,7 +170,7 @@
170 170 }
171 171 }
172 172  
173   - public String getCategoryName() {
  173 + public String getCategoryName() {
174 174 return categoryName;
175 175 }
176 176  
parent/base.common/src/main/java/com/lyms/base/common/entity/sys/SyncDataBasic.java View file @ 203aa68
... ... @@ -42,7 +42,13 @@
42 42 */
43 43 @TableField(value = "IFSUC")
44 44 private Integer ifsuc;
45   -
  45 +
  46 +
  47 + /**
  48 + * 错误次数
  49 + */
  50 + @TableField(value = "ERROR_COUNT")
  51 + private Integer errorCount;
46 52 public String getId() {
47 53 return id;
48 54 }
... ... @@ -74,6 +80,14 @@
74 80 public void setIfsuc(Integer ifsuc) {
75 81 this.ifsuc = ifsuc;
76 82 }
  83 +
  84 + public Integer getErrorCount() {
  85 + return errorCount;
  86 + }
  87 +
  88 + public void setErrorCount(Integer errorCount) {
  89 + this.errorCount = errorCount;
  90 + }
77 91  
78 92 }
parent/base.common/src/main/java/com/lyms/base/common/service/content/ContentArticlesService.java View file @ 203aa68
1 1 package com.lyms.base.common.service.content;
2 2  
3   -import java.io.Serializable;
4   -import java.util.List;
5   -
6 3 import com.baomidou.mybatisplus.plugins.Page;
7 4 import com.lyms.base.common.entity.content.ContentArticles;
8   -import com.lyms.base.common.entity.content.ContentArticlesTags;
9 5 import com.lyms.base.common.vo.content.AricleSearchDTO;
10 6 import com.lyms.web.service.BaseService;
11 7  
  8 +import java.io.Serializable;
  9 +
12 10 /**
13 11 * <p>
14 12 * 服务类
... ... @@ -25,8 +23,6 @@
25 23 * <li>@return 大于0修改成功,否则为失败
26 24 */
27 25 public Integer deleteLogicById(Serializable id);
28   -
29   - public boolean create(ContentArticles conArti, List<ContentArticlesTags> tagsList);
30 26  
31 27 Page<ContentArticles> getArticlesPage(Page<ContentArticles> page, AricleSearchDTO aricleDto);
32 28 }
parent/base.common/src/main/java/com/lyms/base/common/service/content/impl/ContentArticlesServiceImpl.java View file @ 203aa68
... ... @@ -5,15 +5,13 @@
5 5 import com.lyms.base.common.dao.content.ContentArticlesMapper;
6 6 import com.lyms.base.common.dao.content.ContentArticlesTagsMapper;
7 7 import com.lyms.base.common.entity.content.ContentArticles;
8   -import com.lyms.base.common.entity.content.ContentArticlesTags;
9 8 import com.lyms.base.common.service.content.ContentArticlesService;
10 9 import com.lyms.base.common.vo.content.AricleSearchDTO;
  10 +import com.lyms.util.StrUtils;
11 11 import org.springframework.beans.factory.annotation.Autowired;
12 12 import org.springframework.stereotype.Service;
13   -import org.springframework.transaction.annotation.Transactional;
14 13  
15 14 import java.io.Serializable;
16   -import java.util.Date;
17 15 import java.util.List;
18 16  
19 17 /**
20 18  
21 19  
22 20  
... ... @@ -26,31 +24,29 @@
26 24 */
27 25 @Service
28 26 public class ContentArticlesServiceImpl extends ServiceImpl<ContentArticlesMapper, ContentArticles> implements ContentArticlesService {
29   - @Autowired
30   - private ContentArticlesTagsMapper articlesTagsDao;
  27 + @Autowired
  28 + private ContentArticlesTagsMapper articlesTagsDao;
31 29  
32   - public Integer deleteLogicById(Serializable id){
33   - return baseMapper.deleteLogicById(id);
34   - }
  30 + public Integer deleteLogicById(Serializable id) {
  31 + return baseMapper.deleteLogicById(id);
  32 + }
35 33  
36   - @Transactional
37   - @Override
38   - public boolean create(ContentArticles conArti,List<ContentArticlesTags> tagsList) {
39   - if (conArti == null)
40   - return false;
41   - conArti.setCreateTime(new Date());
42   - Integer tag = baseMapper.insert(conArti);
43   - for(ContentArticlesTags c : tagsList){
44   - articlesTagsDao.insert(c);
45   - }
46   - return tag != null && tag > 0;
47   - }
48 34  
49   - @Override
50   - public Page<ContentArticles> getArticlesPage(Page<ContentArticles> page, AricleSearchDTO aricleDto) {
51   - List<ContentArticles> lists = baseMapper.getArticlesPage(page, aricleDto);
52   - page.setRecords(lists);
53   - return page;
54   - }
  35 + @Override
  36 + public Page<ContentArticles> getArticlesPage(Page<ContentArticles> page, AricleSearchDTO aricleDto) {
  37 + List<ContentArticles> lists = baseMapper.getArticlesPage(page, aricleDto);
  38 + for (ContentArticles ct : lists) {
  39 + String[] contentTags = ct.getTagIds()==null?new String[0]:ct.getTagIds().split(",");
  40 + String tagName = ContentTagsServiceImpl.tagIdToTagName(contentTags);
  41 + if (StrUtils.isNotEmpty(tagName)) {
  42 + ct.setTagIds(tagName.substring(0, tagName.length() - 1));
  43 + } else {
  44 + ct.setTagIds("");
  45 + }
  46 + System.out.println("标签名:--------------->" + ct.getTagIds());
  47 + }
  48 + page.setRecords(lists);
  49 + return page;
  50 + }
55 51 }
parent/base.common/src/main/java/com/lyms/base/common/service/content/impl/ContentTagsServiceImpl.java View file @ 203aa68
1 1 package com.lyms.base.common.service.content.impl;
2 2  
  3 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  4 +import com.baomidou.mybatisplus.mapper.Wrapper;
3 5 import com.baomidou.mybatisplus.plugins.Page;
4 6 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
5 7 import com.lyms.base.common.dao.content.ContentTagsMapper;
6 8  
... ... @@ -32,10 +34,30 @@
32 34  
33 35 @PostConstruct
34 36 public void initData(){
35   - List<ContentTags> tagsList = baseMapper.getTags();
  37 + Wrapper wrapper = new EntityWrapper();
  38 + wrapper.and("IFDEL=0");
  39 + wrapper.and("ENABLE=0");
  40 + List<ContentTags> tagsList = baseMapper.selectList(wrapper);
36 41 for(ContentTags conTag:tagsList){
37 42 tagsMap.put(conTag.getId(),conTag.getTagName());
38 43 }
  44 + }
  45 +
  46 + public static String tagIdToTagName(String [] tagIds){
  47 + if(tagIds.length==0){
  48 + return "";
  49 + }
  50 + StringBuffer tagsBf = new StringBuffer();
  51 + for (String s : tagIds) {
  52 + if (StrUtils.isEmpty(s)) {
  53 + continue;
  54 + }
  55 + String tagName = getValue(s);
  56 + if (StrUtils.isNotEmpty(tagName)) {
  57 + tagsBf.append(tagName + ",");
  58 + }
  59 + }
  60 + return tagsBf.toString();
39 61 }
40 62  
41 63 public static String getValue(String key){
parent/base.common/src/main/java/com/lyms/base/common/service/sys/SyncDataBasicService.java View file @ 203aa68
... ... @@ -59,6 +59,18 @@
59 59 * <li>修改时间:
60 60 */
61 61 public boolean addSyncData(SyncParamEnum syncParamConf,Object ...dataObjects);
  62 +
  63 +
  64 + /**
  65 + * <li>@Description:错误次数添加
  66 + * <li>@param id
  67 + * <li>@return
  68 + * <li>创建人:方承
  69 + * <li>创建时间:2017年5月6日
  70 + * <li>修改人:
  71 + * <li>修改时间:
  72 + */
  73 + public boolean errorCountAdd(Serializable id);
62 74  
63 75 }
parent/base.common/src/main/java/com/lyms/base/common/service/sys/impl/SyncDataBasicServiceImpl.java View file @ 203aa68
... ... @@ -10,6 +10,7 @@
10 10  
11 11 import com.baomidou.mybatisplus.mapper.EntityWrapper;
12 12 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
  13 +import com.baomidou.mybatisplus.toolkit.SqlUtils;
13 14 import com.lyms.base.common.dao.sys.SyncDataBasicMapper;
14 15 import com.lyms.base.common.entity.sys.SyncDataBasic;
15 16 import com.lyms.base.common.enums.SyncParamEnum;
... ... @@ -91,6 +92,12 @@
91 92  
92 93 entity.setData(cdata.toJsonString());
93 94 Integer tag = baseMapper.insert(entity);
  95 + return tag >= 1 ? true : false;
  96 + }
  97 +
  98 + @Override
  99 + public boolean errorCountAdd(Serializable id) {
  100 + Integer tag = baseMapper.errorCountAdd(id);
94 101 return tag >= 1 ? true : false;
95 102 }
96 103  
parent/base.common/src/main/java/com/lyms/base/common/service/user/impl/UsersServiceImpl.java View file @ 203aa68
... ... @@ -87,6 +87,7 @@
87 87 this.initPwd(user);
88 88  
89 89 Integer tag = userMapper.insert(user);
  90 +
90 91 if(StrUtils.isNotEmpty(user.getDataOrgIds())){
91 92 String[] dataPermissionArray = user.getDataOrgIds().split(",");
92 93 if (dataPermissionArray != null && dataPermissionArray.length > 0) {
parent/base.common/src/main/java/com/lyms/base/common/vo/content/AricleSearchDTO.java View file @ 203aa68
... ... @@ -15,6 +15,10 @@
15 15 */
16 16 private Integer type;
17 17 /**
  18 + * 状态
  19 + */
  20 + private Integer status;
  21 + /**
18 22 * 标签id
19 23 */
20 24 private String tagId;
... ... @@ -22,6 +26,14 @@
22 26 * 标题
23 27 */
24 28 private String title;
  29 +
  30 + public Integer getStatus() {
  31 + return status;
  32 + }
  33 +
  34 + public void setStatus(Integer status) {
  35 + this.status = status;
  36 + }
25 37  
26 38 public Integer getColumnId() {
27 39 return columnId;
parent/base.common/src/main/java/com/lyms/base/common/vo/content/ContentArticlesDTO.java View file @ 203aa68
1 1 package com.lyms.base.common.vo.content;
2 2  
3 3 import com.baomidou.mybatisplus.annotations.TableField;
  4 +import org.springframework.web.util.HtmlUtils;
4 5  
5 6 import java.util.ArrayList;
6 7 import java.util.List;
7 8  
8 9 /**
9   - * @auther HuJiaqi
  10 + * @auther YangFei
10 11 * @createTime 2017年04月25日 17时24分
11 12 * @discription
12 13 */
13 14 public class ContentArticlesDTO {
14 15 /**
  16 + * 主键ID
  17 + */
  18 + private String id;
  19 + /**
15 20 * 栏目ID
16 21 */
17 22 private String categoryId;
... ... @@ -49,6 +54,14 @@
49 54 */
50 55 private String link;
51 56  
  57 + public String getId() {
  58 + return id;
  59 + }
  60 +
  61 + public void setId(String id) {
  62 + this.id = id;
  63 + }
  64 +
52 65 private List<String> tags = new ArrayList<>();
53 66  
54 67 public String getCategoryId() {
... ... @@ -108,7 +121,7 @@
108 121 }
109 122  
110 123 public String getContent() {
111   - return content;
  124 + return HtmlUtils.htmlUnescape(content);
112 125 }
113 126  
114 127 public void setContent(String content) {
parent/base.common/src/main/java/com/lyms/base/common/vo/content/ContentCategoriesDTO.java View file @ 203aa68
1 1 package com.lyms.base.common.vo.content;
2 2  
3   -import com.baomidou.mybatisplus.annotations.TableField;
  3 +import org.springframework.web.util.HtmlUtils;
4 4  
5 5 /**
6 6 * @auther yangfei
7 7  
8 8  
... ... @@ -9,14 +9,16 @@
9 9 */
10 10 public class ContentCategoriesDTO {
11 11 /**
  12 + * 主键ID
  13 + */
  14 + private String id;
  15 + /**
12 16 * 栏目名称
13 17 */
14   - @TableField(value="NAME")
15 18 private String name;
16 19 /**
17 20 * 栏目图标
18 21 */
19   - @TableField(value="ICON")
20 22 private String icon;
21 23 /**
22 24 * 栏目简介
... ... @@ -31,6 +33,14 @@
31 33 */
32 34 private String perent;
33 35  
  36 + public String getId() {
  37 + return id;
  38 + }
  39 +
  40 + public void setId(String id) {
  41 + this.id = id;
  42 + }
  43 +
34 44 public String getName() {
35 45 return name;
36 46 }
... ... @@ -48,7 +58,7 @@
48 58 }
49 59  
50 60 public String getDescription() {
51   - return description;
  61 + return HtmlUtils.htmlUnescape(description);
52 62 }
53 63  
54 64 public void setDescription(String description) {
parent/base.common/src/main/java/com/lyms/base/common/vo/content/ContentMessageTemplateDTO.java View file @ 203aa68
1 1 package com.lyms.base.common.vo.content;
2 2  
3   -import com.baomidou.mybatisplus.annotations.TableField;
4   -
5 3 public class ContentMessageTemplateDTO {
6 4 /**
7 5 * 主键ID
8 6  
... ... @@ -38,12 +36,10 @@
38 36 /**
39 37 * 是否删除
40 38 */
41   - @TableField(value="IFDEL")
42 39 private Integer ifdel;
43 40 /**
44 41 * 是否启用
45 42 */
46   - @TableField(value="ENABLE")
47 43 private Integer enable;
48 44  
49 45 public Integer getIfdel() {
parent/base.common/src/main/java/com/lyms/base/common/vo/content/ContentTagsDTO.java View file @ 203aa68
... ... @@ -6,6 +6,7 @@
6 6 * @discription
7 7 */
8 8 public class ContentTagsDTO {
  9 + private String id;
9 10 /**
10 11 * 标签名称
11 12 */
... ... @@ -18,6 +19,27 @@
18 19 * 父标签ID
19 20 */
20 21 private String perentId;
  22 +
  23 + /**
  24 + * 标签等级
  25 + */
  26 + private int level;
  27 +
  28 + public String getId() {
  29 + return id;
  30 + }
  31 +
  32 + public void setId(String id) {
  33 + this.id = id;
  34 + }
  35 +
  36 + public int getLevel() {
  37 + return level;
  38 + }
  39 +
  40 + public void setLevel(int level) {
  41 + this.level = level;
  42 + }
21 43  
22 44 public String getTagName() {
23 45 return tagName;
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentArticlesController.java View file @ 203aa68
... ... @@ -4,22 +4,22 @@
4 4 import com.lyms.base.common.entity.content.ContentArticles;
5 5 import com.lyms.base.common.entity.content.ContentArticlesTags;
6 6 import com.lyms.base.common.service.content.ContentArticlesService;
7   -import com.lyms.base.common.vo.content.ContentArticlesDTO;
  7 +import com.lyms.base.common.service.content.ContentArticlesTagsService;
8 8 import com.lyms.base.common.vo.content.AricleSearchDTO;
  9 +import com.lyms.base.common.vo.content.ContentArticlesDTO;
9 10 import com.lyms.constants.OperationName;
10 11 import com.lyms.util.StrUtils;
11 12 import com.lyms.web.bean.AjaxResult;
12 13 import com.lyms.web.controller.BaseController;
13 14 import org.springframework.beans.factory.annotation.Autowired;
14 15 import org.springframework.stereotype.Controller;
  16 +import org.springframework.ui.Model;
  17 +import org.springframework.web.bind.annotation.PathVariable;
15 18 import org.springframework.web.bind.annotation.RequestMapping;
16 19 import org.springframework.web.bind.annotation.RequestMethod;
17 20 import org.springframework.web.bind.annotation.ResponseBody;
18 21  
19   -import java.util.ArrayList;
20   -import java.util.Date;
21   -import java.util.List;
22   -import java.util.Map;
  22 +import java.util.*;
23 23  
24 24 /**
25 25 * <p>
26 26  
27 27  
28 28  
... ... @@ -34,18 +34,77 @@
34 34 public class ContentArticlesController extends BaseController {
35 35 @Autowired
36 36 private ContentArticlesService contentArticlesService;
  37 + @Autowired
  38 + private ContentArticlesTagsService contentArticTagService;
37 39  
38 40 /**
39 41 * 跳转到新增页面
40 42 *
41 43 * @return
42 44 */
43   - @RequestMapping(value = "/toEdit", method = { RequestMethod.GET })
44   - public String toEdit() {
  45 + @RequestMapping(value = "/{id}/toEdit", method = { RequestMethod.GET })
  46 + public String toEdit(@PathVariable String id, Model model) {
  47 + model.addAttribute("id", id);
  48 + if(StrUtils.isNotEmpty(id)){
  49 + ContentArticles conArtic = contentArticlesService.selectById(id);
  50 + if(conArtic!=null){
  51 + model.addAttribute("conArtic",conArtic);
  52 + Map<String,Object> map = new HashMap();
  53 + map.put("ARTICLES_ID",conArtic.getId());
  54 + List<ContentArticlesTags> artiTags = contentArticTagService.selectByMap(map);
  55 + model.addAttribute("tags", artiTags);
  56 + }
  57 + }
45 58 return "/articles/articles_edit";
46 59 }
47 60  
  61 +
48 62 /**
  63 + * 审核图文:发布、上线、下线
  64 + * @return
  65 + */
  66 + @ResponseBody
  67 + @RequestMapping(value = "/audit", method = { RequestMethod.POST })
  68 + public AjaxResult audit(String id,int type,String reason,AjaxResult ajaxResult) {
  69 + String operationName = "操作";
  70 + if(StrUtils.isNotEmpty(id)){
  71 + ContentArticles articles = contentArticlesService.selectById(id);
  72 + if(articles!=null){
  73 + if(type == 1){//审核
  74 + if(articles.getStatus() == 1){//审核操作:当前状态是待审核状态
  75 + articles.setStatus(2);
  76 + articles.setAuditorTime(new Date());
  77 + articles.setReason(reason);
  78 + operationName = "审核";
  79 + }else{
  80 + return handleAjaxResult(ajaxResult, false, "当前状态不是待审核状态导致");
  81 + }
  82 + }else if(type == 2){//发布
  83 + if(articles.getStatus() == 2 ||articles.getStatus() == 4){//发布操作::当前状态是审核通过状态或已下线状态
  84 + articles.setStatus(3);
  85 + operationName = "发布";
  86 + }else{
  87 + return handleAjaxResult(ajaxResult, false, "当前状态不是审核通过状态导致");
  88 + }
  89 + }else if(type == 3){//下线操作:当前状态是已发布状态
  90 + if(articles.getStatus() == 3){
  91 + articles.setStatus(4);
  92 + operationName = "下线";
  93 + }else{
  94 + return handleAjaxResult(ajaxResult, false, "当前状态不是发布状态导致");
  95 + }
  96 + }else{
  97 + return handleAjaxResult(ajaxResult, false, "未知操作");
  98 + }
  99 + boolean tag = contentArticlesService.updateById(articles);
  100 + return handleAjaxResult(ajaxResult, tag, operationName);
  101 + }
  102 + }
  103 + return handleAjaxResult(ajaxResult, false, operationName);
  104 + }
  105 +
  106 +
  107 + /**
49 108 * 获取图文内容列表
50 109 * @return
51 110 */
52 111  
... ... @@ -56,7 +115,20 @@
56 115 page = contentArticlesService.getArticlesPage(page,aricleDto);
57 116 return toGridData(page);
58 117 }
  118 + @RequestMapping(value = "/{ids}/delete", method = { RequestMethod.GET, RequestMethod.POST })
  119 + @ResponseBody
  120 + public AjaxResult delete(@PathVariable String ids, AjaxResult ajaxResult) {
  121 + List<String> idList = Arrays.asList(ids.split(","));
  122 + List<ContentArticles> tags = contentArticlesService.selectBatchIds(idList);
  123 + for(ContentArticles t : tags){
  124 + t.setIfdel(1);
  125 + t.setModifyTime(new Date());
  126 + }
  127 + boolean tag = contentArticlesService.updateBatchById(tags);
59 128  
  129 + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE);
  130 + }
  131 +
60 132 /**
61 133 * 跳转到列表页面
62 134 *
63 135  
... ... @@ -70,15 +142,20 @@
70 142 @ResponseBody
71 143 @RequestMapping(value = "/create", method = { RequestMethod.POST })
72 144 public AjaxResult create(ContentArticlesDTO cav, AjaxResult ajaxResult) {
73   -
74   - ContentArticles conArti = new ContentArticles();
75   - conArti.setStatus(1);//初始 待审核状态
76   - conArti.setCreateTime(new Date());
77   -
78   - conArti.setId(StrUtils.uuid());
  145 + ContentArticles conArti = null;
  146 + if(StrUtils.isNotEmpty(cav.getId())&&!cav.getId().equals("0")) {//更新
  147 + conArti = contentArticlesService.selectById(cav.getId());
  148 + conArti.setModifyTime(new Date());
  149 + }else{
  150 + conArti = new ContentArticles();
  151 + conArti.setStatus(1);//初始 待审核状态
  152 + conArti.setEnable(0);
  153 + conArti.setIfdel(0);
  154 + conArti.setCreateTime(new Date());
  155 + conArti.setId(StrUtils.uuid());
  156 + }
79 157 conArti.setCategoryId(cav.getCategoryId());
80 158 conArti.setType(cav.getType());
81   - conArti.setWeight(cav.getWeight());
82 159 conArti.setImage(cav.getImage());
83 160 conArti.setTitle(cav.getTitle());
84 161 conArti.setContentType(cav.getContentType());
... ... @@ -88,7 +165,6 @@
88 165 }else{//专题内容
89 166 conArti.setLink(cav.getLink());
90 167 }
91   -
92 168 List<ContentArticlesTags> tagsList = new ArrayList<>();
93 169 for (String tags:cav.getTags()){
94 170 if(StrUtils.isEmpty(tags)){continue;}
95 171  
... ... @@ -98,9 +174,21 @@
98 174 tag.setTagsIds(tags);
99 175 tagsList.add(tag);
100 176 }
101   - boolean tag = contentArticlesService.create(conArti,tagsList);
102   - return handleAjaxResult(ajaxResult, tag, OperationName.CREATE);
  177 +
  178 + Map<String, Object> map = new HashMap<>();
  179 + map.put("ARTICLES_ID",conArti.getId());
  180 + //先删除标签关系
  181 + contentArticTagService.deleteByMap(map);
  182 + //新增或修改图文信息
  183 + boolean tag = contentArticlesService.insertOrUpdate(conArti);
  184 + //批量新增图文对应的标签
  185 + boolean bi = contentArticTagService.insertBatch(tagsList);
  186 +
  187 + if(StrUtils.isNotEmpty(cav.getId())&&!cav.getId().equals("0")) {//更新
  188 + return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE);
  189 + }else{
  190 + return handleAjaxResult(ajaxResult, tag&&bi, OperationName.CREATE);
  191 + }
103 192 }
104   -
105 193 }
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentCategoriesController.java View file @ 203aa68
1 1 package com.lyms.cm.controller.content;
2 2  
  3 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  4 +import com.baomidou.mybatisplus.mapper.Wrapper;
3 5 import com.baomidou.mybatisplus.plugins.Page;
4 6 import com.lyms.base.common.entity.content.ContentCategories;
5 7 import com.lyms.base.common.service.content.ContentCategoriesService;
6 8  
... ... @@ -10,12 +12,11 @@
10 12 import com.lyms.web.controller.BaseController;
11 13 import org.springframework.beans.factory.annotation.Autowired;
12 14 import org.springframework.stereotype.Controller;
13   -import org.springframework.web.bind.annotation.RequestMapping;
14   -import org.springframework.web.bind.annotation.RequestMethod;
15   -import org.springframework.web.bind.annotation.RequestParam;
16   -import org.springframework.web.bind.annotation.ResponseBody;
  15 +import org.springframework.ui.Model;
  16 +import org.springframework.web.bind.annotation.*;
17 17  
18 18 import java.util.Date;
  19 +import java.util.HashMap;
19 20 import java.util.List;
20 21 import java.util.Map;
21 22  
22 23  
... ... @@ -39,10 +40,26 @@
39 40 @ResponseBody
40 41 @RequestMapping(value = "/selelist", method = { RequestMethod.GET, RequestMethod.POST })
41 42 public AjaxResult selelist() {
42   - List<ContentCategories> lists = categorService.selectList(null);
  43 + Wrapper wrapper = new EntityWrapper();
  44 + wrapper.and("IFDEL=0");
  45 + wrapper.and("ENABLE=0");
  46 + List<ContentCategories> lists = categorService.selectList(wrapper);
43 47 return AjaxResult.returnSuccess(lists);
44 48 }
45 49  
  50 + @RequestMapping(value = "/{id}/delete", method = { RequestMethod.GET, RequestMethod.POST })
  51 + @ResponseBody
  52 + public AjaxResult delete(@PathVariable String id, AjaxResult ajaxResult) {
  53 + ContentCategories tags = categorService.selectById(id);
  54 + tags.setIfdel(1);
  55 + tags.setModifyTime(new Date());
  56 + Wrapper<ContentCategories> wrapper = new EntityWrapper<>();
  57 + wrapper.where("id={0}",id);
  58 + boolean tag = categorService.update(tags,wrapper);
  59 +
  60 + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE);
  61 + }
  62 +
46 63 /**
47 64 * 获取栏目列表
48 65 * @param name 栏目名称
49 66  
... ... @@ -50,8 +67,18 @@
50 67 */
51 68 @ResponseBody
52 69 @RequestMapping(value = "/list", method = { RequestMethod.GET, RequestMethod.POST })
53   - public Map<String, Object> list(@RequestParam(defaultValue= "",value="name",required = false) String name) {
  70 + public Map<String, Object> list(@RequestParam(defaultValue= "",value="name",required = false) String name,String perId) {
54 71 Page<ContentCategories> page = getPage();
  72 + //根据父Id查询下一级的数据
  73 + if(StrUtils.isNotEmpty(perId)){
  74 + Wrapper<ContentCategories> wrapper = new EntityWrapper<>();
  75 + wrapper.where("PERENT={0}",perId);
  76 + List<ContentCategories> contentTags = categorService.selectList(wrapper);
  77 + Map<String, Object> gridData = new HashMap<String, Object>();
  78 + gridData.put("rows", contentTags);
  79 + return gridData;
  80 + }
  81 +
55 82 if(StrUtils.isNotEmpty(name)){
56 83 page = categorService.getCategories(page,name);
57 84 }else{
... ... @@ -65,8 +92,16 @@
65 92 *
66 93 * @return
67 94 */
68   - @RequestMapping(value = "/toEdit", method = { RequestMethod.GET })
69   - public String toEdit() {
  95 + @RequestMapping(value = "/{id}/toEdit", method = { RequestMethod.GET })
  96 + public String toEdit(@PathVariable String id, String perId, String perCgName, String level, Model model) {
  97 + model.addAttribute("id", id);
  98 + model.addAttribute("perId", perId);
  99 + model.addAttribute("perCgName", perCgName);
  100 + model.addAttribute("level", level);
  101 + if(StrUtils.isNotEmpty(id)){
  102 + ContentCategories conCate = categorService.selectById(id);
  103 + model.addAttribute("conCate",conCate);
  104 + }
70 105 return "/categories/categonies_edit";
71 106 }
72 107  
... ... @@ -84,16 +119,29 @@
84 119 @ResponseBody
85 120 @RequestMapping(value = "/create", method = { RequestMethod.POST })
86 121 public AjaxResult create(ContentCategoriesDTO ccd, AjaxResult ajaxResult) {
87   - ContentCategories ccs = new ContentCategories();
88   - ccs.setId(StrUtils.uuid());
89   - ccs.setCreateTime(new Date());
90   -
91   - ccs.setName(ccd.getName());
92   - ccs.setIcon(ccd.getIcon());
93   - ccs.setDescription(ccd.getDescription());
94   - ccs.setPerent(ccd.getPerent());
95   -
96   - boolean tag = categorService.insert(ccs);
  122 + ContentCategories cts = null;
  123 + if(StrUtils.isNotEmpty(ccd.getId())&&!ccd.getId().equals("0")){//更新
  124 + cts = categorService.selectById(ccd.getId());
  125 + if(cts!=null){
  126 + cts.setModifyTime(new Date());
  127 + }
  128 + }else {//新增
  129 + cts = new ContentCategories();
  130 + cts.setId(StrUtils.uuid());
  131 + cts.setCreateTime(new Date());
  132 + cts.setPerent(ccd.getPerent());
  133 + cts.setIfdel(0);
  134 + cts.setEnable(0);
  135 + if(StrUtils.isNotEmpty(ccd.getPerent())){//子栏目等级+1
  136 + cts.setLevel(ccd.getLevel()+1);
  137 + }else{//父栏目
  138 + cts.setLevel(0);
  139 + }
  140 + }
  141 + cts.setName(ccd.getName());
  142 + cts.setIcon(ccd.getIcon());
  143 + cts.setDescription(ccd.getDescription());
  144 + boolean tag = categorService.insertOrUpdate(cts);
97 145 return handleAjaxResult(ajaxResult, tag, OperationName.CREATE);
98 146 }
99 147 }
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentMessageTemplateController.java View file @ 203aa68
1 1 package com.lyms.cm.controller.content;
2 2  
  3 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  4 +import com.baomidou.mybatisplus.mapper.Wrapper;
3 5 import com.baomidou.mybatisplus.plugins.Page;
4 6 import com.lyms.base.common.entity.content.ContentMessageTemplate;
5 7 import com.lyms.base.common.entity.content.ContentTemplateMessageTags;
... ... @@ -18,9 +20,7 @@
18 20 import org.springframework.ui.Model;
19 21 import org.springframework.web.bind.annotation.*;
20 22  
21   -import java.util.Date;
22   -import java.util.List;
23   -import java.util.Map;
  23 +import java.util.*;
24 24  
25 25 /**
26 26 * <p>
27 27  
28 28  
29 29  
30 30  
31 31  
32 32  
33 33  
34 34  
35 35  
36 36  
37 37  
38 38  
39 39  
40 40  
41 41  
42 42  
43 43  
44 44  
45 45  
... ... @@ -39,91 +39,133 @@
39 39 //模板信息标签
40 40 @Autowired
41 41 private ContentTemplateMessageTagsService messageTagsService;
  42 +
42 43 /**
43 44 * 跳转到列表页面
44 45 *
45 46 * @return
46 47 */
47   - @RequestMapping(value = "/toList", method = { RequestMethod.GET })
  48 + @RequestMapping(value = "/toList", method = {RequestMethod.GET})
48 49 public String toList() {
49   - return "/content/template_list";
  50 + return "/content/template_list";
50 51 }
51   -
  52 +
  53 +
  54 + @RequestMapping(value = "/{ids}/delete", method = {RequestMethod.GET, RequestMethod.POST})
  55 + @ResponseBody
  56 + public AjaxResult delete(@PathVariable String ids, AjaxResult ajaxResult) {
  57 + Wrapper<ContentMessageTemplate> wrapper = new EntityWrapper<>();
  58 + //wrapper.where("id in ({0})",ids);
  59 + wrapper.in("id", ids);
  60 + List<ContentMessageTemplate> template = messageTemplateService.selectList(wrapper);
  61 + for (ContentMessageTemplate temp : template) {
  62 + temp.setIfdel(1);
  63 + temp.setModifyTime(new Date());
  64 + }
  65 + boolean tag = messageTemplateService.updateBatchById(template);
  66 +
  67 + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE);
  68 + }
  69 +
52 70 /**
53   - * 跳转到编辑页面
54   - *
55   - * @return
56   - */
57   - @RequestMapping(value = { "/{verId}/toEdit" }, method = RequestMethod.GET)
58   - public String toEdit(@PathVariable String verId,String id,String vName, Model model) {
59   - model.addAttribute("verId", verId);
60   - model.addAttribute("vName", vName);
61   - model.addAttribute("id", id);
62   - if(StrUtils.isNotEmpty(id)){//查询
  71 + * 跳转到编辑页面
  72 + *
  73 + * @return
  74 + */
  75 + @RequestMapping(value = {"/{verId}/toEdit"}, method = RequestMethod.GET)
  76 + public String toEdit(@PathVariable String verId, String id, String vName, Model model) {
  77 + model.addAttribute("verId", verId);
  78 + model.addAttribute("vName", vName);
  79 + model.addAttribute("id", id);
  80 + if (StrUtils.isNotEmpty(id)) {//查询
63 81 ContentMessageTemplate tempInfo = messageTemplateService.selectById(id);
64   - model.addAttribute("tempInfo",tempInfo);
  82 + model.addAttribute("tempInfo", tempInfo);
  83 + Map<String, Object> colMap = new HashMap<>();
  84 + colMap.put("MESSAGE_TEMPLATE", id);
  85 + List<ContentTemplateMessageTags> tagList = messageTagsService.selectByMap(colMap);
  86 + model.addAttribute("tags", tagList);
65 87 }
66 88 return "/content/template_edit";
67   - }
  89 + }
68 90  
69   - /**
70   - * 获取消息内容列表
71   - * @param msgTemp
72   - * @return
73   - */
  91 + /**
  92 + * 获取消息内容列表
  93 + *
  94 + * @param msgTemp
  95 + * @return
  96 + */
74 97 @ResponseBody
75   - @RequestMapping(value = "/list", method = { RequestMethod.GET, RequestMethod.POST })
  98 + @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
76 99 public Map<String, Object> list(MsgTempSerachDTO msgTemp) {
77   - Page<ContentMessageTemplateDTO> page = getPage();
78   - List<ContentMessageTemplateDTO> cmtdList = messageTemplateService.getContentMessageTemplate(page,msgTemp);
79   - for(ContentMessageTemplateDTO ct : cmtdList){
80   - StringBuffer tagsBf = new StringBuffer();
81   - String[] contentTags = ct.getContentTagIds().split(",");
82   - for(String s:contentTags){
83   - if(StrUtils.isEmpty(s)){
84   - continue;
  100 + if (StrUtils.isNotEmpty(msgTemp.getVerId())) {
  101 + Page<ContentMessageTemplateDTO> page = getPage();
  102 + //根据条件查询短信列表
  103 + List<ContentMessageTemplateDTO> cmtdList = messageTemplateService.getContentMessageTemplate(page, msgTemp);
  104 + for (ContentMessageTemplateDTO ct : cmtdList) {
  105 + String[] contentTags = ct.getContentTagIds().split(",");
  106 + String tagName = ContentTagsServiceImpl.tagIdToTagName(contentTags);
  107 + if (StrUtils.isNotEmpty(tagName.toString())) {
  108 + ct.setContentTagIds(tagName.substring(0, tagName.length() - 1).toString());
  109 + } else {
  110 + ct.setContentTagIds("");
85 111 }
86   - tagsBf.append(ContentTagsServiceImpl.getValue(s)+",");
87 112 }
88   - ct.setContentTagIds(tagsBf.substring(0,tagsBf.length()-1).toString());
89   - System.out.println("标签名:--------------->"+ct.getContentTagIds());
  113 + page.setRecords(cmtdList);
  114 + return toGridData(page);
  115 + }else{
  116 + return toGridData(getPage());
90 117 }
91   -
92   - page.setRecords(cmtdList);
93   - return toGridData(page);
94 118 }
95   -
96   - /**
  119 +
  120 + /**
97 121 * 新增消息模板信息
98 122 * <p>
99 123 * TODO
100   - *
  124 + *
101 125 * @return
102 126 */
103 127 @RequestMapping(value = "/create", method = RequestMethod.POST)
104 128 @ResponseBody
105 129 public AjaxResult create(@ModelAttribute InContentMessageTemplateDTO contentMessage, AjaxResult ajaxResult) {
106   - ContentMessageTemplate messTemp = new ContentMessageTemplate();
107   - messTemp.setId(StrUtils.uuid());
108   - messTemp.setEnable(0);
109   - messTemp.setIfdel(0);
110   - messTemp.setCreateTime(new Date());
111   - messTemp.setKeyCode(messTemp.getId());
112   - messTemp.setContent(contentMessage.getContent());
113   - messTemp.setRichTitle(contentMessage.getRichTitle());
114   - messTemp.setRichText(contentMessage.getRichText());
115   - messTemp.setTemplateVersionId(contentMessage.getTemplateVersionId());
  130 + ContentMessageTemplate messTemp = new ContentMessageTemplate();
  131 + String operationName = "操作";
  132 + if(StrUtils.isNotEmpty(contentMessage.getId())&&!contentMessage.getId().equals("0")){//更新
  133 + messTemp = messageTemplateService.selectById(contentMessage.getId());
  134 + if(messTemp!=null){
  135 + messTemp.setModifyTime(new Date());
  136 + }
  137 + operationName = "修改";
  138 +
  139 + Map<String, Object> map = new HashMap<>();
  140 + map.put("MESSAGE_TEMPLATE",messTemp.getId());
  141 + //先删除标签关系
  142 + messageTagsService.deleteByMap(map);
  143 + }else{
  144 + messTemp.setId(StrUtils.uuid());
  145 + messTemp.setEnable(0);
  146 + messTemp.setIfdel(0);
  147 + messTemp.setCreateTime(new Date());
  148 + messTemp.setKeyCode(messTemp.getId());
  149 + messTemp.setTemplateVersionId(contentMessage.getTemplateVersionId());
  150 + operationName = "新增";
  151 + }
  152 + messTemp.setContent(contentMessage.getContent());
  153 + messTemp.setRichTitle(contentMessage.getRichTitle());
  154 + messTemp.setRichText(contentMessage.getRichText());
116 155 messTemp.setIsRich(contentMessage.getIsRich());
117   - for(String tags : contentMessage.getContentTagIds()){
  156 +
  157 + List<ContentTemplateMessageTags> tempTags = new ArrayList<>();
  158 + for (String tags : contentMessage.getContentTagIds()) {
118 159 ContentTemplateMessageTags ctmt = new ContentTemplateMessageTags();
119 160 ctmt.setId(StrUtils.uuid());
120 161 ctmt.setMessageTemplate(messTemp.getId());
121 162 ctmt.setTagsIds(tags);
122   - messageTagsService.insert(ctmt);
  163 + tempTags.add(ctmt);
123 164 }
124   - boolean tag = messageTemplateService.insert(messTemp);
125   - return handleAjaxResult(ajaxResult, tag, OperationName.CREATE);
  165 + boolean tags = messageTagsService.insertBatch(tempTags);
  166 + boolean tag = messageTemplateService.insertOrUpdate(messTemp);
  167 + return handleAjaxResult(ajaxResult, tag&&tags, operationName);
126 168 }
127   -
  169 +
128 170 }
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentTagsController.java View file @ 203aa68
1 1 package com.lyms.cm.controller.content;
2 2  
  3 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  4 +import com.baomidou.mybatisplus.mapper.Wrapper;
3 5 import com.baomidou.mybatisplus.plugins.Page;
4 6 import com.lyms.base.common.entity.content.ContentTags;
5 7 import com.lyms.base.common.service.content.ContentTagsService;
6 8  
... ... @@ -11,12 +13,11 @@
11 13 import com.lyms.web.controller.BaseController;
12 14 import org.springframework.beans.factory.annotation.Autowired;
13 15 import org.springframework.stereotype.Controller;
14   -import org.springframework.web.bind.annotation.RequestMapping;
15   -import org.springframework.web.bind.annotation.RequestMethod;
16   -import org.springframework.web.bind.annotation.RequestParam;
17   -import org.springframework.web.bind.annotation.ResponseBody;
  16 +import org.springframework.ui.Model;
  17 +import org.springframework.web.bind.annotation.*;
18 18  
19 19 import java.util.Date;
  20 +import java.util.HashMap;
20 21 import java.util.List;
21 22 import java.util.Map;
22 23  
23 24  
... ... @@ -44,13 +45,34 @@
44 45 return "/tags/tags_list";
45 46 }
46 47  
  48 + @RequestMapping(value = "/{id}/delete", method = { RequestMethod.GET, RequestMethod.POST })
  49 + @ResponseBody
  50 + public AjaxResult delete(@PathVariable String id, AjaxResult ajaxResult) {
  51 + ContentTags tags = contentTagsService.selectById(id);
  52 + tags.setIfdel(1);
  53 + tags.setModifyTime(new Date());
  54 + Wrapper<ContentTags> wrapper = new EntityWrapper<>();
  55 + wrapper.where("id={0}",id);
  56 + boolean tag = contentTagsService.update(tags,wrapper);
  57 +
  58 + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE);
  59 + }
  60 +
47 61 /**
48 62 * 跳转到新增页面
49 63 *
50 64 * @return
51 65 */
52   - @RequestMapping(value = "/toEdit", method = { RequestMethod.GET })
53   - public String toEdit() {
  66 + @RequestMapping(value = "/{id}/toEdit", method = { RequestMethod.GET })
  67 + public String toEdit(@PathVariable String id, String perId, String pertTgName, String level, Model model) {
  68 + model.addAttribute("id", id);
  69 + model.addAttribute("perId", perId);
  70 + model.addAttribute("pertTgName", pertTgName);
  71 + model.addAttribute("level", level);
  72 + if(!StrUtils.isBlank(id)){
  73 + ContentTags contentTags = contentTagsService.selectById(id);
  74 + model.addAttribute("contentTags",contentTags);
  75 + }
54 76 return "/tags/tags_edit";
55 77 }
56 78  
57 79  
... ... @@ -68,8 +90,19 @@
68 90 */
69 91 @ResponseBody
70 92 @RequestMapping(value = "/list", method = { RequestMethod.GET, RequestMethod.POST })
71   - public Map<String, Object> list(@RequestParam(value="name",required = false) String name) {
  93 + public Map<String, Object> list(@RequestParam(value="name",required = false) String name,String perId) {
72 94 Page<ContentTags> page = getPage();
  95 + //根据父Id查询下一级的数据
  96 + if(StrUtils.isNotEmpty(perId)){
  97 + Wrapper<ContentTags> wrapper = new EntityWrapper<>();
  98 + wrapper.where("PERENT_ID={0}",perId);
  99 + List<ContentTags> contentTags = contentTagsService.selectList(wrapper);
  100 + Map<String, Object> gridData = new HashMap<String, Object>();
  101 + gridData.put("rows", contentTags);
  102 + return gridData;
  103 + }
  104 +
  105 + //根据标签名模糊查询
73 106 if(StrUtils.isNotEmpty(name)){
74 107 page = contentTagsService.getTags(page,name);
75 108 }else{
76 109  
77 110  
78 111  
... ... @@ -87,21 +120,32 @@
87 120 @ResponseBody
88 121 @RequestMapping(value = "/create", method = { RequestMethod.POST })
89 122 public AjaxResult create(ContentTagsDTO ctd, AjaxResult ajaxResult) {
90   - ContentTags cts = new ContentTags();
91   - cts.setId(StrUtils.uuid());
92   - cts.setCreateTime(new Date());
93   - cts.setIfdel(0);
94   - cts.setEnable(0);
95   -
  123 + ContentTags cts = null;
  124 + String operationName = "新增";
  125 + if(StrUtils.isNotEmpty(ctd.getId())&&!ctd.getId().equals("0")){//更新
  126 + cts = contentTagsService.selectById(ctd.getId());
  127 + cts.setModifyTime(new Date());
  128 + operationName = "修改";
  129 + }else{//新增
  130 + cts = new ContentTags();
  131 + cts.setId(StrUtils.uuid());
  132 + cts.setCreateTime(new Date());
  133 + cts.setIfdel(0);
  134 + cts.setEnable(0);
  135 + cts.setPerentId(ctd.getPerentId());
  136 + if(StrUtils.isNotEmpty(ctd.getPerentId())){//子栏目等级+1
  137 + cts.setLevel(ctd.getLevel()+1);
  138 + }else{//父栏目
  139 + cts.setLevel(0);
  140 + }
  141 + }
96 142 cts.setTagName(ctd.getTagName());
97 143 cts.setTagDesc(ctd.getTagDesc());
98   - cts.setPerentId(ctd.getPerentId());
99   - boolean tag = contentTagsService.insert(cts);
  144 + boolean tag = contentTagsService.insertOrUpdate(cts);
100 145 if(tag){
101 146 ContentTagsServiceImpl.setValue(cts.getId(),cts.getTagName());
102 147 }
103   - return handleAjaxResult(ajaxResult, tag, OperationName.CREATE);
  148 + return handleAjaxResult(ajaxResult, tag, operationName);
104 149 }
105   -
106 150 }
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentTemplateVersionController.java View file @ 203aa68
1 1 package com.lyms.cm.controller.content;
2 2  
3   -import com.baomidou.mybatisplus.mapper.EntityWrapper;
4   -import com.baomidou.mybatisplus.plugins.Page;
5 3 import com.lyms.base.common.entity.content.ContentMessageTemplate;
6 4 import com.lyms.base.common.entity.content.ContentTemplateMessageTags;
7 5 import com.lyms.base.common.entity.content.ContentTemplateVersion;
... ... @@ -23,7 +21,6 @@
23 21  
24 22 import java.util.Date;
25 23 import java.util.List;
26   -import java.util.Map;
27 24  
28 25 /**
29 26 * <p>
... ... @@ -51,9 +48,8 @@
51 48 */
52 49 @RequestMapping(value = "/list", method = { RequestMethod.POST, RequestMethod.GET })
53 50 @ResponseBody
54   - public Map<String, Object> list(Model model) {
55   - Page<ContentTemplateVersion> page = getPage();
56   - EntityWrapper<ContentTemplateVersion> ew = new EntityWrapper<ContentTemplateVersion>();
  51 + public List<ContentTemplateVersion> list(Model model) {
  52 + /*EntityWrapper<ContentTemplateVersion> ew = new EntityWrapper<ContentTemplateVersion>();
57 53 String versionId = getParameter("versionId");
58 54 String searchName = getParameter("name");
59 55 if (StrUtils.isNotEmpty(searchName)) {
... ... @@ -62,10 +58,9 @@
62 58 if (StrUtils.isNotEmpty(versionId)) {
63 59 ew.and("version_id like {0}", versionId.trim() + "%");
64 60 }
65   - ew.orderBy("id");
66   - page = templateVersionService.selectPage(page,ew);
67   - Map<String, Object> map = toGridData(page);
68   - return map;
  61 + ew.orderBy("id");*/
  62 + List<ContentTemplateVersion> tempVerList = templateVersionService.selectList(null);
  63 + return tempVerList;
69 64 }
70 65  
71 66 @ResponseBody
... ... @@ -93,7 +88,6 @@
93 88 messTemp.setIfdel(ctd.getIfdel());
94 89 for(int i =0;i<tagIds.length;i++) {
95 90 String tagId = tagIds[i];
96   - System.out.println("tagsId前---------------->:" + tagId);
97 91 if(tagId.indexOf(",")!=0){
98 92 tagId = ","+tagId;
99 93 }
... ... @@ -105,7 +99,6 @@
105 99 ctmt.setMessageTemplate(messTemp.getId());
106 100 ctmt.setTagsIds(tagId);
107 101 messageTagsService.insert(ctmt);
108   - System.out.println("tagsId后---------------->:" + tagId);
109 102 }
110 103 messageTemplateService.insert(messTemp);
111 104 }
parent/center.manager/src/main/java/com/lyms/cm/controller/sync/SyncController.java View file @ 203aa68
  1 +package com.lyms.cm.controller.sync;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import javax.servlet.http.HttpServletRequest;
  6 +
  7 +import org.apache.commons.lang3.builder.ToStringBuilder;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.http.MediaType;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import com.lyms.sync.ParamsAdpter;
  15 +import com.lyms.sync.SyncHandler;
  16 +import com.lyms.sync.SyncUtils;
  17 +import com.lyms.sync.channel.ChannelData;
  18 +import com.lyms.web.controller.BaseController;
  19 +
  20 +/**
  21 + * <li>@ClassName: RouterController
  22 + * <li>@Description: 远程接口调用数据处理分发
  23 + * <li>@author maliang
  24 + * <li>@date 2017年3月14日
  25 + * <li>
  26 + */
  27 +@RestController
  28 +@RequestMapping("/sync")
  29 +public class SyncController extends BaseController {
  30 +
  31 + private static final Logger log = LoggerFactory.getLogger(SyncController.class);
  32 +
  33 + @RequestMapping(value = "/push", produces = { MediaType.APPLICATION_JSON_VALUE })
  34 + public Object push(HttpServletRequest request) throws Exception {
  35 + ChannelData data = SyncUtils.conver(request);
  36 + log.debug("中心接受到节点推送数据:" + ToStringBuilder.reflectionToString(data));
  37 + Object handResult = SyncHandler.handler(data);
  38 + if (data.getLoop()) {
  39 + data = (ChannelData) handResult;
  40 + } else {
  41 + data.setData(ParamsAdpter.builder().push(handResult).toJsonString());
  42 + }
  43 + data.setSuccess(true);
  44 + return data;
  45 + }
  46 +
  47 +
  48 +}
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganGroupController.java View file @ 203aa68
1 1 package com.lyms.cm.controller.sys;
2 2  
3   -import java.util.Map;
4   -
5   -import org.apache.commons.lang3.StringUtils;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.stereotype.Controller;
8   -import org.springframework.ui.Model;
9   -import org.springframework.web.bind.annotation.PathVariable;
10   -import org.springframework.web.bind.annotation.RequestMapping;
11   -import org.springframework.web.bind.annotation.RequestMethod;
12   -import org.springframework.web.bind.annotation.ResponseBody;
13   -
14 3 import com.baomidou.mybatisplus.mapper.EntityWrapper;
15 4 import com.baomidou.mybatisplus.plugins.Page;
16 5 import com.lyms.base.common.entity.organ.OrganGroup;
17 6  
... ... @@ -21,7 +10,17 @@
21 10 import com.lyms.util.StrUtils;
22 11 import com.lyms.web.bean.AjaxResult;
23 12 import com.lyms.web.controller.BaseController;
  13 +import org.apache.commons.lang3.StringUtils;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Controller;
  16 +import org.springframework.ui.Model;
  17 +import org.springframework.web.bind.annotation.PathVariable;
  18 +import org.springframework.web.bind.annotation.RequestMapping;
  19 +import org.springframework.web.bind.annotation.RequestMethod;
  20 +import org.springframework.web.bind.annotation.ResponseBody;
24 21  
  22 +import java.util.Map;
  23 +
25 24 /**
26 25 * <p>
27 26 * 机构组信息
... ... @@ -82,7 +81,6 @@
82 81 if (!StringUtils.isBlank(id)) {
83 82 OrganGroup group = groupService.selectById(id);
84 83 model.addAttribute("group", group);
85   -
86 84 }
87 85 return "/group/group_edit";
88 86 }
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysRemoteController.java View file @ 203aa68
1 1 package com.lyms.cm.controller.sys;
2 2  
3   -import java.io.IOException;
4   -
5 3 import javax.servlet.http.HttpServletRequest;
6 4  
7 5 import org.springframework.http.MediaType;
... ... @@ -22,7 +20,7 @@
22 20  
23 21 @RequestMapping(value = "/sycn", produces = { MediaType.APPLICATION_JSON_VALUE })
24 22 @ResponseBody
25   - public Object push(HttpServletRequest request) throws ClassNotFoundException, IOException {
  23 + public Object push(HttpServletRequest request) throws Exception {
26 24 ChannelData model = SyncUtils.conver(request);
27 25 Object object = SyncHandler.handler(model);
28 26 model.setData(ParamsAdpter.builder().push(object).toJsonString());
parent/center.manager/src/main/java/com/lyms/cm/job/SyncFixJob.java View file @ 203aa68
... ... @@ -96,18 +96,22 @@
96 96 LOG.info("拉取到本地任务: " + ToStringBuilder.reflectionToString(oldData));
97 97 LOG.info("返回结果: " + result);
98 98 System.out.println("执行: " + ToStringBuilder.reflectionToString(data));
99   - Object handlResult = SyncHandler.handler(data);
100   - // 要求处理成功都必须返回true | false;
101   - Boolean tag = (Boolean) handlResult;
102   - if (tag) {
103   - data.setRemote(oldData.getRemote());
104   - data.setData(ParamsAdpter.builder().push(data.getId()).toJsonString());
105   - data.setAck(true);
106   - // 处理成功回执消息
107   - data.setRemoteClazz("com.lyms.hospital.service.sys.impl.SyncDataBasicServiceImpl");
108   - data.setRemoteMethod("updateBasic");
109   - work.ack(data);
110   - }
  99 + try{
  100 + Object handlResult = SyncHandler.handler(data);
  101 + // 要求处理成功都必须返回true | false;
  102 + Boolean tag = (Boolean) handlResult;
  103 + if (tag) {
  104 + data.setRemote(oldData.getRemote());
  105 + data.setData(ParamsAdpter.builder().push(data.getId()).toJsonString());
  106 + data.setAck(true);
  107 + // 处理成功回执消息
  108 + data.setRemoteClazz("com.lyms.hospital.service.sys.impl.SyncDataBasicServiceImpl");
  109 + data.setRemoteMethod("updateBasic");
  110 + work.ack(data);
  111 + }
  112 + }catch (Exception e) {
  113 + LOG.error("拉取任务执行失败:{}",e);
  114 + }
111 115 }
112 116 }
113 117 }
parent/center.manager/src/main/java/com/lyms/cm/job/SyncTableJob.java View file @ 203aa68
  1 +package com.lyms.cm.job;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +
  9 +import com.alibaba.fastjson.JSONObject;
  10 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  11 +import com.lyms.base.common.entity.sys.SyncDataBasic;
  12 +import com.lyms.base.common.service.sys.SyncDataBasicService;
  13 +import com.lyms.sync.ParamsAdpter;
  14 +import com.lyms.sync.SyncHandler;
  15 +import com.lyms.sync.channel.ChannelData;
  16 +import com.lyms.util.JsonUtils;
  17 +
  18 +/**
  19 + * <li>@ClassName: SyncTableJob
  20 + * <li>@Description: 同步任务执行器,获取SYNC_DATA_BASIC表格的数据进行处理
  21 + * <li>@author 方承
  22 + * <li>@date 2017年5月5日
  23 + * <li>
  24 + */
  25 +public class SyncTableJob {
  26 +
  27 + private static Logger log = LoggerFactory.getLogger(SyncTableJob.class);
  28 +
  29 + @Autowired
  30 + private SyncDataBasicService syncDataBasicService;
  31 +
  32 + public void excute() {
  33 + List<SyncDataBasic> dataList = syncDataBasicService.selectList(new EntityWrapper<SyncDataBasic>().where("IFSUC=0"));
  34 + if(dataList != null && dataList.size() > 0){
  35 + log.debug("=======开始进行本地 SYNC_DATA_BASIC 表格数据的同步=======");
  36 + for(SyncDataBasic entity : dataList){
  37 + try{
  38 + ChannelData data = JsonUtils.jsonToBean(entity.getData(), ChannelData.class);
  39 + Object handResult = SyncHandler.handler(data);
  40 + if (data.getLoop()) {
  41 + data = (ChannelData) handResult;
  42 + } else {
  43 + data.setData(ParamsAdpter.builder().push(handResult).toJsonString());
  44 + }
  45 + entity.setIfsuc(1);
  46 + syncDataBasicService.updateById(entity);
  47 + }catch (Exception e) {
  48 + log.error("本地【SYNC_DATA_BASIC】表格数据的同步错误:SyncDataBasic = {} {}",JSONObject.toJSON(entity),e);
  49 + }
  50 + }
  51 + }
  52 + }
  53 +
  54 +
  55 +}
parent/center.manager/src/main/resources/dev/jdbc.properties View file @ 203aa68
1 1 # Datasource Configurations
2 2 jdbc.url=jdbc:mysql://119.90.57.26:3306/center?autoReconnect=true&useUnicode=true&characterEncoding=utf-8
3 3 jdbc.username=center
4   -jdbc.password=lyms2015
  4 +jdbc.password=p6CBLGB3pp7LZCJXI2+1cA==
5 5  
6 6 #jdbc.url=jdbc:mysql://localhost:3306/center?autoReconnect=true&useUnicode=true&characterEncoding=utf-8
7 7 #jdbc.username=root
parent/center.manager/src/main/resources/logback.xml View file @ 203aa68
... ... @@ -29,10 +29,12 @@
29 29  
30 30 <!-- 下面配置一些第三方包的日志过滤级别,用于避免刷屏 -->
31 31 <!-- 打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF 默认是DEBUG -->
32   - <logger name="org.springframework" level="INFO"/>
33   - <logger name="org.apache" level="DEBUG"/>
34   - <logger name="org.mybatis.spring" level="DEBUG"/>
35   - <logger name="org.apache.ibatis" level="DEBUG"/>
  32 + <logger name="org.springframework" level="WARN"/>
  33 + <logger name="com.baomidou" level="INFO"/>
  34 + <logger name="org.apache" level="INFO"/>
  35 + <logger name="org.mybatis.spring" level="INFO"/>
  36 + <logger name="org.apache.ibatis" level="INFO"/>
  37 + <logger name="org.hibernate.validator" level="INFO"/>
36 38 <logger name="org.quartz" level="INFO"/>
37 39 <logger name="net.sf.ehcache" level="WARN"/>
38 40 <logger name="org.apache.shiro" level="WARN"/>
... ... @@ -44,7 +46,6 @@
44 46 <logger name="org.apache.velocity" level="WARN"/>
45 47 <logger name="org.apache.velocity.tools.view" level="ERROR"/>
46 48  
47   -
48   -
  49 + <logger name="com.lyms.base.common.dao.sys.SyncDataBasicMapper.selectList" level="INFO"/>
49 50 </configuration>
parent/center.manager/src/main/resources/xml/app-datasource.xml View file @ 203aa68
... ... @@ -11,6 +11,8 @@
11 11  
12 12 <!-- 启用CGliB -->
13 13 <aop:aspectj-autoproxy proxy-target-class="true"/>
  14 +
  15 + <bean id="dbPasswordCallback" class="com.lyms.common.db.DBPasswordCallback" lazy-init="true"/>
14 16  
15 17 <!-- base dataSource -->
16 18 <bean name="baseDataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
17 19  
... ... @@ -42,11 +44,13 @@
42 44 </bean>
43 45  
44 46 <!-- 主库 -->
45   - <bean id="master-dataSource" name="master-dataSource" parent="baseDataSource" init-method="init">
  47 + <bean id="master-dataSource" name="master-dataSource" parent="baseDataSource" init-method="init" lazy-init="true">
46 48 <property name="url" value="${jdbc.url}" />
47 49 <!-- <property name="driverClassName" value="com.mysql.jdbc.Driver" /> -->
48 50 <property name="username" value="${jdbc.username}" />
49 51 <property name="password" value="${jdbc.password}" />
  52 + <property name="connectionProperties" value="password=${jdbc.password}"/>
  53 + <property name="passwordCallback" ref="dbPasswordCallback"/>
50 54 </bean>
51 55  
52 56 <!--数据源切面注入spring-->
parent/center.manager/src/main/resources/xml/app-shiro.xml View file @ 203aa68
... ... @@ -49,6 +49,7 @@
49 49 /remote/** =anon
50 50 /logout = logout
51 51 /static/** = anon
  52 + /sync/** = anon
52 53 /authenticated = authc
53 54 /** = user,forceLogout
54 55 </value>
parent/center.manager/src/main/resources/xml/app-timer.xml View file @ 203aa68
... ... @@ -16,10 +16,12 @@
16 16 <task:scheduled-tasks>
17 17 <task:scheduled ref="syncTmpJob" method="excute" cron="*/10 * * * * ?"/>
18 18 <task:scheduled ref="syncFixJob" method="excute" cron="*/30 * * * * ?"/>
  19 + <task:scheduled ref="syncTableJob" method="excute" cron="*/30 * * * * ?"/>
19 20 </task:scheduled-tasks>
20 21  
21 22 <bean class="com.lyms.cm.job.SyncTmpJob" id="syncTmpJob"/>
22 23 <bean class="com.lyms.cm.job.SyncFixJob" id="syncFixJob"/>
  24 + <bean class="com.lyms.cm.job.SyncTableJob" id="syncTableJob"/>
23 25  
24 26 </beans>
parent/center.manager/src/main/webapp/WEB-INF/views/articles/articles_edit.html View file @ 203aa68
... ... @@ -21,43 +21,45 @@
21 21 novalidate="novalidate">
22 22 <div class="form-group">
23 23 <label class="col-sm-2 control-label">*栏目:</label>
24   - <div class="col-sm-5">
  24 + <div class="col-sm-8">
25 25 <select class="form-control" required="" name="categoryId" id="columnList">
26 26  
27 27 </select>
  28 + <input type="hidden" value="$!id" name="id"
  29 + class="form-control w-lg">
28 30 </div>
29 31 </div>
30 32 <div class="hr-line-dashed"></div>
31 33 <div class="form-group">
32 34 <label class="col-sm-2 control-label">*分类:</label>
33   - <div class="col-sm-5">
  35 + <div class="col-sm-8">
34 36 <select class="form-control" required="" name="type">
35 37 <option value>请选择</option>
36   - <option value="1">孕期</option>
37   - <option value="2">育儿</option>
38   - <option value="3">其它</option>
  38 + <option value="1" #if($!conArtic.type==1) selected #end>孕期</option>
  39 + <option value="2" #if($!conArtic.type==2) selected #end>育儿</option>
  40 + <option value="3" #if($!conArtic.type==3) selected #end>其它</option>
39 41 </select>
40 42 </div>
41 43 </div>
42   - <div class="hr-line-dashed" style="display: none;"></div>
  44 + <!--<div class="hr-line-dashed" style="display: none;"></div>
43 45 <div class="form-group" style="display: none;">
44 46 <label class="col-sm-2 control-label">权重:</label>
45   - <div class="col-sm-5">
  47 + <div class="col-sm-8">
46 48 <input type="number" class="form-control" class="form-control" placeholder="选填" name="weight">
47 49 </div>
48   - </div>
49   -
  50 + </div>-->
  51 +
50 52 <div class="hr-line-dashed"></div>
51 53 <div class="form-group">
52   - <label class="col-sm-2 control-label">*标签:</label><button type="button" onclick="addTags()" class="glyphicon glyphicon-plus btn glyphicon btn-primary btn-sm"></button>
53   - <div class="col-sm-5" id="seleArrs">
  54 + <label class="col-sm-2 control-label">*标签:</label><button type="button" onclick="addSeleTags()" class="glyphicon glyphicon-plus btn glyphicon btn-primary btn-sm"></button>
  55 + <div class="col-sm-8" id="seleTagArrs">
54 56  
55 57 </div>
56 58 </div>
57 59 <div class="hr-line-dashed"></div>
58 60 <div class="form-group">
59   - <label class="col-sm-2 control-label" for="">*封面:</label>
60   - <div class="col-sm-5">
  61 + <label class="col-sm-2 control-label">*封面:</label>
  62 + <div class="col-sm-8">
61 63 <div class="btn-group m-b col-sm-12 ">
62 64 <label class="btn btn-sm btn-info w-sm col-sm-3"
63 65 onclick="switchContent(1)"> <i
64 66  
65 67  
66 68  
67 69  
68 70  
... ... @@ -74,36 +76,43 @@
74 76 class="btn btn-primary btn-upload m-b-sm">
75 77 <i class="fa fa-cloud-upload text"></i> 点击上传图片
76 78 </div>
  79 +
  80 + #if($conArtic.image)
77 81 <img class="b wrapper-xs w img-responsive" style="width: 200px" id="pickImage"
78   - src="${ctx}/static/images/p0.jpg" />
  82 + src="$!conArtic.image" />
  83 + #else
  84 + <img class="b wrapper-xs w img-responsive" style="width: 200px" id="pickImage"
  85 + src="${ctx}/static/images/p0.jpg" />
  86 + #end
  87 +
79 88 </div>
80 89 </div>
81 90 </div>
82 91 <div class="hr-line-dashed"></div>
83 92 <div class="form-group">
84 93 <label class="col-sm-2 control-label">*标题:</label>
85   - <div class="col-sm-5">
86   - <input type="text" ng-maxlength="32" name="title"
87   - class="form-control w-lg" required="" aria-required="true">
  94 + <div class="col-sm-8">
  95 + <input type="text" maxlength="32" value="$!conArtic.title" name="title"
  96 + class="form-control w-lg" required="">
88 97 </div>
89 98 </div>
90 99 <div class="form-group" id="linkContent" style="display:none">
91 100 <label class="col-sm-2 control-label">*链接:</label>
92   - <div class="col-sm-5">
93   - <input type="text" type="url" name="link" id="linkAddr" class="form-control w-lg">
  101 + <div class="col-sm-8">
  102 + <input type="text" type="url" value="$!conArtic.link" name="link" id="linkAddr" class="form-control w-lg">
94 103 </div>
95 104 </div>
96 105 <div class="form-group" id="zaiyaoContent">
97 106 <label class="col-sm-2 control-label">*摘要:</label>
98   - <div class="col-sm-5">
99   - <input type="text" maxlength="255" required="" id="introdu" name="introduction" class="form-control w-lg">
  107 + <div class="col-sm-8">
  108 + <input type="text" maxlength="1024" value="$!conArtic.introduction" required="" id="introdu" name="introduction" class="form-control w-lg">
100 109 </div>
101 110 </div>
102 111  
103 112 <div class="form-group" id="zhengwenConent">
104 113 <label class="col-sm-2 control-label">正文:</label>
105   - <div class="col-sm-5">
106   - <script id="editor" name="richText" type="text/plain"></script>
  114 + <div class="col-sm-8">
  115 + <script id="editor" name="richText" type="text/plain">$!conArtic.content</script>
107 116 </div>
108 117 </div>
109 118  
110 119  
... ... @@ -134,32 +143,43 @@
134 143 <script type="text/javascript" src="${ctx}/static/js/plugins/qiniu/qiniu.min.js"></script>
135 144  
136 145 <script type="text/javascript">
137   - var seleNum = 1;
138   - var optionHtml = "";
139   - function addTags(){
  146 + var seleTagNum = 1;
  147 + var tagsData;
  148 + function addSeleTags(seleIds){
  149 + var seleHtml = "<select id='select"+seleTagNum+"' style='width: 100%;height: 36px;' multiple data-selectator-keep-open='true'>";
  150 + tagsData.forEach(function(d, i) {
  151 + seleHtml += "<option";
  152 + if(seleIds!=null) {
  153 + for(t in seleIds){
  154 + if(seleIds[t]!=""){
  155 + if (d.id == seleIds[t]) {
  156 + seleHtml += ' selected ';
  157 + }
  158 + }
  159 + }
  160 + }
  161 + seleHtml += " value='"+d.id+"'>" + d.tagName + "</option>";
  162 + });
  163 + seleHtml+="</select>";
  164 + $("#seleTagArrs").append(seleHtml);
  165 + $('#select'+seleTagNum).selectator({
  166 + prefix : 'selectator_', // CSS class prefix
  167 + height : '36', // auto or element
  168 + useDimmer : false, // dims the screen when option list is visible
  169 + useSearch : true, // if false, the search boxes are removed and
  170 + keepOpen : true, // if true, then the dropdown will not close when
  171 + showAllOptionsOnFocus : true, // shows all options if input box is empty
  172 + selectFirstOptionOnSearch : true, // selects the topmost option on every search
  173 + searchCallback : function(value) {
  174 + },
  175 + labels : {
  176 + search : 'Search...' // Placeholder text in search box in single select box
  177 + }
  178 + });
  179 + //ID累计
  180 + seleTagNum++;
  181 + }
140 182  
141   - var seleHtml = "<select id='select"+seleNum+"' style='width: 100%;height: 36px;' multiple data-selectator-keep-open='true'>"+optionHtml+"</select>";
142   -
143   - $("#seleArrs").append(seleHtml);
144   -
145   - $('#select'+seleNum).selectator({
146   - prefix : 'selectator_', // CSS class prefix
147   - height : '36', // auto or element
148   - useDimmer : false, // dims the screen when option list is visible
149   - useSearch : true, // if false, the search boxes are removed and
150   - keepOpen : true, // if true, then the dropdown will not close when
151   - showAllOptionsOnFocus : true, // shows all options if input box is empty
152   - selectFirstOptionOnSearch : true, // selects the topmost option on every search
153   - searchCallback : function(value) {
154   - },
155   - labels : {
156   - search : 'Search...' // Placeholder text in search box in single select box
157   - }
158   - });
159   - //ID累计
160   - seleNum++;
161   - }
162   -
163 183 function switchContent(num) {
164 184 if (num == 1) {//普通内容
165 185 $("#commonCon").addClass("fa-check");
... ... @@ -170,7 +190,6 @@
170 190 $("#linkContent").hide();
171 191  
172 192 $("#contentType").val(1);
173   -
174 193 //链接不是必须的
175 194 $("#linkAddr").removeAttr("required");
176 195 $("#introdu").attr("required","");
... ... @@ -210,7 +229,6 @@
210 229 var domain = up.getOption('domain');
211 230 var res = JSON.parse(info);
212 231 var sourceLink = domain + res.key; //获取上传成功后的文件的Url+
213   -
214 232 $("#pickImage").attr("src",sourceLink);
215 233 }
216 234 }
217 235  
... ... @@ -219,11 +237,16 @@
219 237 }
220 238  
221 239 function initCloumnData(){
  240 + var cateGoryId = "$conArtic.categoryId";
222 241 $.getJSON("${ctx}/contentCategories/selelist", function(data) {
223 242 if (data.success) {
224 243 var columnList = "<option value=''>请选择</option>";
225 244 data.data.forEach(function(d, i) {
226   - columnList += "<option value='"+d.id+"'>" + d.name + "</option>";
  245 + columnList += "<option value='"+d.id+"'";
  246 + if(cateGoryId==d.id){
  247 + columnList +=" selected ";
  248 + }
  249 + columnList +=">" + d.name + "</option>";
227 250 });
228 251 $("#columnList").empty();
229 252 $("#columnList").append(columnList);
230 253  
... ... @@ -234,15 +257,29 @@
234 257 function initTagsData(){
235 258 $.get("${ctx}/contentTags/seleList", "json", function(data) {
236 259 if (data.success) {
237   - data.data.forEach(function(d, i) {
238   - optionHtml += '<option value="'+d.id+'">' + d.tagName + '</option>';
239   - });
240   - //默认一个选择标签
241   - addTags();
  260 + tagsData = data.data;
  261 + initSeleTags();
  262 +// data.data.forEach(function(d, i) {
  263 +// optionHtml += '<option value="'+d.id+'">' + d.tagName + '</option>';
  264 +// });
  265 +// //默认一个选择标签
  266 +// addTags();
242 267 }
243 268 });
244 269 }
245 270  
  271 + function initSeleTags(){
  272 + var tags = "$!tags";
  273 + if(tags != "" && tags != "[]"){
  274 + #foreach($tg in $tags)
  275 + addSeleTags("${tg.tagsIds}".split(","));
  276 + #end
  277 + }else{
  278 + //默认一个选择标签
  279 + addSeleTags();
  280 + }
  281 + }
  282 +
246 283 $(function() {
247 284 //初始化图片上传插件
248 285 initUpload();
... ... @@ -250,8 +287,13 @@
250 287 initCloumnData();
251 288 //初始化标签数据
252 289 initTagsData();
253   -
254   - //初始化
  290 + //内容类型 1:普通内容,2:专题内容
  291 + var contentType = "$!conArtic.contentType";
  292 + if(contentType == "2"){
  293 + switchContent(2);
  294 + }
  295 +
  296 + //初始化
255 297 var ue = UE.getEditor('editor', {
256 298 initialFrameHeight : 200,
257 299 initialFrameWidth : "100%"
258 300  
259 301  
260 302  
... ... @@ -259,25 +301,23 @@
259 301 });
260 302  
261 303 function save() {
262   -
263 304 if ($('#validForm').valid()) {
264 305 var data = $('#validForm').serialize();
265 306 var pickImgSrc = $("#pickImage").attr("src");
266 307 var content = UE.getEditor('editor').getContent();
267 308 data+="&content="+content;
268   -
269 309 if(pickImgSrc.indexOf("p0.jpg")==-1){
270 310 data+="&image="+pickImgSrc;
271 311 }
272 312  
273   - for(var i=1;i<seleNum;i++){
  313 + for(var i=1;i<seleTagNum;i++){
274 314 data+="&tags["+(i-1)+"]=,"+$("#select"+i).val()+",";
275 315 }
276   -
277   -
278   -
279   - ajaxPost(APP.PATH + "/contentArticles/create", data);
280   - parent.reloadGrid('dataTable');
  316 + ajaxPost(APP.PATH + "/contentArticles/create", data,function(r){
  317 + msg(r.message);
  318 + parent.reloadGrid('dataTable');
  319 + parent.layer.closeAll();//关闭弹窗
  320 + });
281 321 }
282 322 }
283 323 </script>
parent/center.manager/src/main/webapp/WEB-INF/views/articles/articles_list.html View file @ 203aa68
... ... @@ -5,13 +5,38 @@
5 5 <form role="form" class="form-inline">
6 6 <div class="row wrapper">
7 7 <div class="col-sm-12">
8   - <div class="form-group col-sm-3">
  8 + <div class="btn-group m-b col-sm-6 ">
  9 + <label class="btn btn-sm btn-default w-sm col-sm-2" onclick="switchContent('','qbChe')">
  10 + <i class="fa text-active statusChe" id="qbChe"></i> 全部
  11 + </label>
  12 + <label class="btn btn-sm btn-primary w-sm col-sm-2" onclick="switchContent(1,'dshChe')">
  13 + <i class="fa text-active statusChe" id="dshChe"></i> 待审核
  14 + </label>
  15 + <label class="btn btn-sm btn-success w-sm col-sm-2" onclick="switchContent(2,'dfbChe')">
  16 + <i class="fa text-active statusChe" id="dfbChe"></i> 待发布
  17 + </label>
  18 + <label class="btn btn-sm btn-info w-sm col-sm-2" onclick="switchContent(3,'yfbChe')">
  19 + <i class="fa text-active statusChe" id="yfbChe"></i> 已发布
  20 + </label>
  21 + <label class="btn btn-sm btn btn-warning w-sm col-sm-2" onclick="switchContent(4,'yxxChe')">
  22 + <i class="fa text-active statusChe" id="yxxChe"></i> 已下线
  23 + </label>
  24 + <input type="hidden" id="status">
  25 + </div>
  26 + </div>
  27 + <div class="col-sm-12">
  28 + <div class="form-group col-sm-2">
  29 + <label class="control-label">标题:</label>
  30 + <input style='width: 100%;height: 36px;' type="text" placeholder="请输入标题" id="title" class="form-control">
  31 + </div>
  32 +
  33 + <div class="form-group col-sm-2">
9 34 <label class="control-label">所属栏目:</label>
10 35 <select class="form-control" style='width: 100%;height: 36px;' id="columnSeleHtml">
11 36  
12 37 </select>
13 38 </div>
14   - <div class="form-group col-sm-3">
  39 + <div class="form-group col-sm-2">
15 40 <label class="control-label">分类:</label>
16 41 <select class="form-control" style='width: 100%;height: 36px;' id="type">
17 42 <option value>全部</option>
18 43  
19 44  
20 45  
21 46  
... ... @@ -20,33 +45,25 @@
20 45 <option value="3">其它</option>
21 46 </select>
22 47 </div>
23   - <div class="form-group col-sm-3" id="seleTagsHtml">
  48 + <div class="form-group col-sm-2" id="seleTagsHtml">
24 49 <label class="control-label">标签:</label>
25 50 </div>
26   - <div class="form-group col-sm-3">
27   - <label class="control-label">标题:</label>
28   - <input style='width: 100%;height: 36px;' type="text" placeholder="请输入标题" id="title" class="form-control">
  51 + <div class="title-action" onclick="search();">
  52 + <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
29 53 </div>
30 54 </div>
31 55 </div>
32 56 </form>
33 57 </div>
34 58 </div>
35   - <div class="col-sm-2">
36   - <div class="title-action" onclick="search();">
37   - <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
38   - </div>
39   - </div>
40 59 </div>
41 60 <div class="wrapper wrapper-content">
42 61 <div class="row">
43 62 <div class="col-sm-12">
44 63 <div id="toolbar">
45 64 <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
46   - <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
47   - <!--
  65 + <!--<button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>-->
48 66 <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
49   - -->
50 67 </div>
51 68 <table id="dataTable"></table>
52 69 </div>
53 70  
... ... @@ -55,12 +72,19 @@
55 72 #end
56 73 #override("js")
57 74 <script type="text/javascript">
  75 + function switchContent(num,cname) {
  76 + $(".statusChe").removeClass("fa-check");
  77 + $("#"+cname).addClass("fa-check");
  78 + $("#status").val(num);
  79 + search();
  80 + }
58 81 $(function(){
59 82 //初始化栏目
60 83 initCloumnData();
61 84 //初始化标签选项
62 85 initTags();
63   -
  86 + //加载表格数据
  87 + initData();
64 88 })
65 89 function initTags(){
66 90 $.get("${ctx}/contentTags/seleList", "json", function(data) {
67 91  
68 92  
... ... @@ -101,15 +125,19 @@
101 125 }
102 126  
103 127 function search(){
  128 + var status = $("#status").val();
104 129 var comId = $("#columnSeleHtml").val();
105 130 var type = $("#type").val();
106 131 var title = $("#title").val();
107 132 var seleTagArrs = $("#seleTagArrs").val();
108 133  
109 134 var querys = {};
110   - if(comId!=""){
111   - querys.columnId = comId;
  135 + if(status!=""){
  136 + querys.status = status;
112 137 }
  138 + if(comId!=""){
  139 + querys.columnId = comId;
  140 + }
113 141 if(type!=""){
114 142 querys.type = type;
115 143 }
... ... @@ -117,7 +145,7 @@
117 145 querys.title = title;
118 146 }
119 147 if(seleTagArrs!=""){
120   - querys.ccName = seleTagArrs;
  148 + querys.tagId = seleTagArrs;
121 149 }
122 150  
123 151 var queryParams = {
124 152  
... ... @@ -135,35 +163,165 @@
135 163 }
136 164  
137 165 function add(){
138   - fullWindow("添加图文内容", APP.PATH + controllerRequestMappint + "/toEdit");
139   -
  166 + popWindow("添加图文内容", APP.PATH + controllerRequestMappint + "0/toEdit",850,800);
140 167 }
141 168  
142 169 function del(){
143 170 goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete");
144 171 }
145   -var default_dataUrl = APP.PATH + controllerRequestMappint + "list";
146   -var default_dataColumns = [{
147   - field: 'perent',
148   - title: '',
149   - checkbox: true
150   - },{
151   - field: 'title',
152   - title: '标题'
153   - },{
154   - field: 'categoryName',
155   - title: '所属栏目'
156   - },{
157   - field: 'typeName',
158   - title: '分类'
159   - },{
160   - field:"tagsName",
161   - title:"标签"
162   - },{
163   - field:"createName",
164   - title:"添加人"
165   - }];
166   -
  172 +
  173 +function initData(){
  174 + $('#dataTable').bootstrapTable({
  175 + url: '${ctx}/contentArticles/list', //请求后台的URL(*)
  176 + method: 'get', //请求方式(*)
  177 + contentType:'application/x-www-form-urlencoded',
  178 + toolbar: '#toolbar', //工具按钮用哪个容器
  179 + striped: true, //是否显示行间隔色
  180 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  181 + pagination: true, //是否显示分页(*)
  182 + sortable: false, //是否启用排序
  183 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  184 + pageNumber:1, //初始化加载第一页,默认第一页
  185 + pageSize: 10, //每页的记录行数(*)
  186 + pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  187 + strictSearch: true,
  188 + queryParams:function (params) {
  189 + return {
  190 + _size: params.limit, //每页记录数
  191 + _offset: params.offset , //偏移量
  192 + };
  193 + },
  194 + clickToSelect: true, //是否启用点击选中行
  195 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  196 + cardView: false, //是否显示详细视图
  197 + showRefresh: true,
  198 + showColumns: true,
  199 + showExport: true,
  200 + showToggle: true,
  201 + detailView: false,
  202 + onDblClickRow:function(row,ev){
  203 + popWindow("修改图文信息", APP.PATH + controllerRequestMappint + row.id+"/toEdit?id="+row.id,850,800);
  204 + },
  205 + columns:[{
  206 + field: 'perent',
  207 + title: '',
  208 + checkbox: true
  209 + },{
  210 + field: 'title',
  211 + title: '标题',
  212 + width:"20%",
  213 + },{
  214 + field: 'categoryName',
  215 + title: '所属栏目',
  216 + width:"20%",
  217 + },{
  218 + field: 'typeName',
  219 + title: '分类',
  220 + width:"10%",
  221 + },{
  222 + field: 'status',
  223 + title: '审核状态',
  224 + width:"10%",
  225 + formatter:function(value,row,index){
  226 + switch (value){
  227 + case 1: return "待审核";
  228 + case 2: return "待发布";
  229 + case 3: return "已发布";
  230 + case 4: return "已下线";
  231 + default: return "未知";
  232 + }
  233 + }
  234 + },{
  235 + field:"tagIds",
  236 + title:"标签",
  237 + width:"30%",
  238 + formatter:function(value,row,index){
  239 + var tagsNames = value.split(",");
  240 + var tagsHtml = "";
  241 + for(var i =0;i<tagsNames.length;i++){
  242 + if((i+1)%5==1){
  243 + tagsHtml+='<span class="badge badge-primary" style="margin: 3px;">'+tagsNames[i]+'</span>';
  244 + }else if((i+1)%5==2){
  245 + tagsHtml+='<span class="badge label-info" style="margin: 3px;">'+tagsNames[i]+'</span>';
  246 + }else if((i+1)%5==3){
  247 + tagsHtml+='<span class="badge label-success" style="margin: 3px;">'+tagsNames[i]+'</span>';
  248 + }else if((i+1)%5==4){
  249 + tagsHtml+='<span class="badge label-warning" style="margin: 3px;">'+tagsNames[i]+'</span>';
  250 + }else{
  251 + tagsHtml+='<span class="badge label-danger" style="margin: 3px;">'+tagsNames[i]+'</span>';
  252 + }
  253 + }
  254 + return tagsHtml;
  255 + }
  256 + },{
  257 + field:"id",
  258 + title:"操作",
  259 + width:"15%",
  260 + formatter:function(value,row,index){
  261 + if(row.status == 1){
  262 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=audit('"+row.id+"',1)>审核</button>";
  263 + }else if(row.status == 2 ||row.status == 4){
  264 + return "<button class='btn btn-sm btn-info m-r-xs' onclick=audit('"+row.id+"',2)>发布</button>";
  265 + }else if(row.status == 3){
  266 + return "<button class='btn btn-sm btn-danger m-r-xs' onclick=audit('"+row.id+"',3)>下线</button>";
  267 + }else{
  268 + return "";
  269 + }
  270 + }
  271 + }]
  272 + });
  273 +}
  274 +function audit(id,status){
  275 + if(status == 1){//进入审核页面
  276 + layer.open({
  277 + type: 1 //Page层类型
  278 + ,area: ['530px', '300px']
  279 + ,title: '审核'
  280 + ,shade: 0.6 //遮罩透明度
  281 + ,maxmin: true //允许全屏最小化
  282 + ,anim: 2 //0-6的动画形式,-1不开启
  283 + ,content: "<div class='col-sm-9 col-sm-offset-1'>" +
  284 + "<form action='#' class='form-horizontal m-t navbar-form navbar-left' id='validForm'>" +
  285 + "<div class='form-group'><label class='col-sm-4 control-label'>*审核意见:</label><div class='col-sm-7'>" +
  286 + "<textarea maxlength='256' cols='30%' rows='7' required name='reason'></textarea>"+
  287 + "</div></div><div class='col-sm-offset-8'>" +
  288 + "</div></form></div>"
  289 + ,btn: ['通过','取消'] //按钮
  290 + ,yes:function(){
  291 + auditReas(id,1);
  292 + },btn2:function(){
  293 + layer.msg('取消', {icon: 1});
  294 + }
  295 + }
  296 + );
  297 + }else if(status == 2){//发布
  298 + auditReas(id,2)
  299 + }else if(status == 3){//下线
  300 + auditReas(id,3)
  301 + }
  302 +}
  303 +function auditReas(id,type){
  304 + if(type==1){//审核
  305 + if($("#validForm").valid()){
  306 + var data = $('#validForm').serialize();
  307 + data+="&type="+type;
  308 + data+="&id="+id;
  309 + ajaxPost( APP.PATH + controllerRequestMappint+"/audit",data,function(r){
  310 + msg(r.message);
  311 + search();
  312 + });
  313 + layer.closeAll('page');//关闭弹窗
  314 + }
  315 + }else{//其他处理{发布、上线...}
  316 + var data = {};
  317 + data.id = id;
  318 + data.type = type;
  319 + ajaxPost( APP.PATH + controllerRequestMappint+"/audit",data,function(r){
  320 + msg(r.message);
  321 + search();
  322 + });
  323 + }
  324 +}
167 325 </script>
168 326 #end
169 327 #extends("/common/base_list.html")
parent/center.manager/src/main/webapp/WEB-INF/views/categories/categonies_edit.html View file @ 203aa68
... ... @@ -16,30 +16,39 @@
16 16 novalidate="novalidate">
17 17 <div class="form-group">
18 18 <label class="col-sm-2 control-label">父栏目名称:</label>
19   - <div class="col-sm-5">
20   - <input type="text" class="form-control" disabled class="form-control"
21   - placeholder="无" name="">
22   - <input type="text" name="perent"/>
  19 + <div class="col-sm-8">
  20 + <input type="text" class="form-control" value="$!perCgName" disabled class="form-control"
  21 + placeholder="无">
  22 + <input type="hidden" value="$!id" name="id"/>
  23 + <input type="hidden" value="$!perId" name="perent"/>
  24 + <input type="hidden" value="$!level" name="level"/>
  25 +
23 26 </div>
24 27 </div>
25 28 <div class="form-group">
26 29 <label class="col-sm-2 control-label">*栏目名称:</label>
27   - <div class="col-sm-5">
28   - <input type="text" class="form-control" required class="form-control"
29   - placeholder="请填入栏目名称" name="name">
  30 + <div class="col-sm-8">
  31 + <input type="text" maxlength="32" class="form-control" required class="form-control"
  32 + placeholder="请填入栏目名称" value="$!conCate.name" name="name">
30 33 </div>
31 34 </div>
32 35 <div class="form-group">
33 36 <label class="col-sm-2 control-label" for="">栏目icon:</label>
34   - <div class="col-sm-5">
  37 + <div class="col-sm-8">
35 38 <div class="col-sm-12 no-padder" id="container">
36 39 <div data-multiple="false"
37 40 title="点击上传" id="pickfiles"
38 41 class="btn btn-primary btn-upload m-b-sm">
39 42 <i class="fa fa-cloud-upload text"></i> 点击上传图片
40 43 </div>
  44 + #if($conCate.icon)
41 45 <img class="b wrapper-xs w img-responsive" style="width: 200px" id="pickImage"
42   - src="${ctx}/static/images/p0.jpg" />
  46 + src="$!conCate.icon" />
  47 + #else
  48 + <img class="b wrapper-xs w img-responsive" style="width: 200px" id="pickImage"
  49 + src="${ctx}/static/images/p0.jpg" />
  50 + #end
  51 +
43 52 </div>
44 53 </div>
45 54 </div>
... ... @@ -48,8 +57,8 @@
48 57  
49 58 <div class="form-group" id="zhengwenConent">
50 59 <label class="col-sm-2 control-label">栏目简介:</label>
51   - <div class="col-sm-5">
52   - <script id="editor" type="text/plain"></script>
  60 + <div class="col-sm-8">
  61 + <script id="editor" type="text/plain">$!conCate.description</script>
53 62 </div>
54 63 </div>
55 64  
... ... @@ -89,7 +98,6 @@
89 98 $("#zaiyaoContent").show();
90 99 $("#zhengwenConent").show();
91 100 $("#linkContent").hide();
92   -
93 101  
94 102 } else {
95 103 $("#commonCon").removeClass("fa-check");
96 104  
... ... @@ -153,10 +161,8 @@
153 161 // progress.setStatus(errTip);
154 162  
155 163 var domain = up.getOption('domain');
156   -
157 164 var res = JSON.parse(info);
158 165 var sourceLink = domain + res.key; //获取上传成功后的文件的Url+
159   -
160 166 $("#pickImage").attr("src",sourceLink);
161 167 },
162 168 'Error': function(up, err, errTip) {
163 169  
... ... @@ -226,15 +232,18 @@
226 232 });
227 233  
228 234 function save() {
229   -
230 235 if ($('#validForm').valid()) {
231 236 var data = $('#validForm').serialize();
232 237 var pickImgSrc = $("#pickImage").attr("src");
233 238 var content = UE.getEditor('editor').getContent();
234 239 data+="&description="+content;
235 240 data+="&icon="+pickImgSrc;
236   - ajaxPost(APP.PATH + "/contentCategories/create", data);
237   - parent.reloadGrid('dataTable');
  241 + ajaxPost(APP.PATH + "/contentCategories/create", data,function(r){
  242 + msg(r.message);
  243 + parent.reloadGrid('dataTable');
  244 + parent.layer.closeAll();//关闭弹窗
  245 + });
  246 +
238 247 }
239 248 }
240 249 </script>
parent/center.manager/src/main/webapp/WEB-INF/views/categories/categonies_list.html View file @ 203aa68
... ... @@ -19,8 +19,8 @@
19 19 <div class="row">
20 20 <div class="col-sm-12">
21 21 <div id="toolbar">
22   - <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
23   - <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
  22 + <button class="btn btn-info " type="button" onclick="add('','','');"><i class="fa fa-plus"></i> 新增</button>
  23 + <!--<button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>-->
24 24 <!--
25 25 <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
26 26 -->
27 27  
28 28  
29 29  
... ... @@ -42,42 +42,121 @@
42 42 }
43 43 var controllerRequestMappint = "/contentCategories/";
44 44  
45   -function add() {
46   - fullWindow("新增栏目", APP.PATH + controllerRequestMappint + "/toEdit");
  45 +function add(id,level,cgName) {
  46 + popWindow("新增栏目", APP.PATH + controllerRequestMappint + "0/toEdit?perId="+id+"&perCgName="+cgName+"&level="+level,800,800);
47 47 }
48 48  
49   -function edit(){
50   - var id = getSingleSelectedValue("dataTable","id");
51   - if(id){
52   - fullWindow("修改栏目", APP.PATH + controllerRequestMappint + id + "/toEdit");
53   - }
  49 +function edit(id){
  50 + popWindow("修改栏目", APP.PATH + controllerRequestMappint + id + "/toEdit",800,800);
54 51 }
55 52  
56   -function del(){
57   - goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete");
  53 +function del(id){
  54 + layer.confirm('确定删除吗?', {
  55 + btn: ['确定','取消'], //按钮
  56 + shade: false //不显示遮罩
  57 + }, function(){
  58 + ajaxPost(APP.PATH + controllerRequestMappint + id + "/delete","",function(r){
  59 + msg(r.message);
  60 + reloadGrid('dataTable');
  61 + });
  62 +
  63 + //layer.msg('删除成功', {icon: 1});
  64 + }, function(){
  65 + layer.msg('取消删除', {shift: 6});
  66 + });
58 67 }
59   -var default_dataUrl = APP.PATH + controllerRequestMappint + "list";
60   -var default_dataColumns = [{
61   - field: 'perent',
62   - title: '',
63   - formatter:function(value,row,index){
64   - if(value == ""){
65   - return '无';
66   - }else {
67   - return '下一级'
68   - }
69   - }
70   - },{
71   - field: 'name',
72   - title: '栏目名称'
73   - },{
74   - field: 'description',
75   - title: '栏目简介'
76   - },{
77   - field: 'level',
78   - title: '栏目等级'
79   - }];
80   -
  68 +function buildTable(tab,id){
  69 + tab.bootstrapTable({
  70 + columns: [{
  71 + field: 'name',
  72 + title: '栏目名称',
  73 + width: '20%'
  74 + },{
  75 + field: 'description',
  76 + title: '栏目简介',
  77 + width: '40%'
  78 + },{
  79 + field: 'level',
  80 + title: '栏目等级',
  81 + width: '10%'
  82 + },{
  83 + fileld:'id',
  84 + width: '20%',
  85 + formatter:function(value,row,index){
  86 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=add('"+row.id+"',"+row.level+",'"+row.name+"')>添加子栏目</button>" +
  87 + "<button class='btn btn-sm btn-info m-r-xs' onclick=edit('"+row.id+"')>编辑</button>" +
  88 + "<button class='btn btn-sm btn-danger' onclick=del('"+row.id+"')>删除</button>";
  89 + }
  90 + }],
  91 + url: APP.PATH + controllerRequestMappint + "list?perId="+id, //请求后台的URL(*)
  92 + method: 'post',
  93 + showHeader:false,
  94 + striped: true, //是否显示行间隔色
  95 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  96 + sortable: false, //是否启用排序
  97 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  98 + clickToSelect: true, //是否启用点击选中行
  99 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  100 + cardView: false, //是否显示详细视图
  101 + showColumns: false,
  102 + showExport: false,
  103 + showToggle: false,
  104 + detailView: true,
  105 + onExpandRow: function (index, row, detail) {
  106 + buildTable(detail.html('<table></table>').find('table'),row.id);
  107 + }
  108 + });
  109 +}
  110 +
  111 +$(function(){
  112 + $('#dataTable').bootstrapTable({
  113 + columns: [{
  114 + field: 'name',
  115 + title: '栏目名称',
  116 + width: '20%'
  117 + },{
  118 + field: 'description',
  119 + title: '栏目简介',
  120 + width: '40%'
  121 + },{
  122 + field: 'level',
  123 + title: '栏目等级',
  124 + width: '10%'
  125 + },{
  126 + fileld:'id',
  127 + width: '20%',
  128 + formatter:function(value,row,index){
  129 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=add('"+row.id+"',"+row.level+",'"+row.name+"')>添加子栏目</button>" +
  130 + "<button class='btn btn-sm btn-info m-r-xs' onclick=edit('"+row.id+"')>编辑</button>" +
  131 + "<button class='btn btn-sm btn-danger' onclick=del('"+row.id+"')>删除</button>";
  132 + }
  133 + }],
  134 + url: APP.PATH + controllerRequestMappint + "list", //请求后台的URL(*)
  135 + method: 'post',
  136 + contentType:'application/x-www-form-urlencoded',
  137 + toolbar: '#toolbar', //工具按钮用哪个容器
  138 + striped: true, //是否显示行间隔色
  139 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  140 + pagination: true, //是否显示分页(*)
  141 + sortable: false, //是否启用排序
  142 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  143 + pageNumber:1, //初始化加载第一页,默认第一页
  144 + pageSize: 10, //每页的记录行数(*)
  145 + pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  146 + strictSearch: true,
  147 + clickToSelect: true, //是否启用点击选中行
  148 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  149 + cardView: false, //是否显示详细视图
  150 + showRefresh: true,
  151 + showColumns: true,
  152 + showExport: true,
  153 + showToggle: true,
  154 + detailView: true,
  155 + onExpandRow: function (index, row, detail) {
  156 + buildTable(detail.html('<table></table>').find('table'),row.id);
  157 + }
  158 + });
  159 +});
81 160 </script>
82 161 #end
83 162 #extends("/common/base_list.html")
parent/center.manager/src/main/webapp/WEB-INF/views/common/base_list.html View file @ 203aa68
... ... @@ -42,7 +42,6 @@
42 42  
43 43  
44 44 $(function(){
45   -
46 45 function get(id,callback) {
47 46 $.get(APP.PATH+"/sysRegions/find?id="+id,function(data){
48 47 callback(data);
parent/center.manager/src/main/webapp/WEB-INF/views/content/select_template_list.html View file @ 203aa68
  1 +#override("body")
  2 +<div class="ibox float-e-margins">
  3 + <div class="ibox-content">
  4 + <div class="col-sm-12">
  5 + <form id="validForm" class="form-horizontal m-t"
  6 + novalidate="novalidate">
  7 + <div class="form-group">
  8 + <label class="col-sm-4 control-label">医院名称:</label>
  9 + <div class="col-sm-5">
  10 + <input type="text" class="form-control" disabled class="form-control"
  11 + placeholder="无" value="$!orgName">
  12 + <input type="hidden" value="$!id" name="id"/>
  13 + </div>
  14 + </div>
  15 + <div class="hr-line-dashed"></div>
  16 + <div class="form-group">
  17 + <label class="col-sm-4 control-label">*版本库:</label>
  18 + <div class="col-sm-5">
  19 + <select class="form-control" id="seleVerArrs" required="" name="verId">
  20 + <option value>请选择</option>
  21 + </select>
  22 + </div>
  23 + </div>
  24 +
  25 + <div class="hr-line-dashed"></div>
  26 + <div class="form-group">
  27 + <div class="col-sm-7 col-sm-offset-3 pull-right">
  28 + <button type="button" class="btn btn-primary" onclick="save();">
  29 + <i class="fa fa-check"></i>&nbsp;提交
  30 + </button>
  31 + <button type="button" class="btn btn-white"
  32 + onclick="parent.closeAll();">
  33 + <i class="fa fa-close"></i>&nbsp;取消
  34 + </button>
  35 + </div>
  36 + </div>
  37 + </form>
  38 + </div>
  39 + </div>
  40 +</div>
  41 +#end
  42 +#override("js")
  43 +<script type="text/javascript">
  44 + var controllerRequestMappint = "/contentMessageTemplate/";
  45 + function saveVers(){
  46 + if($('#validForm').valid()){
  47 + var data = $('#validForm').serialize();
  48 + ajaxPost(APP.PATH +'/contentTemplateVersion/create',data);
  49 + }
  50 + }
  51 +
  52 + $(function(){
  53 + $.getJSON("${ctx}/contentTemplateVersion/list", function(data) {
  54 + if (data.success) {
  55 + var columnList = "<option value=''>请选择</option>";
  56 + data.data.forEach(function(d, i) {
  57 + columnList += "<option value='"+d.id+"'";
  58 + /* if(cateGoryId==d.id){
  59 + columnList +=" selected ";
  60 + }*/
  61 + columnList +=">" + d.versionName + "</option>";
  62 + });
  63 + $("#seleVerArrs").empty();
  64 + $("#seleVerArrs").append(columnList);
  65 + }
  66 + });
  67 + });
  68 +
  69 +
  70 +
  71 +</script>
  72 +#end
  73 +#extends("/common/base_list.html")
parent/center.manager/src/main/webapp/WEB-INF/views/content/template_edit.html View file @ 203aa68
... ... @@ -11,14 +11,15 @@
11 11 <label class="col-sm-2 control-label">版本库名称:</label>
12 12 <div class="col-sm-9">
13 13 <input type="text" name="vName" value="$!vName" disabled class="form-control">
14   - <input type="hidden" name="id" value="$!id" disabled class="form-control">
  14 + <input type="hidden" class="i-checks" value="$!verId" id="verId" name="templateVersionId">
  15 + <input type="hidden" name="id" value="$!id" class="form-control">
15 16 </div>
16 17 </div>
17 18  
18 19 <div class="form-group">
19 20 <label class="col-sm-2 control-label">*短信内容:</label>
20 21 <div class="col-sm-9">
21   - <textarea class="form-control" rows="4" cols="12" name="content" id="content" required placeholder="请输入短信内容">$!tempInfo.content</textarea>
  22 + <textarea class="form-control" rows="4" maxlength="128" cols="12" name="content" id="content" required placeholder="请输入短信内容">$!tempInfo.content</textarea>
22 23 </div>
23 24 </div>
24 25 <div class="form-group">
... ... @@ -36,12 +37,6 @@
36 37 </div>
37 38 </label>
38 39 </div>
39   - <div class="form-group">
40   - <label class="col-sm-2 control-label"></label>
41   - <div class="col-sm-10">
42   - <input type="hidden" class="i-checks" value="$!verId" name="templateVersionId">
43   - </div>
44   - </div>
45 40 <div class="form-group hidden" id="imageTitle">
46 41 <label class="col-sm-2 control-label">标题:</label>
47 42 <div class="col-sm-9">
48 43  
49 44  
... ... @@ -73,14 +68,26 @@
73 68 <script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
74 69 <script type="text/javascript">
75 70 var seleTagNum = 1;
76   - var optionTagHtml = "";
  71 + //var optionTagHtml = "";
  72 + var tagsData;
77 73  
78   - function addSeleTags(){
79   -
80   - var seleHtml = "<select id='select"+seleTagNum+"' style='width: 100%;height: 36px;' multiple data-selectator-keep-open='true'>"+optionTagHtml+"</select>";
81   -
  74 + function addSeleTags(seleIds){
  75 + var seleHtml = "<select id='select"+seleTagNum+"' style='width: 100%;height: 36px;' multiple data-selectator-keep-open='true'>";
  76 + tagsData.forEach(function(d, i) {
  77 + seleHtml += "<option";
  78 + if(seleIds!=null) {
  79 + for(t in seleIds){
  80 + if(seleIds[t]!=""){
  81 + if (d.id == seleIds[t]) {
  82 + seleHtml += ' selected ';
  83 + }
  84 + }
  85 + }
  86 + }
  87 + seleHtml += " value='"+d.id+"'>" + d.tagName + "</option>";
  88 + });
  89 + seleHtml+="</select>";
82 90 $("#seleTagArrs").append(seleHtml);
83   -
84 91 $('#select'+seleTagNum).selectator({
85 92 prefix : 'selectator_', // CSS class prefix
86 93 height : '36', // auto or element
... ... @@ -102,11 +109,8 @@
102 109 function initTagsData(){
103 110 $.get("${ctx}/contentTags/seleList", "json", function(data) {
104 111 if (data.success) {
105   - data.data.forEach(function(d, i) {
106   - optionTagHtml += '<option value="'+d.id+'">' + d.tagName + '</option>';
107   - });
108   - //默认一个选择标签
109   - addSeleTags();
  112 + tagsData = data.data;
  113 + initSeleTags();
110 114 }
111 115 });
112 116 }
113 117  
114 118  
... ... @@ -120,12 +124,21 @@
120 124 var ue = UE.getEditor('editor',{initialFrameHeight:200,initialFrameWidth:"100%" });
121 125 });
122 126  
  127 + function initSeleTags(){
  128 + if("$!tags" != "" && "$!tags" != "[]"){
  129 + #foreach($tg in $tags)
  130 + //alert("${tg.tagsIds}".split(","));
  131 + addSeleTags("${tg.tagsIds}".split(","));
  132 + #end
  133 + }else{
  134 + //默认一个选择标签
  135 + addSeleTags();
  136 + }
  137 + }
123 138  
124   - $(function(){
125   - setTimeout(function(){
126   - initTagsData();
127   - },500);
128 139  
  140 + $(function(){
  141 + initTagsData();
129 142 if("$!id"!=""&&"$!tempInfo.isRich"==1){
130 143 $("#imageTitle").toggleClass("hidden");
131 144 $("#imageContext").toggleClass("hidden");
132 145  
133 146  
134 147  
... ... @@ -136,30 +149,24 @@
136 149 //设置编辑器的内容
137 150 ue.setContent('$!tempInfo.richText');
138 151 });
139   -
140 152 }
141 153 });
142 154  
143 155 function save(){
144 156 if($('#validForm').valid()){
145   -
146 157 var data = $('#validForm').serialize();
147 158 if($("#multChe:checked").val() == "on"){//图文指导
148 159 data+="&isRich=1";
149 160 }else{
150 161 data+="&isRich=0";
151 162 }
152   -
153 163 for(var i=1;i<seleTagNum;i++){
154 164 data+="&contentTagIds["+(i-1)+"]=,"+$("#select"+i).val()+",";
155 165 }
156   - if("$!id" == ""){
157   - data.id = $("#id").val();
158   - ajaxPost(APP.PATH + "/contentMessageTemplate/create",data);
159   - }else{
160   - ajaxPost(APP.PATH + "/contentMessageTemplate/update",data);
161   - }
162   - parent.reloadGrid('dataTable');
  166 + ajaxPost(APP.PATH + "/contentMessageTemplate/create",data,function (r) {
  167 + msg(r.message);
  168 + parent.showMessageList();//关闭弹窗
  169 + });
163 170  
164 171 // $('#validForm')[0].reset();
165 172 // UE.getEditor('editor').setContent("");
parent/center.manager/src/main/webapp/WEB-INF/views/content/template_list.html View file @ 203aa68
... ... @@ -54,7 +54,7 @@
54 54 <div class="col-sm-12">
55 55 <div id="toolbar">
56 56 <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
57   - <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
  57 + <!--<button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>-->
58 58 <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
59 59 </div>
60 60 <table id="dataTable"></table>
61 61  
62 62  
... ... @@ -76,23 +76,19 @@
76 76 ,shade: 0.6 //遮罩透明度
77 77 ,maxmin: true //允许全屏最小化
78 78 ,anim: 2 //0-6的动画形式,-1不开启
79   - ,content: "<div class='col-sm-9 col-sm-offset-1'><form action='#' class='form-horizontal m-t navbar-form navbar-left' id='validForm'><div class='form-group'><label class='col-sm-4 control-label'>版本名称:</label><div class='col-sm-5'><input type='text' class='form-control w-lg' placeholder='版本名称' id='versionName' name='versionName' aria-required='true' required></div></div><div class='col-sm-offset-12'><a onclick='saveVersion()' class='btn btn-primary navbar-btn'>提交</a></div></form></div>"
  79 + ,content: "<div class='col-sm-9 col-sm-offset-1'><form action='#' class='form-horizontal m-t navbar-form navbar-left' id='validForm'><div class='form-group'><label class='col-sm-4 control-label'>版本名称:</label><div class='col-sm-5'><input type='text' class='form-control w-lg' maxlength='10' placeholder='版本名称' id='versionName' name='versionName' aria-required='true' required></div></div><div class='col-sm-offset-12'></div></form></div>"
  80 + ,btn: ['通过','取消'] //按钮
  81 + ,yes:function(){
  82 + saveVersion();
  83 + },btn2:function(){
  84 + layer.msg('取消', {icon: 1});
  85 + }
80 86 });
81 87 }
82 88  
83 89 function del(){
84   -
85 90 var seleions = $('#dataTable').bootstrapTable("getSelections","");
86   -// alert(JSON.stringify(seleions));
87   - layer.confirm('确定删除选中的短信吗?', {
88   - btn: ['确定','取消'], //按钮
89   - shade: false //不显示遮罩
90   - }, function(){
91   - layer.msg('删除成功', {icon: 1});
92   - }, function(){
93   - layer.msg('取消删除', {shift: 6});
94   - });
95   -
  91 + goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete");
96 92 }
97 93  
98 94 function search(){
... ... @@ -125,7 +121,11 @@
125 121 function saveVersion(){
126 122 if($('#validForm').valid()){
127 123 var data = $('#validForm').serialize();
128   - ajaxPost(APP.PATH +'/contentTemplateVersion/create',data);
  124 + ajaxPost(APP.PATH +'/contentTemplateVersion/create',data,function(r){
  125 + msg(r.message);
  126 + initTempVersion();
  127 + layer.closeAll();//关闭弹窗
  128 + });
129 129 }
130 130 }
131 131 function add() {
132 132  
133 133  
... ... @@ -141,16 +141,21 @@
141 141 var templateVer = [];
142 142 var version = "";
143 143 function showMessageList(vId){
144   - version = templateVer[vId];
145   - $("#verId").val(version.id);
146   - $("#version").text(version.versionName);
  144 + if(vId!=null){
  145 + version = templateVer[vId];
  146 + }else{
  147 + layer.closeAll();//关闭弹窗
  148 + }
  149 + $("#verId").val(version.id);
  150 + $("#version").text(version.versionName);
147 151  
148 152 var querys = {verId:version.id};
  153 + var queryParams = {
  154 + query:querys
  155 + }
  156 + $('#dataTable').bootstrapTable('refresh', queryParams );
149 157  
150   - var queryParams = {
151   - query:querys
152   - }
153   - $('#dataTable').bootstrapTable('refresh', queryParams );
  158 +
154 159 }
155 160  
156 161 function initMsgTab(){
157 162  
158 163  
159 164  
... ... @@ -158,21 +163,22 @@
158 163 url: '${ctx}/contentMessageTemplate/list', //请求后台的URL(*)
159 164 method: 'get', //请求方式(*)
160 165 striped: true, //是否显示行间隔色
  166 + pagination: true,
161 167 cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
162 168 sortable: false, //是否启用排序
163 169 sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
164 170 pageNumber:1, //初始化加载第一页,默认第一页
165   - pageSize: 50, //每页的记录行数(*)
  171 + pageSize: 10, //每页的记录行数(*)
166 172 pageList: [200], //可供选择的每页的行数(*)
167 173 strictSearch: true,
168 174 onDblClickRow:function(row,ev){
169   - //alert(JSON.stringify(row));
170   -// var id = row.id;
171   -// alert(id)
172 175 popWindow("修改信息模板", APP.PATH + controllerRequestMappint + version.id+"/toEdit?id="+row.id+"&vName="+version.versionName,850,800);
173 176 },
174   - queryParams:{
175   - verId:0
  177 + queryParams:function (params) {
  178 + return {
  179 + _size: params.limit, //每页记录数
  180 + _offset: params.offset , //偏移量
  181 + };
176 182 },
177 183 clickToSelect: true, //是否启用点击选中行
178 184 //height: 600, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
179 185  
... ... @@ -189,10 +195,12 @@
189 195 visible:false
190 196 },{
191 197 field: 'content',
192   - title: '短信内容'
  198 + title: '短信内容',
  199 + width:"70%"
193 200 },{
194 201 field:'contentTagIds',
195 202 title:'标签',
  203 + width:"30%",
196 204 formatter:function(value,row,index){
197 205 var tagsNames = value.split(",");
198 206 var tagsHtml = "";
199 207  
200 208  
201 209  
202 210  
203 211  
... ... @@ -227,31 +235,41 @@
227 235 "<div class='form-group'><label class='col-sm-5 control-label'>将要复制的版本名称:</label><div class='col-sm-5'><input type='hidden' name='perId' value='"+ver+"'/>" +
228 236 "<input type='text' class='form-control w-lg' value='"+name+"' disabled></div></div>" +
229 237 "<div class='form-group'><label class='col-sm-6 control-label'>版本名称:</label><div class='col-sm-5'>" +
230   - "<input type='text' class='form-control w-lg' placeholder='版本名称' name='versionName' required></div></div>" +
231   - "<div class='col-sm-offset-9'><a onclick='saveVersion()' class='btn btn-primary navbar-btn'>提交</a></div></form></div>"
  238 + "<input type='text' class='form-control w-lg' maxlength='10' placeholder='版本名称' name='versionName' required></div></div></form></div>"
  239 + ,btn: ['通过','取消'] //按钮
  240 + ,yes:function(){
  241 + saveVersion();
  242 + },btn2:function(){
  243 + layer.msg('取消', {icon: 1});
  244 + }
232 245 });
233 246 }
234   -
235   - $(function(){
236   - initTagsData();
237   - initMsgTab();
  247 + //初始化短信版本
  248 + function initTempVersion(){
238 249 //获取消息模板版本列表
239 250 $.ajax({
240 251 url: "${ctx}/contentTemplateVersion/list",
241 252 cache: false,
242 253 dataType: "json",
243 254 success: function(data){
244   - var data = data.rows;
245 255 var versionHtml = "";
246 256 if(data){
247   - templateVer = data;
  257 + templateVer = data;
248 258 data.forEach(function(i,d){
249 259 versionHtml+="<li onclick='showMessageList("+d+")' class='list-group-item col-sm-9'>"+i.versionName+"</li><button onclick=copyVer('"+i.id+"','"+i.versionName+"') class='col-sm-3 btn'>复制</button>";
250 260 });
  261 + $("#temp_version").empty();
251 262 $("#temp_version").append(versionHtml);
252 263 }
253 264 }
254 265 });
  266 +
  267 + }
  268 +
  269 + $(function(){
  270 + initTagsData();
  271 + initMsgTab();
  272 + initTempVersion();
255 273 });
256 274  
257 275 </script>
parent/center.manager/src/main/webapp/WEB-INF/views/organ/org_list.html View file @ 203aa68
... ... @@ -64,9 +64,6 @@
64 64 title: '',
65 65 checkbox: true
66 66 },{
67   - field: 'id',
68   - title: '编号'
69   - },{
70 67 field: 'name',
71 68 title: '名称'
72 69 },{
73 70  
... ... @@ -128,13 +125,23 @@
128 125 },{
129 126 field: 'address',
130 127 title: '地址'
131   - }];
  128 + },{
  129 + field: 'id',
  130 + title: '操作',
  131 + formatter:function(value,row,index) {
  132 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=allotContent('"+value+"')>配置短信版本</button>"
  133 + }
  134 + }];
132 135  
133 136 </script>
134 137 #end
135 138 #extends("/common/base_list.html")
136 139 <script src="${ctx}/static/js/area.js"></script>
137 140 <script type="text/javascript">
  141 + function allotContent(id){
  142 + alert(id);
  143 + }
  144 +
138 145 //初始信息
139 146 get("",function(data){
140 147 handler(data,"leve0");
parent/center.manager/src/main/webapp/WEB-INF/views/tags/tags_edit.html View file @ 203aa68
1 1 #override("css") #end #override("body")
2   -<style>
3   -#select6 {
4   - width: 100%;
5   - height: 36px;
6   -}
7   -</style>
8 2 <div class="ibox float-e-margins">
9 3 <div class="ibox-content">
10 4 <div class="col-sm-12">
11 5  
12 6  
13 7  
... ... @@ -12,25 +6,27 @@
12 6 novalidate="novalidate">
13 7 <div class="form-group">
14 8 <label class="col-sm-4 control-label">父标签名称:</label>
15   - <div class="col-sm-3">
  9 + <div class="col-sm-5">
16 10 <input type="text" class="form-control" disabled class="form-control"
17   - placeholder="无" name="">
18   - <input type="text" name="perentId"/>
  11 + placeholder="无" value="$!pertTgName">
  12 + <input type="hidden" value="$!perId" name="perentId"/>
  13 + <input type="hidden" value="$!id" name="id"/>
19 14 </div>
20 15 </div>
21 16 <div class="hr-line-dashed"></div>
22 17 <div class="form-group">
23 18 <label class="col-sm-4 control-label">*标签名称:</label>
24   - <div class="col-sm-3">
25   - <input type="text" class="form-control" required class="form-control"
26   - placeholder="请填入标签名称" name="tagName">
  19 + <div class="col-sm-5">
  20 + <input type="text" maxlength="32" class="form-control" required class="form-control"
  21 + placeholder="请填入标签名称" value="$!contentTags.tagName" name="tagName">
  22 + <input type="hidden" value="$!level" name="level"/>
27 23 </div>
28 24 </div>
29 25 <div class="hr-line-dashed"></div>
30 26 <div class="form-group">
31 27 <label class="col-sm-4 control-label">*标签简介:</label>
32   - <div class="col-sm-3">
33   - <textarea class="form-control" rows="4" cols="12" aria-required="true" name="tagDesc" required="true" placeholder="请输入短信内容"></textarea>
  28 + <div class="col-sm-5">
  29 + <textarea class="form-control" maxlength="128" rows="4" cols="12" aria-required="true" name="tagDesc" required="true" placeholder="请输入短信内容">$!contentTags.tagDesc</textarea>
34 30 </div>
35 31 </div>
36 32  
37 33  
... ... @@ -54,11 +50,14 @@
54 50  
55 51 <script type="text/javascript">
56 52 function save() {
57   -
58 53 if ($('#validForm').valid()) {
59 54 var data = $('#validForm').serialize();
60   - ajaxPost(APP.PATH + "/contentTags/create", data);
61   - parent.reloadGrid('dataTable');
  55 + ajaxPost(APP.PATH + "/contentTags/create", data,function (r){
  56 + msg(r.message);
  57 + parent.search();
  58 + parent.layer.closeAll();//关闭弹窗
  59 + });
  60 +
62 61 }
63 62 }
64 63 </script>
parent/center.manager/src/main/webapp/WEB-INF/views/tags/tags_list.html View file @ 203aa68
... ... @@ -19,8 +19,8 @@
19 19 <div class="row">
20 20 <div class="col-sm-12">
21 21 <div id="toolbar">
22   - <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
23   - <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
  22 + <button class="btn btn-info " type="button" onclick='add("","0","");'><i class="fa fa-plus"></i>新增父栏目</button>
  23 + <!--<button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>-->
24 24 <!--
25 25 <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
26 26 -->
27 27  
28 28  
29 29  
30 30  
... ... @@ -42,42 +42,132 @@
42 42 }
43 43 var controllerRequestMappint = "/contentTags/";
44 44  
45   -function add() {
46   - fullWindow("新增标签", APP.PATH + controllerRequestMappint + "/toEdit");
  45 +//添加子栏目
  46 +function add(id,level,tagName) {
  47 + popWindow("新增标签", APP.PATH + controllerRequestMappint + "0/toEdit?perId="+id+"&pertTgName="+tagName+"&level="+level,800,480);
47 48 }
48 49  
49   -function edit(){
50   - var id = getSingleSelectedValue("dataTable","id");
  50 +function editTag(id){
51 51 if(id){
52   - fullWindow("修改标签", APP.PATH + controllerRequestMappint + id + "/toEdit");
  52 + popWindow("修改标签", APP.PATH + controllerRequestMappint + id + "/toEdit?level=0",800,480);
53 53 }
54 54 }
55 55  
56   -function del(){
57   - goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete");
  56 +function delTag(id){
  57 + layer.confirm('确定删除吗?', {
  58 + btn: ['确定','取消'], //按钮
  59 + shade: false //不显示遮罩
  60 + }, function(){
  61 + ajaxPost(APP.PATH + controllerRequestMappint + id + "/delete","",function(r){
  62 + msg(r.message);
  63 + reloadGrid('dataTable');
  64 + });
  65 +
  66 + //layer.msg('删除成功', {icon: 1});
  67 + }, function(){
  68 + layer.msg('取消删除', {shift: 6});
  69 + });
58 70 }
59   -var default_dataUrl = APP.PATH + controllerRequestMappint + "list";
60   -var default_dataColumns = [{
61   - field: 'perent',
62   - title: '',
63   - formatter:function(value,row,index){
64   - if(value == ""){
65   - return '无';
66   - }else {
67   - return '下一级'
68   - }
69   - }
70   - },{
71   - field: 'tagName',
72   - title: '栏目名称'
73   - },{
74   - field: 'tagDesc',
75   - title: '栏目简介'
76   - },{
77   - field: 'level',
78   - title: '栏目等级'
79   - }];
80   -
  71 +
  72 +function buildTable(tab,id){
  73 + tab.bootstrapTable({
  74 + columns: [{
  75 + field: 'tagName',
  76 + title: '标签名称',
  77 + width: '20%',
  78 + },{
  79 + field: 'tagDesc',
  80 + title: '标签简介',
  81 + width: '40%'
  82 + },{
  83 + field: 'level',
  84 + title: '栏目等级',
  85 + width: '10%',
  86 + },{
  87 + fileld:'id',
  88 + width: '20%',
  89 + formatter:function(value,row,index){
  90 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=add('"+row.id+"',"+row.level+",'"+row.tagName+"')>添加子标签</button>" +
  91 + "<button class='btn btn-sm btn-info m-r-xs' onclick=editTag('"+row.id+"')>编辑</button>" +
  92 + "<button class='btn btn-sm btn-danger' onclick=delTag('"+row.id+"')>删除</button>";
  93 + }
  94 + }],
  95 + url: APP.PATH + controllerRequestMappint + "list?perId="+id, //请求后台的URL(*)
  96 + method: 'post',
  97 + showHeader:false,
  98 + striped: true, //是否显示行间隔色
  99 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  100 + sortable: false, //是否启用排序
  101 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  102 + clickToSelect: true, //是否启用点击选中行
  103 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  104 + cardView: false, //是否显示详细视图
  105 + showColumns: false,
  106 + showExport: false,
  107 + showToggle: false,
  108 + detailView: true,
  109 + onExpandRow: function (index, row, detail) {
  110 + buildTable(detail.html('<table></table>').find('table'),row.id);
  111 + }
  112 + });
  113 +}
  114 +
  115 +$(function(){
  116 + $('#dataTable').bootstrapTable({
  117 + columns: [{
  118 + field: 'tagName',
  119 + title: '标签名称',
  120 + width: '20%',
  121 + },{
  122 + field: 'tagDesc',
  123 + title: '标签简介',
  124 + width: '40%'
  125 + },{
  126 + field: 'level',
  127 + title: '栏目等级',
  128 + width: '10%',
  129 + },{
  130 + fileld:'id',
  131 + width: '20%',
  132 + formatter:function(value,row,index){
  133 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=add('"+row.id+"',"+row.level+",'"+row.tagName+"')>添加子标签</button>" +
  134 + "<button class='btn btn-sm btn-info m-r-xs' onclick=editTag('"+row.id+"')>编辑</button>" +
  135 + "<button class='btn btn-sm btn-danger' onclick=delTag('"+row.id+"')>删除</button>";
  136 + }
  137 + }],
  138 + url: APP.PATH + controllerRequestMappint + "list", //请求后台的URL(*)
  139 + method: 'post',
  140 + contentType:'application/x-www-form-urlencoded',
  141 + toolbar: '#toolbar', //工具按钮用哪个容器
  142 + striped: true, //是否显示行间隔色
  143 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  144 + pagination: true, //是否显示分页(*)
  145 + sortable: false, //是否启用排序
  146 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  147 + pageNumber:1, //初始化加载第一页,默认第一页
  148 + pageSize: 10, //每页的记录行数(*)
  149 + pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  150 + strictSearch: true,
  151 + clickToSelect: true, //是否启用点击选中行
  152 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  153 + cardView: false, //是否显示详细视图
  154 + showRefresh: true,
  155 + showColumns: true,
  156 + showExport: true,
  157 + showToggle: true,
  158 + detailView: true,
  159 + queryParams:function (params) {
  160 + return {
  161 + _size: params.limit, //每页记录数
  162 + _offset: params.offset , //偏移量
  163 + };
  164 + },
  165 + onExpandRow: function (index, row, detail) {
  166 + buildTable(detail.html('<table></table>').find('table'),row.id);
  167 + }
  168 + });
  169 +})
  170 +
81 171 </script>
82 172 #end
83 173 #extends("/common/base_list.html")
parent/core.sdk/src/main/java/com/lyms/aop/SysLogAop.java View file @ 203aa68
... ... @@ -20,8 +20,8 @@
20 20  
21 21 import com.alibaba.fastjson.JSON;
22 22  
23   -@Aspect
24   -@Component
  23 +//@Aspect
  24 +//@Component
25 25 public class SysLogAop {
26 26 private static Logger logger = LoggerFactory.getLogger(SysLogAop.class);
27 27  
parent/core.sdk/src/main/java/com/lyms/common/db/DBPasswordCallback.java View file @ 203aa68
... ... @@ -15,35 +15,50 @@
15 15 import com.lyms.util.Base64Utils;
16 16  
17 17 /**
18   - * 数据库密码回调解密
19   - *
20   - * @author ShenHuaJie
21   - * @version 2016年5月20日 下午3:18:25
  18 + * <li>@ClassName: DBPasswordCallback
  19 + * <li>@Description: 数据库密码回调解密
  20 + * <li>@author 方承
  21 + * <li>@date 2017年5月5日
  22 + * <li>
22 23 */
23 24 @SuppressWarnings("serial")
24 25 public class DBPasswordCallback extends DruidPasswordCallback {
25   - private static final byte[] key = { 9, -1, 0, 5, 39, 8, 6, 19 };
  26 + private static final byte[] key = { 56, 43, -44, 9, 5, -41, 0, -5, -39, 8, 8, -6, 19 };
26 27  
27   - public void setProperties(Properties properties) {
28   - super.setProperties(properties);
29   - String pwd = properties.getProperty("password");
30   - if (StringUtils.isNotBlank(pwd)) {
31   - try {
32   - String password = new String(DES.decrypt(Base64Utils.decode(pwd), key));
33   - setPassword(password.toCharArray());
34   - } catch (Exception e) {
35   - setPassword(pwd.toCharArray());
36   - }
37   - } else {
38   - setPassword("".toCharArray());
39   - }
40   - }
  28 + public void setProperties(Properties properties) {
  29 + super.setProperties(properties);
  30 + String pwd = properties.getProperty("password");
  31 + if (StringUtils.isNotBlank(pwd)) {
  32 + try {
  33 + String password = new String(DES.decrypt(Base64Utils.decode(pwd), key));
  34 + setPassword(password.toCharArray());
  35 + } catch (Exception e) {
  36 + setPassword(pwd.toCharArray());
  37 + }
  38 + } else {
  39 + setPassword("".toCharArray());
  40 + }
  41 + }
41 42  
42   - // 请使用该方法加密后,把密文写入classpath:/config/jdbc.properties
43   - public static void main(String[] args) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeySpecException, Exception {
44   - String encrypt = Base64Utils.encode(DES.encrypt("root".getBytes(), key));
45   - System.out.println(encrypt);
46   - System.out.println( new String(DES.decrypt(Base64Utils.decode(encrypt), key)));
47   - }
  43 + /**
  44 + * 数据库密码回调解密
  45 + * <!--数据源加密操作-->
  46 + <bean id="dbPasswordCallback" class="com.lyms.common.db.DBPasswordCallback" lazy-init="true"/>
  47 +
  48 + <bean id="readDataSource" class="com.alibaba.druid.pool.DruidDataSource"
  49 + destroy-method="close" init-method="init" lazy-init="true">
  50 + <property name="password" value="${password}"/>
  51 +
  52 + <property name="connectionProperties" value="password=${password}"/>
  53 + <property name="passwordCallback" ref="dbPasswordCallback"/>
  54 + </bean>
  55 + */
  56 + public static void main(String[] args) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException,
  57 + IllegalBlockSizeException, BadPaddingException, InvalidKeySpecException,
  58 + Exception {
  59 + String encrypt = Base64Utils.encode(DES.encrypt("lyms2015".getBytes(), key));
  60 + System.out.println(encrypt);
  61 + System.out.println(new String(DES.decrypt(Base64Utils.decode(encrypt), key)));
  62 + }
48 63 }
parent/core.sdk/src/main/java/com/lyms/sync/SyncHandler.java View file @ 203aa68
... ... @@ -32,12 +32,12 @@
32 32 */
33 33 private static final SyncCenter center = SyncCenter.install();
34 34  
35   - public static Object handler(ChannelData data) {
  35 + public static Object handler(ChannelData data) throws Exception{
36 36 try {
37 37 return invoke(data);
38 38 } catch (Exception e) {
39 39 LOG.error("执行方法错误: {}", e);
40   - return false;
  40 + throw e;
41 41 }
42 42 }
43 43  
parent/core.sdk/src/main/java/com/lyms/sync/channel/ChannelData.java View file @ 203aa68
... ... @@ -69,6 +69,11 @@
69 69 * 出错重试次数
70 70 */
71 71 private int errorRetryCount;
  72 +
  73 + /**
  74 + * 是否成功
  75 + */
  76 + private boolean success;
72 77  
73 78 public ChannelData(String remote, String remoteClazz, String remoteMethod, String data, boolean loop) {
74 79 this.id = StrUtils.uuid();
... ... @@ -178,6 +183,14 @@
178 183  
179 184 public void setErrorRetryCount(int errorRetryCount) {
180 185 this.errorRetryCount = errorRetryCount;
  186 + }
  187 +
  188 + public boolean isSuccess() {
  189 + return success;
  190 + }
  191 +
  192 + public void setSuccess(boolean success) {
  193 + this.success = success;
181 194 }
182 195  
183 196  
parent/core.sdk/src/main/java/com/lyms/util/remote/HttpRemote.java View file @ 203aa68
... ... @@ -3,6 +3,7 @@
3 3 import java.io.IOException;
4 4 import java.util.Map;
5 5  
  6 +import org.apache.commons.lang3.builder.ToStringBuilder;
6 7 import org.apache.http.HttpEntity;
7 8 import org.apache.http.client.ClientProtocolException;
8 9 import org.apache.http.client.methods.CloseableHttpResponse;
... ... @@ -46,7 +47,7 @@
46 47 httpContext.getCookieStore().clear();
47 48 return responseUTF8(entity);
48 49 } catch (Exception e) {
49   - LOG.error("连接错误: " + e);
  50 + LOG.error("连接错误: " + e + " ChannelData: 【{}】",ToStringBuilder.reflectionToString(data));
50 51 } finally {
51 52 try {
52 53 if (response != null) {
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/diagnose/DiagnoseInfoMapper.java View file @ 203aa68
1 1 package com.lyms.hospital.dao.diagnose;
2 2  
  3 +import com.lyms.base.common.entity.conf.DiagnoseConf;
3 4 import com.lyms.base.common.entity.conf.HighriskConf;
4 5 import com.lyms.hospital.entity.diagnose.DiagnoseInfo;
5 6 import com.baomidou.mybatisplus.mapper.BaseMapper;
... ... @@ -20,6 +21,8 @@
20 21 public Integer deleteLogicById(Serializable id);
21 22  
22 23 public List<HighriskConf> getLastHighrisk(Serializable personId);
  24 +
  25 + public List<DiagnoseConf> getLastDiagnose(Serializable personId);
23 26  
24 27 }
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/diagnose/DiagnoseInfoMapper.xml View file @ 203aa68
... ... @@ -94,16 +94,27 @@
94 94  
95 95 <select id="getLastHighrisk" resultType="HighriskConf">
96 96 select c.* from (
97   - select m.* from DIAGNOSE_MAPS m where m.DIAGNOSE_ID in (
  97 + select m.* from HIGHRISK_MAPS m where m.DIAGNOSE_ID in (
98 98 select id from (
99 99 select * from DIAGNOSE_INFO d where d.person_id = #{personId} and d.HAS_HIGHRISK = 1 ORDER BY d.DIAGNOSE_TIME desc limit 0,1
100 100 ) as t
101 101 )
102   - ) m left join HIGHRISK_CONF c on m.SOURCE_ID = c.id
  102 + ) m left join HIGHRISK_CONF c on m.CONF_ID = c.id
103 103 union all
104 104 select * from (
105 105 select null as ID,'other' as source_ID , null as VERSION_ID,cus_hr_name as name,CUS_HR_COLORCODE as colorcode,CUS_HR_COLORTEXT as colortext ,999 as grouporder,999 as itemorder,dd.cus_hr_grade as grade,1 as enable from DIAGNOSE_INFO dd where dd.person_id = #{personId} and dd.HAS_HIGHRISK = 1 ORDER BY dd.DIAGNOSE_TIME desc limit 0,1
106 106 ) as tt
  107 + </select>
  108 +
  109 + <select id="getLastDiagnose" resultType="DiagnoseConf">
  110 + select c.* from (
  111 + select m.* from DIAGNOSE_MAPS m where m.DIAGNOSE_ID in (
  112 + select id from (
  113 + select * from DIAGNOSE_INFO d where d.person_id = #{personId} and d.HAS_DIAGNOSE = 1 ORDER BY d.DIAGNOSE_TIME desc limit 0,1
  114 + ) as t
  115 + )
  116 + ) m left join DIAGNOSE_CONF c on m.CONF_ID = c.id
  117 +
107 118 </select>
108 119 </mapper>
parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/impl/DiagnoseInfoServiceImpl.java View file @ 203aa68
... ... @@ -190,7 +190,6 @@
190 190 return selectList(ew);
191 191 }
192 192  
193   -
194 193 @Override
195 194 public List<DiagnoseConf> getLastDiagnose(Serializable personId) {
196 195 return baseMapper.getLastDiagnose(personId);
parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java View file @ 203aa68
... ... @@ -117,7 +117,7 @@
117 117 @RequestParam(value = "password", required = false) String password,
118 118 AjaxResult ajaxResult,
119 119 HttpServletResponse response) {
120   - System.out.println("ShiroWebUtils.getCurrentUser()="+JSONObject.toJSONString(ShiroWebUtils.getCurrentUser()));
  120 + System.out.println(JSONObject.toJSON(ShiroWebUtils.getCurrentUser()));
121 121 ajaxResult.setSuccess(false);
122 122 if (StringUtils.isEmpty(account) && (StringUtils.isEmpty(code) || StringUtils.isEmpty(password))) {
123 123 ajaxResult.setMessage("登录账户或者验证码为空,请输入!");
... ... @@ -139,6 +139,7 @@
139 139 return ajaxResult;
140 140 }
141 141 }
  142 + System.out.println(ShiroWebUtils.getCurrentUser());
142 143 Users users = ShiroWebUtils.getCurrentUser();
143 144 //Organizations organizations = organizationsService.selectById( users.getOrgId());
144 145 Map<String, Object> result = InstanceUtils.newHashMap();
parent/hospital.web/src/main/java/com/lyms/hospital/controller/RouterController.java View file @ 203aa68
... ... @@ -31,7 +31,7 @@
31 31 private static final Logger log = LoggerFactory.getLogger(RouterController.class);
32 32  
33 33 @RequestMapping(value = "/pull", produces = { MediaType.APPLICATION_JSON_VALUE })
34   - public Object pull(HttpServletRequest request) throws ClassNotFoundException, IOException {
  34 + public Object pull(HttpServletRequest request) throws Exception {
35 35 ChannelData data = SyncUtils.conver(request);
36 36 log.debug("节点数据被中心拉取:" + ToStringBuilder.reflectionToString(data));
37 37 Object handResult = SyncHandler.handler(data);
38 38  
... ... @@ -45,10 +45,10 @@
45 45 }
46 46  
47 47 @RequestMapping(value = "/push", produces = { MediaType.APPLICATION_JSON_VALUE })
48   - public Object push(HttpServletRequest request) throws ClassNotFoundException, IOException {
  48 + public Object push(HttpServletRequest request) throws Exception {
49 49 ChannelData data = SyncUtils.conver(request);
50 50 log.debug("中心推送数据到节点:" + ToStringBuilder.reflectionToString(data));
51   - Object handResult = SyncHandler.handler(data);
  51 + Object handResult = SyncHandler.handler(data);
52 52 if (data.getLoop()) {
53 53 data = (ChannelData) handResult;
54 54 } else {
parent/hospital.web/src/main/java/com/lyms/hospital/job/SyncPushToCenterJob.java View file @ 203aa68
  1 +package com.lyms.hospital.job;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.apache.commons.lang3.builder.ToStringBuilder;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.beans.factory.annotation.Value;
  10 +
  11 +import com.alibaba.fastjson.JSONObject;
  12 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  13 +import com.lyms.base.common.entity.sys.SyncDataBasic;
  14 +import com.lyms.base.common.service.sys.SyncDataBasicService;
  15 +import com.lyms.sync.channel.ChannelData;
  16 +import com.lyms.util.HttpUtils;
  17 +import com.lyms.util.JsonUtils;
  18 +
  19 +/**
  20 + * <li>@ClassName: SyncTableJob
  21 + * <li>@Description: 同步任务执行器,获取SYNC_DATA_BASIC表格的数据进行推送到中心
  22 + * <li>@author 方承
  23 + * <li>@date 2017年5月5日
  24 + * <li>
  25 + */
  26 +public class SyncPushToCenterJob {
  27 + @Value("${center.syncpush.url}")
  28 + private String CENTER_SYNCPUSH_URL;
  29 +
  30 + @Value("${isNodePushToCenter}")
  31 + private boolean isNodePushToCenter;
  32 +
  33 + private static final int ERROR_COUNT_MAX = 4;
  34 +
  35 + private static Logger log = LoggerFactory.getLogger(SyncPushToCenterJob.class);
  36 +
  37 + @Autowired
  38 + private SyncDataBasicService syncDataBasicService;
  39 +
  40 + public void excute() {
  41 + if(null != CENTER_SYNCPUSH_URL && CENTER_SYNCPUSH_URL.startsWith("http") && isNodePushToCenter){
  42 + List<SyncDataBasic> dataList = syncDataBasicService.selectList(new EntityWrapper<SyncDataBasic>().where("IFSUC=0").and("ERROR_COUNT < {0}", ERROR_COUNT_MAX));
  43 + if(dataList != null && dataList.size() > 0){
  44 + log.debug("=======开始进行 SYNC_DATA_BASIC 表格数据的推送到中心=======");
  45 + for(SyncDataBasic entity : dataList){
  46 + try{
  47 + ChannelData data = JsonUtils.jsonToBean(entity.getData(), ChannelData.class);
  48 + data.setRemote(CENTER_SYNCPUSH_URL);
  49 + log.debug("节点推送数据:"+ToStringBuilder.reflectionToString(data));
  50 + String result = HttpUtils.REMOTE.post(data);
  51 + if(result == null){//远程无法访问等情况
  52 + syncDataBasicService.errorCountAdd(entity.getId());
  53 + return;
  54 + }
  55 + ChannelData model = JsonUtils.jsonToBean(result, ChannelData.class);
  56 + if(model.isSuccess()){
  57 + entity.setIfsuc(1);
  58 + syncDataBasicService.updateById(entity);
  59 + }
  60 + }catch (Exception e) {
  61 + syncDataBasicService.errorCountAdd(entity.getId());
  62 + log.error("【SYNC_DATA_BASIC】表格数据的的推送到中心错误:SyncDataBasic = {} {}",JSONObject.toJSON(entity),e);
  63 + }
  64 + }
  65 + }
  66 + }
  67 + }
  68 +
  69 +
  70 +}
parent/hospital.web/src/main/resources/dev/conf.properties View file @ 203aa68
1   -token.prefix=token:user:
  1 +token.prefix=token.user:
  2 +
  3 +
  4 +#\u4E2D\u5FC3\u64CD\u4F5C\u63A8\u9001\u5230\u8282\u70B9
2 5 isCenterOperateSyncToNode=false
  6 +#\u8282\u70B9SyncDataBasic\u6570\u636E\u4E3B\u52A8\u63A8\u9001\u5230\u4E2D\u5FC3
  7 +isNodePushToCenter=true
  8 +#\u8282\u70B9\u63A8\u9001\u5230\u4E2D\u5FC3\u7684\u4E2D\u5FC3\u670D\u52A1url
  9 +center.syncpush.url=http://localhost:8080/center.manager/sync/push
parent/hospital.web/src/main/resources/dev/jdbc.properties View file @ 203aa68
1 1 # Datasource Configurations
2 2 jdbc.url=jdbc:mysql://119.90.57.26:3306/hospital?autoReconnect=true&useUnicode=true&characterEncoding=utf-8
3 3 jdbc.username=hospital
4   -jdbc.password=lyms2015
  4 +jdbc.password=p6CBLGB3pp7LZCJXI2+1cA==
5 5  
6 6 druid.initialSize=10
7 7 druid.minIdle=10
parent/hospital.web/src/main/resources/logback.xml View file @ 203aa68
... ... @@ -30,21 +30,21 @@
30 30 <!-- 下面配置一些第三方包的日志过滤级别,用于避免刷屏 -->
31 31 <!-- 打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF 默认是DEBUG -->
32 32 <logger name="org.springframework" level="INFO"/>
  33 + <logger name="com.baomidou" level="INFO"/>
33 34 <logger name="org.apache" level="INFO"/>
34 35 <logger name="org.mybatis.spring" level="INFO"/>
35 36 <logger name="org.apache.ibatis" level="INFO"/>
36 37 <logger name="org.quartz" level="INFO"/>
  38 + <logger name="org.hibernate.validator" level="INFO"/>
37 39 <logger name="net.sf.ehcache" level="WARN"/>
38 40 <logger name="org.apache.shiro" level="WARN"/>
39 41 <logger name="com.alibaba.druid.pool" level="WARN"/>
40 42 <logger name="org.quartz.core" level="WARN"/>
41 43 <logger name="org.springframework.scheduling.quartz" level="WARN"/>
42 44 <logger name="org.apache.commons" level="WARN"/>
43   -
44 45 <logger name="org.apache.velocity" level="WARN"/>
45 46 <logger name="org.apache.velocity.tools.view" level="ERROR"/>
46 47  
47   -
48   -
  48 + <logger name="com.lyms.base.common.dao.sys.SyncDataBasicMapper.selectList" level="INFO"/>
49 49 </configuration>
parent/hospital.web/src/main/resources/xml/app-datasource.xml View file @ 203aa68
... ... @@ -10,6 +10,8 @@
10 10  
11 11 <!-- 启用CGliB -->
12 12 <aop:aspectj-autoproxy proxy-target-class="true" />
  13 +
  14 + <bean id="dbPasswordCallback" class="com.lyms.common.db.DBPasswordCallback" lazy-init="true"/>
13 15  
14 16 <!-- base dataSource -->
15 17 <bean name="baseDataSource" class="com.alibaba.druid.pool.DruidDataSource"
... ... @@ -45,6 +47,8 @@
45 47 <!-- <property name="driverClassName" value="com.mysql.jdbc.Driver" /> -->
46 48 <property name="username" value="${jdbc.username}" />
47 49 <property name="password" value="${jdbc.password}" />
  50 + <property name="connectionProperties" value="password=${jdbc.password}"/>
  51 + <property name="passwordCallback" ref="dbPasswordCallback"/>
48 52 </bean>
49 53  
50 54  
parent/hospital.web/src/main/resources/xml/app-timer.xml View file @ 203aa68
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<beans xmlns="http://www.springframework.org/schema/beans"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xmlns:context="http://www.springframework.org/schema/context"
  5 + xmlns:tx="http://www.springframework.org/schema/tx"
  6 + xmlns:task="http://www.springframework.org/schema/task"
  7 + xmlns:aop="http://www.springframework.org/schema/aop"
  8 + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
  9 + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
  10 + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
  11 + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
  12 + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
  13 + ">
  14 +
  15 + <!-- 同步远程数据, 定时任务处理同步任务 -->
  16 + <task:scheduled-tasks>
  17 + <task:scheduled ref="syncPushToCenterJob" method="excute" cron="*/5 * * * * ?"/>
  18 + </task:scheduled-tasks>
  19 +
  20 + <bean class="com.lyms.hospital.job.SyncPushToCenterJob" id="syncPushToCenterJob"/>
  21 +
  22 +</beans>
parent/hospital.web/src/test/java/test/hospital/diagnose/DiagnoseMapsTest.java View file @ 203aa68
... ... @@ -36,7 +36,7 @@
36 36 DiagnoseMaps entity = new DiagnoseMaps();
37 37 entity.setId(StrUtils.uuid());
38 38 entity.setDiagnoseId("1");
39   - entity.setSourceId("123");
  39 + entity.setConfId("123");
40 40 diagnoseMapsService.insert(entity);
41 41 }
42 42  
parent/hospital.web/src/test/java/test/hospital/highrisk/HighriskMapsTest.java View file @ 203aa68
... ... @@ -31,7 +31,7 @@
31 31 HighriskMaps entity = new HighriskMaps();
32 32 entity.setId(StrUtils.uuid());
33 33 entity.setDiagnoseId("1");
34   - entity.setSourceId("123");
  34 + entity.setConfId("123");
35 35 highriskMapsService.insert(entity);
36 36 }
37 37 }