Commit 19bc0833 authored by 曲欣红's avatar 曲欣红

修改

parent 20095e65
...@@ -20,6 +20,7 @@ import com.egolm.admin.config.XException; ...@@ -20,6 +20,7 @@ import com.egolm.admin.config.XException;
import com.egolm.admin.pojo.TPlatformTheme; import com.egolm.admin.pojo.TPlatformTheme;
import com.egolm.admin.service.ThemeTemplateService; import com.egolm.admin.service.ThemeTemplateService;
import com.egolm.admin.service.impl.ThemeTemplateServiceImpl; import com.egolm.admin.service.impl.ThemeTemplateServiceImpl;
import com.egolm.common.GsonUtil;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
...@@ -29,6 +30,13 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -29,6 +30,13 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/**
*
* @author qu133
* @date 2018年8月7日
* @className ThemeTemplateConfController
* @Description 主题模板配置
*/
@Api(tags={"主题模板配置"}) @Api(tags={"主题模板配置"})
@RestController @RestController
@RequestMapping("theme") @RequestMapping("theme")
...@@ -39,20 +47,40 @@ public class ThemeTemplateConfController { ...@@ -39,20 +47,40 @@ public class ThemeTemplateConfController {
@Autowired @Autowired
private ThemeTemplateService ttService; private ThemeTemplateService ttService;
/**
*
* @Title: insert
* @Description: TODO(新增主题)
* @return Object 返回类型
* @param sMemo
* @param sThemeAuthor
* @param sSnapshot1
* @param sSnapshot2
* @param sThemeNO
* @param nTag
* @param sCaption
* @param sCreateUser
* @param sThemeJson
* @param sThemeName
* @param sSnapshot3
* @return
* @throws
*/
@ApiOperation("新增主题") @ApiOperation("新增主题")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言"), @ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言"),
@ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号"), @ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称"), @ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称varchar(100)"),
@ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者"), @ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明"), @ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置"), @ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置text(0)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1"), @ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2"), @ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3"), @ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注"), @ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态"), @ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态int(0)"),
@ApiImplicitParam(paramType = "query", name = "sCreateUser", dataType = "String", required = true, value = "创建人"), @ApiImplicitParam(paramType = "query", name = "sCreateUser", dataType = "String", required = true, value = "创建人varchar(30)"),
}) })
@ResponseBody @ResponseBody
@PostMapping(value = "/insert") @PostMapping(value = "/insert")
...@@ -87,24 +115,44 @@ public class ThemeTemplateConfController { ...@@ -87,24 +115,44 @@ public class ThemeTemplateConfController {
d, d,
sSnapshot3 sSnapshot3
); );
logger.info("新增主题》》》"+GsonUtil.toJson(tPlatformTheme));
ttService.insert(tPlatformTheme); ttService.insert(tPlatformTheme);
return Rjx.jsonOk().set("detail", ttService.selectByNO(sThemeNO)).toString(); return Rjx.jsonOk().set("detail", ttService.selectByNO(sThemeNO)).toString();
} }
@ApiOperation("新增主题") /**
*
* @Title: update
* @Description: TODO(修改主题)
* @return Object 返回类型
* @param sMemo
* @param sThemeAuthor
* @param sSnapshot1
* @param sSnapshot2
* @param sThemeNO
* @param nTag
* @param sCaption
* @param sUpdateUser
* @param sThemeJson
* @param sThemeName
* @param sSnapshot3
* @return
* @throws
*/
@ApiOperation("修改主题")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言"), @ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言"),
@ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号"), @ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称"), @ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称varchar(100)"),
@ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者"), @ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明"), @ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置"), @ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置text(0)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1"), @ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2"), @ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3"), @ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注"), @ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态"), @ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态int(0)"),
@ApiImplicitParam(paramType = "query", name = "sUpdateUser", dataType = "String", required = true, value = "修改人"), @ApiImplicitParam(paramType = "query", name = "sUpdateUser", dataType = "String", required = true, value = "修改人varchar(30)"),
}) })
@ResponseBody @ResponseBody
@PostMapping(value = "/update") @PostMapping(value = "/update")
...@@ -139,10 +187,22 @@ public class ThemeTemplateConfController { ...@@ -139,10 +187,22 @@ public class ThemeTemplateConfController {
d,//dUpdateDate更新日期 d,//dUpdateDate更新日期
sSnapshot3//sSnapshot3快照3 sSnapshot3//sSnapshot3快照3
); );
logger.info("修改主题》》》"+GsonUtil.toJson(tPlatformTheme));
return Rjx.jsonOk().set("detail", ttService.update(tPlatformTheme)).toString(); return Rjx.jsonOk().set("detail", ttService.update(tPlatformTheme)).toString();
} }
@ApiOperation("用户列表查询") /**
*
* @Title: query
* @Description: TODO(主题列表查询)
* @return Object 返回类型
* @param searchKey
* @param index
* @param limit
* @return
* @throws
*/
@ApiOperation("主题列表查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "searchKey", dataType = "String", required = false, value = "用户编码/名称"), @ApiImplicitParam(paramType = "query", name = "searchKey", dataType = "String", required = false, value = "用户编码/名称"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "long", required = false, value = "页码"), @ApiImplicitParam(paramType = "query", name = "index", dataType = "long", required = false, value = "页码"),
...@@ -151,6 +211,7 @@ public class ThemeTemplateConfController { ...@@ -151,6 +211,7 @@ public class ThemeTemplateConfController {
@ResponseBody @ResponseBody
@GetMapping("/getUserList") @GetMapping("/getUserList")
public Object query(String searchKey, Long index, Long limit){ public Object query(String searchKey, Long index, Long limit){
logger.info("主题列表查询》》》searchKey: "+searchKey+", index: "+index+", limit: "+limit);
if(StringUtil.isEmpty(index)){ if(StringUtil.isEmpty(index)){
index = 1L; index = 1L;
} }
......
...@@ -3,27 +3,37 @@ package com.egolm.admin.service.impl; ...@@ -3,27 +3,37 @@ package com.egolm.admin.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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 com.egolm.admin.config.XException; import com.egolm.admin.config.XException;
import com.egolm.admin.controller.OSSFileController;
import com.egolm.admin.pojo.TPlatformTheme; import com.egolm.admin.pojo.TPlatformTheme;
import com.egolm.admin.service.ThemeTemplateService; import com.egolm.admin.service.ThemeTemplateService;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
/**
*
* @author qu133
* @date 2018年8月7日
* @className ThemeTemplateServiceImpl
* @Description 主题模板管理相关业务逻辑
*/
@Service @Service
public class ThemeTemplateServiceImpl implements ThemeTemplateService{ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
private static final Log logger = LogFactory.getLog(ThemeTemplateServiceImpl.class);
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
/**
*
* @Title: insert
* @Description: TODO(新增主题模板)
* @param theme
* @return
* @throws
*/
@Override @Override
public TPlatformTheme insert(TPlatformTheme theme) { public TPlatformTheme insert(TPlatformTheme theme) {
try{ try{
...@@ -34,6 +44,14 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{ ...@@ -34,6 +44,14 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
return selectByNO(theme.getsThemeNO()); return selectByNO(theme.getsThemeNO());
} }
/**
*
* @Title: selectByNO
* @Description: TODO(查询主题模板)
* @param themeNO
* @return
* @throws
*/
@Override @Override
public TPlatformTheme selectByNO(String themeNO) { public TPlatformTheme selectByNO(String themeNO) {
try{ try{
...@@ -44,9 +62,22 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{ ...@@ -44,9 +62,22 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
} }
} }
/**
*
* @Title: update
* @Description: TODO(修改主题模板)
* @param theme
* @return
* @throws
*/
@Override @Override
public TPlatformTheme update(TPlatformTheme theme) { public TPlatformTheme update(TPlatformTheme theme) {
try{ try{
String sThemeNO = theme.getsThemeNO();
boolean haveTheme = haveTheme(sThemeNO);
if(!haveTheme){
throw new XException("无此模板:"+sThemeNO);
}
String sql = "update tPlatformTheme set sThemeName = ?, sThemeAuthor = ?, sCaption = ?, sThemeJson = ?, sSnapshot1 = ?, sSnapshot2 = ?, sSnapshot3 = ?, sMemo = ?, nTag = ?, sUpdateUser = ?, dUpdateDate = ?, dLastUpdateTime = ? where sThemeNO = ?"; String sql = "update tPlatformTheme set sThemeName = ?, sThemeAuthor = ?, sCaption = ?, sThemeJson = ?, sSnapshot1 = ?, sSnapshot2 = ?, sSnapshot3 = ?, sMemo = ?, nTag = ?, sUpdateUser = ?, dUpdateDate = ?, dLastUpdateTime = ? where sThemeNO = ?";
jdbcTemplate.update( jdbcTemplate.update(
sql, sql,
...@@ -62,14 +93,29 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{ ...@@ -62,14 +93,29 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
theme.getsUpdateUser(), theme.getsUpdateUser(),
theme.getdUpdateDate(), theme.getdUpdateDate(),
theme.getdLastUpdateTime(), theme.getdLastUpdateTime(),
theme.getsThemeNO() sThemeNO
); );
}catch(Exception e){ }catch(Exception e){
throw new XException("修改失败", e); throw new XException("修改失败", e);
} }
return selectByNO(theme.getsThemeNO()); return selectByNO(theme.getsThemeNO());
} }
private boolean haveTheme(String sThemeNO){
String sql = "select count(1) from tPlatformTheme where sThemeNO = ? and nTag&1 = 0";
Integer count = jdbcTemplate.queryForInt(sql, sThemeNO);
return count>0;
}
/**
*
* @Title: queryList
* @Description: TODO(查询主题模板列表)
* @param searchKey
* @param page
* @return
* @throws
*/
@Override @Override
public List<Map<String, Object>> queryList(String searchKey, Page page) { public List<Map<String, Object>> queryList(String searchKey, Page page) {
try{ try{
...@@ -84,7 +130,7 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{ ...@@ -84,7 +130,7 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
} }
return themes; return themes;
}catch(Exception e){ }catch(Exception e){
throw new XException("修改失败", e); throw new XException("查询失败", e);
} }
} }
......
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