first commit

This commit is contained in:
2025-02-20 15:14:38 +08:00
commit 70e3764011
1113 changed files with 107789 additions and 0 deletions
@@ -0,0 +1,197 @@
package lingtao.net.controller;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysRole;
import lingtao.net.bean.SysUser;
import lingtao.net.dao.SysUserMapper;
import lingtao.net.service.SysRoleService;
import lingtao.net.service.SysUserService;
import lingtao.net.util.MD5Util;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 用户登录注册、退出
*
* @author Administrator
*/
@Controller
@RequestMapping("/SysUser")
public class AcountController {
@Autowired
private SysUserService sysUserService;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private SysUserMapper userMapper;
/**
* 获取客户端IP
*
* @param request 请求对象
* @return IP地址
*/
public static String getIpAddr(HttpServletRequest request) {
if (request == null) {
return "unknown";
}
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Forwarded-For");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Real-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
}
/**
* 从多级反向代理中获得第一个非unknown IP地址
*
* @param ip 获得的IP地址
* @return 第一个非unknown IP地址
*/
public static String getMultistageReverseProxyIp(String ip) {
// 多级反向代理检测
if (ip != null && ip.indexOf(",") > 0) {
final String[] ips = ip.trim().split(",");
for (String subIp : ips) {
if (false == isUnknown(subIp)) {
ip = subIp;
break;
}
}
}
return StringUtils.substring(ip, 0, 255);
}
/**
* 检测给定字符串是否为未知,多用于检测HTTP请求相关
*
* @param checkString 被检测的字符串
* @return 是否未知
*/
public static boolean isUnknown(String checkString) {
return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString);
}
/**
* 登陆
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
public ModelAndView login(@RequestParam("username") String username, @RequestParam("password") String password,
HttpServletRequest request, HttpServletResponse response) throws Exception {
password = new MD5Util().md5(password, "lingtao");
// 使用 shiro 登录验证
// 1 认证的核心组件:获取 Subject 对象
Subject subject = SecurityUtils.getSubject();
// 2 将登陆表单封装成 token 对象
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
token.setHost(getIpAddr(request));
try {
// 3 让 shiro 框架进行登录验证:传递token给shiro的reaml
subject.login(token);
// return "redirect:/views/main.jsp";
// 此处并没有跳转页面-前端根据状态码跳转对应页面
return new ModelAndView("redirect:/views/main.jsp");
} catch (UnknownAccountException uae) {
// 状态码 200--成功 100--失败 300禁用
response.getWriter().print("100");
throw new UnknownAccountException("账户或密码有误!");
} catch (IncorrectCredentialsException ice) {
response.getWriter().print("100");
throw new IncorrectCredentialsException("账户或密码有误!");
} catch (LockedAccountException lae) {
response.getWriter().print("300");
throw new LockedAccountException("用户未激活!!!");
} catch (AuthenticationException re) {
response.getWriter().print("404");
throw new AuthenticationException("未知IP!!!");
}
/* catch (RuntimeException re) { response.getWriter().print("400"); throw new
* RuntimeException("用户已登录!!!"); }
*/
}
/**
* 注册
*/
@RequestMapping("/register")
@ResponseBody
public Msg register(SysUser user) {
SysUser username = userMapper.getUserByUsername(user.getUsername());
if (username != null) {
return Msg.fail("用户名已存在!");
}
return sysUserService.register(user);
}
/**
* 注销
*/
@RequestMapping("/logout")
public String logout() {
Subject subject = SecurityUtils.getSubject();
subject.logout();
return "redirect:/login.jsp";
}
/**
* 获取可以被注册的角色名称
*
* @return
*/
@RequestMapping("/getRoleName")
@ResponseBody
public Map<Number, String> roleNameList(@RequestParam(value = "isRegist") String isRegist) {
Map<Number, String> map = new HashMap<Number, String>();
List<SysRole> allRoleNames = sysRoleService.getAllRoleName(isRegist);
for (SysRole sysRole : allRoleNames) {
map.put(sysRole.getRoleId(), sysRole.getRoleName());
}
return map;
}
@ResponseBody
@RequestMapping("/getIp")
public Msg getIp(HttpServletRequest request) {
String ip = getIpAddr(request);
// String ip = "120.38.127.157";
if (ip != null) {
return Msg.success().add("ip", ip);
}
return Msg.fail();
}
}
@@ -0,0 +1,137 @@
package lingtao.net.controller;
import java.io.File;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Article;
import lingtao.net.bean.Msg;
import lingtao.net.service.ArticleService;
@Controller
public class ArticleController {
@Autowired
private ArticleService articleService;
/**
* 获取所有的文章
*
* @param article
* @return
*/
@RequestMapping("/getArticle")
@ResponseBody
public Msg articleList(Article article) {
PageHelper.startPage(1, 10);
List<Article> articles = articleService.getArticle(article);
PageInfo<Article> pageInfo = new PageInfo<Article>(articles);
return Msg.success().add("articles", pageInfo);
}
/**
* 新增文章
*/
@RequestMapping("/addArticle")
@ResponseBody
public Msg addArticle(Article article) {
return articleService.addArticle(article);
}
/**
* 文章中的图片
*/
@RequestMapping(value = "/uploadconimage", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> uploadconimage(HttpServletRequest request, @RequestParam MultipartFile file) {
Map<String, Object> mv = new HashMap<String, Object>();
Map<String, String> mvv = new HashMap<String, String>();
try {
String rootPath = request.getSession().getServletContext().getRealPath("/image/");
String contextPath = request.getContextPath();
System.err.println(contextPath);
System.out.println(rootPath);
Calendar date = Calendar.getInstance(); // Calendar.getInstance()是获取一个Calendar对象并可以进行时间的计算,时区的指定
String originalFile = file.getOriginalFilename(); // 获得文件最初的路径
String uuid = UUID.randomUUID().toString(); // UUID转化为String对象
String newfilename = date.get(Calendar.YEAR) + "" + (date.get(Calendar.MONTH) + 1) + ""
+ date.get(Calendar.DATE) + uuid.replace("-", "") + originalFile;
// 得到完整路径名
File newFile = new File(rootPath + newfilename);
/* 文件不存在就创建 */
if (!newFile.getParentFile().exists()) {
newFile.getParentFile().mkdirs();
}
String filename = originalFile.substring(0, originalFile.indexOf("."));
System.out.println(originalFile);
System.out.println(filename);
file.transferTo(newFile);
System.out.println("newFile : " + newFile);
String urlpat = contextPath + "/image/" + newfilename;
mvv.put("src", urlpat);
mvv.put("title", newfilename);
mv.put("code", 0);
mv.put("msg", "上传成功");
mv.put("data", mvv);
return mv;
} catch (Exception e) {
e.printStackTrace();
mv.put("success", 1);
return mv;
}
}
// 用户跳转页面
@RequestMapping("/toUpdateArticle")
public String index(HttpServletRequest request, HttpServletResponse response) throws Exception {
return "updateArticle";
//response.sendRedirect(request.getContextPath() + "/views/updateArticle.jsp");
}
/**
* 修改文章
*
*/
@RequestMapping("/updateArticle")
@ResponseBody
public Msg updateArticle(Article article) {
return articleService.updateArticleById(article);
}
/**
* 文章详情
*
*/
@RequestMapping("/articleInfo")
@ResponseBody
public Msg articleInfo(@RequestParam("id") Integer id) {
Article article = articleService.articleInfo(id);
return Msg.success().add("article", article);
}
/**
* 删除文章
*/
@RequestMapping("/deleteArticle")
@ResponseBody
public Msg delArticle(@RequestParam("id") Integer id) {
return articleService.delArticleById(id);
}
}
@@ -0,0 +1,105 @@
package lingtao.net.controller;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import javax.management.RuntimeErrorException;
import javax.servlet.http.HttpSession;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.http.client.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Bug;
import lingtao.net.bean.Msg;
import lingtao.net.service.BugService;
@RestController
public class BugController {
@Autowired
private BugService bugService;
private String localPrefix = "abc\\bug";
private String localPath = "C:\\lingtao\\quote_price\\upload";
//private String localDomain = "http://47.114.150.226:8080/erp";
/**
* bug列表
*
* @param page
* @param limit
* @return
*/
@RequestMapping("/getBugs")
public PageInfo<Bug> getBugs(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Bug bug) {
PageHelper.startPage(page, limit);
List<Bug> bugList = bugService.getBugs(bug);
PageInfo<Bug> pageInfo = new PageInfo<Bug>(bugList);
return pageInfo;
}
/**
* 添加角色
*/
@RequestMapping("/addBug")
public Msg addBug(Bug bug, HttpSession session) {
return bugService.addBug(bug, session);
}
// 图片上传及新增
@RequestMapping("/bugUpload")
public Msg upload(@RequestParam("file") MultipartFile file) throws Exception {
if (file.isEmpty()) {
return Msg.fail("文件不能为空");
}
// 获取文件名后缀
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
// 获取path
String path = getPath(extension, FilenameUtils.getBaseName(file.getOriginalFilename()));
// 保存文件信息
File newFile = new File(localPath + File.separator + path);
try {
FileUtils.copyInputStreamToFile(new ByteArrayInputStream(file.getBytes()), newFile);
} catch (IOException e) {
throw new RuntimeErrorException(null, "");
}
return Msg.success();
}
/**
*
* @param prefixSelf 根据上传的接口存入自己的文件夹
* @param suffix 文件的后缀
* @param fileName 文件名
* @return
*/
public String getPath(String suffix, String fileName) {
// 生成uuid
// String uuid = UUID.randomUUID().toString().replaceAll("-", "");
String path = null;
// 文件路径
path = DateUtils.formatDate(new Date(), "yyyyMMdd") + File.separator + fileName;
path = localPrefix + File.separator + File.separator + path;
return path + "." + suffix;
}
}
@@ -0,0 +1,109 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.CustomerAward;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.CustomerAwardService;
import lingtao.net.util.PublicMethods;
@Controller
public class CustomerAwardController {
@Autowired
private CustomerAwardService customerAwardService;
// 用户跳转页面
@RequestMapping("/customerAward/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.sendRedirect(request.getContextPath() + "/views/system/customerAward/customerAward.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getCustomerAward")
public PageInfo<CustomerAward> getCustomerAward(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, CustomerAward customerAward) {
PageHelper.startPage(page, limit);
List<CustomerAward> customerAwardList = customerAwardService.getCustomerAward(customerAward);
PageInfo<CustomerAward> pageInfo = new PageInfo<CustomerAward>(customerAwardList);
return pageInfo;
}
/**
* 批量删除
*
* @param ids
*/
@ResponseBody
@RequestMapping("/deleteDatas")
public Msg deleteBatch(@RequestParam(value = "ids") String ids, @RequestParam(value = "creators") String creators) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
String[] arrCreators = creators.split(",");
boolean selfFlag = true;
for (String creator : arrCreators) {
if (!user.getRealname().equals(creator)) {
selfFlag = false;
break;
}
}
// 超管身份
boolean flag = new PublicMethods().isSuper();
// 不是超管
if (!flag) {
// 判断是不是自己上传的数据
if (!selfFlag) {
return Msg.fail("禁止删除其他人数据!");
}
}
String[] arrIds = ids.split(",");
// String数组转为Integer数组
int[] ints = new int[arrIds.length];
for (int i = 0; i < arrIds.length; i++) {
ints[i] = Integer.parseInt(arrIds[i]);
}
return customerAwardService.deleteBatch(ints);
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_customerAward")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return customerAwardService.ajaxUploadExcel(file);
}
}
/**
* 获取上传过的店铺
*
* @return
*/
@ResponseBody
@RequestMapping("/getArardShopname")
public List<String> getArardShopname() {
List<String> FilenameList = customerAwardService.getArardShopname();
return FilenameList;
}
}
@@ -0,0 +1,129 @@
package lingtao.net.controller;
import java.util.List;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.CustomerData;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.CustomerDataService;
@RestController
public class CustomerDataControlle {
@Autowired
private CustomerDataService customerDataService;
@RequestMapping("/getCustomerDatas")
public Msg getCustomerDatas(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, CustomerData customerData) {
PageHelper.startPage(page, limit);
List<CustomerData> customerDatalist = customerDataService.getCustomerDatas(customerData);
PageInfo<CustomerData> pageInfo = new PageInfo<CustomerData>(customerDatalist);
return Msg.success().add("list", pageInfo);
}
/**
* 添加数据
*
* @throws Exception
*/
@RequestMapping("/addCustomerData")
public Msg addCustomerData(CustomerData customerData) throws Exception {
// 把字符串转为日期格式
customerDataService.addCustomerData(customerData);
return Msg.success();
}
/**
* 修改数据
*/
@RequestMapping("/updateCustomerData")
public Msg updateCustomerData(CustomerData customerData) {
customerDataService.updateCustomerDataById(customerData);
return Msg.success();
}
/**
* 删除数据
*/
@RequestMapping("/deleteCustomerData")
public Msg deleteCustomerData(@RequestParam("id") Integer id) {
customerDataService.deleteCustomerDataById(id);
return Msg.success();
}
/**
* 店长修改说明数据
*
* @param customerData
*/
@RequestMapping("/updateRemarkById")
public Msg updateRemarkById(@RequestParam(value = "id") int id, @RequestParam(value = "field") String field,
@RequestParam(value = "value") String value) {
// 超管、组长身份才允许修改comment
boolean flag = isSuperOrManager();
if (!flag) {
return Msg.fail();
}
customerDataService.updateRemarkById(id, field, value);
return Msg.success();
}
/**
* 修改完成状态
*
* @param id
* @return
*/
@RequestMapping("/changeIsBuy")
public Msg changeIsBuy(@RequestParam(value = "id") Integer id, @RequestParam(value = "username") String username) {
// 超管、组长身份才允许修改【成交状态】
boolean flag = isSuperOrManager();
if (!flag) {
return Msg.fail();
}
return customerDataService.changeIsBuy(id);
// 只有自己创建的数据才能更改【完成状态】
/*
* if (username.equals(user.getUsername())) { }
*/
// return Msg.fail();
}
// 是否有超管或者组长身份
public boolean isSuperOrManager() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
String role = user.getRole();
boolean flag = false;
if (role.contains(",")) {
String[] split = role.split(",");
for (int i = 0; i < split.length; i++) {
if ("1011".equals(split[i]) || "1".equals(split[i])) {
flag = true;
break;
}
}
} else {
if ("1011".equals(role) || "1".equals(role)) {
flag = true;
}
}
return flag;
}
// 获取摘要
@RequestMapping("/getProductExplain")
public List<String> getProductExplain(@RequestParam("productExplain") String productExplain) {
List<String> name = customerDataService.getProductExplain(productExplain);
return name;
}
}
@@ -0,0 +1,243 @@
package lingtao.net.controller;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.management.RuntimeErrorException;
import javax.servlet.http.HttpSession;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.http.client.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.CustomerTrainContent;
import lingtao.net.bean.CustomerTrainKindLabel;
import lingtao.net.bean.CustomerTrainProType;
import lingtao.net.bean.Msg;
import lingtao.net.service.CustomerTrainService;
@RestController
public class CustomerTrainController {
@Autowired
private CustomerTrainService customerTrainService;
private String localPrefix = "abc\\train";
private String localPath = "C:\\lingtao\\upload";
private String localDomain = "http://47.114.150.226:80/erp";
// 图片上传及新增
@RequestMapping("/imgUpload")
public Object upload(@RequestParam("file") MultipartFile file) throws Exception {
if (file.isEmpty()) {
return Msg.fail("文件不能为空");
}
// 获取文件名后缀
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
// 获取path
String path = getPath(extension, FilenameUtils.getBaseName(file.getOriginalFilename()));
// 保存文件信息
File newFile = new File(localPath + File.separator + path);
try {
FileUtils.copyInputStreamToFile(new ByteArrayInputStream(file.getBytes()), newFile);
} catch (IOException e) {
throw new RuntimeErrorException(null, "");
}
String serverPath = localDomain + "/" + path;
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map2 = new HashMap<String, Object>();
map.put("code", 0); // 0表示上传成功
map.put("msg", "上传成功"); // 提示消息
// src返回图片上传成功后的下载路径,这里直接给绝对路径
map2.put("src", serverPath);
map.put("data", map2);
return map;
}
/**
*
* @param prefixSelf 根据上传的接口存入自己的文件夹
* @param suffix 文件的后缀
* @param fileName 文件名
* @return
*/
public String getPath(String suffix, String fileName) {
// 生成uuid
// String uuid = UUID.randomUUID().toString().replaceAll("-", "");
String path = null;
// 文件路径
path = DateUtils.formatDate(new Date(), "yyyyMMdd") + File.separator + fileName;
path = localPrefix + File.separator + File.separator + path;
return path + "." + suffix;
}
/* =============产品知识内容================ */
/**
* 查询
*
* @param page
* @param limit
* @param customerTrainContent
* @return
*/
@RequestMapping("/getCustomerTrainContents")
public PageInfo<CustomerTrainContent> getCustomerTrainContents(
@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
CustomerTrainContent customerTrainContent) {
PageHelper.startPage(page, limit);
List<CustomerTrainContent> customerTrainContentList = customerTrainService
.getCustomerTrainContents(customerTrainContent);
PageInfo<CustomerTrainContent> pageInfo = new PageInfo<CustomerTrainContent>(customerTrainContentList);
return pageInfo;
}
/**
* 添加
*
*/
@RequestMapping("/addCustomerTrainContent")
public Msg addCustomerTrainContent(CustomerTrainContent customerTrainContent, HttpSession session) {
return customerTrainService.addCustomerTrainContent(customerTrainContent, session);
}
/**
* 修改
*/
@RequestMapping("/updateCustomerTrainContent")
public Msg updateCustomerTrainContent(CustomerTrainContent customerTrainContent, HttpSession session) {
return customerTrainService.updateCustomerTrainContentById(customerTrainContent, session);
}
/**
* 修改
*/
@RequestMapping("/updateCustomerTrainContentSort")
public Msg updateById(@RequestParam(value = "id") int id, @RequestParam(value = "value") String value) {
return customerTrainService.updateCustomerTrainContentSort(id, value);
}
/**
* 删除
*/
@RequestMapping("/deleteCustomerTrainContent")
public Msg deleteCustomerTrainContent(@RequestParam("id") Integer id) {
return customerTrainService.deleteCustomerTrainContentById(id);
}
/* =============产品种类================ */
/**
* 查询
*
* @param page
* @param limit
* @param customerTrainProType
* @return
*/
@RequestMapping("/getCustomerTrainProTypes")
public PageInfo<CustomerTrainProType> getCustomerTrainProTypes(
@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
CustomerTrainProType customerTrainProType) {
PageHelper.startPage(page, limit);
List<CustomerTrainProType> customerTrainProTypeList = customerTrainService
.getCustomerTrainProTypes(customerTrainProType);
PageInfo<CustomerTrainProType> pageInfo = new PageInfo<CustomerTrainProType>(customerTrainProTypeList);
return pageInfo;
}
/**
* 添加
*
*/
@RequestMapping("/addCustomerTrainProType")
public Msg addCustomerTrainProType(CustomerTrainProType customerTrainProType, HttpSession session) {
return customerTrainService.addCustomerTrainProType(customerTrainProType, session);
}
/**
* 修改
*/
@RequestMapping("/updateCustomerTrainProType")
public Msg updateCustomerTrainProType(CustomerTrainProType customerTrainProType, HttpSession session) {
return customerTrainService.updateCustomerTrainProTypeById(customerTrainProType, session);
}
/**
* 删除
*/
@RequestMapping("/deleteCustomerTrainProType")
public Msg deleteCustomerTrainProType(@RequestParam("id") Integer id) {
return customerTrainService.deleteCustomerTrainProTypeById(id);
}
/* =============产品类型================ */
/**
* 查询
*
* @param page
* @param limit
* @param customerTrainKindLabel
* @return
*/
@RequestMapping("/getCustomerTrainKindLabelsByProType")
public PageInfo<CustomerTrainKindLabel> getCustomerTrainKindLabelsByProType(
@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "needPage") String needPage, CustomerTrainKindLabel customerTrainKindLabel) {
// 0:不要分页 1:要分页
if ("1".equals(needPage))
PageHelper.startPage(page, limit);
List<CustomerTrainKindLabel> customerTrainKindLabelList = customerTrainService
.getCustomerTrainKindLabelsByProType(customerTrainKindLabel);
PageInfo<CustomerTrainKindLabel> pageInfo = new PageInfo<CustomerTrainKindLabel>(customerTrainKindLabelList);
return pageInfo;
}
/**
* 添加
*
*/
@RequestMapping("/addCustomerTrainKindLabel")
public Msg addCustomerTrainKindLabel(CustomerTrainKindLabel customerTrainKindLabel, HttpSession session) {
return customerTrainService.addCustomerTrainKindLabel(customerTrainKindLabel, session);
}
/**
* 修改
*/
@RequestMapping("/updateCustomerTrainKindLabel")
public Msg updateCustomerTrainKindLabel(CustomerTrainKindLabel customerTrainKindLabel, HttpSession session) {
return customerTrainService.updateCustomerTrainKindLabelById(customerTrainKindLabel, session);
}
/**
* 删除
*/
@RequestMapping("/deleteCustomerTrainKindLabel")
public Msg deleteCustomerTrainKindLabel(@RequestParam("id") Integer id) {
return customerTrainService.deleteCustomerTrainKindLabelById(id);
}
}
@@ -0,0 +1,75 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.ExpressFee;
import lingtao.net.bean.Msg;
import lingtao.net.service.ExpressFeeService;
@RestController
public class ExpressFeeController {
@Autowired
private ExpressFeeService expressFeeService;
/**
* 省份快递费列表
*
* @return
*/
@RequestMapping("/getExpressFees")
public Msg getExpressFees(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, ExpressFee expressFee) {
PageHelper.startPage(page, limit);
// 带分页,用于列表展示
List<ExpressFee> expressFeeList = expressFeeService.getExpressFees(expressFee);
// 全国省份
List<ExpressFee> allProvinces = expressFeeService.getAllExpressFees(expressFee);
// 手提袋偏远地区运费
List<ExpressFee> handBagExpressFees = expressFeeService.getHandBagExpressFees(expressFee);
// 封套:6、房卡套:7、吊旗:13
List<ExpressFee> taoExpressFees = expressFeeService.getTaoExpressFees(expressFee);
// 其他产品偏远地区运费
List<ExpressFee> orherExpressFees = expressFeeService.getOtherExpressFees(expressFee);
PageInfo<ExpressFee> pageInfo = new PageInfo<ExpressFee>(expressFeeList);
return Msg.success().add("list", pageInfo).add("allProvinces", allProvinces).add("handBag", handBagExpressFees)
.add("tao", taoExpressFees).add("other", orherExpressFees);
}
/**
* 添加省份快递费
*/
@RequestMapping("/addExpressFee")
public Msg addExpressFee(ExpressFee expressFee, HttpSession session) {
expressFeeService.addExpressFee(expressFee, session);
return Msg.success();
}
/**
* 修改省份快递费
*/
@RequestMapping("/updateExpressFee")
public Msg updateExpressFee(HttpSession session, @RequestParam(value = "id") int id,
@RequestParam(value = "field") String field, @RequestParam(value = "value") String value) throws Exception {
return expressFeeService.updateExpressFeeById(session, id, field, value);
}
/**
* 删除
*/
@RequestMapping("/deleteExpressFee")
public Msg deleteExpressFee(@RequestParam("id") Integer id) {
expressFeeService.deleteExpressFeeById(id);
return Msg.success();
}
}
@@ -0,0 +1,90 @@
package lingtao.net.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Msg;
import lingtao.net.bean.MyFile;
import lingtao.net.service.MyFileService;
@Controller
public class FileController {
@Autowired
private MyFileService fileService;
/**
* 上传文件
*
* @throws IOException
*/
@RequestMapping("/fileUpload")
@ResponseBody
public Msg uploadFile(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
return fileService.fileUpload(file, request);
}
/**
* 查询文件列表
* @param page
* @param limit
* @param myFile
* @param session
* @return
*/
@RequestMapping("getAllFiles")
@ResponseBody
public Msg FileList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, MyFile myFile, HttpSession session) {
PageHelper.startPage(page, limit);
List<MyFile> fileList = fileService.getFileList(myFile, session);
PageInfo<MyFile> filesInfo = new PageInfo<MyFile>(fileList);
return Msg.success().add("fileList", filesInfo);
}
/**
* 根据id删除文件
*
*/
@RequestMapping("/deleteFile")
@ResponseBody
public Msg deleteFile(@Param("fileId") Integer fileId) {
return fileService.deleteFile(fileId);
}
/**
* 批量删除
*
* @param ids
*/
@ResponseBody
@RequestMapping("/deleteFiles")
public Msg deleteBatch(@RequestParam(value = "ids") String ids, @RequestParam(value = "fileNames") String fileNames,
HttpServletRequest request) {
String[] arrIds = ids.split(",");
String[] fileNameArr = fileNames.split(";");
List<Integer> del_ids = new ArrayList<Integer>();
String hasFileload = request.getSession().getServletContext().getRealPath("/") + "/deptFile/";
for (int i = 0; i < fileNameArr.length; i++) {
del_ids.add(Integer.parseInt(arrIds[i]));
fileService.deleteBatch(del_ids);
fileService.deleteFile(hasFileload + fileNameArr[i]);
}
return Msg.success();
}
}
@@ -0,0 +1,104 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Finance;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.Finance2Service;
@Controller
public class Finance2Controller {
@Autowired
private Finance2Service finance2Service;
// 用户跳转页面
@RequestMapping("/finance_2/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/finance/finance";
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance2.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance_2")
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
PageHelper.startPage(page, limit);
List<Finance> financeList = finance2Service.getFinance(finance);
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getAllFilename_2")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = finance2Service.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename_2")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return finance2Service.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_f2")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return finance2Service.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel_2")
public void excel(HttpServletResponse response, Finance finance) throws Exception {
if (StringUtils.isEmpty(finance.getFilename())) {
return;
}
finance2Service.excel(response, finance);
}
}
@@ -0,0 +1,104 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Finance;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.Finance3Service;
@Controller
public class Finance3Controller {
@Autowired
private Finance3Service finance3Service;
// 用户跳转页面
@RequestMapping("/finance_3/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/finance/finance";
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance3.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance_3")
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
PageHelper.startPage(page, limit);
List<Finance> financeList = finance3Service.getFinance(finance);
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getAllFilename_3")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = finance3Service.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename_3")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return finance3Service.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_f3")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return finance3Service.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel_3")
public void excel(HttpServletResponse response, Finance finance) throws Exception {
if (StringUtils.isEmpty(finance.getFilename())) {
return;
}
finance3Service.excel(response, finance);
}
}
@@ -0,0 +1,104 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Finance;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.Finance4Service;
@Controller
public class Finance4Controller {
@Autowired
private Finance4Service finance4Service;
// 用户跳转页面
@RequestMapping("/finance_4/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/finance/finance";
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance4.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance_4")
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
PageHelper.startPage(page, limit);
List<Finance> financeList = finance4Service.getFinance(finance);
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getAllFilename_4")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = finance4Service.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename_4")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return finance4Service.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_f4")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return finance4Service.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel_4")
public void excel(HttpServletResponse response, Finance finance) throws Exception {
if (StringUtils.isEmpty(finance.getFilename())) {
return;
}
finance4Service.excel(response, finance);
}
}
@@ -0,0 +1,104 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Finance;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.Finance5Service;
@Controller
public class Finance5Controller {
@Autowired
private Finance5Service finance5Service;
// 用户跳转页面
@RequestMapping("/finance_5/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/finance/finance";
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance5.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance_5")
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
PageHelper.startPage(page, limit);
List<Finance> financeList = finance5Service.getFinance(finance);
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getAllFilename_5")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = finance5Service.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename_5")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return finance5Service.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_f5")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return finance5Service.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel_5")
public void excel(HttpServletResponse response, Finance finance) throws Exception {
if (StringUtils.isEmpty(finance.getFilename())) {
return;
}
finance5Service.excel(response, finance);
}
}
@@ -0,0 +1,104 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Finance;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.Finance6Service;
@Controller
public class Finance6Controller {
@Autowired
private Finance6Service finance6Service;
// 用户跳转页面
@RequestMapping("/finance_6/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/finance/finance";
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance6.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance_6")
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
PageHelper.startPage(page, limit);
List<Finance> financeList = finance6Service.getFinance(finance);
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getAllFilename_6")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = finance6Service.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename_6")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return finance6Service.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_f6")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return finance6Service.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel_6")
public void excel(HttpServletResponse response, Finance finance) throws Exception {
if (StringUtils.isEmpty(finance.getFilename())) {
return;
}
finance6Service.excel(response, finance);
}
}
@@ -0,0 +1,104 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Finance;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.Finance7Service;
@Controller
public class Finance7Controller {
@Autowired
private Finance7Service finance7Service;
// 用户跳转页面
@RequestMapping("/finance_7/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/finance/finance";
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance7.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance_7")
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
PageHelper.startPage(page, limit);
List<Finance> financeList = finance7Service.getFinance(finance);
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getAllFilename_7")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = finance7Service.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename_7")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return finance7Service.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_f7")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return finance7Service.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel_7")
public void excel(HttpServletResponse response, Finance finance) throws Exception {
if (StringUtils.isEmpty(finance.getFilename())) {
return;
}
finance7Service.excel(response, finance);
}
}
@@ -0,0 +1,104 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Finance;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.FinanceService;
@Controller
public class FinanceController {
@Autowired
private FinanceService financeService;
// 用户跳转页面
@RequestMapping("/finance/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/finance/finance";
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance")
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
PageHelper.startPage(page, limit);
List<Finance> financeList = financeService.getFinance(finance);
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getAllFilename")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = financeService.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return financeService.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_1")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return financeService.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel")
public void excel(HttpServletResponse response, Finance finance) throws Exception {
if (StringUtils.isEmpty(finance.getFilename())) {
return;
}
financeService.excel(response, finance);
}
}
@@ -0,0 +1,87 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.FinanceDifference;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.FinanceDifferenceService;
@Controller
public class FinanceDifferenceController {
@Autowired
private FinanceDifferenceService differenceService;
// 用户跳转页面
@RequestMapping("/finance/difference/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
// return "/difference/difference";
response.sendRedirect(request.getContextPath() + "/views/system/financeDifference/difference.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getDifference")
public PageInfo<FinanceDifference> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, FinanceDifference difference) {
PageHelper.startPage(page, limit);
List<FinanceDifference> differenceList = differenceService.get(difference);
PageInfo<FinanceDifference> pageInfo = new PageInfo<FinanceDifference>(differenceList);
return pageInfo;
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return differenceService.ajaxUploadExcel(file);
}
}
@ResponseBody
@RequestMapping("/getFilename")
public List<String> getAllFilename() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = differenceService.getAllFilename(user.getRealname());
return FilenameList;
}
/**
* 导出
*
* @param response
* @param request
* @param difference
* @throws Exception
*/
@RequestMapping("/excel_difference")
public void excel(HttpServletResponse response, FinanceDifference difference) throws Exception {
if (StringUtils.isEmpty(difference.getFilename())) {
return;
}
differenceService.excel(response, difference);
}
}
@@ -0,0 +1,103 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.FinanceExtract;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.FinanceExtractService;
@Controller
public class FinanceExtractController {
@Autowired
private FinanceExtractService financeExtractService;
// 用户跳转页面
@RequestMapping("/finance/extract/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.sendRedirect(request.getContextPath() + "/views/system/finance/extract/extract.jsp");
}
/**
* 根据条件查询数据
*
*/
@ResponseBody
@RequestMapping("/getFinance_extract")
public PageInfo<FinanceExtract> getFinanceExtract(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, FinanceExtract financeExtract) {
PageHelper.startPage(page, limit);
List<FinanceExtract> financeList = financeExtractService.getFinanceExtract(financeExtract);
PageInfo<FinanceExtract> pageInfo = new PageInfo<FinanceExtract>(financeList);
return pageInfo;
}
/**
* 获取自己上传过的文件名(用于导出文件)
*
* @return
*/
@ResponseBody
@RequestMapping("/getFilename_extract")
public List<String> getFilename_extract() {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
List<String> FilenameList = financeExtractService.getFilename_extract(user.getRealname());
return FilenameList;
}
/**
* 根据文件名删除自己导入过的文件
*
* @return
*/
@ResponseBody
@RequestMapping("/deleteDataByFilename2")
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
return financeExtractService.deleteDataByFilename(filename, user.getRealname());
}
/**
*
* 文件上传
*/
@ResponseBody
@RequestMapping(value = "/ajaxUpload_2")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
synchronized (this) {
return financeExtractService.ajaxUploadExcel(file);
}
}
/**
* 导出
*
* @param response
* @param request
* @param finance
* @throws Exception
*/
@RequestMapping("/excel_extract")
public void excel(HttpServletResponse response, FinanceExtract financeExtract) throws Exception {
if (StringUtils.isEmpty(financeExtract.getFilename())) {
return;
}
financeExtractService.excel(response, financeExtract);
}
}
@@ -0,0 +1,65 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Information;
import lingtao.net.bean.Msg;
import lingtao.net.service.InformationService;
@RestController
public class InformationController {
@Autowired
private InformationService informationService;
/**
* 产品知识列表
*
* @return
*/
@RequestMapping("/getInformations")
public Msg getInformations(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Information information) {
PageHelper.startPage(page, limit);
List<Information> informationList = informationService.getInformations(information);
PageInfo<Information> pageInfo = new PageInfo<Information>(informationList);
return Msg.success().add("list", pageInfo);
}
/**
* 添加产品知识
*/
@RequestMapping("/addInformation")
public Msg addInformation(Information information, HttpSession session) {
informationService.addInformation(information, session);
return Msg.success();
}
/**
* 修改产品知识
*/
@RequestMapping("/updateInformation")
public Msg updateInformation(Information information, HttpSession session) {
informationService.updateInformationById(information, session);
return Msg.success();
}
/**
* 删除
*/
@RequestMapping("/deleteInformation")
public Msg deleteInformation(@RequestParam("id") Integer id) {
informationService.deleteInformationById(id);
return Msg.success();
}
}
@@ -0,0 +1,101 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.LoginIp;
import lingtao.net.bean.Msg;
import lingtao.net.service.LoginIpService;
@Controller
public class LoginIpController {
@Autowired
private LoginIpService loginIpService;
// IP跳转页面
@RequestMapping("/loginIp/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.sendRedirect(request.getContextPath() + "/views/system/loginIp/loginIp.jsp");
}
/**
* 查询所有IP
*/
@RequestMapping("/getLoginIpList")
@ResponseBody
private Msg IPList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, LoginIp loginIp) {
PageHelper.startPage(page, limit);
List<LoginIp> list = loginIpService.getLoginIpList(loginIp);
PageInfo<LoginIp> pageInfo = new PageInfo<LoginIp>(list);
return Msg.success().add("ipList", pageInfo);
}
/**
* 添加IP
*/
@ResponseBody
@RequestMapping("/addIp")
public Msg addIp(LoginIp loginIp) {
loginIpService.addIp(loginIp);
return Msg.success();
}
/**
* 修改IP
*/
@ResponseBody
@RequestMapping("/updateIp")
public Msg updateIp(LoginIp loginIp) {
loginIpService.updateIp(loginIp);
return Msg.success();
}
/**
* 删除
*/
@RequestMapping("/deleteIp")
@ResponseBody
public Msg deleteIp(@RequestParam("id") Integer id) {
loginIpService.deleteIpById(id);
return Msg.success();
}
/**
* 批量删除
*
* @param ids
*/
@ResponseBody
@RequestMapping("/deleteIps")
public Msg deleteBatch(@RequestParam(value = "ids") String ids) {
String[] arrIds = ids.split(",");
// String数组转为Integer数组
int[] ints = new int[arrIds.length];
for (int i = 0; i < arrIds.length; i++) {
ints[i] = Integer.parseInt(arrIds[i]);
}
return loginIpService.deleteBatch(ints);
}
/**
* 检查授权IP是否存在
*/
@ResponseBody
@RequestMapping("/checkIP")
public Msg checkIP(@RequestParam(value = "agreeIp") String agreeIp) {
return loginIpService.checkIP(agreeIp);
}
}
@@ -0,0 +1,45 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.LoginLog;
import lingtao.net.service.LoginLogService;
@Controller
public class LoginLogController {
@Autowired
private LoginLogService loginLogService;
// 登录情况跳转页面
@RequestMapping("/loginLog/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.sendRedirect(request.getContextPath() + "/views/system/loginLog/loginLog.jsp");
}
/**
* 查询所有登录情况
*/
@RequestMapping("/getLoginLogList")
@ResponseBody
private PageInfo<LoginLog> IPList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, LoginLog loginLog) {
PageHelper.startPage(page, limit);
List<LoginLog> list = loginLogService.getLoginLogList(loginLog);
PageInfo<LoginLog> pageInfo = new PageInfo<LoginLog>(list);
return pageInfo;
}
}
@@ -0,0 +1,397 @@
package lingtao.net.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Msg;
import lingtao.net.bean.Product;
import lingtao.net.bean.SysDictSearchPro;
import lingtao.net.bean.SysUser;
import lingtao.net.service.ProductService;
import lingtao.net.service.QuoteLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class ProductController {
@Autowired
private ProductService productService;
@Autowired
private QuoteLogService quoteLogService;
// 价格跳转页面
@RequestMapping("/product/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.sendRedirect(request.getContextPath() + "/views/system/product/product.jsp");
}
/**
* 查询所有价格
*/
@RequestMapping("/getProductList")
@ResponseBody
private Msg IPList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Product product) {
PageHelper.startPage(page, limit);
List<Product> list = productService.getProductList(product);
PageInfo<Product> pageInfo = new PageInfo<Product>(list);
return Msg.success().add("list", pageInfo);
}
/**
* 修改价格
*
* @param customerData
*/
@RequestMapping("/updatePriceById")
public Msg updatePriceById(@RequestParam(value = "proId") int proId, @RequestParam(value = "field") String field,
@RequestParam(value = "value") String value) {
return productService.updatePriceById(proId, field, value);
}
/**
* 计算价格
*
* @param product
* @return
*/
@RequestMapping("/getThanSum")
public Msg thanPrice(Product product, HttpServletRequest request) {
SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION");
/*if (StringUtils.isEmpty(product.getWangwang().trim()) && user.getRole().contains("999")
&& !user.getRole().contains("1049")) {
return Msg.fail("请填写客户旺旺!");
}*/
if ("帆布".equals(product.getProTypeValue())) {
if ("套餐".equals(product.getStickerKind())) {
product.setCount(1);
}
} else {
if (StringUtils.isEmpty(product.getCount()) || product.getCount() <= 0) {
return Msg.fail("数量必须大于0");
}
}
// 透明不干胶进去后kindValue 会为1,记录起来,查询日志
String toumingKind = "";
if ("0".equals(product.getProTypeValue()) && "2".equals(product.getKindValue())) {
toumingKind = product.getKindValue();
}
if ("18".equals(product.getProTypeValue()) && "4".equals(product.getKindValue())) {
product.setCount(Integer.valueOf(request.getParameter("count1")));
}
product.setRole(user.getRole());
if ("菜单".equals(product.getProTypeLabel())) {
product.setSize(product.getSize1().replace(",", ""));
String s = request.getParameter("kindValue5");
product.setKind1Value(s);
product.setSize(request.getParameter("ui_menu_size"));
} else if ("4".equals(product.getProTypeValue()) && "9".equals(product.getKind())) {
product.setSize(request.getParameter("ui_shk_size"));
}
if (user.getRole().indexOf("1010") > -1) {
if ("0".equals(product.getKindValue()) && "专版打印".equals(product.getStickerKind())) {
double len = Double.valueOf(product.getSize().substring(0, product.getSize().indexOf("*")));
double wid = Double.valueOf(product.getSize().substring(product.getSize().indexOf("*") + 1));
if ((len <= 5 && wid < 4) || (len < 4 && wid <= 5)) {
product.setSize("5*4");
}
}
} else {
if (product.getNumber() != null && product.getNumber() > 1) {
if ("专版打印".equals(product.getStickerKind()) || "少数量".equals(product.getCouponKind())) {
if (request.getParameter("desType") != null && !"".equals(request.getParameter("desType"))) {
product.setP(Integer.valueOf(request.getParameter("desType")));
}
}
}
}
List<Product> proList = productService.getThanPrice(product, user.getRole());
if (proList == null) {
return Msg.fail("暂无报价");
}
//银瑾单独报价
if (user.getRole().indexOf("1010") > -1) {
double otherPrice = 0;
/*if("5".equals(product.getKind())) {
for (Product list : proList) {
list.setPrice(list.getPrice() + 30);
}
}else if("帆布".equals(product.getProTypeValue())) {
for (Product list : proList) {
otherPrice = Math.floor(list.getPrice() + 5);
list.setPrice(otherPrice > 40 ? otherPrice : 40);
if(product.getNumber() > 1) {
list.setPrice(Math.floor(list.getPrice() + 2 * (product.getNumber()-1)));
}
}
}else */
if ("22".equals(product.getProTypeValue())) {
for (Product list : proList) {
list.setPrice(list.getPrice() + 50);
}
} else if ("桌布".equals(product.getProTypeValue())) {
for (Product list : proList) {
list.setPrice(list.getPrice() + 30);
}
} else if ("13".equals(product.getProTypeValue())) {
for (Product list : proList) {
list.setPrice(list.getPrice() + 80);
}
} else if ("亚克力".equals(product.getProTypeValue())) {
for (Product list : proList) {
list.setPrice(list.getPrice() + 40);
}
} else if ("11".equals(product.getProTypeValue())) {
for (Product list : proList) {
list.setPrice(list.getPrice() + 50);
}
} else if ("0".equals(product.getProTypeValue())) {
if ("0".equals(product.getKindValue()) && "常用种类".equals(product.getStickerKind())) {
double len = Double.valueOf(product.getSize().substring(0, product.getSize().indexOf("*")));
;
double wid = Double.valueOf(product.getSize().substring(product.getSize().indexOf("*") + 1));
if ((len <= 5 && wid < 4) || (len < 4 && wid <= 5)) {
double priceArr[] = {45, 50, 75, 90, 170, 260, 440, 620, 810, 1000};
double countArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
for (Product list : proList) {
for (int i = 0; i < countArr.length; i++) {
if (countArr[i] < list.getCount()) {
continue;
}
list.setPrice(priceArr[i]);
break;
}
}
}
} else if ("11".equals(product.getKindValue()) || "布纹纸超白".equals(product.getKindValue())) {
for (Product list : proList) {
list.setPrice(Math.floor(list.getPrice() * 1.5));
}
} else if ("拉丝金".equals(product.getKindValue()) || "拉丝银".equals(product.getKindValue())) {
for (Product list : proList) {
list.setPrice(Math.floor(list.getPrice() + 60));
}
}
} else if ("金属标".equals(product.getProTypeValue()) && "UV转印贴".equals(product.getKind())) {
for (Product list : proList) {
if (list.getCount() > 500) {
list.setPrice(Math.floor(list.getPrice() * 0.95));
} else {
list.setPrice(Math.floor(list.getPrice() * 0.9));
}
}
} else if ("服装吊牌".equals(product.getProTypeValue()) && "异形模切".equals(product.getCraftQie())) {
for (Product list : proList) {
list.setPrice(list.getPrice() + 50);
}
}
}
if ("0".equals(product.getProTypeValue())) {
if ("5".equals(product.getKindValue()) && proList == null) {
if (StringUtils.isEmpty(product.getAotu())) {
return Msg.fail("哑金不干胶该尺寸无法制作,最大做到 39*27 cm");
} /*else {
return Msg.fail("哑金不干胶带凹凸工艺该尺寸无法制作 (1*1CM至11*11CM;10*6至12*8CM;20*4以内)");
}*/
} else if ("易碎纸不干胶".equals(product.getKindValue()) && proList == null) {
return Msg.fail("易碎纸不干胶该尺寸无法制作,最大做到 42*38 cm");
} else if (("拉丝金".equals(product.getKindValue()) || "拉丝银".equals(product.getKindValue()))
&& proList == null) {
return Msg.fail("拉丝金/银该尺寸无法制作,最大做到 42*38 cm");
} else if ("格底珠光膜".equals(product.getKindValue()) && proList == null) {
return Msg.fail("格底珠光膜该尺寸无法制作,最大做到 42*38 cm");
}
if (proList == null) {
if ("少数量".contentEquals(product.getStickerKind())) {
return Msg.fail("少数量最大做到 42*28.5 cm");
}
/*return Msg.fail("该工艺、该尺寸无法制作,请单独报价");*/
}
} else if ("20".equals(product.getProTypeValue())) {
if (proList == null && "0".equals(product.getKindValue())) {
return Msg.fail("双插盒该尺寸展开超过650*500MM,请另行报价");
} else if (proList == null && "1".equals(product.getKindValue())) {
return Msg.fail("飞机盒该尺寸展开超过900*600MM,请另行报价");
}
}
if (!StringUtils.isEmpty(toumingKind)) {
product.setKindValue(toumingKind);
}
// 插入操作日志
String log = quoteLogService.log(product, request, proList);
if ("登陆失效".equals(log)) {
return Msg.fail("登录信息失效~请刷新页面!");
}
// 把角色存入,前台判断,区分不同价格
for (Product p : proList) {
// p.setPrice(Math.ceil(p.getPrice() * 1.3));
p.setRole(user.getRole());
}
if (product.getKindValue() != null) {//判断是否大店报不干胶价格
/*if(product.getKindValue().equals("0")) {
double width = 0, length = 0;
if(product.getWidth() != null) {
width = product.getWidth();
}
if(product.getLength() != null) {
length = product.getLength();
}
String role = user.getRole();
if(length < width) {
length = product.getWidth();
width = product.getLength();
}
if(width == 0 && length == 0) {
}else if((length <= 5 && width <= 4)) {
String tang = product.getCraftTang();
if(AStickersPrice.f_getRole(role) == 1 && tang == null) {
List<Product> price = new ArrayList<Product>();
if(length == 1 && width == 1) {
int priceArr[] = {30, 35, 50, 55, 65, 90, 135, 185, 235, 285};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 2 && width == 1) {
int priceArr[] = {35, 40, 55, 60, 70, 95, 140, 190, 240, 290};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 3 && width == 1) {
int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 4 && width == 1) {
int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 5 && width == 1) {
int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 2 && width == 2) {
int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 3 && width == 2) {
int priceArr[] = {35, 40, 55, 70, 80, 125, 205, 290, 370, 455};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 4 && width == 2) {
int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 5 && width == 2) {
int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 3 && width == 3) {
int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 4 && width == 3) {
int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 5 && width == 3) {
int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 4 && width == 4) {
int priceArr[] = {35, 40, 55, 70, 110, 170, 290, 410, 535, 665};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}else if(length == 5 && width == 4) {
int priceArr[] = {35, 40, 55, 70, 150, 240, 420, 600, 790, 980};
price = f_getPrice( priceArr, product.getCount(), product.getCraftMo());
}
if (proList.size() >= 4) {
proList = proList.subList(0, 4);
}
for(int i = 0; i < price.size(); i ++){
if(product.getNumber() > 1) {
proList.get(i).setPrice(price.get(i).getPrice() * product.getNumber());
}else {
proList.get(i).setPrice(price.get(i).getPrice());
}
}
}
}
}elseif(user.getRole().indexOf("1033") > 0 && product.getProTypeValue().equals("17")) {
if(product.getKindValue().equals("6")) {
for (Product products : proList) {
products.setPrice(Math.floor(products.getPrice() * 0.88));
}
}
} */
}
return Msg.success().add("proList", proList);
}
/*public List<Product> f_getPrice( int priceArr[], int count, String craftMo) {
List<Product> list = new ArrayList<Product>();
Product p = new Product();
int countArr[] = { 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000 };
for(int i = 0; i < countArr.length; i++) {
if(countArr[i] < count || list.size() > 3) {
continue;
}
p = new Product();
p.setCount(countArr[i]);
if(craftMo.equals("覆哑膜")) {
p.setPrice(Math.ceil(Double.valueOf(priceArr[i]) * 1.2));
}else {
p.setPrice(Double.valueOf(priceArr[i]));
}
list.add(p);
}
return list;
}*/
/**
* 根据产品种类获取材质
*
* @param proTypeValue
* @return
*/
@RequestMapping(value = "/getKindsByPro")
public Map<String, String> kindList(@RequestParam("proTypeValue") String proTypeValue) {
Map<String, String> map = new HashMap<String, String>();
List<Product> proList = productService.getKindsByPro(proTypeValue);
for (Product product : proList) {
map.put(product.getKindValue(), product.getKindLabel());
}
return map;
}
/**
* 根据用户搜索的产品名称获取产品
*/
@RequestMapping(value = "/getSearchPro")
public List<SysDictSearchPro> searchPro(@RequestParam("likeProTypeLabel") String likeProTypeLabel)
throws Exception {
List<SysDictSearchPro> proList = productService.searchPro(likeProTypeLabel);
return proList;
}
/**
* 价格文件上传
*/
@RequestMapping(value = "/priceUpload")
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
System.out.println("进来了");
productService.ajaxUploadExcel(file);
return Msg.success();
}
}
@@ -0,0 +1,214 @@
package lingtao.net.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Msg;
import lingtao.net.bean.ProductImg;
import lingtao.net.bean.SysDictProduct;
import lingtao.net.service.ProductImgService;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.client.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.management.RuntimeErrorException;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class ProductImgController {
private String localPrefix = "abc\\product";
private String localPath = "C:\\lingtao\\upload";
private String localDomain = "http://47.114.150.226:80/erp";
@Autowired
private ProductImgService productImgService;
/**
* 根据条件查询
*/
@RequestMapping("/getImgList")
private Msg imgList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, ProductImg productImg) {
PageHelper.startPage(page, limit);
List<ProductImg> list = productImgService.getProKindList(productImg);
PageInfo<ProductImg> pageInfo = new PageInfo<ProductImg>(list);
return Msg.success().add("list", pageInfo);
}
/**
* 获取所有产品
*
* @return
*/
@RequestMapping("/productList")
public Msg productList() {
Map<String, String> map = new HashMap<String, String>();
List<SysDictProduct> proList = productImgService.findAllPro();
for (SysDictProduct entity : proList) {
map.put(entity.getProTypeValue(), entity.getProTypeLabel());
}
return Msg.success().add("proMap", map);
}
/**
* 根据产品种类获取材质
*
* @param proTypeValue
* @return
*/
/*
* @RequestMapping("/getKindsByPro") public Msg
* kindList(@RequestParam("proTypeValue") String proTypeValue) { Map<String,
* String> map = new HashMap<String, String>(); List<SysDictProduct> kindList =
* productImgService.getKindsByPro(proTypeValue); if (kindList.size() > 0) { for
* (SysDictProduct entity : kindList) { map.put(entity.getKindValue(),
* entity.getKindLabel()); } } return Msg.success().add("proMap", map); }
*/
/**
* 根据材质获取规格
*
* @param dto
* @return
*/
@RequestMapping(value = "/getKind2sByKind")
public Map<String, String> kind2List(@RequestParam("proTypeValue") String proTypeValue,
@RequestParam("kindValue") String kindValue) {
Map<String, String> map = new HashMap<String, String>();
List<SysDictProduct> kind2List = productImgService.getKind2sByKind(proTypeValue, kindValue);
if (kind2List.size() > 0) {
for (SysDictProduct entity : kind2List) {
map.put(entity.getKind2Value(), entity.getKind2Label());
}
}
return map;
}
// 图片上传及新增
@RequestMapping("/productUpload")
public Msg upload(@RequestParam("file") MultipartFile file,
@RequestParam(value = "proTypeValue", required = false) String proTypeValue,
@RequestParam(value = "kindValue", required = false) String kindValue,
@RequestParam(value = "kind2Value", required = false) String kind2Value,
@RequestParam(value = "remark", required = false) String remark) throws Exception {
if (file.isEmpty()) {
return Msg.fail("文件不能为空");
}
// 获取文件名后缀
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
// 获取path
String path = getPath(extension, FilenameUtils.getBaseName(file.getOriginalFilename()));
// 保存文件信息
File newFile = new File(localPath + File.separator + path);
try {
FileUtils.copyInputStreamToFile(new ByteArrayInputStream(file.getBytes()), newFile);
} catch (IOException e) {
throw new RuntimeErrorException(null, "");
}
System.out.println("kind2Value=" + "null".equals(kind2Value));
// 文件信息
ProductImg productImg = new ProductImg();
// productImg.setImgUrl(localPath + "/" + path);
productImg.setImgUrl(localDomain + "/" + path);
// 保存图片信息
productImg.setProTypeValue(proTypeValue);
if (StringUtils.isNotEmpty(kindValue)) {
productImg.setKindValue(kindValue);
}
if (StringUtils.isNotEmpty(kind2Value) && !"null".equals(kind2Value)) {
productImg.setKind2Value(kind2Value);
}
if (StringUtils.isNotEmpty(remark)) {
productImg.setRemark(remark);
}
// 根据value查询label
SysDictProduct label = productImgService.getLabel(productImg);
productImg.setProTypeLabel(label.getProTypeLabel());
productImg.setKindLabel(label.getKindLabel());
productImg.setKind2Label(label.getKind2Label());
// productImg.setImgUrl(productImg.getImgUrl());
productImgService.addImgUrl(productImg);
return Msg.success().add("imgList", productImg);
}
/**
* 修改备注说明
*
* @param id
* @param remark
* @return
*/
@RequestMapping("/updateImgUploadRemark")
public Msg updateImgUploadRemark(@RequestParam("id") Long id, @RequestParam("remark") String remark) {
ProductImg img = new ProductImg();
img.setId(id);
img.setRemark(remark);
productImgService.updateImgUploadRemark(img);
return Msg.success();
}
/**
* @param prefixSelf 根据上传的接口存入自己的文件夹
* @param suffix 文件的后缀
* @param fileName 文件名
* @return
*/
public String getPath(String suffix, String fileName) {
// 生成uuid
// String uuid = UUID.randomUUID().toString().replaceAll("-", "");
String path = null;
// 文件路径
path = DateUtils.formatDate(new Date(), "yyyyMMdd") + File.separator + fileName;
path = localPrefix + File.separator + File.separator + path;
return path + "." + suffix;
}
/**
* 根据条件获取产品图片
*
* @param dto
* @return
*/
@RequestMapping("/getImgs")
public List<ProductImg> imgList(@RequestParam("proTypeValue") String proTypeValue,
@RequestParam(value = "kindValue", required = false) String kindValue,
@RequestParam(value = "craftValue", required = false) String craftValue,
@RequestParam(value = "kind2Value", required = false) String kind2Value) {
List<ProductImg> imgList = productImgService.getImgsByProKind(proTypeValue, kindValue, kind2Value, craftValue);
return imgList;
}
/**
* 获取视频地址
*
* @param dto
* @return
*/
@RequestMapping("/getVideos")
public List<String> videos() {
List<String> videoUrls = productImgService.getVideos();
return videoUrls;
}
}
@@ -0,0 +1,122 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Information;
import lingtao.net.bean.Msg;
import lingtao.net.bean.Question;
import lingtao.net.bean.SysUser;
import lingtao.net.service.InformationService;
import lingtao.net.service.QuestionService;
import lingtao.net.service.SysUserService;
@RestController
public class QuestionController {
@Autowired
private QuestionService questionService;
@Autowired
private InformationService informationService;
@Autowired
private SysUserService sysUserService;
/**
* 问题列表
*
* @return
*/
@RequestMapping("/questions")
public Msg questions(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Question question) {
PageHelper.startPage(page, limit);
List<Question> questionList = questionService.questions(question);
PageInfo<Question> pageInfo = new PageInfo<Question>(questionList);
return Msg.success().add("list", pageInfo);
}
@RequestMapping("/getQuestions")
public Msg getQuestions(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit) {
PageHelper.startPage(page, limit);
// 单选题
List<Question> singleQuestionList = questionService.getSingleQuestions();
// 多选题
List<Question> multipleQuestionList = questionService.getMultipleQuestions();
// 填空题
List<Question> fillQuestionList = questionService.getFillQuestions();
// 简答题
List<Information> shortAnswerList = informationService.getShortAnswers();
PageInfo<Question> single = new PageInfo<Question>(singleQuestionList);
PageInfo<Question> multiple = new PageInfo<Question>(multipleQuestionList);
PageInfo<Question> fill = new PageInfo<Question>(fillQuestionList);
PageInfo<Information> shortAnswer = new PageInfo<Information>(shortAnswerList);
// 转成json返回JSONArray.fromObject(questionList)
return Msg.success().add("single", single).add("multiple", multiple).add("fill", fill).add("shortAnswer",
shortAnswer);
}
/**
* 添加问题
*/
@RequestMapping("/addQuestion")
public Msg addQuestion(Question question, HttpSession session) {
questionService.addQuestion(question, session);
return Msg.success();
}
/**
* 修改问题
*/
@RequestMapping("/updateQuestion")
public Msg updateQuestion(Question question, HttpSession session) {
questionService.updateQuestionById(question, session);
return Msg.success();
}
/**
* 删除
*/
@RequestMapping("/deleteQuestion")
public Msg deleteQuestion(@RequestParam("id") Integer id) {
questionService.deleteQuestionById(id);
return Msg.success();
}
/**
* 答对80%后,改变系统状态
*
* @return
*/
@RequestMapping("/videoOverToChangeSysStatus")
public Msg videoOverToChangeSysStatus(HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
return sysUserService.videoOverToChangeSysStatus(user.getUserId());
}
@RequestMapping("/examOverToChangeSysStatus")
public Msg examOverToChangeSysStatus(HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
return sysUserService.examOverToChangeSysStatus(user.getUserId());
}
/*
* @RequestMapping("/changeSysStatus") public Msg changeSysStatus(HttpSession
* session, @RequestBody Map<String, String> map) { System.out.println(map);
* Set<Entry<String, String>> entrySet = map.entrySet(); for (Entry<String,
* String> key : entrySet) { System.out.println(key); } SysUser user = (SysUser)
* session.getAttribute("USER_SESSION"); return
* sysUserService.changeSysStatus(user.getUserId()); }
*/
}
@@ -0,0 +1,165 @@
package lingtao.net.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Msg;
import lingtao.net.bean.QuoteData;
import lingtao.net.bean.SysUser;
import lingtao.net.service.QuoteDataService;
@RestController
public class QuoteDataController {
@Autowired
private QuoteDataService quoteDataService;
/**
* 获取操作日志列表
*
* @param page
* @param limit
* @param quoteLog
* @return
*/
@RequestMapping("/getQuoteData")
public PageInfo<QuoteData> logList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, QuoteData quoteData) {
PageHelper.startPage(page, limit);
List<QuoteData> logList = quoteDataService.quoteDatas(quoteData);
PageInfo<QuoteData> pageInfo = new PageInfo<QuoteData>(logList);
return pageInfo;
}
/**
* 修改数据
*
*/
@RequestMapping("/updateById")
public Msg updateById(@RequestParam(value = "id") int id, @RequestParam(value = "field") String field,
@RequestParam(value = "value") String value, @RequestParam(value = "username") String username) {
return quoteDataService.updateById(id, field, value, username);
}
/**
* 获取报过的产品
*
*/
@RequestMapping("/getProTypeLabel")
public List<String> getProType() {
return quoteDataService.getProType();
}
/**
* 修改【是否当天成交】状态(自己修改)
*
* @param id
* @return
*/
@RequestMapping("/changeIsBuyToDayStatus")
public Msg changeIsBuyToDay(@RequestParam(value = "id") Integer id,
@RequestParam(value = "username") String username) {
// 只有自己的数据才能更改【是否当天成交】状态
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
// 超管、组长身份也能更改【是否当天成交】状态
boolean flag = new CustomerDataControlle().isSuperOrManager();
if (!username.equals(user.getUsername()) && !flag) {
return Msg.fail("只允许修改自己的数据!");
}
return quoteDataService.changeIsBuyToDay(id);
}
/**
* 修改【是否成交】状态(店长修改)
*
* @param id
* @return
*/
@RequestMapping("/changeIsBuyStatus")
public Msg changeIsBuy(@RequestParam(value = "id") Integer id) {
// 超管、组长身份才允许修改【成交状态】
boolean flag = new CustomerDataControlle().isSuperOrManager();
if (!flag) {
return Msg.fail();
}
return quoteDataService.changeIsBuy(id);
}
/**
* 修改所属店铺以及选择状态
*
* @param id
* @return
*/
@RequestMapping("/updateShopname")
public Msg updateShopname(@RequestParam(value = "id") Integer id, @RequestParam(value = "shopname") String shopname,
@RequestParam(value = "username") String username) {
if (StringUtils.isEmpty(shopname)) {
return Msg.fail("请选择有效店铺!");
}
// 只有自己的数据才能更改【所属店铺】
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
if (!username.equals(user.getUsername())) {
return Msg.fail("只允许修改自己的数据!");
}
return quoteDataService.updateShopnameSelect(shopname, id);
}
@RequestMapping("/addOrderNumber")
public Msg addOrderNumber(@RequestParam(value = "id") Integer id,
@RequestParam(value = "orderNumber") String orderNumber) {
if (StringUtils.isEmpty(orderNumber)) {
return Msg.fail("请填写订单号");
}
if (orderNumber.length() < 10 || orderNumber.length() > 25) {
return Msg.fail("请填写正确的订单号");
}
return quoteDataService.addOrderNumber(id, orderNumber);
}
/**
* 柱状图
*
*/
@ResponseBody
@RequestMapping("/echartZhuSummary")
public Map<String, Object> echartZhuList(QuoteData quoteData) {
return quoteDataService.echartZhuList(quoteData, 0);
}
/**
* 客服大单统计图
*
*/
@ResponseBody
@RequestMapping("/echartKefuSummary")
public Map<String, Object> echartKefuList(QuoteData quoteData) {
return quoteDataService.echartZhuList(quoteData, 1);
}
/**
* 导出
*
* @param response
* @param request
* @param difference
* @throws Exception
*/
@RequestMapping("/excel_quoteData")
public void excel(HttpServletResponse response, QuoteData quoteData) throws Exception {
quoteDataService.excel(response, quoteData);
}
}
@@ -0,0 +1,39 @@
package lingtao.net.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.QuoteLog;
import lingtao.net.service.QuoteLogService;
@RestController
public class QuoteLogController {
@Autowired
private QuoteLogService quoteLogService;
/**
* 获取操作日志列表
*
* @param page
* @param limit
* @param quoteLog
* @return
*/
@RequestMapping("/getQuoteLog")
public PageInfo<QuoteLog> logList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, QuoteLog quoteLog) {
PageHelper.startPage(page, limit);
List<QuoteLog> logList = quoteLogService.quoteLogs(quoteLog);
PageInfo<QuoteLog> pageInfo = new PageInfo<QuoteLog>(logList);
return pageInfo;
}
}
@@ -0,0 +1,67 @@
package lingtao.net.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysDictSearchPro;
import lingtao.net.service.SysDictSearchProService;
@RestController
public class SysDictSearchProController {
@Autowired
private SysDictSearchProService searchProService;
/**
* 查询关键字
*
* @param searchPro
* @return
*/
@RequestMapping("/getKeyWordsList")
public PageInfo<SysDictSearchPro> keyWordsList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, SysDictSearchPro searchPro) {
PageHelper.startPage(page, limit);
List<SysDictSearchPro> keyWordsList = searchProService.keyWordsList(searchPro);
PageInfo<SysDictSearchPro> pageInfo = new PageInfo<SysDictSearchPro>(keyWordsList);
return pageInfo;
}
/**
* 添加关键字
*/
@RequestMapping("/addSearchPro")
public Msg addSearchPro(SysDictSearchPro searchPro, HttpSession session) {
return searchProService.addSearchPro(searchPro, session);
}
/**
* 根据id修改关键字
*
*/
@ResponseBody
@RequestMapping("/updateKeyWord")
public Msg updateKeyWordById(HttpSession session, @RequestParam(value = "id") int id,
@RequestParam(value = "value") String value, @RequestParam(value = "field") String field) throws Exception {
return searchProService.updateKeyWordById(session, id, value, field);
}
/**
* 改变用户状态
*/
@RequestMapping("/changeKeyWordsStatus")
public Msg changeKeyWordStatus(@RequestParam(value = "id") Integer id) {
return searchProService.changeKeyWordStatus(id);
}
}
@@ -0,0 +1,42 @@
package lingtao.net.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import lingtao.net.bean.SysPermission;
import lingtao.net.service.SysPermissionService;
@RequestMapping("/sysPermission")
@Controller
public class SysPermissionController {
@Autowired
private SysPermissionService sysPermissionService;
@RequestMapping("/index")
public String index() throws Exception {
return "system/permission/index";
}
@RequestMapping("/parentList")
@ResponseBody
public List<SysPermission> parentList() {
return sysPermissionService.getParentPers();
}
@RequestMapping("/list")
@ResponseBody
public Map<String, Object> list() throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("code", 0);
map.put("msg", null);
map.put("data", sysPermissionService.getAll());
return map;
}
}
@@ -0,0 +1,172 @@
package lingtao.net.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysRole;
import lingtao.net.bean.SysUser;
import lingtao.net.service.SysRoleService;
/**
* 角色权限
*/
@Controller
public class SysRoleController {
@Autowired
private SysRoleService sysRoleService;
// 用户跳转页面
@RequestMapping("/role/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.sendRedirect(request.getContextPath() + "/views/system/role/role.jsp");
}
/**
* 根据条件查询角色
*/
@RequestMapping("/getRoleList")
@ResponseBody
private Msg roleList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, SysRole role) {
PageHelper.startPage(page, limit);
List<SysRole> list = sysRoleService.getRoles(role);
// 查询所有的角色,不分页:用于查询
List<SysRole> allRoleList = sysRoleService.getRoles(role);
PageInfo<SysRole> pageInfo = new PageInfo<SysRole>(list);
return Msg.success().add("roleList", pageInfo).add("allRoleList", allRoleList);
}
/**
* 添加角色
*/
@ResponseBody
@RequestMapping("/addRole")
public Msg addRole(SysRole role, HttpSession session) {
return sysRoleService.addRole(role, session);
}
/**
* 修改角色
*/
@ResponseBody
@RequestMapping("/updateRole")
public Msg updateRoleById(SysRole role) {
return sysRoleService.updateRoleById(role);
}
/**
* 改变角色状态
*/
@ResponseBody
@RequestMapping("/changeRoleStatus")
public Msg changeRoleStatus(@RequestParam(value = "roleId") String roleId) {
return sysRoleService.changeRoleStatus(roleId);
}
/**
* 根据角色id查询角色拥有的权限
*
* @param roleId
* @return List<perId>
*/
@RequestMapping("/rolePers")
@ResponseBody
public List<Integer> rolePers(Integer roleId) throws Exception {
return sysRoleService.getPerIdsByRoleId(roleId);
}
/**
* 根据角色id授权(先删除已有的权限,再插入新的权限集合)
*/
@RequestMapping("/assignPers")
@ResponseBody
public Map<String, Object> assignPers(Integer roleId, String persIds) throws Exception {
Map<String, Object> map = new HashMap<>();
sysRoleService.deleteRolePermissions(roleId);
sysRoleService.addRolePermissions(roleId, persIds.split(","));
return map;
}
/**
* 角色名称字段转换
*
* @return
*/
@RequestMapping("/changeRoleName")
@ResponseBody
public Map<Number, String> changeRoleName() {
Map<Number, String> map = new HashMap<Number, String>();
List<SysRole> allRoleNames = sysRoleService.getAllRoleName(null);
for (SysRole sysRole : allRoleNames) {
map.put(sysRole.getRoleId(), sysRole.getRoleName());
}
return map;
}
/**
* 获取用户拥有的角色列表
*
* @return
*/
@ResponseBody
@RequestMapping("/getUserRoles")
public Msg userRoles(String flag) {
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
// 用户角色集合
List<SysRole> userRoleList = null;
// 用户所拥有的角色
String[] roleList = user.getRole().split(",");
// 判断是否拥有超管身份标识
boolean isSuper = false;
boolean isAllShop = false;
for (int i = 0; i < roleList.length; i++) {
// 有‘超级管理员’身份,状态改为true
if ("1".equals(roleList[i])) {
isSuper = true;
break;
}
// 客服数据管理页面
if (StringUtils.isNotEmpty(flag)) {
// 拥有‘所有店铺’身份,状态为ture
if ("777".equals(roleList[i])) {
isAllShop = true;
break;
}
}
}
// 如果有‘超级管理员’身份,查询所有角色;如果没,就查询用户所拥有的且允许被创建的角色
if (isSuper) {
userRoleList = sysRoleService.getRoles(null);
} else {
// 如果有‘所有店铺’身份,查询所有允许被创建的角色;如果没,就查询用户所拥有的且允许被创建的角色
if (isAllShop) {
userRoleList = sysRoleService.getAllRoleName("1");
} else {
userRoleList = sysRoleService.getRolesByUserId(user.getUserId());
}
}
return Msg.success().add("userRoleList", userRoleList);
}
}
@@ -0,0 +1,240 @@
package lingtao.net.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Msg;
import lingtao.net.bean.SysUser;
import lingtao.net.service.SysUserService;
import lingtao.net.util.PublicMethods;
/**
* 用户
*
*/
@Controller
public class SysUserController {
@Autowired
private SysUserService sysUserService;
// 用户跳转页面
@RequestMapping("/user/index")
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.sendRedirect(request.getContextPath() + "/views/system/user/user.jsp");
}
/**
* 根据条件查询用户
*/
@RequestMapping("/getUserList")
@ResponseBody
private Msg userList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, SysUser user) {
PageHelper.startPage(page, limit);
List<SysUser> list = sysUserService.getUsers(user);
PageInfo<SysUser> pageInfo = new PageInfo<SysUser>(list);
return Msg.success().add("userList", pageInfo);
}
/**
* 检查用户名是否存在
*/
@ResponseBody
@RequestMapping("/checkUsername")
public Msg checkUsername(@RequestParam(value = "username") String username) {
return sysUserService.checkUsername(username);
}
/**
* 添加用户
*/
@ResponseBody
@RequestMapping("/addUser")
public Msg addUser(SysUser user) {
sysUserService.addUser(user);
if (StringUtils.isNotEmpty(user.getRole())) {
addUserRoles(user);
}
return Msg.success();
}
/**
* 修改用户
*/
@ResponseBody
@RequestMapping("/updateUser")
public Msg updateUserById(SysUser user) {
sysUserService.updateUserById(user);
sysUserService.deleteUserRoles(user.getUserId());
if (StringUtils.isNotEmpty(user.getRole())) {
addUserRoles(user);
}
return Msg.success();
}
/**
* 删除用户
*/
@RequestMapping("/deleteUserById")
@ResponseBody
public Msg deleteUserById(@RequestParam("id") Integer userId) {
return sysUserService.deleteUserById(userId);
}
/**
* 根据用户编号更改角色
*
* @param user
*/
public void addUserRoles(SysUser user) {
String[] array = user.getRole().split(",");
Integer[] ids = new Integer[array.length];
for (int i = 0; i < array.length; i++) {
ids[i] = Integer.parseInt(array[i]);
}
Integer userId = user.getUserId();
sysUserService.addUserRoles(userId, ids);
}
/**
* 改变用户状态
*/
@ResponseBody
@RequestMapping("/changeUserStatus")
public Msg changeUserStatus(@RequestParam(value = "userId") Integer userId) {
return sysUserService.changeUserStatus(userId);
}
/**
* 改变用户系统状态
*/
@ResponseBody
@RequestMapping("/changeSysStatus")
public Msg changeSysStatus(@RequestParam(value = "userId") Integer userId) {
return sysUserService.changeSysStatus(userId);
}
/**
* 改变所有用户的Ip状态
*/
@ResponseBody
@RequestMapping("/changeNeedIp")
public Msg changeNeedIp() {
return sysUserService.changeNeedIp();
}
/**
* 改变用户阅读日志状态
*/
@ResponseBody
@RequestMapping("/changeReadLogStatus")
public Msg changeReadLogStatus(HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
sysUserService.changeReadLogStatus(user.getUserId());
return Msg.success();
}
/**
* 获取用户信息
*
* @param session
* @return
*/
@ResponseBody
@RequestMapping("/getUserInfo")
public Msg getUserInfo(HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
SysUser userInfo = sysUserService.getUserInfo(user.getUserId());
if (userInfo != null) {
return Msg.success().add("userInfo", userInfo);
}
return Msg.fail();
}
/**
* 修改密码
*
*/
@ResponseBody
@RequestMapping("/updatePassword")
public Msg updatePassword(SysUser user) {
return sysUserService.updatePassword(user);
}
/**
* 补充生日
*
*/
@ResponseBody
@RequestMapping("/addBirthDay")
public Msg addBirthDay(SysUser user) {
return sysUserService.addBirthDay(user);
}
/**
* 改变用户生日状态
*/
@ResponseBody
@RequestMapping("/changeIsBirthDay")
public Msg changeIsBirthDay(HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
sysUserService.changeIsBirthDay(user.getUserId());
return Msg.success();
}
/**
* 从session中取出登录用户到信息
*
* @return
*/
@ResponseBody
@RequestMapping("/loginAttribute")
public Msg loginAttribute(HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
if (user != null) {
return Msg.success().add("user", user);
}
return Msg.fail();
}
/**
* 客服数据 -- 根据搜索的店铺获取人员
*
* @return
*/
@RequestMapping("/getRealnamesByShopname")
@ResponseBody
public Map<String, String> getRealnamesByShopname(@RequestParam(value = "shopname") String shopname,
HttpServletRequest request) {
Map<String, String> map = new HashMap<String, String>();
SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION");
// 没有选择店铺 没有超管或者 没有店铺身份
if (StringUtils.isEmpty(shopname) && (!new PublicMethods().isSuper() && !user.getRole().contains("777"))) {
return null;
}
List<SysUser> realnameList = sysUserService.getRealnamesByShopname(shopname);
for (SysUser sysUser : realnameList) {
map.put(sysUser.getRealname(), sysUser.getRealname());
}
return map;
}
}
@@ -0,0 +1,67 @@
package lingtao.net.controller;
import com.github.pagehelper.PageHelper;
import lingtao.net.bean.Msg;
import lingtao.net.bean.UpdateLog;
import lingtao.net.service.UpdateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.List;
@RestController
public class UpdateLogControllef {
@Autowired
private UpdateLogService updateLogService;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@RequestMapping("/getUpdateLogs")
public Msg getUpdateLogs(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, UpdateLog updateLog) {
PageHelper.startPage(page, limit);
List<UpdateLog> updateLogList = updateLogService.getUpdateLogs(updateLog);
for (UpdateLog log : updateLogList) {
log.setAddTimeStr(sdf.format(log.getAddTime()));
}
return Msg.success().add("list", updateLogList);
}
/**
* 添加更新日志
*
* @throws Exception
*/
@RequestMapping("/addLog")
public Msg addLog(UpdateLog updateLog, HttpSession session) throws Exception {
// 把字符串转为日期格式
updateLog.setAddTime(sdf.parse(updateLog.getAddTimeStr()));
updateLogService.addLog(updateLog, session);
// 更新日志后,把所有用户的阅读更新日志状态改为未读:0
updateLogService.changeReadLogStatus();
return Msg.success();
}
/**
* 修改更新日志
*/
@RequestMapping("/updateLog")
public Msg updateLog(UpdateLog updateLog, HttpSession session) {
updateLogService.updateLogById(updateLog, session);
return Msg.success();
}
/**
* 删除
*/
@RequestMapping("/deleteLog")
public Msg deleteLog(@RequestParam("id") Integer id) {
updateLogService.deleteLogById(id);
return Msg.success();
}
}