Commit 20095e65 authored by 曲欣红's avatar 曲欣红
parents 277a6f9d 9dbe236d
Msg_check_key_set=this is not set
\ No newline at end of file
Msg_check_key_set=this is not set
\ No newline at end of file
Msg_check_key_set=\u8BF7\u68C0\u67E5{key}\u53C2\u6570\u662F\u5426\u8BBE\u7F6E
\ No newline at end of file
......@@ -12,7 +12,7 @@ import org.springframework.transaction.PlatformTransactionManager;
import com.alibaba.druid.pool.DruidDataSource;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.MySqlDialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
@Configuration
public class ShopDataSourceConfig {
......@@ -35,7 +35,7 @@ public class ShopDataSourceConfig {
public JdbcTemplate getJdbcTemplate(@Qualifier("shopDataSource")DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
jdbcTemplate.setDialect(new MySqlDialect());
jdbcTemplate.setDialect(new SqlServerDialect());
jdbcTemplate.setSql_level(3);
return jdbcTemplate;
}
......
package com.egolm.admin.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"链接资源管理"})
@RestController
@RequestMapping("link")
public class LinkController {
@ApiOperation("测试")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = true, value = "手机号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "content", dataType = "String", required = true, value = "内容", defaultValue = ""),
})
@RequestMapping(value = "/sms",method=RequestMethod.POST)
public String sms(HttpServletRequest request) {
return "1111";
}
}
package com.egolm.admin.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.admin.pojo.TLinkList;
import com.egolm.admin.service.LinkListService;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"链接资源管理"})
@RestController
@RequestMapping("link")
public class LinkListController {
@Autowired
private LinkListService linkListService;
@ApiOperation("新增")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "linkNO", dataType = "String", required = true, value = "链接编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "linkName", dataType = "String", required = true, value = "链接名称", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "linkType", dataType = "String", required = true, value = "链接类型", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "linkPath", dataType = "String", required = true, value = "链接地址", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "memo", dataType = "String", required = false, value = "链接备注", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = true, value = "用户NO", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "tag", dataType = "String", required = true, value = "状态 0为正常 2为不可用", defaultValue = "0"),
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
})
@RequestMapping(value = "/save",method=RequestMethod.POST)
public String save(HttpServletRequest request) {
String linkNO = request.getParameter("linkNO");
String linkName = request.getParameter("linkName");
String linkType = request.getParameter("linkType");
String linkPath = request.getParameter("linkPath");
String memo = request.getParameter("memo");
String userNO = request.getParameter("userNO");
String tag = request.getParameter("tag");
if(!StringUtil.isNotEmpty(linkNO,linkName,linkType,linkPath,userNO,tag)) {
return Rjx.json().setCode(-1).setMessage("参数不能为空").toJson();
}
TLinkList tLinkList = new TLinkList();
tLinkList.setsLinkNO(linkNO.trim());
tLinkList.setsLinkName(linkName.trim());
tLinkList.setsLinkType(linkType.trim());
tLinkList.setsLinkPath(linkPath.trim());
tLinkList.setsMemo(memo);
tLinkList.setnTag(Integer.valueOf(tag));
tLinkList.setsCreateUser(userNO.trim());
tLinkList.setsUpdateUser(userNO.trim());
Rjx rjx = linkListService.save(tLinkList);
return rjx.toJson();
}
@ApiOperation("修改")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "linkNO", dataType = "String", required = true, value = "链接编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "linkName", dataType = "String", required = true, value = "链接名称", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "linkType", dataType = "String", required = true, value = "链接类型", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "linkPath", dataType = "String", required = true, value = "链接地址", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "memo", dataType = "String", required = false, value = "链接备注", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = true, value = "用户NO", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "tag", dataType = "String", required = true, value = "状态0为正常 2为不可用", defaultValue = "0"),
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
})
@RequestMapping(value = "/modify",method=RequestMethod.POST)
public String modify(HttpServletRequest request) {
String linkNO = request.getParameter("linkNO");
String linkName = request.getParameter("linkName");
String linkType = request.getParameter("linkType");
String linkPath = request.getParameter("linkPath");
String memo = request.getParameter("memo");
String userNO = request.getParameter("userNO");
String tag = request.getParameter("tag");
if(!StringUtil.isNotEmpty(linkNO,linkName,linkType,linkPath,userNO,tag)) {
return Rjx.json().setCode(-1).setMessage("参数不能为空").toJson();
}
TLinkList tLinkList = linkListService.getTLinkListByNO(linkNO);
if(tLinkList != null) {
tLinkList.setsLinkNO(linkNO.trim());
tLinkList.setsLinkName(linkName.trim());
tLinkList.setsLinkType(linkType.trim());
tLinkList.setsLinkPath(linkPath.trim());
tLinkList.setsMemo(memo);
tLinkList.setnTag(Integer.valueOf(tag));
tLinkList.setsUpdateUser(userNO.trim());
Rjx rjx = linkListService.modify(tLinkList);
return rjx.toJson();
}else {
return Rjx.jsonErr().setCode(-100).setMessage("数据不存在").toJson();
}
}
@ApiOperation("查询")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "queryMsg", dataType = "String", required = false, value = "类型/编号/名称", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "int", required = true, value = "页码", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
})
@RequestMapping(value = "/query",method=RequestMethod.POST)
public String query(HttpServletRequest request) {
String queryMsg = request.getParameter("queryMsg");
String index = request.getParameter("index");
String limit = request.getParameter("limit");
System.out.println("queryMsg---"+queryMsg);
Map<String,Object> params = new HashMap<String,Object>();
params.put("queryMsg", queryMsg);
Page page = new Page();
page.setIndex(Long.valueOf(index));
page.setLimit(Long.valueOf(limit));
page.setLimitKey(" lastUpdateTime desc ");
List<Map<String,Object>> tLinkList = linkListService.query(params, page);
return Rjx.jsonOk().set("list", tLinkList).setPage(page).toString();
}
}
......@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
......@@ -15,6 +16,8 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -25,6 +28,7 @@ import com.alibaba.fastjson.JSONObject;
import com.egolm.admin.service.OSSFileService;
import com.egolm.admin.service.SystemCtlService;
import com.egolm.admin.util.AdminContstrant;
import com.egolm.admin.util.I18NUtils;
import com.egolm.common.DateUtil;
import com.egolm.common.FileUtil;
import com.egolm.common.HttpUtil;
......@@ -57,7 +61,8 @@ public class OSSFileController {
@Autowired
private SystemCtlService systemCtlService;
@Autowired
private MessageSource messageSource;
/**
* http://qa.egolm.com/mgr/doc.html
* @Title: upload
......@@ -170,10 +175,16 @@ public class OSSFileController {
@ApiOperation("测试上传")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "uFilePath", dataType = "String", required = false, value = "绝对路径", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = false, value = "语言", defaultValue = "936/900"),
})
@RequestMapping(value = "/testUpload",method=RequestMethod.POST) //
public String testUpload(HttpServletRequest request) throws IOException {
String uFilePath = request.getParameter("uFilePath");
String LangID = request.getParameter("LangID");/*
Locale locale = LocaleContextHolder.getLocale();
System.out.println(locale);
Locale.setDefault(Locale.CHINA);
System.out.println(messageSource.getMessage("Msg_check_key_set", null, locale));*/
List<String> codeList = new ArrayList<String>();
codeList.add(AdminContstrant.OSS_UPLOAD_CONFIG_KEY);
......@@ -181,7 +192,7 @@ public class OSSFileController {
List<Map<String,Object>> listCtl = systemCtlService.getTSystemCtrlByCode(codeList);
if(listCtl.isEmpty() || listCtl.size() !=2 ) {
if(listCtl.isEmpty() || listCtl.size() !=2 ) { //"请检查"+StringUtil.join(",",codeList)+"参数是否配置"
return Rjx.jsonErr().setCode(-100).setMessage("请检查"+StringUtil.join(",",codeList)+"参数是否配置").toJson();
}
......
package com.egolm.admin.service;
import java.util.List;
import java.util.Map;
import com.egolm.admin.pojo.TLinkList;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
public interface LinkListService {
public Rjx save(TLinkList linkList);
public Rjx modify(TLinkList linkList);
public TLinkList getTLinkListByNO(String linkNO) ;
public List<Map<String,Object>> query(Map<String,Object> params,Page page);
}
package com.egolm.admin.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
import com.egolm.admin.pojo.TLinkList;
import com.egolm.admin.service.LinkListService;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
/**
*
* @ClassName: LinkListServiceImpl
* @Description:链接资源服务
* @author: zhang.yong
* @date: 2018年8月7日 上午10:03:20
*
*/
@Service
public class LinkListServiceImpl implements LinkListService {
@Autowired
@Qualifier("shopJdbcTemplate")
private JdbcTemplate jdbcTemplate;
/**
* 新增
* <p>Title: save</p>
* <p>Description: </p>
* @param linkList
* @return
* @see com.egolm.admin.service.LinkListService#save(com.egolm.admin.pojo.TLinkList)
*/
@Override
public Rjx save(TLinkList linkList) {
linkList.setdCreateDate(new Date());
linkList.setdUpdateDate(new Date());
linkList.setdLastUpdateTime(new Date());
TLinkList link = getTLinkListByNO(linkList.getsLinkNO());
if(link != null) {
return Rjx.jsonErr().setMessage("链接编号已存在");
}else {
int i = jdbcTemplate.save(linkList);
if(i >0) {
return Rjx.jsonOk().setMessage("保存成功");
}
return Rjx.jsonErr().setMessage("保存失败");
}
}
/**
* 修改
* @Title: modify
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param linkList
* @param: @return
* @return: Rjx
* @throws
*/
public Rjx modify(TLinkList linkList) {
linkList.setdUpdateDate(new Date());
linkList.setdLastUpdateTime(new Date());
int i = jdbcTemplate.update(linkList);
if(i >0) {
return Rjx.jsonOk().setMessage("更新成功");
}
return Rjx.jsonErr().setMessage("更新失败");
}
/**
* 获取单个对象
* <p>Title: getTLinkListByNO</p>
* <p>Description: </p>
* @param linkNO
* @return
* @see com.egolm.admin.service.LinkListService#getTLinkListByNO(java.lang.String)
*/
public TLinkList getTLinkListByNO(String linkNO) {
try {
String sql = "SELECT * FROM tLinkList WHERE sLinkNO = ? AND nTag&1=0";
return jdbcTemplate.queryForBean(sql, TLinkList.class, linkNO);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 查询
* <p>Title: query</p>
* <p>Description: </p>
* @param params
* @return
* @see com.egolm.admin.service.LinkListService#query(java.util.Map)
*/
public List<Map<String,Object>> query(Map<String,Object> params,Page page){
String sql = "SELECT sLinkNO linkNO ,sLinkName linkName ,sLinkType linkType,sLinkPath linkPath,sMemo memo,sCreateUser createUser,sUpdateUser updateUser ,dLastUpdateTime lastUpdateTime "
+ " FROM tLinkList WHERE nTag&1=0 ";
if(params != null && params.size()> 0) {
String queryMsg = params.get("queryMsg")+"";
if(StringUtil.isNotUndefinedAndNull(queryMsg)) {
sql += " and (sLinkNO like '%"+queryMsg+"%' or sLinkName like '%"+queryMsg+"%' or sLinkType like '%"+queryMsg+"%') ";
}
}
return jdbcTemplate.limit(sql, page);
}
}
spring.profiles.active=dev
spring.messages.basename=i18n/messages
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment