优化部分jsp页面

master
星期八 6 years ago
parent d3aa18b496
commit e5da291b9c
  1. 1
      src/main/java/com/lq/cms/dao/AdminBaseDao.java
  2. 16
      src/main/java/com/lq/cms/emun/WechatInfoEncodingTypeEnum.java
  3. 61
      src/main/java/com/lq/cms/emun/WechatMessageTypeEnum.java
  4. 2
      src/main/java/com/lq/cms/service/AdminBaseService.java
  5. 6
      src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java
  6. 1
      src/main/java/com/lq/cms/service/impl/WechatMessageServiceImpl.java
  7. 9
      src/main/java/com/lq/cms/vo/WechatMessageVo.java
  8. 4
      src/main/java/com/lq/cms/web/wechat/WechatInfoController.java
  9. 13
      src/main/java/com/lq/cms/web/wechat/WechatMessageController.java
  10. 1
      src/main/java/com/lq/code/util/BeanUtil.java
  11. 6
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/info/edit.jsp
  12. 16
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/info/index.jsp
  13. 55
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/edit.jsp
  14. 42
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/message/index.jsp

@ -10,4 +10,5 @@ public interface AdminBaseDao<T> extends BaseDao {
List<AdminBaseVo> findLisatPage(AdminBaseVo vo);
int count(AdminBaseVo vo);
}

