特定服务(APP)功能修改,增加特定服务码字段

This commit is contained in:
zhangwei
2018-06-21 09:12:25 +08:00
parent 5f401d6f1f
commit 0866888337
6 changed files with 46 additions and 44 deletions

View File

@@ -17,7 +17,7 @@ public class SpecificServiceCfg extends BaseEntity<SpecificServiceCfg>{
private static final long serialVersionUID = -1133644323636425766L; private static final long serialVersionUID = -1133644323636425766L;
private Integer specServiceId; //spec_service_id 协议ID int N 主键,初始化 private Integer specServiceId; //spec_service_id 协议ID int N 主键,初始化
//private Integer specServiceCode; //协议编码 int N 暂定,以后可扩展 1000微信 , 1001QQ private Integer specServiceCode; //协议编码 int N 暂定,以后可扩展 1000微信 , 1001QQ
private String specServiceName; //spec_service_name 协议名称 varchar(64) N private String specServiceName; //spec_service_name 协议名称 varchar(64) N
private String specServiceDesc; //spec_service_desc 协议描述 varchar2(64) N private String specServiceDesc; //spec_service_desc 协议描述 varchar2(64) N
private Integer isValid; //is_valid 有效标志 int N 1-有效 0-无效 private Integer isValid; //is_valid 有效标志 int N 1-有效 0-无效
@@ -36,6 +36,12 @@ public class SpecificServiceCfg extends BaseEntity<SpecificServiceCfg>{
public void setSpecServiceId(Integer specServiceId) { public void setSpecServiceId(Integer specServiceId) {
this.specServiceId = specServiceId; this.specServiceId = specServiceId;
} }
public Integer getSpecServiceCode() {
return specServiceCode;
}
public void setSpecServiceCode(Integer specServiceCode) {
this.specServiceCode = specServiceCode;
}
public String getSpecServiceName() { public String getSpecServiceName() {
return specServiceName; return specServiceName;
} }

View File

@@ -147,9 +147,9 @@ public class SpecificServiceCfgController extends BaseController {
@RequiresPermissions(value= {"specific:service:add","specific:service:edit"},logical=Logical.OR) @RequiresPermissions(value= {"specific:service:add","specific:service:edit"},logical=Logical.OR)
@RequestMapping(value="saveOrUpdate") @RequestMapping(value="saveOrUpdate")
public String saveOrUpdate(SpecificServiceCfg specificServiceCfg, Model model, public String saveOrUpdate(SpecificServiceCfg specificServiceCfg, Model model,
RedirectAttributes redirectAttributes,Integer oldId) { RedirectAttributes redirectAttributes) {
try { try {
specificServiceCfgService.saveOrUpdate(specificServiceCfg,oldId); specificServiceCfgService.saveOrUpdate(specificServiceCfg);
addMessage(redirectAttributes, "save_success"); addMessage(redirectAttributes, "save_success");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@@ -4,6 +4,7 @@
<resultMap id="CFGResultMap" type="com.nis.domain.specific.SpecificServiceCfg" > <resultMap id="CFGResultMap" type="com.nis.domain.specific.SpecificServiceCfg" >
<id column="spec_service_id" property="specServiceId" jdbcType="INTEGER" /> <id column="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="spec_service_code" property="specServiceCode" jdbcType="INTEGER" />
<result column="spec_service_name" property="specServiceName" jdbcType="VARCHAR" /> <result column="spec_service_name" property="specServiceName" jdbcType="VARCHAR" />
<result column="spec_service_desc" property="specServiceDesc" jdbcType="VARCHAR" /> <result column="spec_service_desc" property="specServiceDesc" jdbcType="VARCHAR" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" /> <result column="is_valid" property="isValid" jdbcType="INTEGER" />
@@ -18,6 +19,7 @@
<sql id="specificServiceCfgColumns"> <sql id="specificServiceCfgColumns">
s.spec_service_id AS specServiceId, s.spec_service_id AS specServiceId,
s.spec_service_code AS specServiceCode,
s.spec_service_name AS specServiceName, s.spec_service_name AS specServiceName,
s.spec_service_desc AS specServiceDesc, s.spec_service_desc AS specServiceDesc,
s.is_valid AS isValid, s.is_valid AS isValid,
@@ -62,6 +64,9 @@
<if test="specServiceId != null"> <if test="specServiceId != null">
AND s2.spec_service_id like '%${specServiceId}%' AND s2.spec_service_id like '%${specServiceId}%'
</if> </if>
<if test="specServiceCode != null">
AND spec_service_code = #{specServiceCode}
</if>
<if test="specServiceName != null and specServiceName != '' "> <if test="specServiceName != null and specServiceName != '' ">
AND s2.spec_service_name like '%${specServiceName}%' AND s2.spec_service_name like '%${specServiceName}%'
</if> </if>
@@ -93,7 +98,10 @@
<select id="findAllSpecificServiceCfg" resultMap="CFGResultMap" > <select id="findAllSpecificServiceCfg" resultMap="CFGResultMap" >
SELECT * from specific_service_cfg where is_valid = 1 SELECT * from specific_service_cfg where is_valid = 1
<if test="specificServiceCfg.specServiceId != null"> <if test="specificServiceCfg.specServiceId != null">
AND spec_service_id like '%${specificServiceCfg.specServiceId}%' AND spec_service_id =#{specificServiceCfg.specServiceId}
</if>
<if test="specificServiceCfg.specServiceCode != null">
AND spec_service_id =#{specificServiceCfg.specServiceCode}
</if> </if>
<if test="specificServiceCfg.specServiceName != null and specificServiceCfg.specServiceName != '' "> <if test="specificServiceCfg.specServiceName != null and specificServiceCfg.specServiceName != '' ">
AND spec_service_name like '%${specificServiceCfg.specServiceName}%' AND spec_service_name like '%${specificServiceCfg.specServiceName}%'
@@ -122,22 +130,22 @@
<!-- 新增 --> <!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true"> <insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true">
insert into specific_service_cfg (spec_service_id,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id) insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id)
values(#{specServiceId},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId}) values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId})
</insert> </insert>
<!-- 修改 --> <!-- 修改 -->
<update id="update" parameterType="com.nis.domain.specific.SpecificServiceCfg"> <update id="update" parameterType="com.nis.domain.specific.SpecificServiceCfg">
UPDATE specific_service_cfg s SET UPDATE specific_service_cfg s SET
s.spec_service_id = #{specificServiceCfg.specServiceId}, s.spec_service_code = #{specServiceCode},
s.spec_service_name = #{specificServiceCfg.specServiceName}, s.spec_service_name = #{specServiceName},
s.spec_service_desc = #{specificServiceCfg.specServiceDesc}, s.spec_service_desc = #{specServiceDesc},
s.is_valid = #{specificServiceCfg.isValid}, s.is_valid = #{isValid},
s.op_time = #{specificServiceCfg.opTime}, s.op_time = #{opTime},
s.parent_id = #{specificServiceCfg.parent.specServiceId}, s.parent_id = #{parent.specServiceId},
s.is_leaf = #{specificServiceCfg.isLeaf}, s.is_leaf = #{isLeaf},
s.group_id = #{specificServiceCfg.groupId} s.group_id = #{groupId}
WHERE s.spec_service_id = #{oldId} WHERE s.spec_service_id = #{specServiceId}
</update> </update>
<!-- 删除 --> <!-- 删除 -->

View File

@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -13,6 +14,7 @@ import com.nis.domain.Page;
import com.nis.domain.specific.ConfigGroupInfo; import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.domain.specific.SpecificServiceCfg; import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.main.ConvertTool; import com.nis.main.ConvertTool;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.StringUtil; import com.nis.util.StringUtil;
import com.nis.web.dao.specific.SpecificServiceCfgDao; import com.nis.web.dao.specific.SpecificServiceCfgDao;
import com.nis.web.service.BaseService; import com.nis.web.service.BaseService;
@@ -65,9 +67,10 @@ public class SpecificServiceCfgService extends BaseService{
* @throws Exception * @throws Exception
*/ */
@Transactional(readOnly=false,rollbackFor=RuntimeException.class) @Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(SpecificServiceCfg specificServiceCfg, Integer oldId) throws Exception { public void saveOrUpdate(SpecificServiceCfg specificServiceCfg) throws Exception {
if(specificServiceCfg.getGroupId()==null || specificServiceCfg.getGroupId()==0){ if(specificServiceCfg.getGroupId()==null || specificServiceCfg.getGroupId()==0){
specificServiceCfg.setGroupId(new ConvertTool().getGroupId()); Integer groupId = ConfigServiceUtil.getId(2, 1).get(0);
specificServiceCfg.setGroupId(groupId);
} }
//新增协议分组 //新增协议分组
ConfigGroupInfo group = specificServiceCfgDao.getConfigGroupInfoByGroupId(specificServiceCfg.getGroupId()); ConfigGroupInfo group = specificServiceCfgDao.getConfigGroupInfoByGroupId(specificServiceCfg.getGroupId());
@@ -79,26 +82,13 @@ public class SpecificServiceCfgService extends BaseService{
group.setGroupType(1); group.setGroupType(1);
specificServiceCfgDao.insertConfigGroupInfo(group); specificServiceCfgDao.insertConfigGroupInfo(group);
} }
if(oldId==null){//新增 if(specificServiceCfg.getSpecServiceId()==null){//新增
specificServiceCfg.setIsValid(1); specificServiceCfg.setIsValid(1);
specificServiceCfg.setOpTime(new Date()); specificServiceCfg.setOpTime(new Date());
specificServiceCfgDao.insert(specificServiceCfg); specificServiceCfgDao.insert(specificServiceCfg);
}else{//修改 }else{//修改
specificServiceCfg.setOpTime(new Date()); specificServiceCfg.setOpTime(new Date());
//修改id则将其子类的parent_id一并修改 specificServiceCfgDao.update(specificServiceCfg);
if(oldId!=specificServiceCfg.getSpecServiceId()){
//找出所有子类
List<SpecificServiceCfg> list = specificServiceCfgDao.getChildrenById(oldId);
SpecificServiceCfg se =new SpecificServiceCfg();
se.setSpecServiceId(specificServiceCfg.getSpecServiceId());
for(SpecificServiceCfg ss:list){
if(ss!=null){
ss.setParent(se);
specificServiceCfgDao.update(ss,ss.getSpecServiceId());
}
}
}
specificServiceCfgDao.update(specificServiceCfg,oldId);
} }
} }
/** /**

View File

@@ -2,8 +2,6 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%> <%@ include file="/WEB-INF/include/taglib.jsp"%>
<html> <html>
<head> <head>
<link rel="stylesheet" type="text/css" href="${ctxStatic}/pages/css/dictInfo.css" />
<script type="text/javascript" src="${ctxStatic}/pages/scripts/specificServiceForm/specificServiceFormCfg.js"></script>
<title></title> <title></title>
<script type="text/javascript"> <script type="text/javascript">
var validateForm; var validateForm;
@@ -25,7 +23,7 @@
$("#name").focus(); $("#name").focus();
validateForm = $("#inputForm").validate({ validateForm = $("#inputForm").validate({
rules:{ /* rules:{
specServiceId:{ specServiceId:{
remote:'${ctx}/specific/specificServiceCfg/isIdRepeat?oldId=${specificServiceCfg.specServiceId}' remote:'${ctx}/specific/specificServiceCfg/isIdRepeat?oldId=${specificServiceCfg.specServiceId}'
} }
@@ -34,7 +32,7 @@
specServiceId:{ specServiceId:{
remote:'<spring:message code="repeat"/>' remote:'<spring:message code="repeat"/>'
} }
}, }, */
submitHandler: function(form){ submitHandler: function(form){
if(!validateForm.form()) { if(!validateForm.form()) {
@@ -93,7 +91,7 @@
<!-- BEGIN FORM--> <!-- BEGIN FORM-->
<form:form id="inputForm" modelAttribute="specificServiceCfg" action="${ctx}/specific/specificServiceCfg/saveOrUpdate" method="post" class="form-horizontal"> <form:form id="inputForm" modelAttribute="specificServiceCfg" action="${ctx}/specific/specificServiceCfg/saveOrUpdate" method="post" class="form-horizontal">
<input name="oldId" type="hidden" value="${specificServiceCfg.specServiceId}"/> <input name="specServiceId" type="hidden" value="${specificServiceCfg.specServiceId}"/>
<form:hidden path="isValid" class="form-control"/> <form:hidden path="isValid" class="form-control"/>
<sys:message content="${message}"/> <sys:message content="${message}"/>
<div class="form-group"> <div class="form-group">
@@ -101,13 +99,13 @@
<div class="col-md-4"> <div class="col-md-4">
<c:set var="fatherName"><spring:message code="root_node"/></c:set> <c:set var="fatherName"><spring:message code="root_node"/></c:set>
<sys:treeselect id="specificServiceCfg" name="parent.specServiceId" value="${specificServiceCfg.parent.specServiceId}" labelName="parent.specServiceName" labelValue="${specificServiceCfg.parent.specServiceId eq '0'?fatherName:fns:getBySpecServiceId(specificServiceCfg.parent.specServiceId).specServiceName}" <sys:treeselect id="specificServiceCfg" name="parent.specServiceId" value="${specificServiceCfg.parent.specServiceId}" labelName="parent.specServiceName" labelValue="${specificServiceCfg.parent.specServiceId eq '0'?fatherName:fns:getBySpecServiceId(specificServiceCfg.parent.specServiceId).specServiceName}"
title="菜单" url="/specific/specificServiceCfg/treeData" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/> title="" url="/specific/specificServiceCfg/treeData" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="protocol_id"/>:</label> <label class="col-md-3 control-label"><font color="red">*</font><spring:message code="protocol_code"/>:</label>
<div class="col-md-4"> <div class="col-md-4">
<input id="specServiceId" name="specServiceId" maxlength="50" range="[0,2147483647]" class="form-control required digits" value="${specificServiceCfg.specServiceId}"/> <input id="specServiceCode" name="specServiceCode" maxlength="50" range="[0,2147483647]" class="form-control required digits" value="${specificServiceCfg.specServiceCode}"/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@@ -160,12 +160,12 @@
<div class="input-group"> <div class="input-group">
<div class="input-group-btn"> <div class="input-group-btn">
<select id="seltype" class="selectpicker select2 input-middle" > <select id="seltype" class="selectpicker select2 input-middle" >
<option value="specServiceId"><spring:message code="protocol_id"/></option> <option value="specServiceCode"><spring:message code="protocol_code"/></option>
<option value="specServiceName"><spring:message code="protocol_name"/></option> <option value="specServiceName"><spring:message code="protocol_name"/></option>
<option value="groupId"><spring:message code="group_id"/></option> <option value="groupId"><spring:message code="group_id"/></option>
</select> </select>
</div> </div>
<input id="intype" class="form-control input-medium" placeholder="<spring:message code='input_protocol_id'/>" type="text" onchange="casec()" maxlength="60"> <input id="intype" class="form-control input-medium" placeholder="<spring:message code='input_protocol_code'/>" type="text" onchange="casec()" maxlength="60">
</div> </div>
@@ -252,7 +252,7 @@
<tr> <tr>
<th><input type="checkbox" class="ckboxs" id="selAll" onclick="selectAll()"></th> <th><input type="checkbox" class="ckboxs" id="selAll" onclick="selectAll()"></th>
<!-- <th>序号</th> --> <!-- <th>序号</th> -->
<th><spring:message code="protocol_id"/></th> <th><spring:message code="protocol_code"/></th>
<th><spring:message code="protocol_name"/></th> <th><spring:message code="protocol_name"/></th>
<th><spring:message code="protocol_desc"/></th> <th><spring:message code="protocol_desc"/></th>
<th><spring:message code="group_id"/></th> <th><spring:message code="group_id"/></th>
@@ -265,7 +265,7 @@
<tr id="${specificServiceCfg.specServiceId}" pId="${specificServiceCfg.parent.specServiceId ne 0?specificServiceCfg.parent.specServiceId:0}"> <tr id="${specificServiceCfg.specServiceId}" pId="${specificServiceCfg.parent.specServiceId ne 0?specificServiceCfg.parent.specServiceId:0}">
<td><input type="checkbox" class="ckbox" name="check" value="${specificServiceCfg.specServiceId}"></td> <td><input type="checkbox" class="ckbox" name="check" value="${specificServiceCfg.specServiceId}"></td>
<%-- <td>${specificServiceCfg.showSequence}</td> --%> <%-- <td>${specificServiceCfg.showSequence}</td> --%>
<td nowrap><i class="icon-icon-tablet"></i><a href="${ctx}/specific/specificServiceCfg/form?specServiceId=${specificServiceCfg.specServiceId}&doAction=0">${specificServiceCfg.specServiceId}</a></td> <td nowrap><i class="icon-icon-tablet"></i><a href="${ctx}/specific/specificServiceCfg/form?specServiceId=${specificServiceCfg.specServiceId}&doAction=0">${specificServiceCfg.specServiceCode}</a></td>
<td title="${specificServiceCfg.specServiceName}">${specificServiceCfg.specServiceName}</td> <td title="${specificServiceCfg.specServiceName}">${specificServiceCfg.specServiceName}</td>
<td title="${specificServiceCfg.specServiceDesc}">${fns:abbr(specificServiceCfg.specServiceDesc,15)}</td> <td title="${specificServiceCfg.specServiceDesc}">${fns:abbr(specificServiceCfg.specServiceDesc,15)}</td>
<td>${specificServiceCfg.groupId }</td> <td>${specificServiceCfg.groupId }</td>