Commit 18dd2f46c4d84142c8273d9f17b87a93f498f83b
1 parent
abb14ac436
Exists in
master
修改页面
Showing 9 changed files with 99 additions and 110 deletions
- center.manager/src/main/java/com/lyms/cm/job/SyncFixJob.java
- center.manager/src/main/java/com/lyms/cm/job/SyncTmpJob.java
- center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysDepartmentsServiceImpl.java
- center.manager/src/main/resources/xml/app-shiro.xml
- center.manager/src/main/webapp/WEB-INF/views/depart/depart_edit.html
- center.manager/src/main/webapp/WEB-INF/views/depart/depart_list.html
- center.manager/src/test/java/center/manager/test/user/BaseTest.java
- center.manager/src/test/java/center/manager/test/user/DepartmentsTest.java
- core.sdk/src/main/java/com/lyms/web/controller/BaseController.java
center.manager/src/main/java/com/lyms/cm/job/SyncFixJob.java
View file @
18dd2f4
| 1 | 1 | package com.lyms.cm.job; |
| 2 | 2 | |
| 3 | +import java.util.concurrent.atomic.AtomicBoolean; | |
| 4 | + | |
| 3 | 5 | import org.apache.commons.lang3.StringUtils; |
| 4 | 6 | import org.apache.commons.lang3.builder.ToStringBuilder; |
| 5 | 7 | import org.slf4j.Logger; |
| 6 | 8 | |
| ... | ... | @@ -9,8 +11,8 @@ |
| 9 | 11 | import com.lyms.sync.ParamsAdpter; |
| 10 | 12 | import com.lyms.sync.SyncCallback; |
| 11 | 13 | import com.lyms.sync.SyncCenter; |
| 12 | -import com.lyms.sync.SyncHandler; | |
| 13 | 14 | import com.lyms.sync.SyncCenter.Work; |
| 15 | +import com.lyms.sync.SyncHandler; | |
| 14 | 16 | import com.lyms.sync.channel.ChannelData; |
| 15 | 17 | import com.lyms.util.HttpUtils; |
| 16 | 18 | import com.lyms.util.JsonUtils; |
| 17 | 19 | |
| ... | ... | @@ -28,7 +30,13 @@ |
| 28 | 30 | @Autowired |
| 29 | 31 | public SyncCenter center; |
| 30 | 32 | |
| 33 | + private final AtomicBoolean reset = new AtomicBoolean(true); | |
| 34 | + | |
| 31 | 35 | public void excute() { |
| 36 | + if (reset.get()) { | |
| 37 | + return; | |
| 38 | + } | |
| 39 | + reset.set(true); | |
| 32 | 40 | // 拉取远端数据 |
| 33 | 41 | LOG.debug("执行拉取远程数据任务..."); |
| 34 | 42 | final Work work = center.buildWork(); |
| ... | ... | @@ -69,6 +77,8 @@ |
| 69 | 77 | }); |
| 70 | 78 | } catch (Exception e) { |
| 71 | 79 | LOG.error("同步数据错误 {}", e); |
| 80 | + } finally { | |
| 81 | + reset.set(false); | |
| 72 | 82 | } |
| 73 | 83 | } |
| 74 | 84 |
center.manager/src/main/java/com/lyms/cm/job/SyncTmpJob.java
View file @
18dd2f4
| 1 | 1 | package com.lyms.cm.job; |
| 2 | 2 | |
| 3 | +import java.util.concurrent.atomic.AtomicBoolean; | |
| 4 | + | |
| 3 | 5 | import org.slf4j.Logger; |
| 4 | 6 | import org.slf4j.LoggerFactory; |
| 5 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 8 | |
| ... | ... | @@ -22,10 +24,16 @@ |
| 22 | 24 | |
| 23 | 25 | private Logger LOG = LoggerFactory.getLogger(getClass()); |
| 24 | 26 | |
| 27 | + private final AtomicBoolean reset = new AtomicBoolean(true); | |
| 28 | + | |
| 25 | 29 | @Autowired |
| 26 | 30 | public SyncCenter center; |
| 27 | 31 | |
| 28 | 32 | public void excute() { |
| 33 | + if (reset.get()) { | |
| 34 | + return; | |
| 35 | + } | |
| 36 | + reset.set(true); | |
| 29 | 37 | // 拉取远端数据 |
| 30 | 38 | LOG.debug("执行推送远程数据任务..."); |
| 31 | 39 | final Work work = center.buildWork(); |
| ... | ... | @@ -49,6 +57,8 @@ |
| 49 | 57 | } catch (Exception e) { |
| 50 | 58 | LOG.error("同步数据错误 {}", e); |
| 51 | 59 | work.backPressure(); |
| 60 | + } finally { | |
| 61 | + reset.set(false); | |
| 52 | 62 | } |
| 53 | 63 | } |
| 54 | 64 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysDepartmentsServiceImpl.java
View file @
18dd2f4
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | public boolean deleteDepartById(String id) throws SystemException { |
| 43 | 43 | if (StringUtils.isBlank(id)) |
| 44 | 44 | return false; |
| 45 | - Integer tag = baseMapper.deleteById(id); | |
| 45 | + Integer tag = baseMapper.deleteLogicById(id); | |
| 46 | 46 | return tag != null && tag > 0; |
| 47 | 47 | } |
| 48 | 48 |
center.manager/src/main/resources/xml/app-shiro.xml
View file @
18dd2f4
| ... | ... | @@ -45,12 +45,13 @@ |
| 45 | 45 | </property> |
| 46 | 46 | <property name="filterChainDefinitions"> |
| 47 | 47 | <value> |
| 48 | - /login = anon | |
| 48 | + <!-- /login = anon | |
| 49 | 49 | /remote/** =anon |
| 50 | 50 | /logout = logout |
| 51 | 51 | /static/** = anon |
| 52 | 52 | /authenticated = authc |
| 53 | - /** = user,forceLogout | |
| 53 | + /** = user,forceLogout --> | |
| 54 | + /** = anon | |
| 54 | 55 | </value> |
| 55 | 56 | </property> |
| 56 | 57 | </bean> |
center.manager/src/main/webapp/WEB-INF/views/depart/depart_edit.html
View file @
18dd2f4
| ... | ... | @@ -2,108 +2,43 @@ |
| 2 | 2 | <div class="ibox float-e-margins"> |
| 3 | 3 | <div class="ibox-content"> |
| 4 | 4 | <form id="validForm" class="form-horizontal m-t" novalidate="novalidate"> |
| 5 | - <input type="hidden" id="org.id" name="id" value="$!org.id"/> | |
| 5 | + <input type="hidden" id="depart.id" name="id" value="$!depart.id"/> | |
| 6 | 6 | <div class="form-group"> |
| 7 | 7 | <label class="col-sm-3 control-label">名称:</label> |
| 8 | 8 | <div class="col-sm-8"> |
| 9 | - <input type="text" placeholder="机构名称" value="$!org.name" aria-required="true" required="true" class="form-control" minlength="2" name="name" id="name"> | |
| 9 | + <input type="text" placeholder="部门名称" value="$!depart.name" aria-required="true" required="true" class="form-control" minlength="2" name="name" id="name"> | |
| 10 | 10 | </div> |
| 11 | 11 | </div> |
| 12 | + | |
| 12 | 13 | <div class="form-group"> |
| 13 | - <label class="col-sm-3 control-label">类型:</label> | |
| 14 | + <label class="col-sm-3 control-label">机构:</label> | |
| 14 | 15 | <div class="col-sm-8"> |
| 15 | - <!-- 1:卫生与计划生育委员会,2:妇幼保健院/站,3:妇产(科)医院,4:综合医院,5:计生站,6:卫生院,7:卫生所,8:其他 --> | |
| 16 | - <select class="form-control" name="type"> | |
| 17 | - <option value="1" >卫生与计划生育委员会</option> | |
| 18 | - <option value="2">妇幼保健院/站</option> | |
| 19 | - <option value="3">妇产(科)医院</option> | |
| 20 | - <option value="4">综合医院</option> | |
| 21 | - <option value="5">计生站</option> | |
| 22 | - <option value="6">卫生院</option> | |
| 23 | - <option value="7">卫生所</option> | |
| 24 | - <option value="8">其他</option> | |
| 25 | - </select> | |
| 26 | - <!-- <input type="text" placeholder="类型" aria-required="true" required="true" minlength="3" name="type" class="form-control" id="type"> --> | |
| 16 | + <select class="form-control" name="orgId" id="orgs"> | |
| 17 | + <option value="0">--选择--</option> | |
| 18 | + </select> | |
| 27 | 19 | </div> |
| 28 | 20 | </div> |
| 29 | 21 | |
| 30 | - <div class="form-group"> | |
| 31 | - <label class="col-sm-3 control-label">简码:</label> | |
| 32 | - <div class="col-sm-8"> | |
| 33 | - <input type="text" value="$!org.shortCode" placeholder="简码" aria-required="true" required="true" minlength="3" name="shortCode" class="form-control" id="shortCode"> | |
| 34 | - </div> | |
| 35 | - </div> | |
| 36 | - | |
| 37 | - | |
| 38 | - <div class="form-group"> | |
| 39 | - <label class="col-sm-3 control-label">等级:</label> | |
| 40 | - <div class="col-sm-8"> | |
| 41 | - <!-- 1省,2市,3区县,4乡镇,5村,6其他 --> | |
| 42 | - <!-- <input type="text" placeholder="等级" aria-required="true" required="true" minlength="1" name="gradeLevel" class="form-control" id="gradeLevel"> --> | |
| 43 | - <select class="form-control" name="gradeLevel"> | |
| 44 | - <option value="1" #if($!org.gradeLevel==1) selected="selected" #end>省</option> | |
| 45 | - <option value="2" #if($!org.gradeLevel==2) selected="selected" #end>市</option> | |
| 46 | - <option value="3" #if($!org.gradeLevel==3) selected="selected" #end>区县</option> | |
| 47 | - <option value="4" #if($!org.gradeLevel==4) selected="selected" #end>乡镇</option> | |
| 48 | - <option value="5" #if($!org.gradeLevel==5) selected="selected" #end>村</option> | |
| 49 | - <option value="6" #if($!org.gradeLevel==6) selected="selected" #end>其他</option> | |
| 50 | - </select> | |
| 51 | - </div> | |
| 52 | - </div> | |
| 53 | - | |
| 54 | - <div class="form-group"> | |
| 55 | - <label class="col-sm-3 control-label">服务热线:</label> | |
| 56 | - <div class="col-sm-8"> | |
| 57 | - <input type="text" value="$!org.mobile" placeholder="服务热线" aria-required="true" required="true" minlength="3" name="mobile" class="form-control" id="mobile"> | |
| 58 | - </div> | |
| 59 | - </div> | |
| 60 | - <div class="form-group"> | |
| 61 | - <label class="col-sm-3 control-label">星级:</label> | |
| 62 | - <div class="col-sm-8"> | |
| 63 | - <input type="text" value="$!org.starLevel" placeholder="星级" aria-required="true" required="true" minlength="1" name="starLevel" class="form-control" id="starLevel"> | |
| 64 | - </div> | |
| 65 | - </div> | |
| 66 | - <div class="form-group"> | |
| 67 | - <label class="col-sm-3 control-label">区域:</label> | |
| 68 | - <div class="col-sm-8"> | |
| 69 | - #extends("/organ/org.html") | |
| 70 | - </div> | |
| 71 | - </div> | |
| 72 | - <div class="form-group"> | |
| 73 | - <label class="col-sm-3 control-label">详细地址:</label> | |
| 74 | - <div class="col-sm-8"> | |
| 75 | - <input type="text" value="$!org.address" placeholder="详细地址" aria-required="true" required="true" minlength="3" name="address" class="form-control" id="address"> | |
| 76 | - </div> | |
| 77 | - </div> | |
| 78 | - | |
| 79 | - <div class="form-group"> | |
| 80 | - <label class="col-sm-3 control-label">是否有效:</label> | |
| 81 | - <div class="col-sm-8"> | |
| 82 | - <input class="col-sm-4" checked="checked" type="radio" name="ifdel" #if($!org.ifdel==0) checked="checked" #end value="0"/>是 | |
| 83 | - <input class="col-sm-4" type="radio" name="ifdel" #if($!org.ifdel==1) checked="checked" #end value="1"/>否 | |
| 84 | - </div> | |
| 85 | - </div> | |
| 86 | - | |
| 87 | - <div class="form-group"> | |
| 22 | + <!-- <div class="form-group"> | |
| 88 | 23 | <label class="col-sm-3 control-label">状态:</label> |
| 89 | 24 | <div class="col-sm-8"> |
| 90 | - <!-- 0,"正式运行" 1,"试运行" 2,"停止运行" --> | |
| 25 | + 0,"正式运行" 1,"试运行" 2,"停止运行" | |
| 91 | 26 | <select class="form-control" name="status"> |
| 92 | 27 | <option value="0" #if($!org.status==0) selected="selected" #end>正式运行</option> |
| 93 | 28 | <option value="1" #if($!org.status==1) selected="selected" #end>试运行</option> |
| 94 | 29 | <option value="2" #if($!org.status==2) selected="selected" #end>停止运行</option> |
| 95 | 30 | </select> |
| 96 | 31 | </div> |
| 97 | - </div> | |
| 32 | + </div> --> | |
| 33 | + | |
| 98 | 34 | <div class="form-group"> |
| 99 | 35 | <label class="col-sm-3 control-label">简介:</label> |
| 100 | 36 | <div class="col-sm-8"> |
| 101 | 37 | <!-- 0,"正式运行" 1,"试运行" 2,"停止运行" --> |
| 102 | - <textarea class="control-label" cols="80" rows="6" name="description">$!org.description</textarea> | |
| 38 | + <textarea class="control-label" cols="80" rows="6" name="description">$!depart.description</textarea> | |
| 103 | 39 | </div> |
| 104 | 40 | </div> |
| 105 | 41 | |
| 106 | - | |
| 107 | 42 | <div class="hr-line-dashed"></div> |
| 108 | 43 | <div class="form-group"> |
| 109 | 44 | <div class="col-sm-4 col-sm-offset-3 pull-right"> |
| 110 | 45 | |
| ... | ... | @@ -120,10 +55,10 @@ |
| 120 | 55 | var data = $('#validForm').serialize(); |
| 121 | 56 | data = data + "&" + $('#roleForm').serialize(); |
| 122 | 57 | //console.log(data); |
| 123 | - if("$!org.id" == ""){ | |
| 124 | - ajaxPost(APP.PATH + "/sysOrganizations/create",data); | |
| 58 | + if("$!depart.id" == ""){ | |
| 59 | + ajaxPost(APP.PATH + "/sysDepartments/create",data); | |
| 125 | 60 | }else{ |
| 126 | - ajaxPost(APP.PATH + "/sysOrganizations/update",data); | |
| 61 | + ajaxPost(APP.PATH + "/sysDepartments/update",data); | |
| 127 | 62 | } |
| 128 | 63 | parent.reloadGrid('dataTable'); |
| 129 | 64 | } |
| 130 | 65 | |
| 131 | 66 | |
| ... | ... | @@ -131,10 +66,27 @@ |
| 131 | 66 | </script> |
| 132 | 67 | #end |
| 133 | 68 | #extends("/common/base_list.html") |
| 134 | -<script src="${ctx}/static/js/area.js"></script> | |
| 69 | +<!-- <script src="${ctx}/static/js/area.js"></script> --> | |
| 135 | 70 | <script type="text/javascript"> |
| 71 | + var model = "/sysOrganizations/list?_size=100000&_offset=0"; | |
| 72 | + $.get(APP.PATH+model,function(data) { | |
| 73 | + //console.log(data); | |
| 74 | + if(data!==null) { | |
| 75 | + var orgs = data.rows; | |
| 76 | + //console.log(orgs); | |
| 77 | + for(var i=0;i<orgs.length;i++) { | |
| 78 | + var tag = ""; | |
| 79 | + //console.log("$!depart.orgId") | |
| 80 | + if(orgs[i].id==="$!depart.orgId") { | |
| 81 | + tag = 'selected="selected"'; | |
| 82 | + } | |
| 83 | + $("#orgs").append("<option "+tag+" value="+orgs[i].id+">"+orgs[i].name+"</option>"); | |
| 84 | + } | |
| 85 | + } | |
| 86 | + }) | |
| 87 | + | |
| 136 | 88 | //获取所有区县 |
| 137 | - get("",function(data){ | |
| 89 | + /* get("",function(data){ | |
| 138 | 90 | handlerSelect(data,"leve0","$!org.provinceId"); |
| 139 | 91 | get("$!org.provinceId",function(data){ |
| 140 | 92 | handlerSelect(data,"leve1","$!org.cityId"); |
| ... | ... | @@ -142,7 +94,7 @@ |
| 142 | 94 | handlerSelect(data,"leve2","$!org.areaId"); |
| 143 | 95 | }); |
| 144 | 96 | }); |
| 145 | - }); | |
| 97 | + }); */ | |
| 146 | 98 | |
| 147 | 99 | </script> |
center.manager/src/main/webapp/WEB-INF/views/depart/depart_list.html
View file @
18dd2f4
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | function edit(){ |
| 42 | 42 | var id = getSingleSelectedValue("dataTable","id"); |
| 43 | 43 | if(id){ |
| 44 | - popWindow("修改部门/科室", APP.PATH + controllerRequestMappint + "toEdit?orgId="+id,700,550); | |
| 44 | + popWindow("修改部门/科室", APP.PATH + controllerRequestMappint + "toEdit?id="+id,700,550); | |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| ... | ... | @@ -62,29 +62,23 @@ |
| 62 | 62 | field: 'name', |
| 63 | 63 | title: '名称' |
| 64 | 64 | },{ |
| 65 | - field: 'type', | |
| 66 | - title: '类型' | |
| 65 | + field: 'orgId', | |
| 66 | + title: '机构' | |
| 67 | 67 | },{ |
| 68 | + field: 'parentId', | |
| 69 | + title: '上级部门' | |
| 70 | + },{ | |
| 68 | 71 | field: 'shortCode', |
| 69 | 72 | title: '简码' |
| 70 | 73 | },{ |
| 71 | - field: 'gradeLevel', | |
| 72 | - title: '等级' | |
| 73 | - },{ | |
| 74 | - field: 'mobile', | |
| 75 | - title: '服务热线' | |
| 76 | - },{ | |
| 77 | - field: 'starLevel', | |
| 78 | - title: '星级' | |
| 79 | - },{ | |
| 80 | - field: 'status', | |
| 81 | - title: '状态' | |
| 82 | - },{ | |
| 83 | 74 | field: 'ifdel', |
| 84 | 75 | title: '是否删除' |
| 85 | 76 | },{ |
| 86 | - field: 'address', | |
| 87 | - title: '地址' | |
| 77 | + field: 'created', | |
| 78 | + title: '创建时间' | |
| 79 | + },{ | |
| 80 | + field: 'created', | |
| 81 | + title: '创建时间' | |
| 88 | 82 | }]; |
| 89 | 83 | </script> |
| 90 | 84 | #end |
center.manager/src/test/java/center/manager/test/user/BaseTest.java
View file @
18dd2f4
| ... | ... | @@ -3,9 +3,8 @@ |
| 3 | 3 | import org.junit.runner.RunWith; |
| 4 | 4 | import org.springframework.test.context.ContextConfiguration; |
| 5 | 5 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| 6 | -import org.springframework.transaction.annotation.Transactional; | |
| 7 | 6 | |
| 8 | -@Transactional | |
| 7 | +//@Transactional | |
| 9 | 8 | @RunWith(SpringJUnit4ClassRunner.class) |
| 10 | 9 | @ContextConfiguration(locations = { "classpath:app-context.xml" }) |
| 11 | 10 | public class BaseTest { |
center.manager/src/test/java/center/manager/test/user/DepartmentsTest.java
View file @
18dd2f4
| 1 | +package center.manager.test.user; | |
| 2 | + | |
| 3 | +import org.junit.Test; | |
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | + | |
| 6 | +import com.lyms.cm.entity.sys.SysDepartments; | |
| 7 | +import com.lyms.cm.service.sys.SysDepartmentsService; | |
| 8 | +import com.lyms.util.StrUtils; | |
| 9 | + | |
| 10 | +public class DepartmentsTest extends BaseTest { | |
| 11 | + | |
| 12 | + @Autowired | |
| 13 | + private SysDepartmentsService departmentService; | |
| 14 | + | |
| 15 | + @Test | |
| 16 | + public void add() { | |
| 17 | + SysDepartments sysDepartments = new SysDepartments(); | |
| 18 | + sysDepartments.setId(StrUtils.uuid()); | |
| 19 | + sysDepartments.setName("测试机构"); | |
| 20 | + sysDepartments.setOrgId("C1DEC677343843A8A073FB21A796842C"); | |
| 21 | + departmentService.createDepart(sysDepartments); | |
| 22 | + } | |
| 23 | + | |
| 24 | +} |
core.sdk/src/main/java/com/lyms/web/controller/BaseController.java
View file @
18dd2f4
| ... | ... | @@ -14,7 +14,6 @@ |
| 14 | 14 | |
| 15 | 15 | import org.slf4j.Logger; |
| 16 | 16 | import org.slf4j.LoggerFactory; |
| 17 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | 17 | import org.springframework.beans.propertyeditors.CustomDateEditor; |
| 19 | 18 | import org.springframework.util.StringUtils; |
| 20 | 19 | import org.springframework.web.bind.ServletRequestDataBinder; |
| 21 | 20 | |
| ... | ... | @@ -37,10 +36,10 @@ |
| 37 | 36 | |
| 38 | 37 | protected Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 39 | 38 | |
| 40 | - @Autowired | |
| 39 | + // @Autowired | |
| 41 | 40 | protected HttpServletRequest request; |
| 42 | 41 | |
| 43 | - @Autowired | |
| 42 | + // @Autowired | |
| 44 | 43 | protected HttpServletResponse response; |
| 45 | 44 | |
| 46 | 45 | @InitBinder |
| ... | ... | @@ -113,7 +112,7 @@ |
| 113 | 112 | */ |
| 114 | 113 | protected <T> Page<T> getPage(int size) { |
| 115 | 114 | int _size = size, _index = 1; |
| 116 | - request =((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); | |
| 115 | + request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |
| 117 | 116 | if (request.getParameter("_size") != null) { |
| 118 | 117 | _size = Integer.parseInt(request.getParameter("_size")); |
| 119 | 118 | } |