Commit bbe70a19 authored by 王琮's avatar 王琮

Merge branch 'dev' into 'master'

Dev

See merge request !1
parents 0fc521e1 819e7229
/* */ package com.tiptimes.ctrl;
/* */
/* */ import com.github.pagehelper.PageHelper;
/* */ import com.github.pagehelper.PageInfo;
/* */ import com.tiptimes.model.ActionLog;
/* */ import com.tiptimes.model.TeamMessage;
/* */ import com.tiptimes.model.UserLogin;
/* */ import com.tiptimes.service.ActionLogService;
/* */ import com.tiptimes.service.TeamMessageService;
/* */ import com.tiptimes.service.UserService;
/* */ import java.io.IOException;
/* */ import java.util.ArrayList;
/* */ import java.util.HashMap;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import org.json.JSONObject;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.http.HttpEntity;
/* */ import org.springframework.stereotype.Controller;
/* */ import org.springframework.web.bind.annotation.RequestMapping;
/* */ import org.springframework.web.bind.annotation.ResponseBody;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Controller
/* */ @RequestMapping({"/ActionLog"})
/* */ public class ActionLogCtrl
/* */ {
/* */ @Autowired
/* */ private ActionLogService actionLogServer;
/* */ @Autowired
/* */ private UserService userService;
/* */ @Autowired
/* */ private TeamMessageService teamMessageService;
/* */
/* */ @RequestMapping({"seachActionLog"})
/* */ @ResponseBody
/* */ public Map<String, Object> seachActionLog(String userID, String startTime, String stopTime, HttpServletResponse response, HttpServletRequest request, ActionLog actionLog) throws IOException {
/* 63 */ Map<String, Object> map = new HashMap<>();
/* */
/* 65 */ PageHelper.startPage(actionLog.getStart().intValue() / actionLog.getLength().intValue() + 1, actionLog.getLength().intValue());
/* 66 */ int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
/* 67 */ if (authorityID != 2) {
/* 68 */ map.put("list", new ArrayList());
/* 69 */ return map;
/* */ }
/* 71 */ List<Object> object_temp = new ArrayList();
/* 72 */ List<ActionLog> actionLog_list = this.actionLogServer.listActionLog(userID, startTime, stopTime);
/* 73 */ if (actionLog_list == null) {
/* 74 */ map.put("list", object_temp);
/* 75 */ return map;
/* */ }
/* 77 */ if (actionLog_list != null) {
/* 78 */ for (ActionLog sactionLog_list_i : actionLog_list) {
/* 79 */ Map<String, Object> map_temp_i = new HashMap<>();
/* 80 */ map_temp_i.put("userName", sactionLog_list_i.getUserName());
/* 81 */ map_temp_i.put("time", sactionLog_list_i.getTime());
/* 82 */ map_temp_i.put("remark", sactionLog_list_i.getRemark());
/* 83 */ object_temp.add(map_temp_i);
/* */ }
/* */ }
/* */
/* */
/* 88 */ PageInfo<ActionLog> p = new PageInfo(actionLog_list);
/* 89 */ map.put("aaData", object_temp);
/* 90 */ map.put("recordsFiltered", Integer.valueOf(p.getList().size()));
/* 91 */ map.put("iTotalRecords", Long.valueOf(p.getTotal()));
/* 92 */ map.put("iTotalDisplayRecords", Long.valueOf(p.getTotal()));
/* 93 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @RequestMapping({"/getUserByAuthority"})
/* */ @ResponseBody
/* */ public Map<String, Object> getUserByAuthority(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
/* 108 */ Map<String, Object> map = new HashMap<>();
/* 109 */ int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
/* 110 */ if (authorityID != 2) {
/* 111 */ map.put("list", new ArrayList());
/* 112 */ return map;
/* */ }
/* 114 */ String strData = (String)data.getBody();
/* 115 */ JSONObject jObject = new JSONObject(strData);
/* 116 */ int authority = jObject.getInt("authority");
/* 117 */ List<UserLogin> userLogin_list = this.userService.getUserLoginByAuthority(authority);
/* 118 */ List<Object> object_temp = new ArrayList();
/* 119 */ if (userLogin_list != null) {
/* 120 */ for (UserLogin userLogin_list_i : userLogin_list) {
/* 121 */ Map<String, Object> map_temp_i = new HashMap<>();
/* 122 */ map_temp_i.put("realName", userLogin_list_i.getRealName());
/* 123 */ map_temp_i.put("userID", userLogin_list_i.getUserID());
/* 124 */ object_temp.add(map_temp_i);
/* */ }
/* */ }
/* */
/* */
/* 129 */ map.put("list", object_temp);
/* 130 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @RequestMapping({"/getUserBySpaceId"})
/* */ @ResponseBody
/* */ public Map<String, Object> getUserBySpaceId(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
/* 145 */ Map<String, Object> map = new HashMap<>();
/* 146 */ int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
/* 147 */ if (authorityID != 2) {
/* 148 */ map.put("list", new ArrayList());
/* 149 */ return map;
/* */ }
/* 151 */ String strData = (String)data.getBody();
/* 152 */ JSONObject jObject = new JSONObject(strData);
/* 153 */ String space = jObject.getString("space");
/* 154 */ UserLogin userLogin = this.userService.listUserLoginByUserID(space);
/* 155 */ if (userLogin == null) {
/* 156 */ map.put("list", new ArrayList());
/* 157 */ return map;
/* */ }
/* 159 */ List<TeamMessage> spaceList = this.teamMessageService.listTeamMessageBySpaceMessageID(userLogin.getRealID());
/* 160 */ if (spaceList == null) {
/* 161 */ map.put("list", new ArrayList());
/* 162 */ return map;
/* */ }
/* 164 */ List<Object> object_temp = new ArrayList();
/* 165 */ if (spaceList != null) {
/* 166 */ for (TeamMessage item : spaceList) {
/* 167 */ UserLogin userLogin1 = this.userService.listUserLoginByRealID(item.getTeamMessageID());
/* 168 */ Map<String, Object> map_temp_i = new HashMap<>();
/* 169 */ map_temp_i.put("realName", item.getTeamName());
/* 170 */ map_temp_i.put("userID", userLogin1.getUserID());
/* 171 */ object_temp.add(map_temp_i);
/* */ }
/* */ }
/* */
/* */
/* 176 */ map.put("list", object_temp);
/* 177 */ return map;
/* */ }
/* */ }
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.tiptimes.ctrl;
/* Location: D:\project\ROOT\WEB-INF\classes\!\com\tiptimes\ctrl\ActionLogCtrl.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
\ No newline at end of file
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tiptimes.model.ActionLog;
import com.tiptimes.model.TeamMessage;
import com.tiptimes.model.UserLogin;
import com.tiptimes.service.ActionLogService;
import com.tiptimes.service.TeamMessageService;
import com.tiptimes.service.UserService;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping({"/ActionLog"})
public class ActionLogCtrl {
@Autowired
private ActionLogService actionLogServer;
@Autowired
private UserService userService;
@Autowired
private TeamMessageService teamMessageService;
public ActionLogCtrl() {
}
@RequestMapping({"seachActionLog"})
@ResponseBody
public Map<String, Object> seachActionLog(String userID, String startTime, String stopTime, HttpServletResponse response, HttpServletRequest request, ActionLog actionLog) throws IOException {
Map<String, Object> map = new HashMap();
PageHelper.startPage(actionLog.getStart() / actionLog.getLength() + 1, actionLog.getLength());
int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
if (authorityID != 2) {
map.put("list", new ArrayList());
return map;
} else {
List<Object> object_temp = new ArrayList();
List<ActionLog> actionLog_list = this.actionLogServer.listActionLog(userID, startTime, stopTime);
if (actionLog_list == null) {
map.put("list", object_temp);
return map;
} else {
if (actionLog_list != null) {
Iterator var11 = actionLog_list.iterator();
while(var11.hasNext()) {
ActionLog sactionLog_list_i = (ActionLog)var11.next();
Map<String, Object> map_temp_i = new HashMap();
map_temp_i.put("userName", sactionLog_list_i.getUserName());
map_temp_i.put("time", sactionLog_list_i.getTime());
map_temp_i.put("remark", sactionLog_list_i.getRemark());
object_temp.add(map_temp_i);
}
}
PageInfo<ActionLog> p = new PageInfo(actionLog_list);
map.put("aaData", object_temp);
map.put("recordsFiltered", p.getList().size());
map.put("iTotalRecords", p.getTotal());
map.put("iTotalDisplayRecords", p.getTotal());
return map;
}
}
}
@RequestMapping({"/getUserByAuthority"})
@ResponseBody
public Map<String, Object> getUserByAuthority(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
Map<String, Object> map = new HashMap();
int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
if (authorityID != 2) {
map.put("list", new ArrayList());
return map;
} else {
String strData = (String)data.getBody();
JSONObject jObject = new JSONObject(strData);
int authority = jObject.getInt("authority");
List<UserLogin> userLogin_list = this.userService.getUserLoginByAuthority(authority);
List<Object> object_temp = new ArrayList();
if (userLogin_list != null) {
Iterator var11 = userLogin_list.iterator();
while(var11.hasNext()) {
UserLogin userLogin_list_i = (UserLogin)var11.next();
Map<String, Object> map_temp_i = new HashMap();
map_temp_i.put("realName", userLogin_list_i.getRealName());
map_temp_i.put("userID", userLogin_list_i.getUserID());
object_temp.add(map_temp_i);
}
}
map.put("list", object_temp);
return map;
}
}
@RequestMapping({"/getUserBySpaceId"})
@ResponseBody
public Map<String, Object> getUserBySpaceId(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
Map<String, Object> map = new HashMap();
int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
if (authorityID != 2) {
map.put("list", new ArrayList());
return map;
} else {
String strData = (String)data.getBody();
JSONObject jObject = new JSONObject(strData);
String space = jObject.getString("space");
UserLogin userLogin = this.userService.listUserLoginByUserID(space);
if (userLogin == null) {
map.put("list", new ArrayList());
return map;
} else {
List<TeamMessage> spaceList = this.teamMessageService.listTeamMessageBySpaceMessageID(userLogin.getRealID());
if (spaceList == null) {
map.put("list", new ArrayList());
return map;
} else {
List<Object> object_temp = new ArrayList();
if (spaceList != null) {
Iterator var12 = spaceList.iterator();
while(var12.hasNext()) {
TeamMessage item = (TeamMessage)var12.next();
UserLogin userLogin1 = this.userService.listUserLoginByRealID(item.getTeamMessageID());
Map<String, Object> map_temp_i = new HashMap();
map_temp_i.put("realName", item.getTeamName());
map_temp_i.put("userID", userLogin1.getUserID());
object_temp.add(map_temp_i);
}
}
map.put("list", object_temp);
return map;
}
}
}
}
}
/* */ package com.tiptimes.ctrl;
/* */
/* */ import com.tiptimes.model.Banner;
/* */ import com.tiptimes.model.TopSpaceAppearance;
/* */ import com.tiptimes.service.ActionLogService;
/* */ import com.tiptimes.service.BannerService;
/* */ import com.tiptimes.service.SpaceMessageService;
/* */ import com.tiptimes.util.UUIDUtils;
/* */ import java.util.HashMap;
/* */ import java.util.Map;
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import org.json.JSONObject;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.http.HttpEntity;
/* */ import org.springframework.stereotype.Controller;
/* */ import org.springframework.web.bind.annotation.RequestMapping;
/* */ import org.springframework.web.bind.annotation.ResponseBody;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Controller
/* */ @RequestMapping({"/Banner"})
/* */ public class BannerCtrl
/* */ {
/* */ @Autowired
/* */ private BannerService bannerService;
/* */ @Autowired
/* */ private ActionLogService actionLoginServer;
/* */ @Autowired
/* */ private SpaceMessageService spaceMessageService;
/* */
/* */ @RequestMapping({"/saveBanner"})
/* */ @ResponseBody
/* */ public Map<String, Object> saveBanner(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
/* 67 */ String userID = request.getSession().getAttribute("userID").toString();
/* 68 */ String userName = request.getSession().getAttribute("userName").toString();
/* 69 */ Map<String, Object> map = new HashMap<>();
/* 70 */ int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
/* 71 */ if (authorityID != 2 && authorityID != 1) {
/* 72 */ map.put("result", Boolean.valueOf(false));
/* 73 */ map.put("msg", "无权限!");
/* 74 */ this.actionLoginServer.saveActionLog(userID, userName, "保存前端banner,结果:无权限", "");
/* 75 */ return map;
/* */ }
/* 77 */ String strData = (String)data.getBody();
/* 78 */ JSONObject jObject = new JSONObject(strData);
/* */ try {
/* 80 */ String img = jObject.getString("img");
/* 81 */ Banner banner = this.bannerService.listBannerByUserID(userID);
/* 82 */ if (banner != null) {
/* 83 */ banner.setImg(img);
/* 84 */ this.bannerService.updateBanner(banner);
/* */ } else {
/* 86 */ banner = new Banner();
/* 87 */ banner.setId(UUIDUtils.getUUID());
/* 88 */ banner.setImg(img);
/* 89 */ banner.setUrl("");
/* 90 */ banner.setUserID(userID);
/* 91 */ this.bannerService.saveBanner(banner);
/* */ }
/* */
/* 94 */ this.actionLoginServer.saveActionLog(userID, userName, "保存前端banner,结果:保存成功", banner.getId());
/* 95 */ map.put("result", Boolean.valueOf(true));
/* 96 */ map.put("msg", "保存成功!");
/* 97 */ } catch (Exception e) {
/* 98 */ map.put("result", Boolean.valueOf(false));
/* 99 */ map.put("msg", "保存失败!");
/* 100 */ this.actionLoginServer.saveActionLog(userID, userName, "保存前端banner,结果:保存失败", "");
/* */ }
/* */
/* 103 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @RequestMapping({"/getOneBanner"})
/* */ @ResponseBody
/* */ public Map<String, Object> getOneBanner(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
/* 117 */ Map<String, Object> map = new HashMap<>();
/* 118 */ String userID = request.getSession().getAttribute("userID").toString();
/* 119 */ Banner banner = this.bannerService.listBannerByUserID(userID);
/* 120 */ map.put("banner", banner);
/* 121 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @RequestMapping({"/saveTopSpaceAppearance"})
/* */ @ResponseBody
/* */ public Map<String, Object> saveTopSpaceAppearance(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
/* 136 */ String userID = request.getSession().getAttribute("userID").toString();
/* 137 */ String userName = request.getSession().getAttribute("userName").toString();
/* 138 */ Map<String, Object> map = new HashMap<>();
/* 139 */ int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
/* 140 */ if (authorityID != 1) {
/* 141 */ map.put("result", Boolean.valueOf(false));
/* 142 */ map.put("msg", "无权限!");
/* 143 */ this.actionLoginServer.saveActionLog(userID, userName, "保存前端空间外观,结果:无权限", "");
/* 144 */ return map;
/* */ }
/* 146 */ String strData = (String)data.getBody();
/* 147 */ JSONObject jObject = new JSONObject(strData);
/* */ try {
/* 149 */ String img = jObject.getString("img");
/* 150 */ String selectColor = jObject.getString("selectColor");
/* 151 */ String fontcolor = jObject.getString("fontcolor");
/* 152 */ String tell = jObject.getString("tell");
/* 153 */ String address = jObject.getString("address");
/* 154 */ TopSpaceAppearance topSpaceAppearance = this.bannerService.listTopSpaceAppearanceByUserID(userID);
/* 155 */ if (topSpaceAppearance != null) {
/* 156 */ topSpaceAppearance.setImg(img);
/* 157 */ topSpaceAppearance.setFontColor(fontcolor);
/* 158 */ topSpaceAppearance.setSelectColor(selectColor);
/* 159 */ topSpaceAppearance.setAddress(address);
/* 160 */ topSpaceAppearance.setTell(tell);
/* 161 */ this.bannerService.updateTopSpaceAppearance(topSpaceAppearance);
/* */ } else {
/* 163 */ topSpaceAppearance = new TopSpaceAppearance();
/* 164 */ topSpaceAppearance.setId(UUIDUtils.getUUID());
/* 165 */ topSpaceAppearance.setImg(img);
/* 166 */ topSpaceAppearance.setFontColor(fontcolor);
/* 167 */ topSpaceAppearance.setSelectColor(selectColor);
/* 168 */ topSpaceAppearance.setUserID(userID);
/* 169 */ topSpaceAppearance.setAddress(address);
/* 170 */ topSpaceAppearance.setTell(tell);
/* 171 */ this.bannerService.saveTopSpaceAppearance(topSpaceAppearance);
/* */ }
/* */
/* 174 */ this.actionLoginServer.saveActionLog(userID, userName, "保存前端空间外观,结果:保存成功", topSpaceAppearance.getId());
/* 175 */ map.put("result", Boolean.valueOf(true));
/* 176 */ map.put("msg", "保存成功!");
/* 177 */ } catch (Exception e) {
/* 178 */ map.put("result", Boolean.valueOf(false));
/* 179 */ map.put("msg", "保存失败!");
/* 180 */ this.actionLoginServer.saveActionLog(userID, userName, "保存前端空间外观,结果:保存失败", "");
/* */ }
/* */
/* 183 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @RequestMapping({"/getOneTopSpaceAppearance"})
/* */ @ResponseBody
/* */ public Map<String, Object> getOneTopSpaceAppearance(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
/* 197 */ Map<String, Object> map = new HashMap<>();
/* 198 */ String userID = request.getSession().getAttribute("userID").toString();
/* 199 */ TopSpaceAppearance topSpaceAppearance = this.bannerService.listTopSpaceAppearanceByUserID(userID);
/* */
/* 201 */ map.put("topSpaceAppearance", topSpaceAppearance);
/* 202 */ return map;
/* */ }
/* */ }
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.tiptimes.ctrl;
/* Location: D:\project\ROOT\WEB-INF\classes\!\com\tiptimes\ctrl\BannerCtrl.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
\ No newline at end of file
import com.tiptimes.model.Banner;
import com.tiptimes.model.TopSpaceAppearance;
import com.tiptimes.service.ActionLogService;
import com.tiptimes.service.BannerService;
import com.tiptimes.service.SpaceMessageService;
import com.tiptimes.util.UUIDUtils;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping({"/Banner"})
public class BannerCtrl {
@Autowired
private BannerService bannerService;
@Autowired
private ActionLogService actionLoginServer;
@Autowired
private SpaceMessageService spaceMessageService;
public BannerCtrl() {
}
@RequestMapping({"/saveBanner"})
@ResponseBody
public Map<String, Object> saveBanner(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
String userID = request.getSession().getAttribute("userID").toString();
String userName = request.getSession().getAttribute("userName").toString();
Map<String, Object> map = new HashMap();
int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
if (authorityID != 2 && authorityID != 1) {
map.put("result", false);
map.put("msg", "无权限!");
this.actionLoginServer.saveActionLog(userID, userName, "保存前端banner,结果:无权限", "");
return map;
} else {
String strData = (String)data.getBody();
JSONObject jObject = new JSONObject(strData);
try {
String img = jObject.getString("img");
Banner banner = this.bannerService.listBannerByUserID(userID);
if (banner != null) {
banner.setImg(img);
this.bannerService.updateBanner(banner);
} else {
banner = new Banner();
banner.setId(UUIDUtils.getUUID());
banner.setImg(img);
banner.setUrl("");
banner.setUserID(userID);
this.bannerService.saveBanner(banner);
}
this.actionLoginServer.saveActionLog(userID, userName, "保存前端banner,结果:保存成功", banner.getId());
map.put("result", true);
map.put("msg", "保存成功!");
} catch (Exception var12) {
map.put("result", false);
map.put("msg", "保存失败!");
this.actionLoginServer.saveActionLog(userID, userName, "保存前端banner,结果:保存失败", "");
}
return map;
}
}
@RequestMapping({"/getOneBanner"})
@ResponseBody
public Map<String, Object> getOneBanner(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
Map<String, Object> map = new HashMap();
String userID = request.getSession().getAttribute("userID").toString();
Banner banner = this.bannerService.listBannerByUserID(userID);
map.put("banner", banner);
return map;
}
@RequestMapping({"/saveTopSpaceAppearance"})
@ResponseBody
public Map<String, Object> saveTopSpaceAppearance(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
String userID = request.getSession().getAttribute("userID").toString();
String userName = request.getSession().getAttribute("userName").toString();
Map<String, Object> map = new HashMap();
int authorityID = Integer.parseInt(request.getSession().getAttribute("authorityID").toString());
if (authorityID != 1) {
map.put("result", false);
map.put("msg", "无权限!");
this.actionLoginServer.saveActionLog(userID, userName, "保存前端空间外观,结果:无权限", "");
return map;
} else {
String strData = (String)data.getBody();
JSONObject jObject = new JSONObject(strData);
try {
String img = jObject.getString("img");
String selectColor = jObject.getString("selectColor");
String fontcolor = jObject.getString("fontcolor");
String tell = jObject.getString("tell");
String address = jObject.getString("address");
TopSpaceAppearance topSpaceAppearance = this.bannerService.listTopSpaceAppearanceByUserID(userID);
if (topSpaceAppearance != null) {
topSpaceAppearance.setImg(img);
topSpaceAppearance.setFontColor(fontcolor);
topSpaceAppearance.setSelectColor(selectColor);
topSpaceAppearance.setAddress(address);
topSpaceAppearance.setTell(tell);
this.bannerService.updateTopSpaceAppearance(topSpaceAppearance);
} else {
topSpaceAppearance = new TopSpaceAppearance();
topSpaceAppearance.setId(UUIDUtils.getUUID());
topSpaceAppearance.setImg(img);
topSpaceAppearance.setFontColor(fontcolor);
topSpaceAppearance.setSelectColor(selectColor);
topSpaceAppearance.setUserID(userID);
topSpaceAppearance.setAddress(address);
topSpaceAppearance.setTell(tell);
this.bannerService.saveTopSpaceAppearance(topSpaceAppearance);
}
this.actionLoginServer.saveActionLog(userID, userName, "保存前端空间外观,结果:保存成功", topSpaceAppearance.getId());
map.put("result", true);
map.put("msg", "保存成功!");
} catch (Exception var16) {
map.put("result", false);
map.put("msg", "保存失败!");
this.actionLoginServer.saveActionLog(userID, userName, "保存前端空间外观,结果:保存失败", "");
}
return map;
}
}
@RequestMapping({"/getOneTopSpaceAppearance"})
@ResponseBody
public Map<String, Object> getOneTopSpaceAppearance(HttpServletRequest request, HttpServletResponse response, HttpEntity<String> data) {
Map<String, Object> map = new HashMap();
String userID = request.getSession().getAttribute("userID").toString();
TopSpaceAppearance topSpaceAppearance = this.bannerService.listTopSpaceAppearanceByUserID(userID);
map.put("topSpaceAppearance", topSpaceAppearance);
return map;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.tiptimes.ctrl;
import com.tiptimes.model.Answer;
import com.tiptimes.model.Questionnaire;
import com.tiptimes.model.Record;
import com.tiptimes.model.Review;
import com.tiptimes.service.QuestionnaireService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping({"/questionnaire"})
public class QuestionnaireCtrl {
@Autowired
private QuestionnaireService questionnaireService;
public QuestionnaireCtrl() {
}
/**
* 数据上报
* @param questionnaire 上报数据
* @return
*/
@RequestMapping({"/save"})
@ResponseBody
public Map<String, Object> save(@RequestBody Questionnaire questionnaire){
int result;
//1.通过上报人和问卷id查询上报记录id
Long recordId=this.questionnaireService.selectRecordId(questionnaire.getId(),questionnaire.getCreateId());
//2.若recordId为空去添加上报记录,并返回自增id
if(recordId==null) {
Record record = new Record(questionnaire.getId(),questionnaire.getQuestionnaireName(),
0,"",questionnaire.getCreateName(),new Date(),questionnaire.getCreateId());
recordId=this.questionnaireService.insertRecord(record);
}
//3.根据上报记录id删除原上报数据
this.questionnaireService.delAnswer(recordId);
//4.新增新的上报数据
List<Answer> answerList=questionnaire.getAnswersList();
result=this.questionnaireService.insertAnswer(answerList,recordId);
//5.根据类型判断是否修改上报状态
if(questionnaire.getType()==1) {//上报
//修改数据上报状态
Record r = new Record();
r.setId(recordId);
r.setProcessStatus(1);
result=this.questionnaireService.updateRecord(r);
}
Map<String, Object> map = new HashMap();
if(result>0) {
map.put("result", true);
map.put("msg", "操作成功");
} else {
map.put("result", false);
map.put("msg", "操作失败");
}
return map;
}
/**
* 审核页面操作
* @param record 驳回
* @return
*/
@RequestMapping({"/checkReject"})
@ResponseBody
public Map<String, Object> checkReject(@RequestBody Record record){
if(record.getReviews()!=null) {
//1.通过记录id删除原有备注
this.questionnaireService.delView(record.getReviews().get(0).getRecordId());
//2.添加新的备注
this.questionnaireService.insertReview(record.getReviews(), record.getReviews().get(0).getRecordId());
}
int result=this.questionnaireService.updateRecord(record);
Map<String, Object> map = new HashMap();
if(result>0) {
map.put("result", true);
map.put("msg", "操作成功");
} else {
map.put("result", false);
map.put("msg", "操作失败");
}
return map;
}
/**
* 根据上报id查看上报数据详情
* @param recordId 记录id
* @return
*/
@RequestMapping({"/selectDetails"})
@ResponseBody
public Map<String, Object> selectDetails(Long recordId){
//1.根据记录id查询上报数据详情
List<Answer>answerList=this.questionnaireService.selectAnswerByRecordId(recordId);
//2.根据记录id查询审核备注详情
List<Review> reviews=this.questionnaireService.selectReviewByRecordId(recordId);
Map<String, Object> map = new HashMap();
map.put("result", true);
map.put("msg", "");
Map<String, Object> data = new HashMap();
data.put("answerList",answerList);
if(reviews.size()>0) {
data.put("reviews", reviews);
}
//3.根据记录id查询状态
Record record= this.questionnaireService.selectById(recordId);
if(record.getProcessStatus()==2) {
data.put("reason", record.getReason());
}
map.put("data",data);
return map;
}
/**
* 保存备注
* @param review 备注
* @return
*/
@RequestMapping({"/review"})
@ResponseBody
public Map<String, Object> review(@RequestBody List<Review> review){
Map<String, Object> map = new HashMap();
if(review==null||review.size()==0) {
map.put("result", false);
map.put("msg", "不存在需要保存的备注");
return map;
}
int result;
//1.通过记录id删除原有备注
this.questionnaireService.delView(review.get(0).getRecordId());
//2.添加新的备注
result=this.questionnaireService.insertReview(review,review.get(0).getRecordId());
if(result>0) {
map.put("result", true);
map.put("msg", "操作成功");
} else {
map.put("result", false);
map.put("msg", "操作失败");
}
return map;
}
}
package com.tiptimes.dao;
import com.tiptimes.model.Answer;
import com.tiptimes.model.Record;
import com.tiptimes.model.Review;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface QuestionnaireDao {
Long selectRecordId(@Param("questionnaireUuid")Long questionnaireUuid,
@Param("createId")String createId);
Long insertRecord(Record record);
Integer delAnswer(@Param("recordId")Long recordId);
Integer insertAnswer(@Param("list") List<Answer> answerList,
@Param("recordId")Long recordId);
Integer updateRecord(Record record);
Integer delView(@Param("recordId")Long recordId);
Integer insertReview(@Param("list") List<Review> list, @Param("recordId")Long recordId);
List<Answer> selectAnswerByRecordId(@Param("recordId")Long recordId);
List<Review> selectReviewByRecordId(@Param("recordId")Long recordId);
Record selectById(Long recordId);
}
package com.tiptimes.model;
public class Answer {//上报数据表(每条上报记录的详细数据表)
private Long id;//数据id
private Long optionsId;//选项id
private String value;//选项填报数据
private int group;//分组(同一组表示一条记录,用于多条数据区分)
private int recordId;//上报记录id
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getOptionsId() {
return optionsId;
}
public void setOptionsId(Long optionsId) {
this.optionsId = optionsId;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public int getGroup() {
return group;
}
public void setGroup(int group) {
this.group = group;
}
public int getRecordId() {
return recordId;
}
public void setRecordId(int recordId) {
this.recordId = recordId;
}
public Answer() {
}
public Answer(Long id, Long optionsId, String value, int group, int recordId) {
this.id = id;
this.optionsId = optionsId;
this.value = value;
this.group = group;
this.recordId = recordId;
}
}
package com.tiptimes.model;
public class Options {//选项表
private Long id;//选项id
private Long questionId;//问题id
private int status;//选项状态 1:启用(默认值);0:停用'
private String optionValue;//选项内容
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Options() {
}
public Long getQuestionId() {
return questionId;
}
public void setQuestionId(Long questionId) {
this.questionId = questionId;
}
public String getOptionValue() {
return optionValue;
}
public void setOptionValue(String optionValue) {
this.optionValue = optionValue;
}
public Options(Long id, Long questionId, int status, String optionValue) {
this.id = id;
this.questionId = questionId;
this.status = status;
this.optionValue = optionValue;
}
}
package com.tiptimes.model;
import java.util.Date;
import java.util.List;
public class Questionnaire {//问卷相关数据返回Vo
private Long id;//问卷id
private String questionnaireName;//问卷名称
private int status;//问卷状态 1:启用(默认值);0:停用'
private String createBy;//创建者
private Date createTime;//创建时间
private List<Answer> answersList;//问卷数据
private String createId;//上报人员唯一标识
private String createName;//上报人(众创空间)
private Integer type; //0暂存 1上报
private List<Review>reviewList;//审核备注
public List<Review> getReviewList() {
return reviewList;
}
public void setReviewList(List<Review> reviewList) {
this.reviewList = reviewList;
}
public String getCreateId() {
return createId;
}
public void setCreateId(String createId) {
this.createId = createId;
}
public String getCreateName() {
return createName;
}
public void setCreateName(String createName) {
this.createName = createName;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public List<Answer> getAnswersList() {
return answersList;
}
public void setAnswersList(List<Answer> answersList) {
this.answersList = answersList;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getQuestionnaireName() {
return questionnaireName;
}
public void setQuestionnaireName(String questionnaireName) {
this.questionnaireName = questionnaireName;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Questionnaire(Long id, String questionnaireName, int status, String createBy, Date createTime) {
this.id = id;
this.questionnaireName = questionnaireName;
this.status = status;
this.createBy = createBy;
this.createTime = createTime;
}
public Questionnaire() {
}
}
package com.tiptimes.model;
import java.util.Date;
public class Questions {//问题表
private Long id;//问题id
private Long questionnaireUuid;//问卷id
private String question;//问题
private int status;//问题状态 1:启用(默认值);0:停用'
private Date createTime;//创建时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Questions(Long id, Long questionnaireUuid, String question, int status, Date createTime) {
this.id = id;
this.questionnaireUuid = questionnaireUuid;
this.question = question;
this.status = status;
this.createTime = createTime;
}
public Questions() {
}
public Long getQuestionnaireUuid() {
return questionnaireUuid;
}
public void setQuestionnaireUuid(Long questionnaireUuid) {
this.questionnaireUuid = questionnaireUuid;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
}
package com.tiptimes.model;
import java.util.Date;
import java.util.List;
public class Record {//上报记录表
private Long id;//记录id
private Long questionnaireUuid;//问卷id
private String questionnaireName;//问卷名称
private int processStatus;//上报状态,0:未上报(默认),1:待审核, 2:驳回,3:通过
private String reason;//驳回原因
private String createBy;//上报人(众创空间)
private Date createTime;//上报时间
private String createId;//上报人员唯一标识
private List<Review> reviews;
public List<Review> getReviews() {
return reviews;
}
public void setReviews(List<Review> reviews) {
this.reviews = reviews;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getQuestionnaireName() {
return questionnaireName;
}
public void setQuestionnaireName(String questionnaireName) {
this.questionnaireName = questionnaireName;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getQuestionnaireUuid() {
return questionnaireUuid;
}
public void setQuestionnaireUuid(Long questionnaireUuid) {
this.questionnaireUuid = questionnaireUuid;
}
public int getProcessStatus() {
return processStatus;
}
public void setProcessStatus(int processStatus) {
this.processStatus = processStatus;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getCreateId() {
return createId;
}
public void setCreateId(String createId) {
this.createId = createId;
}
public Record() {
}
public Record(Long questionnaireUuid, String questionnaireName, int processStatus, String reason,
String createBy, Date createTime, String createId) {
this.questionnaireUuid = questionnaireUuid;
this.questionnaireName = questionnaireName;
this.processStatus = processStatus;
this.reason = reason;
this.createBy = createBy;
this.createTime = createTime;
this.createId = createId;
}
}
package com.tiptimes.model;
public class Review {//评审备注详情表
private Long id;
private Long questionsId;//问题id
private Long recordId;//记录id
private String remark;//驳回原因
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getQuestionsId() {
return questionsId;
}
public void setQuestionsId(Long questionsId) {
this.questionsId = questionsId;
}
public Long getRecordId() {
return recordId;
}
public void setRecordId(Long recordId) {
this.recordId = recordId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Review(Long id, Long questionsId, Long recordId, String remark) {
this.id = id;
this.questionsId = questionsId;
this.recordId = recordId;
this.remark = remark;
}
public Review() {
}
}
package com.tiptimes.service;
import com.tiptimes.model.Answer;
import com.tiptimes.model.Record;
import com.tiptimes.model.Review;
import java.util.List;
public interface QuestionnaireService {
/**
* 根据上报人和问卷id查询上报记录id
* @param questionnaireUuid 问卷id
* @param createId 上报人唯一标识
* @return
*/
Long selectRecordId(Long questionnaireUuid,String createId);
/**
* 添加上报记录数据
* @param record 上报记录
* @return
*/
Long insertRecord(Record record);
/**
* 根据上报记录id删除原上报数据
* @param recordId 上报记录id
* @return
*/
Integer delAnswer(Long recordId);
/**
* 新增新的上报数据
* @param answerList
* @param recordId
* @return
*/
Integer insertAnswer(List<Answer> answerList,Long recordId);
/**
* 修改数据上报状态
* @param record
* @return
*/
Integer updateRecord(Record record);
/**
* 通过记录id删除原有备注
* @param recordId
* @return
*/
Integer delView(Long recordId);
/**
* 添加新的备注
* @param review
* @return
*/
Integer insertReview(List<Review> review,Long recordId);
/**
*根据记录id查询上报数据详情
* @param recordId 记录id
* @return
*/
List<Answer> selectAnswerByRecordId(Long recordId);
/**
*根据记录id查询评审备注详情
* @param recordId 记录id
* @return
*/
List<Review> selectReviewByRecordId(Long recordId);
/**
*根据记录id查询评审备注详情
* @param recordId 记录id
* @return
*/
Record selectById(Long recordId);
}
package com.tiptimes.service.impl;
import com.tiptimes.dao.QuestionnaireDao;
import com.tiptimes.model.Answer;
import com.tiptimes.model.Record;
import com.tiptimes.model.Review;
import com.tiptimes.service.QuestionnaireService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class QuestionnaireServiceImpl implements QuestionnaireService {
@Autowired
private QuestionnaireDao questionnaireDao;
/**
* 根据上报人和问卷id查询上报记录id
* @param questionnaireUuid 问卷id
* @param createId 上报人唯一标识
* @return
*/
@Override
@Transactional(readOnly = true)
public Long selectRecordId(Long questionnaireUuid, String createId) {
return questionnaireDao.selectRecordId(questionnaireUuid,createId);
}
/**
* 添加上报记录
* @param record 上报记录
* @return
*/
@Override
@Transactional
public Long insertRecord(Record record) {
return questionnaireDao.insertRecord(record);
}
/**
* 根据上报记录id删除原上报数据
* @param recordId 上报记录id
* @return
*/
@Override
@Transactional
public Integer delAnswer(Long recordId) {
return questionnaireDao.delAnswer(recordId);
}
/**
* 添加上报数据
* @param answerList
* @param recordId
* @return
*/
@Override
@Transactional
public Integer insertAnswer(List<Answer> answerList, Long recordId) {
return questionnaireDao.insertAnswer(answerList,recordId);
}
/**
* 修改上报记录
* @param record
* @return
*/
@Override
@Transactional
public Integer updateRecord(Record record) {
return questionnaireDao.updateRecord(record);
}
/**
* 通过记录id删除原有备注
* @param recordId
* @return
*/
@Override
@Transactional
public Integer delView(Long recordId) {
return questionnaireDao.delView(recordId);
}
/**
* 添加新的备注
* @param review
* @return
*/
@Override
@Transactional
public Integer insertReview(List<Review> review,Long recordId) {
return questionnaireDao.insertReview(review,recordId);
}
/**
* 通过记录id删除原有备注
* @param recordId
* @return
*/
@Override
public List<Answer> selectAnswerByRecordId(Long recordId) {
return questionnaireDao.selectAnswerByRecordId(recordId);
}
/**
* 根据记录id查询评审备注详情
* @param recordId 记录id
* @return
*/
@Override
public List<Review> selectReviewByRecordId(Long recordId) {
return questionnaireDao.selectReviewByRecordId(recordId);
}
@Override
public Record selectById(Long recordId) {
return questionnaireDao.selectById(recordId);
}
}
jdbc.type=mysql
jdbc.autoCommitOnClose=false
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://10.96.129.32:3306/tianruan?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#jdbc.url=jdbc:mysql://10.96.129.32:3306/tianruan?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#jdbc.url=jdbc:mysql://localhost:3306/tianruan1?useUnicode=true&characterEncoding=utf-8
jdbc.url=jdbc:mysql://10.9.96.135:3306/tianruan?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
jdbc.username=root
jdbc.password=TR@MyPassWord71!
#jdbc.password=TR@MyPassWord71!
jdbc.password=U31X7Q5BCr0^
#jdbc.password=123456
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tiptimes.dao.QuestionnaireDao">
<insert id="insertRecord" useGeneratedKeys="true" keyProperty="id">
INSERT INTO t_record
(
questionnaire_uuid,
questionnaire_name,
process_status,
reason,
create_time,
create_by,
create_id
)
VALUES
(
#{questionnaireUuid},
#{questionnaireName},
#{processStatus},
#{reason},
#{createTime},
#{createBy},
#{createId}
)
</insert>
<insert id="insertAnswer" parameterType="com.tiptimes.model.Answer">
INSERT INTO t_answer (`options_id`, `value`, `group`, `record_id`) VALUES
<foreach collection="list" item="list" separator=",">
( #{list.optionsId}, #{list.value}, #{list.group} , #{recordId})
</foreach>
</insert>
<insert id="insertReview">
INSERT INTO t_review (`questions_id`, `remark`, `record_id`) VALUES
<foreach collection="list" item="list" separator=",">
( #{list.questionsId}, #{list.remark}, #{recordId})
</foreach>
</insert>
<update id="updateRecord">
UPDATE t_record
<trim prefix="SET" suffixOverrides=",">
<if test="processStatus != null and processStatus != ''">process_status = #{processStatus},</if>
<if test="reason != null and reason != ''">reason = #{reason},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="delAnswer">
DELETE FROM
t_answer
WHERE
record_id=#{recordId}
</delete>
<delete id="delView">
DELETE FROM
t_review
WHERE
record_id=#{recordId}
</delete>
<select id="selectRecordId" resultType="java.lang.Long">
SELECT id FROM t_record
WHERE questionnaire_uuid=#{questionnaireUuid} AND
create_id = #{createId}
</select>
<select id="selectAnswerByRecordId" resultType="com.tiptimes.model.Answer">
SELECT
options_id AS 'optionsId',
`value`,
`group`
FROM
t_answer
WHERE
record_id =#{recordId}
</select>
<select id="selectReviewByRecordId" resultType="com.tiptimes.model.Review">
SELECT
questions_id AS 'questionsId',
`remark`
FROM
t_review
WHERE
record_id =#{recordId}
</select>
<select id="selectById" resultType="com.tiptimes.model.Record">
SELECT process_status AS 'processStatus',reason
FROM t_record
WHERE id=#{recordId}
</select>
</mapper>
\ 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