@ -11,13 +11,13 @@ public enum WechatInfoEncodingTypeEnum {
BLEND("BLEND","混合"),
ENCRYPT("ENCRYPT","加密")
;
private static Map<String,Object> map = new HashMap();
private static Map<String,String> enumMap = new HashMap();
static {
WechatInfoEncodingTypeEnum[] wechatInfoEncodingTypeEnumArray = WechatInfoEncodingTypeEnum.values();
for (WechatInfoEncodingTypeEnum wechatInfoEncodingTypeEnum : wechatInfoEncodingTypeEnumArray) {
map.put(wechatInfoEncodingTypeEnum.getValue(), wechatInfoEncodingTypeEnum.getDesc());
enumMap.put(wechatInfoEncodingTypeEnum.value, wechatInfoEncodingTypeEnum.desc);
}
}
@ -28,9 +28,19 @@ public enum WechatInfoEncodingTypeEnum {
this.value = value;
this.desc = desc;
}
//判断是否存在值
public static boolean hasValue(String value){
return enumMap.containsKey(value);
}
public static Map<String,String> getEnumMap(){
return enumMap;
}
public static String getDesc(String value){
return (String) map.get(value);
return (String) enumMap.get(value);
}
public String getValue() {

@ -0,0 +1,61 @@
package com.lq.cms.emun;
import java.util.HashMap;
import java.util.Map;
public enum WechatMessageTypeEnum {
IMAGE("IMAGE","图片"),
TEXT("TEXT","文本"),
IMAGE_TEXT("IMAGE_TEXT","图文混合")
;
WechatMessageTypeEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
private String value;
private String desc;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
private static Map<String,String> enumMap = new HashMap();
static {
WechatMessageTypeEnum[] wechantMessageTypeEnums = WechatMessageTypeEnum.values();
for (WechatMessageTypeEnum wechantMessageTypeEnum:wechantMessageTypeEnums) {
enumMap.put(wechantMessageTypeEnum.value, wechantMessageTypeEnum.desc);
}
}
//判断是否存在值
public static boolean hasValue(String value){
return enumMap.containsKey(value);
}
public static String getDesc(String value){
return enumMap.get(value);
}
public static Map<String,String> getEnumMap(){
return enumMap;
}
}

@ -5,7 +5,7 @@ import com.lq.code.service.BaseService;
import java.util.List;
public interface AdminBaseService<T> extends BaseService{
public interface AdminBaseService<T> extends BaseService<T>{
List<AdminBaseVo> findListPage(AdminBaseVo vo);

@ -13,9 +13,9 @@ import java.lang.reflect.ParameterizedType;
import java.util.Date;
import java.util.List;
public abstract class AdminBaseServiceImpl<T> extends BaseServiceImpl implements AdminBaseService<T>{
public abstract class AdminBaseServiceImpl<T> extends BaseServiceImpl<T> implements AdminBaseService<T>{
abstract AdminBaseDao getAdminBaseDao();
abstract AdminBaseDao<T> getAdminBaseDao();
@Override
public List<AdminBaseVo> findListPage(AdminBaseVo vo) {
@ -48,7 +48,7 @@ public abstract class AdminBaseServiceImpl<T> extends BaseServiceImpl implements
}
@Override
public BaseDao getBaseDao() {
public BaseDao<T> getBaseDao() {
return getAdminBaseDao();
}

@ -13,6 +13,7 @@ public class WechatMessageServiceImpl extends AdminBaseServiceImpl<WechatMessage
@Autowired
private WechatMessageDao wechatMessageDao;
@Override
AdminBaseDao getAdminBaseDao() {

@ -4,7 +4,6 @@ import java.util.Date;
public class WechatMessageVo extends AdminBaseVo{
private Long id;
//消息类型
private String messageType;
//消息标题
@ -22,14 +21,6 @@ public class WechatMessageVo extends AdminBaseVo{
//创建用户
private Long userId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMessageType() {
return messageType;
}

@ -1,6 +1,7 @@
package com.lq.cms.web.wechat;
import com.lq.cms.emun.StatusTypeEnum;
import com.lq.cms.emun.WechatInfoEncodingTypeEnum;
import com.lq.cms.service.WechatInfoService;
import com.lq.cms.vo.WechatInfoVo;
import com.lq.code.entity.AjaxResult;
@ -41,6 +42,9 @@ public class WechatInfoController {
WechatInfo wechatInfo = wechatInfoService.findOne(vo.getId());
modelAndView.addObject("wechatInfo", wechatInfo);
}
Map<String,String> encodingTypeMap = WechatInfoEncodingTypeEnum.getEnumMap();
modelAndView.addObject("encodingTypeMap",encodingTypeMap);
modelAndView.setViewName("cms/wechat/info/edit");
return modelAndView;
}

@ -1,5 +1,6 @@
package com.lq.cms.web.wechat;
import com.lq.cms.emun.WechatMessageTypeEnum;
import com.lq.cms.service.AdminBaseService;
import com.lq.cms.service.WechatMessageService;
import com.lq.cms.vo.WechatMessageVo;
@ -7,6 +8,7 @@ import com.lq.cms.web.AdminBaseController;
import com.lq.entity.WechatMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -30,6 +32,17 @@ public class WechatMessageController extends AdminBaseController<WechatMessage>
return "cms/wechat/message/index";
}
@RequestMapping("/edit")
public String edit(Model model, Long id){
if (id!=null){
WechatMessage wechatMessage = wechatMessageService.findOne(id);
model.addAttribute("wechatMessage",wechatMessage);
}
Map<String,String> emunMap = WechatMessageTypeEnum.getEnumMap();
model.addAttribute("wechatMessageTypeMap",emunMap);
return "cms/wechat/message/edit";
}
@Override
public AdminBaseService getBaseService() {

@ -198,6 +198,7 @@ public class BeanUtil {
* @return
*/
public static Boolean isType(Object obj,Class clazzType){
if (obj!=null) {
Class clazz = obj.getClass();
return clazz.getTypeName().equals(clazzType.getTypeName()) ? true : false;

@ -50,9 +50,9 @@
<td>消息加密类型:</td>
<td>
<select id="encodingType" >
<option <c:if test="${wechatInfo.encodingType=='PLAINTEXT'}">selected</c:if> value="PLAINTEXT">明文模式</option>
<option <c:if test="${wechatInfo.encodingType=='BLEND'}">selected</c:if> value="BLEND">混合模式</option>
<option <c:if test="${wechatInfo.encodingType=='ENCRYPT'}">selected</c:if> value="ENCRYPT" >密文模式</option>
<c:forEach items="${encodingTypeMap}" var="encoding">
<option <c:if test="${wechatInfo.encodingType == encoding.key}">selected</c:if> value="${encoding.key}">${encoding.value}</option>
</c:forEach>
</select>
</td>
</tr>

@ -83,14 +83,7 @@
var url = 'save';
var obj = new Object();
// obj.id = $("#id").val();
obj.wechatOpenId = $("#wechatOpenId").val();
obj.wechatName = $("#wechatName").val();
obj.appId = $("#appId").val();
obj.appSecpet = $("#appSecpet").val();
obj.url = $("#url").val();
obj.token = $("#token").val();
obj.encodingType = $("#encodingType").val();
obj.encodingAesKey = $("#encodingAesKey").val();
obj = attrObj(obj);
post(url,obj);
}
@ -98,6 +91,11 @@
var url = 'update';
var obj = new Object();
obj.id = $("#id").val();
obj = attrObj(obj);
post(url,obj);
}
function attrObj(obj) {
obj.wechatOpenId = $("#wechatOpenId").val();
obj.wechatName = $("#wechatName").val();
obj.appId = $("#appId").val();
@ -106,7 +104,7 @@
obj.token = $("#token").val();
obj.encodingType = $("#encodingType").val();
obj.encodingAesKey = $("#encodingAesKey").val();
post(url,obj);
return obj;
}
function del(id) {

@ -0,0 +1,55 @@
<%--
Created by IntelliJ IDEA.
User: qi_liang
Date: 2018/6/5
Time: 下午11:40
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../../../common/import-tag.jsp"%>
<html>
<head>
<title>微信公众号消息编辑</title>
</head>
<body>
<div style="margin:20px 0;"></div>
<div style="padding:10px 60px 20px 60px">
<table cellpadding="4">
<input type="hidden" value="${wechatMessage.id}" id="id">
<tr>
<td>消息类型:</td>
<td>
<select id="messageType" >
<c:forEach items="${wechatMessageTypeMap}" var="wechatMessageType">
<option <c:if test="${wechatMessage.messageType == wechatMessageType.key}">selected</c:if> value="${wechatMessageType.key}">${wechatMessageType.value}</option>
</c:forEach>
</select>
</td>
</tr>
<tr>
<td>消息标题:</td>
<td>
<input type="text" id ="title" value="${wechatMessage.title}">
</td>
</tr>
<tr>
<td>消息内容:</td>
<td><input class="easyui-textbox" type="text" id="content" data-options="required:true" value="${wechatMessage.content}"/></td>
</tr>
<tr>
<td>素材ID:</td>
<td><input class="easyui-textbox" type="text" id="imageUrl" data-options="required:true'" value="${wechatMessage.mediaId}"/></td>
</tr>
<tr>
<td>消息跳转链接:</td>
<td><input class="easyui-textbox" type="text" id="mediaId" data-options="required:true" value="${wechatMessage.toUrl}" /></td>
</tr>
</table>
</div>
</body>
</html>

@ -46,5 +46,47 @@
</script>
<body>
<table id="dataList"></table>
<div id="editDate"></div>
</body>
<script type="text/javascript">
function openEdit(title,id) {
var url='edit';
if(id!=null){
url=url+'?id='+id;
}
$("#editDate").dialog({
title:title,
width:400,
height:400,
closed:false,
cache:false,
href:url,
model:true,
buttons:[
{text:'保存',handler:function () {
if (id==null){
save();
}else {
update();
}
}},{
text:'取消',handler:function () {
$("#editDate").dialog('close');
}
},
]
});
$("#editDate").dialog('open').dialog('refresh',url);
}
function save() {
alert("提交保存");
}
function update() {
alert("提交更新");
}
</script>
</html>

Loading…
Cancel
Save