项目源码
64
ksafepack-admin/pom.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.kelp</groupId>
|
||||
<artifactId>ksafepack</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>war</packaging>
|
||||
<artifactId>loulan</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.kelp</groupId>
|
||||
<artifactId>ksafepack-framework</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
43
ksafepack-admin/src/main/java/com/kelp/KelpApplication.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.kelp;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
||||
|
||||
import com.kelp.common.base.RichFreeMarkerView;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author kelp
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@EnableScheduling
|
||||
public class KelpApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(KelpApplication.class, args);
|
||||
|
||||
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ \n" + " .-------. ____ __ \n"
|
||||
+ " | _ _ \\ \\ \\ / / \n" + " | ( ' ) | \\ _. / ' \n"
|
||||
+ " |(_ o _) / _( )_ .' \n" + " | (_,_).' __ ___(_ o _)' \n"
|
||||
+ " | |\\ \\ | || |(_,_)' \n" + " | | \\ `' /| `-' / \n"
|
||||
+ " | | \\ / \\ / \n" + " ''-' `'-' `-..-' ");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandLineRunner customFreemarker(final FreeMarkerViewResolver resolver) {
|
||||
return new CommandLineRunner() {
|
||||
@Override
|
||||
public void run(String... strings) throws Exception {
|
||||
// 增加视图
|
||||
resolver.setViewClass(RichFreeMarkerView.class);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author kelp
|
||||
*/
|
||||
public class KelpServletInitializer extends SpringBootServletInitializer {
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(KelpApplication.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class AnQuanFuWuController {
|
||||
|
||||
private final String prefix = "business/anquanfuwu";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class AnQuanWeiFuWuController {
|
||||
|
||||
private final String prefix = "business/anquanweifuwu";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class AppController {
|
||||
private final String prefix = "business/app";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.kelp.business;
|
||||
|
||||
|
||||
import com.kelp.business.dao.BuyDao;
|
||||
import com.kelp.business.entity.Buy;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
import com.kelp.crm.service.ECustomerService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class BuyController {
|
||||
private final String prefix = "/business/buy";
|
||||
|
||||
protected String RESULT = "result";
|
||||
protected String MESSAGE = "message";
|
||||
|
||||
@Autowired
|
||||
private BuyDao buyDao;
|
||||
|
||||
@Autowired
|
||||
private ECustomerService customerService;
|
||||
|
||||
@PostMapping(path = {prefix + "/{id}"})
|
||||
public ModelMap index(@PathVariable("id") String id, Buy buy) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
ECustomer eCustomer = new ECustomer();
|
||||
String companyName = buy.getCompanyName();
|
||||
|
||||
if (StringUtil.isEmpty(companyName) || companyName.length() > 50) {
|
||||
modelMap.put(MESSAGE, "公司名称不能为空或长度不能大于50!");
|
||||
modelMap.put(RESULT, false);
|
||||
return modelMap;
|
||||
}
|
||||
eCustomer.setName(companyName);
|
||||
|
||||
String name = buy.getName();
|
||||
if (StringUtil.isEmpty(name) || name.length() > 20) {
|
||||
modelMap.put(MESSAGE, "姓名不能为空或长度不能大于20!");
|
||||
modelMap.put(RESULT, false);
|
||||
return modelMap;
|
||||
}
|
||||
eCustomer.setContact(name);
|
||||
|
||||
String telephone = buy.getTelephone();
|
||||
if (StringUtil.isEmpty(telephone) || telephone.length() > 20) {
|
||||
modelMap.put(MESSAGE, "联系电话数据非法!");
|
||||
modelMap.put(RESULT, false);
|
||||
return modelMap;
|
||||
}
|
||||
eCustomer.setTelephone(telephone);
|
||||
eCustomer.setEffctiveTime(System.currentTimeMillis());
|
||||
eCustomer.setExpiredTime(System.currentTimeMillis());
|
||||
eCustomer.setState("00");
|
||||
// 跟单人姓名
|
||||
eCustomer.setStaffName("楼兰安全");
|
||||
|
||||
ECustomer customer = customerService.getByName(eCustomer.getName());
|
||||
if (customer == null) {
|
||||
eCustomer = customerService.add(eCustomer);
|
||||
buy.setCustomerId(eCustomer.getId());
|
||||
} else {
|
||||
buy.setCustomerId(customer.getId());
|
||||
}
|
||||
buy.setType(id);
|
||||
buyDao.add(buy);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class DuLiZhanAnQuanController {
|
||||
private final String prefix = "business/dulizhananquan";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class GuanYuWoMenController {
|
||||
private final String prefix = "business/guanyuwomen";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class GuanYuWoMenLianXiController {
|
||||
private final String prefix = "business/guanyuwomenlianxi";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class GuanYuWoMenYouShiController {
|
||||
private final String prefix = "business/guanyuwomenyoushi";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class GuanYuWoMenZhaoPinController {
|
||||
private final String prefix = "business/guanyuwomenzhaopin";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class IndexController {
|
||||
private final String prefix = "business";
|
||||
|
||||
/**
|
||||
* 主页
|
||||
*/
|
||||
@RequestMapping({"/" + prefix, "/" + prefix +"/index"})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.business.dao.NewsDao;
|
||||
import com.kelp.business.entity.News;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Controller
|
||||
public class XinWenXiangQingController {
|
||||
private final String prefix = "business/xinwenxiangqing";
|
||||
|
||||
@Resource
|
||||
private NewsDao newsDao;
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model, String id) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
News news = newsDao.get(Long.valueOf(id));
|
||||
model.addAttribute("news", news);
|
||||
Page<News> page = newsDao.getPage(0, 10, news.getType());
|
||||
model.addAttribute("resembleNewsList", page.getData());
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.business.dao.NewsDao;
|
||||
import com.kelp.business.entity.News;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Controller
|
||||
public class XinWenZhongXin2Controller {
|
||||
private final String prefix = "business/xinwenzhongxin2";
|
||||
|
||||
@Resource
|
||||
private NewsDao newsDao;
|
||||
|
||||
/**
|
||||
* 新闻中心-安全微服务
|
||||
*/
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model, Integer pageNum) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
if (null == pageNum || pageNum < 0) {
|
||||
pageNum = 1;
|
||||
}
|
||||
String type = "2";
|
||||
Page<News> page = newsDao.getPage(pageNum, 10, type);
|
||||
model.addAttribute("page", page);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.business.dao.NewsDao;
|
||||
import com.kelp.business.entity.News;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Controller
|
||||
public class XinWenZhongXinController {
|
||||
private final String prefix = "business/xinwenzhongxin";
|
||||
|
||||
@Resource
|
||||
private NewsDao newsDao;
|
||||
|
||||
/**
|
||||
* 新闻中心-法律法规
|
||||
*/
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model, Integer pageNum) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
if (null == pageNum || pageNum < 0) {
|
||||
pageNum = 1;
|
||||
}
|
||||
String type = "1";
|
||||
Page<News> page = newsDao.getPage(pageNum, 10, type);
|
||||
model.addAttribute("page", page);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.business;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class YiYuan5SController {
|
||||
private final String prefix = "business/yiyuan5s";
|
||||
|
||||
@RequestMapping({"/" + prefix})
|
||||
public String index(Model model) {
|
||||
model.addAttribute("prefix", "/" + prefix);
|
||||
return prefix + "/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.kelp.common.controller;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.google.code.kaptcha.Constants;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.kelp.common.config.RedisBean;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
|
||||
/**
|
||||
* 图片验证码(支持算术形式)
|
||||
*
|
||||
* @author kelp
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/captcha")
|
||||
public class CaptchaController extends BaseController {
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisBean redisBean;
|
||||
|
||||
/**
|
||||
* 验证码生成
|
||||
*/
|
||||
@GetMapping(value = "/captchaImage")
|
||||
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) {
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
response.setDateHeader("Expires", 0);
|
||||
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setContentType("image/jpeg");
|
||||
|
||||
String type = request.getParameter("type");
|
||||
String timestamp = request.getParameter("timestamp");
|
||||
|
||||
if (type == null || type.length() > 10 || timestamp == null || timestamp.length() > 20) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String capStr = null;
|
||||
String code = null;
|
||||
BufferedImage bi = null;
|
||||
if ("math".equals(type)) {
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
bi = captchaProducerMath.createImage(capStr);
|
||||
} else if ("char".equals(type)) {
|
||||
capStr = code = captchaProducer.createText();
|
||||
bi = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
//验证码两分钟内有效
|
||||
redisBean.hset(Constants.KAPTCHA_SESSION_KEY, timestamp, code,2);
|
||||
|
||||
out = response.getOutputStream();
|
||||
ImageIO.write(bi, "jpg", out);
|
||||
out.flush();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.kelp.crm.api.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
import com.kelp.crm.service.ECustomerService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/api/customer")
|
||||
@Controller
|
||||
public class ACustomerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ECustomerService customerService;
|
||||
|
||||
@RequestMapping("/index")
|
||||
public String index(HttpServletRequest request, HttpServletResponse response) {
|
||||
System.out.println("ip index");
|
||||
return "/ip/index";
|
||||
}
|
||||
|
||||
@RequestMapping("/submit")
|
||||
public @ResponseBody ModelMap submit(HttpServletRequest request, ECustomer customer) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(customer);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (customerService.getByName(customer.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "您已提交,请等待客服联系您!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
customer.setStaffName("楼兰网安");
|
||||
customer.setDescription("");
|
||||
customer.setState("00");
|
||||
customerService.add(customer);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "您已提交,请等待客服联系您!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(ECustomer customer) {
|
||||
|
||||
if (customer == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getContact()) || customer.getContact().length() > 20) {
|
||||
return new ErrorMessage("请正确填写您的称呼!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getTelephone()) || customer.getTelephone().length() > 20) {
|
||||
return new ErrorMessage("请正确填写联系电话!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getName()) || customer.getName().length() > 50) {
|
||||
return new ErrorMessage("请正确填写公司名称!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.biz.service.FileUploadService;
|
||||
import com.kelp.common.constant.RegexConstants;
|
||||
import com.kelp.common.utils.security.Md5Utils;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
import com.kelp.crm.service.EAccountService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.service.E_RoleService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm/account")
|
||||
@Controller
|
||||
public class EAccountController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private EAccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private E_RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("roles", roleService.getAll());
|
||||
|
||||
// 从redis中取当前登录人所属部门id
|
||||
modelMap.put("departmentId", getDepartmentId(request));
|
||||
|
||||
return new ModelAndView("/crm/account", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<EAccount> list(HttpServletRequest request, Page<EAccount> page, String qdepartmentId,
|
||||
String qname, String qtelephone, String qroleId, String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<EAccount>();
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(qdepartmentId)) {
|
||||
// 从redis中取当前登录人所属部门id
|
||||
qdepartmentId = getDepartmentId(request);
|
||||
}
|
||||
|
||||
return accountService.getPage(page.getPageIndex(), page.getLimit(), getEnterpriseId(request), qdepartmentId,
|
||||
qname, qtelephone, qroleId, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
EAccount account = accountService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("account", account);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, EAccount account) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (accountService.getByTelephone(account.getTelephone()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setId(null);
|
||||
account.setEnterpriseId(Long.valueOf(getEnterpriseId(request)));
|
||||
account.setPassword(Md5Utils.hash("d1234567"));
|
||||
accountService.add(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, EAccount account) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("account", account);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
EAccount accountP = accountService.getByTelephone(account.getTelephone());
|
||||
if (accountP != null && !account.getId().equals(accountP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
accountP = accountService.getById(String.valueOf(account.getId()));
|
||||
if (accountP == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setCreateTime(accountP.getCreateTime());
|
||||
account.setUpdateTime(System.currentTimeMillis());
|
||||
account.setEnterpriseId(Long.valueOf(getEnterpriseId(request)));
|
||||
account.setPassword(accountP.getPassword());
|
||||
account.setAvatar(accountP.getAvatar());
|
||||
|
||||
accountService.update(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
accountService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(EAccount account) {
|
||||
|
||||
if (account == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (account.getDepartmentId() == null) {
|
||||
return new ErrorMessage("所属部门不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getName()) || account.getName().length() > 128) {
|
||||
return new ErrorMessage("昵称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRealName() != null && account.getRealName().length() > 128) {
|
||||
return new ErrorMessage("真实姓名长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getTelephone()) || account.getTelephone().length() > 128) {
|
||||
return new ErrorMessage("手机号不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!account.getTelephone().matches(RegexConstants.MOBILE_PHONE_NUMBER_PATTERN)) {
|
||||
return new ErrorMessage("手机号格式有误!", false);
|
||||
}
|
||||
|
||||
if (account.getSex() == null || account.getSex().length() != 1) {
|
||||
return new ErrorMessage("性别不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRoleId() == null) {
|
||||
return new ErrorMessage("账号角色不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getState() == null || account.getState().length() != 2) {
|
||||
return new ErrorMessage("账号状态不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
@RequestMapping("/toSelfInfo")
|
||||
public @ResponseBody ModelAndView toSelfInfo(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("roleName", roleService.getById(redisBean.hget(getAccountId(request), "e_role")).getName());
|
||||
|
||||
EAccount account = accountService.getById(getAccountId(request));
|
||||
account.mask();
|
||||
modelMap.put("account", account);
|
||||
|
||||
return new ModelAndView("/crm/self_info", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/selfInfo")
|
||||
public @ResponseBody ModelMap selfInof(HttpServletRequest request, HttpServletResponse response, EAccount account,
|
||||
MultipartFile avatarFile) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtils.isEmpty(account.getName()) || account.getName().length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "昵称不能为空或长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getRealName() != null && account.getRealName().length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "真实姓名长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getSex() == null || account.getSex().length() != 1) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "性别不能为空或长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
EAccount accountP = accountService.getById(getAccountId(request));
|
||||
accountP.setName(account.getName());
|
||||
accountP.setRealName(account.getRealName());
|
||||
accountP.setSex(account.getSex());
|
||||
|
||||
if (avatarFile != null && !avatarFile.isEmpty()) {
|
||||
String avatarPath = fileUploadService.uploadImageFile(avatarFile);
|
||||
if (avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "文件格式不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
accountP.setAvatar(avatarPath);
|
||||
}
|
||||
|
||||
accountService.update(accountP);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "个人资料修改成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toPassword")
|
||||
public @ResponseBody ModelAndView toPassword(HttpServletRequest request, HttpServletResponse response) {
|
||||
return new ModelAndView("/crm/password");
|
||||
}
|
||||
|
||||
@RequestMapping("/password")
|
||||
public @ResponseBody ModelMap password(HttpServletRequest request, HttpServletResponse response, String opassword,
|
||||
String npassword, String cpassword) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtils.isEmpty(opassword) || opassword.length() < 6) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "原始密码不能为空!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(npassword) || npassword.length() < 6) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码不能为空且不能少于6位!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (!opassword.matches(RegexConstants.LETTER_DIGIT_PATTERN)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码必须包含数字和字母!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(cpassword) || !cpassword.equals(npassword)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码与确认密码不一致!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String accountId = getAccountId(request);
|
||||
EAccount account = accountService.getById(accountId);
|
||||
if (!Md5Utils.hash(opassword).equals(account.getPassword())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "旧密码输入不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setPassword(Md5Utils.hash(npassword));
|
||||
accountService.update(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "密码修改成功,建议您重新登录!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.EContract;
|
||||
import com.kelp.crm.service.EContractService;
|
||||
import com.kelp.crm.service.ECustomerService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm/contract")
|
||||
@Controller
|
||||
public class EContractController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ECustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private EContractService contractService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("customers", customerService.getAll(null));
|
||||
|
||||
return new ModelAndView("/crm/contract4all", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<EContract> list(HttpServletRequest request, Page<EContract> page, String qstartDate,
|
||||
String qendDate, String qcustomerName, String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<EContract>();
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(qstate) && qstate.length() != 2) {
|
||||
return new Page<EContract>();
|
||||
}
|
||||
|
||||
return contractService.getPage(page.getPageIndex(), page.getLimit(), qstartDate, qendDate, qcustomerName,
|
||||
qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("contract", contractService.getById(id));
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, EContract contract) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(contract);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
contract.setAccountId(Long.valueOf(getAccountId(request)));
|
||||
contractService.add(contract);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, EContract contract) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(contract);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (contract.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("contract", contract);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 先设置
|
||||
EContract contractP = contractService.getById(String.valueOf(contract.getId()));
|
||||
contractP.setCustomerId(contract.getCustomerId());
|
||||
contractP.setStaffName(contract.getStaffName());
|
||||
contractP.setCustomerSignatory(contract.getCustomerSignatory());
|
||||
contractP.setSignTime(contract.getSignTime());
|
||||
contractP.setEndTime(contract.getEndTime());
|
||||
contractP.setAmount(contract.getAmount());
|
||||
contractP.setFapiao(contract.getFapiao());
|
||||
contractP.setDso(contract.getDso());
|
||||
contractP.setContent(contract.getContent());
|
||||
contractP.setState(contract.getState());
|
||||
contractP.setUpdateTime(System.currentTimeMillis());
|
||||
|
||||
contractService.update(contractP);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "修改成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
contractService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "禁用成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(EContract contract) {
|
||||
|
||||
if (contract == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (contract.getCustomerId() == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(contract.getStaffName()) || contract.getStaffName().length() > 50) {
|
||||
return new ErrorMessage("我方签订人名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(contract.getCustomerSignatory()) || contract.getCustomerSignatory().length() > 50) {
|
||||
return new ErrorMessage("甲方签订人名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (contract.getSignTime() == null) {
|
||||
return new ErrorMessage("合同签订时间不能为空!", false);
|
||||
}
|
||||
|
||||
if (contract.getEndTime() == null) {
|
||||
return new ErrorMessage("合同终止时间不能为空!", false);
|
||||
}
|
||||
|
||||
if (contract.getFapiao() != null && contract.getFapiao().length() > 1000) {
|
||||
return new ErrorMessage("发票信息长度有误!", false);
|
||||
}
|
||||
|
||||
if (contract.getDso() != null && contract.getDso().length() > 1000) {
|
||||
return new ErrorMessage("回款信息长度有误!", false);
|
||||
}
|
||||
|
||||
if (contract.getContent() != null && contract.getContent().length() > 1000) {
|
||||
return new ErrorMessage("备注内容长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(contract.getState()) || contract.getState().length() != 2) {
|
||||
return new ErrorMessage("状态信息有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
import com.kelp.crm.service.ECustomerService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm/customer")
|
||||
@Controller
|
||||
public class ECustomerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ECustomerService customerService;
|
||||
|
||||
@RequestMapping("/toPage4All")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
return new ModelAndView("/crm/customer4all", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list4all")
|
||||
public @ResponseBody Page<ECustomer> list4all(HttpServletRequest request, Page<ECustomer> page, String qstartDate,
|
||||
String qendDate, String qname, String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<ECustomer>();
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(qname) && qname.length() > 50) {
|
||||
return new Page<ECustomer>();
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(qstate) && qstate.length() != 2) {
|
||||
return new Page<ECustomer>();
|
||||
}
|
||||
|
||||
return customerService.getPage(page.getPageIndex(), page.getLimit(), qstartDate, qendDate, qname, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toPage4NoVisit")
|
||||
public @ResponseBody ModelAndView toPage4NoVisit(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
return new ModelAndView("/crm/customer4novisit", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list4Novisit")
|
||||
public @ResponseBody Page<ECustomer> list4Novisit(HttpServletRequest request, Page<ECustomer> page,
|
||||
String qstartDate, String qendDate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<ECustomer>();
|
||||
}
|
||||
|
||||
return customerService.getPage4NoVisit(page.getPageIndex(), page.getLimit(), qstartDate, qendDate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("customer", customerService.getById(id));
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, ECustomer customer) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(customer);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (customerService.getByName(customer.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "客户名称已存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
customerService.add(customer);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, ECustomer customer) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(customer);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (customer.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("customer", customer);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
ECustomer customerP = customerService.getByName(customer.getName());
|
||||
if (customerP != null && !customer.getId().equals(customerP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "客户名称已存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 先设置
|
||||
customerP = customerService.getById(String.valueOf(customer.getId()));
|
||||
customerP.setName(customer.getName());
|
||||
customerP.setContact(customer.getContact());
|
||||
customerP.setStaffName(customer.getStaffName());
|
||||
customerP.setTelephone(customer.getTelephone());
|
||||
customerP.setEffctiveTime(customer.getEffctiveTime());
|
||||
customerP.setExpiredTime(customer.getExpiredTime());
|
||||
customerP.setState(customer.getState());
|
||||
customerP.setUpdateTime(System.currentTimeMillis());
|
||||
|
||||
customerService.update(customerP);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "修改成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
customerService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "禁用成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(ECustomer customer) {
|
||||
|
||||
if (customer == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getName()) || customer.getName().length() > 50) {
|
||||
return new ErrorMessage("名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getStaffName()) || customer.getStaffName().length() > 50) {
|
||||
return new ErrorMessage("跟单人名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getContact()) || customer.getContact().length() > 20) {
|
||||
return new ErrorMessage("联系人数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getTelephone()) || customer.getTelephone().length() > 20) {
|
||||
return new ErrorMessage("联系电话数据非法!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(customer.getDescription()) && customer.getDescription().length() > 256) {
|
||||
return new ErrorMessage("客户说明长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customer.getState()) || customer.getState().length() != 2) {
|
||||
return new ErrorMessage("状态信息有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.constant.RegexConstants;
|
||||
import com.kelp.common.utils.MathUtil;
|
||||
import com.kelp.crm.entity.ECustomerVisit;
|
||||
import com.kelp.crm.service.ECustomerService;
|
||||
import com.kelp.crm.service.ECustomerVisitService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm/customer/visit")
|
||||
@Controller
|
||||
public class ECustomerVisitController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ECustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private ECustomerVisitService customerVisitService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response,String qcustomerId) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("customers", customerService.getAll(null));
|
||||
modelMap.put("qcustomerId", qcustomerId);
|
||||
|
||||
return new ModelAndView("/crm/customervisit", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<ECustomerVisit> list(HttpServletRequest request, Page<ECustomerVisit> page,
|
||||
String qstartDate, String qendDate, String qcustomerId, String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<ECustomerVisit>();
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(qcustomerId) && MathUtil.string2long(qcustomerId) == null) {
|
||||
return new Page<ECustomerVisit>();
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(qstate) && qstate.length() != 2) {
|
||||
return new Page<ECustomerVisit>();
|
||||
}
|
||||
|
||||
return customerVisitService.getPage(page.getPageIndex(), page.getLimit(), qcustomerId,
|
||||
qstartDate, qendDate, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("customerVisit", customerVisitService.getById(id));
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, ECustomerVisit customerVisit) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(customerVisit);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
customerVisit.setAccountId(Long.valueOf(getAccountId(request)));
|
||||
customerVisitService.add(customerVisit);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, ECustomerVisit customerVisit) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(customerVisit);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (customerVisit.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("customerVisit", customerVisit);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 先设置
|
||||
ECustomerVisit customerVisitP = customerVisitService.getById(String.valueOf(customerVisit.getId()));
|
||||
customerVisitP.setStaffName(customerVisit.getStaffName());
|
||||
customerVisitP.setVisitTime(customerVisit.getVisitTime());
|
||||
customerVisitP.setContent(customerVisit.getContent());
|
||||
customerVisitP.setState(customerVisit.getState());
|
||||
customerVisitP.setUpdateTime(System.currentTimeMillis());
|
||||
|
||||
customerVisitService.update(customerVisitP);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "修改成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
customerVisitService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "禁用成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(ECustomerVisit customerVisit) {
|
||||
|
||||
if (customerVisit == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customerVisit.getStaffName()) || customerVisit.getStaffName().length() > 50) {
|
||||
return new ErrorMessage("拜访人名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customerVisit.getVisiter()) || customerVisit.getVisiter().length() > 50) {
|
||||
return new ErrorMessage("约见人名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(customerVisit.getVisiterTelephone())
|
||||
|| customerVisit.getVisiterTelephone().length() > 128) {
|
||||
return new ErrorMessage("约见人手机号不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!customerVisit.getVisiterTelephone().matches(RegexConstants.MOBILE_PHONE_NUMBER_PATTERN)) {
|
||||
return new ErrorMessage("约见人手机号格式有误!", false);
|
||||
}
|
||||
|
||||
if (customerVisit.getVisitTime() == null) {
|
||||
return new ErrorMessage("拜访时间数据非法!", false);
|
||||
}
|
||||
|
||||
if (customerVisit.getCustomerId() == null) {
|
||||
return new ErrorMessage("拜访客户数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customerVisit.getContent()) || customerVisit.getContent().length() < 50
|
||||
|| customerVisit.getContent().length() > 1000) {
|
||||
return new ErrorMessage("拜访客户结果内容不能小于50个字符且不能大于1000个字符!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(customerVisit.getState()) || customerVisit.getState().length() != 2) {
|
||||
return new ErrorMessage("状态信息有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.kelp.crm.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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.Department;
|
||||
import com.kelp.crm.service.DepartmentService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm/department")
|
||||
@Controller
|
||||
public class EDepartmentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DepartmentService departmentService;
|
||||
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
//从redis中取当前登录人所属企业id
|
||||
modelMap.put("enterpriseId", getEnterpriseId(request));
|
||||
//从redis中取当前登录人所属部门id
|
||||
modelMap.put("departmentId", getDepartmentId(request));
|
||||
|
||||
return new ModelAndView("/crm/department","modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Department> list(HttpServletRequest request, Page<Department> page, String qpId, String qname,String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Department>();
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(qpId)) {
|
||||
//当前登录人所属部门id
|
||||
qpId = getDepartmentId(request);
|
||||
}
|
||||
|
||||
return departmentService.getPage(page.getPageIndex(), page.getLimit(),getEnterpriseId(request), qpId, qname, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
Department department = departmentService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("department", department);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, Department department) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(department);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
department.setId(null);
|
||||
department.setEnterpriseId(Long.valueOf(getEnterpriseId(request)));
|
||||
departmentService.add(department);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, Department department) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(department);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
department.setUpdateTime(System.currentTimeMillis());
|
||||
department.setEnterpriseId(Long.valueOf(getEnterpriseId(request)));
|
||||
departmentService.update(department);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "修改成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
departmentService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/dtop")
|
||||
@ResponseBody
|
||||
public List<Department> dtop(HttpServletRequest request, String id){
|
||||
|
||||
if(StringUtil.isEmpty(id)) {
|
||||
id = getDepartmentId(request);
|
||||
}
|
||||
|
||||
return departmentService.listTop(getEnterpriseId(request),id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/dsubs")
|
||||
@ResponseBody
|
||||
public List<Department> dsubs(HttpServletRequest request, String id){
|
||||
|
||||
if(StringUtil.isEmpty(id)) {
|
||||
id = getDepartmentId(request);
|
||||
}
|
||||
|
||||
return departmentService.listdsub(getEnterpriseId(request),id);
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Department department) {
|
||||
|
||||
if (department == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(department.getName())
|
||||
|| department.getName().length() > 50) {
|
||||
return new ErrorMessage("部门名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (department.getpId() == null) {
|
||||
return new ErrorMessage("上级部门不能为空或数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(department.getPhone()) || department.getPhone().length() > 20) {
|
||||
return new ErrorMessage("联系电话数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(department.getLeader()) || department.getLeader().length() > 50) {
|
||||
return new ErrorMessage("部门领导数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(department.getState()) || department.getState().length() != 2) {
|
||||
return new ErrorMessage("状态信息有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.biz.entity.District;
|
||||
import com.kelp.biz.service.DistrictService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/crm/district")
|
||||
public class EDistrictController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private DistrictService districtService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
return new ModelAndView("/crm/district");
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<District> list(HttpServletRequest request, Page<District> page, String qpId, String qname,String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<District>();
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(qpId)) {
|
||||
qpId = "0";
|
||||
}
|
||||
|
||||
return districtService.getPage(page.getPageIndex(), page.getLimit(), qpId, qname, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() <= 12) {
|
||||
District district = districtService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("district", district);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, District district) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(district);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (districtService.getById(district.getId()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "区划代码已存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
districtService.add(district);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, District district) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(district);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
districtService.update(district);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "修改成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
districtService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 取得pid为参数id的所有直接下级
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/dsubs")
|
||||
public @ResponseBody List<District> dsubs(HttpServletRequest request,String id){
|
||||
|
||||
if(id == null || id.length() > 12){
|
||||
id = "0";
|
||||
}
|
||||
|
||||
return districtService.listdsub(id);
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(District district) {
|
||||
|
||||
if (district == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(district.getId()) || district.getId().length() > 12){
|
||||
return new ErrorMessage("区划编码不能为空或长度有误!",false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(district.getpId()) || district.getpId().length() > 12) {
|
||||
return new ErrorMessage("父级区划不能为空或数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(district.getName())
|
||||
|| district.getName().length() > 50) {
|
||||
return new ErrorMessage("区划名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(district.getState()) || district.getState().length() != 2) {
|
||||
return new ErrorMessage("状态数据非法!", false);
|
||||
}
|
||||
|
||||
if (district.getResidents() == null) {
|
||||
return new ErrorMessage("常驻人口数据不能为空!", false);
|
||||
}
|
||||
|
||||
if (district.getOrderNumber() == null) {
|
||||
return new ErrorMessage("序号数据不能为空!", false);
|
||||
}
|
||||
|
||||
if (district.getLevel() == null) {
|
||||
return new ErrorMessage("级别数据不能为空!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.kelp.biz.service.FileUploadService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
|
||||
@RequestMapping("/crm/file")
|
||||
@Controller
|
||||
public class EFileController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
@RequestMapping("/upload4layui")
|
||||
public @ResponseBody ModelMap uploadFile4LayEditor(HttpServletRequest request,MultipartFile file) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
Map<String,Object> data = new HashMap<String,Object>();
|
||||
|
||||
if (file == null || file.isEmpty()) {
|
||||
modelMap.put("code", "10");
|
||||
modelMap.put("msg", "非法上传!");
|
||||
data.put("src", "");
|
||||
data.put("title", "");
|
||||
modelMap.put("data", data);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String avatarPath = fileUploadService.uploadImageFile(file);
|
||||
if(avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put("code", "11");
|
||||
modelMap.put("msg", "文件格式不正确!");
|
||||
data.put("src", "");
|
||||
data.put("title", "");
|
||||
modelMap.put("data", data);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
modelMap.put("code", "0");
|
||||
modelMap.put("msg", "上传成功!");
|
||||
data.put("src", avatarPath);
|
||||
data.put("title", "");
|
||||
modelMap.put("data", data);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/upload")
|
||||
public @ResponseBody ModelMap uploadFile(HttpServletRequest request,MultipartFile file) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (file == null || file.isEmpty()) {
|
||||
modelMap.put(MESSAGE, "非法上传!");
|
||||
modelMap.put(RESULT, false);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String avatarPath = fileUploadService.uploadImageFile(file);
|
||||
if(avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "文件格式不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
|
||||
@RequestMapping("/crm")
|
||||
@Controller
|
||||
public class EIndexController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* springboot 启动访问的页面,如果不写默认访问index
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/index")
|
||||
public String index(HttpServletRequest request, HttpServletResponse response) {
|
||||
return "/crm/login";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.kelp.crm.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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.google.code.kaptcha.Constants;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.CookieUtil;
|
||||
import com.kelp.common.utils.jwt.JwtUtil;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
import com.kelp.crm.service.EAccountService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.plat.entity.TSMenu;
|
||||
import com.kelp.plat.service.MenuService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm")
|
||||
@Controller
|
||||
public class ELoginController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private EAccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@RequestMapping("/login")
|
||||
public @ResponseBody ModelMap login(HttpServletRequest request, HttpServletResponse response,String telephone,
|
||||
String password, String timestamp, String captcha) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtil.isEmpty(telephone) || telephone.length() != 11) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "手机号格式有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(password) || password.length() > 50) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "密码不能为空或长度错误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(timestamp) || timestamp.length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(captcha) || captcha.length() > 4) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String captcha_ = redisBean.hget(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||
if(captcha_ == null || !captcha_.equals(captcha)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "验证码不正确或已过期!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 验证登录信息
|
||||
EAccount account = accountService.getByTelephone(telephone);
|
||||
if (account == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "账号不存在!");
|
||||
return modelMap;
|
||||
}
|
||||
if ((account != null && !account.getPassword().equals(password))) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "账号或密码错误!");
|
||||
return modelMap;
|
||||
}
|
||||
if (account.getState().equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "账号已禁用!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 删除redis中的验证码
|
||||
redisBean.hdel(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||
|
||||
String token = JwtUtil.sign(String.valueOf(account.getId()), request.getSession().getId(), KeyConstant.JWTKEY);
|
||||
// 设置token到cookie
|
||||
CookieUtil.addCookie(response, "token", token);
|
||||
|
||||
// 向redis中写入
|
||||
redisBean.hset(String.valueOf(account.getId()), "e_token", token);
|
||||
redisBean.hset(String.valueOf(account.getId()), "e_role", String.valueOf(account.getRoleId()));
|
||||
redisBean.hset(String.valueOf(account.getId()), "e_enterprise", String.valueOf(account.getEnterpriseId()));
|
||||
redisBean.hset(String.valueOf(account.getId()), "e_department", String.valueOf(account.getDepartmentId()));
|
||||
redisBean.hset(String.valueOf(account.getId()), "e_eidpath", account.getEidPath());
|
||||
redisBean.hset(String.valueOf(account.getId()), "e_didpath", account.getDidPath());
|
||||
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "登录成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/main")
|
||||
public ModelAndView main(HttpServletRequest request) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
String token = getToken(request);
|
||||
|
||||
List<TSMenu> list = menuService.getMenus4Enterprise(getRoleId(token,"e_role"));
|
||||
|
||||
modelMap.put("tsmenus", list);
|
||||
|
||||
EAccount account = accountService.getById(getAccountId(token)).mask();
|
||||
|
||||
modelMap.put("eaccount", account);
|
||||
|
||||
return new ModelAndView("/crm/index", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/logout")
|
||||
public @ResponseBody ModelMap logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
String token = getToken(request);
|
||||
request.getSession().setMaxInactiveInterval(0);
|
||||
request.getSession().invalidate();
|
||||
|
||||
String accountId = JwtUtil.getId(token);
|
||||
|
||||
redisBean.hdel(accountId, "e_role");
|
||||
redisBean.hdel(accountId, "e_token");
|
||||
redisBean.hdel(accountId, "e_enterprise");
|
||||
redisBean.hdel(accountId, "e_department");
|
||||
redisBean.hdel(accountId, "e_eidpath");
|
||||
redisBean.hdel(accountId, "e_didpath");
|
||||
|
||||
CookieUtil.delCookie(request, response, "token");
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "退出成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
/**
|
||||
* 设置管理员,管理员挂在公司下,其departmentId为
|
||||
*/
|
||||
package com.kelp.crm.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.constant.RegexConstants;
|
||||
import com.kelp.common.utils.security.Md5Utils;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
import com.kelp.crm.service.EAccountService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.service.E_RoleService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm/maccount")
|
||||
@Controller
|
||||
public class EMAccountController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private EAccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private E_RoleService roleService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("roles", roleService.getAll());
|
||||
|
||||
//从redis中取当前登录人所属公司id
|
||||
modelMap.put("qenterpriseId", getEnterpriseId(request));
|
||||
|
||||
return new ModelAndView("/crm/maccount","modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<EAccount> list(HttpServletRequest request, Page<EAccount> page, String qenterpriseId, String qname,String qtelephone,String qroleId,String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<EAccount>();
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(qenterpriseId)) {
|
||||
//从redis中取当前登录人所属部门id
|
||||
qenterpriseId = getEnterpriseId(request);
|
||||
}
|
||||
|
||||
return accountService.getPage4m(page.getPageIndex(), page.getLimit(), qenterpriseId, qname, qtelephone, qroleId, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
EAccount account = accountService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("account", account);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, EAccount account) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (accountService.getByTelephone(account.getTelephone()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setPassword(Md5Utils.hash("c1234567"));
|
||||
accountService.add4m(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, EAccount account) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getId() == null ) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("account", account);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
EAccount accountP = accountService.getByTelephone(account.getTelephone());
|
||||
if (accountP != null && !account.getId().equals(accountP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
accountP = accountService.getById(String.valueOf(account.getId()));
|
||||
if(accountP == null ) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
accountP.setUpdateTime(System.currentTimeMillis());
|
||||
accountP.setName(account.getName());
|
||||
accountP.setTelephone(account.getTelephone());
|
||||
accountP.setRealName(account.getRealName());
|
||||
accountP.setSex(account.getSex());
|
||||
accountP.setRoleId(account.getRoleId());
|
||||
accountP.setState(account.getState());
|
||||
|
||||
accountService.update4m(accountP);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
accountService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(EAccount account) {
|
||||
|
||||
if (account == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (account.getEnterpriseId() == null) {
|
||||
return new ErrorMessage("所属公司不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getName()) || account.getName().length() > 128) {
|
||||
return new ErrorMessage("昵称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRealName() != null && account.getRealName().length() > 128) {
|
||||
return new ErrorMessage("真实姓名长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getTelephone()) || account.getTelephone().length() > 128) {
|
||||
return new ErrorMessage("手机号不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if(!account.getTelephone().matches(RegexConstants.MOBILE_PHONE_NUMBER_PATTERN)) {
|
||||
return new ErrorMessage("手机号格式有误!", false);
|
||||
}
|
||||
|
||||
if (account.getSex() == null || account.getSex().length() != 1) {
|
||||
return new ErrorMessage("性别不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRoleId() == null) {
|
||||
return new ErrorMessage("账号角色不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getState() == null || account.getState().length() != 2) {
|
||||
return new ErrorMessage("账号状态不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package com.kelp.crm.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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.biz.service.FileUploadService;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
import com.kelp.crm.service.EnterpriseService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/crm/enterprise")
|
||||
@Controller
|
||||
public class EnterpriseController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private EnterpriseService enterpriseService;
|
||||
|
||||
@Autowired
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
//从redis中取当前登录人所属企业id
|
||||
modelMap.put("enterpriseId", getEnterpriseId(request));
|
||||
|
||||
return new ModelAndView("/crm/enterprise","modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Enterprise> list(HttpServletRequest request, Page<Enterprise> page, String qpId, String qname,String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Enterprise>();
|
||||
}
|
||||
|
||||
|
||||
return enterpriseService.getPage(page.getPageIndex(), page.getLimit(), qpId, qname, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
Enterprise enterprise = enterpriseService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("enterprise", enterprise);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, Enterprise enterprise,MultipartFile avatarFile) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(enterprise);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (enterpriseService.getByName(enterprise.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "公司名称已存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (avatarFile != null && !avatarFile.isEmpty()) {
|
||||
String avatarPath = fileUploadService.uploadImageFile(avatarFile);
|
||||
if(avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "文件格式不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
enterprise.setAvatar(avatarPath);
|
||||
}
|
||||
|
||||
enterpriseService.add(enterprise);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, Enterprise enterprise,MultipartFile avatarFile) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(enterprise);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (enterprise.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("enterprise", enterprise);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
Enterprise enterpriseP = enterpriseService.getByName(enterprise.getName());
|
||||
|
||||
if (enterpriseP != null && !enterprise.getId().equals(enterpriseP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "公司名称已存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
//先设置
|
||||
enterpriseP = enterpriseService.getById(String.valueOf(enterprise.getId()));
|
||||
enterprise.setAvatar(enterpriseP.getAvatar());
|
||||
|
||||
if (avatarFile != null && !avatarFile.isEmpty()) {
|
||||
String avatarPath = fileUploadService.uploadImageFile(avatarFile);
|
||||
if(avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "文件格式不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
enterprise.setAvatar(avatarPath);
|
||||
}
|
||||
|
||||
enterprise.setUpdateTime(System.currentTimeMillis());
|
||||
enterpriseService.update(enterprise);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "修改成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
enterpriseService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/dtop")
|
||||
@ResponseBody
|
||||
public List<Enterprise> dtop(HttpServletRequest request, String id){
|
||||
|
||||
if(StringUtil.isEmpty(id)) {
|
||||
id = getEnterpriseId(request);
|
||||
}
|
||||
|
||||
return enterpriseService.listTop(Long.valueOf(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/dsubs")
|
||||
@ResponseBody
|
||||
public List<Enterprise> dsubs(HttpServletRequest request, String id){
|
||||
|
||||
if(StringUtil.isEmpty(id)) {
|
||||
id = getEnterpriseId(request);
|
||||
}
|
||||
|
||||
return enterpriseService.listdsub(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/dsubs4type")
|
||||
@ResponseBody
|
||||
public List<Enterprise> dsubs4type(HttpServletRequest request, String id,String type){
|
||||
|
||||
if(StringUtil.isEmpty(id)) {
|
||||
id = getEnterpriseId(request);
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(type) || type.length() != 2) {
|
||||
type = "00";
|
||||
}
|
||||
|
||||
return enterpriseService.listdsub(id,type);
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Enterprise enterprise) {
|
||||
|
||||
if (enterprise == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (enterprise.getpId() == null) {
|
||||
return new ErrorMessage("上级不能为空或数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(enterprise.getName())
|
||||
|| enterprise.getName().length() > 50) {
|
||||
return new ErrorMessage("名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(enterprise.getTelephone()) || enterprise.getTelephone().length() > 20) {
|
||||
return new ErrorMessage("联系电话数据非法!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(enterprise.getContact()) || enterprise.getContact().length() > 50) {
|
||||
return new ErrorMessage("联系人数据非法!", false);
|
||||
}
|
||||
|
||||
if(enterprise.getAddress() != null && enterprise.getAddress().length() > 256) {
|
||||
return new ErrorMessage("地址长度过长!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(enterprise.getType()) || enterprise.getType().length() != 2) {
|
||||
return new ErrorMessage("类型信息有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(enterprise.getState()) || enterprise.getState().length() != 2) {
|
||||
return new ErrorMessage("状态信息有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.entity.E_Role;
|
||||
import com.kelp.plat.service.E_RFService;
|
||||
import com.kelp.plat.service.E_RoleService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/plat/erole")
|
||||
@Controller
|
||||
public class ERoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private E_RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private E_RFService rfService;
|
||||
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("mfs", rfService.getMFs());
|
||||
|
||||
return new ModelAndView("/plat/erole","modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<E_Role> list(HttpServletRequest request, Page<E_Role> page, String qname,String qtype,Integer qlevel) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<E_Role>();
|
||||
}
|
||||
|
||||
return roleService.getPage(page.getPageIndex(), page.getLimit(), qname, qlevel);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request,E_Role role) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(role);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (roleService.getByName(role.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "角色名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
role.setId(null);
|
||||
roleService.add(role);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request,E_Role role) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(role);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (role.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("role", role);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
E_Role roleP = roleService.getByName(role.getName());
|
||||
if (roleP != null && !role.getId().equals(roleP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "角色名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
roleService.update(role);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
E_Role role = roleService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "操作成功");
|
||||
modelMap.put("role", role);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids == null || ids.length() == 0) {
|
||||
ids = "";
|
||||
}
|
||||
|
||||
String[] ids_ = ids.split(",");
|
||||
|
||||
roleService.delete(ids_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(E_Role role) {
|
||||
|
||||
if (role == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(role.getName())
|
||||
|| role.getName().length() > 20) {
|
||||
return new ErrorMessage("角色名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (role.getLevel() == null) {
|
||||
return new ErrorMessage("角色级别不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(role.getDescription()) && role.getDescription().length() > 128) {
|
||||
return new ErrorMessage("角色说明长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
@RequestMapping("/toGrant")
|
||||
public @ResponseBody ModelMap toGrant(HttpServletRequest request,
|
||||
String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (id == null || id.length() > 32) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put("role", roleService.getById(id));
|
||||
modelMap.put("rfs", rfService.getRFs(id));
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/grant")
|
||||
public @ResponseBody ModelMap grant(HttpServletRequest request,
|
||||
String roleId, String functionIds) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtil.isEmpty(roleId) || roleId.length() > 32) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法数据!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(functionIds)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "授权成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (functionIds.endsWith(",")) {
|
||||
functionIds = functionIds.substring(0, functionIds.length() - 1);
|
||||
}
|
||||
|
||||
String[] functionIds_ = functionIds.split(",");
|
||||
rfService.setRFs(roleId, functionIds_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "授权成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.biz.service.FileUploadService;
|
||||
import com.kelp.common.constant.RegexConstants;
|
||||
import com.kelp.common.utils.security.Md5Utils;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.entity.Account;
|
||||
import com.kelp.plat.service.AccountService;
|
||||
import com.kelp.plat.service.RoleService;
|
||||
|
||||
@RequestMapping("/plat/account")
|
||||
@Controller
|
||||
public class PAccountController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("roles", roleService.getAll());
|
||||
|
||||
return new ModelAndView("/plat/account","modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Account> list(HttpServletRequest request, Page<Account> page, String qname,String qtelephone,String qroleId,String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Account>();
|
||||
}
|
||||
|
||||
return accountService.getPage(page.getPageIndex(), page.getLimit(), qname, qtelephone, qroleId, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request,Account account) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (accountService.getByTelephone(account.getTelephone()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setId(null);
|
||||
account.setPassword(Md5Utils.hash("k1234567"));
|
||||
accountService.add(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request,Account account) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getId() == null ) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("account", account);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
Account accountP = accountService.getByTelephone(account.getTelephone());
|
||||
if (accountP != null && !account.getId().equals(accountP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
accountP = accountService.getById(String.valueOf(account.getId()));
|
||||
if(accountP == null ) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setCreateTime(accountP.getCreateTime());
|
||||
account.setUpdateTime(new Date().getTime());
|
||||
account.setPassword(accountP.getPassword());
|
||||
|
||||
accountService.update(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null) {
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "操作成功");
|
||||
modelMap.put("account", accountService.getById(id));
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids == null || ids.length() == 0) {
|
||||
ids = "";
|
||||
}
|
||||
|
||||
String[] ids_ = ids.split(",");
|
||||
|
||||
accountService.delete(ids_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Account account) {
|
||||
|
||||
if (account == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getName()) || account.getName().length() > 128) {
|
||||
return new ErrorMessage("昵称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRealName() != null && account.getRealName().length() > 128) {
|
||||
return new ErrorMessage("真实姓名长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getTelephone()) || account.getTelephone().length() > 128) {
|
||||
return new ErrorMessage("手机号不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if(!account.getTelephone().matches(RegexConstants.MOBILE_PHONE_NUMBER_PATTERN)) {
|
||||
return new ErrorMessage("手机号格式有误!", false);
|
||||
}
|
||||
|
||||
if (account.getSex() == null || account.getSex().length() != 1) {
|
||||
return new ErrorMessage("性别不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRoleId() == null) {
|
||||
return new ErrorMessage("账号角色不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getState() == null || account.getState().length() != 2) {
|
||||
return new ErrorMessage("账号状态不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/toSelfInfo")
|
||||
public @ResponseBody ModelAndView toSelfInfo(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("roleName", roleService.getById(redisBean.hget(getAccountId(request), "mis_role")).getName());
|
||||
|
||||
Account account = accountService.getById(getAccountId(request));
|
||||
account.mask();
|
||||
modelMap.put("account", account);
|
||||
return new ModelAndView("/plat/self_info","modelMap",modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/selfInfo")
|
||||
public @ResponseBody ModelMap selfInof(HttpServletRequest request, HttpServletResponse response,Account account,MultipartFile avatarFile) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtils.isEmpty(account.getName()) || account.getName().length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "昵称不能为空或长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getRealName() != null && account.getRealName().length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "真实姓名长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getSex() == null || account.getSex().length() != 1) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "性别不能为空或长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
Account accountP = accountService.getById(getAccountId(request));
|
||||
accountP.setName(account.getName());
|
||||
accountP.setRealName(account.getRealName());
|
||||
accountP.setSex(account.getSex());
|
||||
|
||||
if (avatarFile != null && !avatarFile.isEmpty()) {
|
||||
String avatarPath = fileUploadService.uploadImageFile(avatarFile);
|
||||
if(avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "文件格式不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
accountP.setAvatar(avatarPath);
|
||||
}
|
||||
|
||||
accountService.update(accountP);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "个人资料修改成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toPassword")
|
||||
public @ResponseBody ModelAndView toPassword(HttpServletRequest request, HttpServletResponse response) {
|
||||
return new ModelAndView("/plat/password");
|
||||
}
|
||||
|
||||
@RequestMapping("/password")
|
||||
public @ResponseBody ModelMap password(HttpServletRequest request, HttpServletResponse response,String opassword,String npassword,String cpassword) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if(StringUtils.isEmpty(opassword) || opassword.length() < 6) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "原始密码不能为空!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(npassword) || npassword.length() < 6) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码不能为空且不能少于6位!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if(!opassword.matches(RegexConstants.LETTER_DIGIT_PATTERN)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码必须包含数字和字母!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(cpassword) || !cpassword.equals(npassword)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码与确认密码不一致!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String accountId = getAccountId(request);
|
||||
Account account = accountService.getById(accountId);
|
||||
if (account == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "此手机号未注册,请先注册!");
|
||||
return modelMap;
|
||||
}
|
||||
if(!Md5Utils.hash(opassword).equals(account.getPassword())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "旧密码输入不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setPassword(Md5Utils.hash(npassword));
|
||||
accountService.update(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "密码修改成功,建议您重新登录!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.biz.entity.Dict;
|
||||
import com.kelp.biz.service.DictService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/plat/dict")
|
||||
@Controller
|
||||
public class PDictController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DictService dictService;
|
||||
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
return new ModelAndView("/plat/dict");
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Dict> list(HttpServletRequest request, Page<Dict> page, String qname,String qtype,String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Dict>();
|
||||
}
|
||||
|
||||
return dictService.getPage(page.getPageIndex(), page.getLimit(), qname, qtype, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request,Dict dict) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(dict);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (dictService.getByCode(dict.getCode()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "字典编码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
dict.setId(null);
|
||||
dictService.add(dict);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request,Dict dict) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(dict);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (dict.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("dict", dict);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
Dict dictP = dictService.getByCode(dict.getCode());
|
||||
if (dictP != null && !dict.getId().equals(dictP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "字典编码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
dictService.update(dict);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
Dict dict = dictService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "操作成功");
|
||||
modelMap.put("dict", dict);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids == null || ids.length() == 0) {
|
||||
ids = "";
|
||||
}
|
||||
|
||||
String[] ids_ = ids.split(",");
|
||||
|
||||
dictService.delete(ids_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Dict dict) {
|
||||
|
||||
if (dict == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(dict.getName())
|
||||
|| dict.getName().length() > 20) {
|
||||
return new ErrorMessage("字典名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(dict.getCode())
|
||||
|| dict.getCode().length() > 20) {
|
||||
return new ErrorMessage("字典编码不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(dict.getType())
|
||||
|| dict.getType().length() > 20) {
|
||||
return new ErrorMessage("字典类型不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(dict.getState())
|
||||
|| dict.getState().length() != 2) {
|
||||
return new ErrorMessage("字典状态不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.kelp.biz.service.FileUploadService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
|
||||
@RequestMapping("/plat/file")
|
||||
@Controller
|
||||
public class PFileController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
@RequestMapping("/upload4layui")
|
||||
public @ResponseBody ModelMap uploadFile4LayEditor(HttpServletRequest request,MultipartFile file) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
Map<String,Object> data = new HashMap<String,Object>();
|
||||
|
||||
if (file == null || file.isEmpty()) {
|
||||
modelMap.put("code", "10");
|
||||
modelMap.put("msg", "非法上传!");
|
||||
data.put("src", "");
|
||||
data.put("title", "");
|
||||
modelMap.put("data", data);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String avatarPath = fileUploadService.uploadImageFile(file);
|
||||
if(avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put("code", "11");
|
||||
modelMap.put("msg", "文件格式不正确!");
|
||||
data.put("src", "");
|
||||
data.put("title", "");
|
||||
modelMap.put("data", data);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
modelMap.put("code", "0");
|
||||
modelMap.put("msg", "上传成功!");
|
||||
data.put("src", avatarPath);
|
||||
data.put("title", "");
|
||||
modelMap.put("data", data);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/upload")
|
||||
public @ResponseBody ModelMap uploadFile(HttpServletRequest request,MultipartFile file) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (file == null || file.isEmpty()) {
|
||||
modelMap.put(MESSAGE, "非法上传!");
|
||||
modelMap.put(RESULT, false);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String avatarPath = fileUploadService.uploadImageFile(file);
|
||||
if(avatarPath != null && avatarPath.equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "文件格式不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.entity.Function;
|
||||
import com.kelp.plat.service.FunctionService;
|
||||
import com.kelp.plat.service.ModuleService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/plat/function")
|
||||
@Controller
|
||||
public class PFunctionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
|
||||
@Autowired
|
||||
private FunctionService functionService;
|
||||
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("modules", moduleService.getAll("00"));
|
||||
|
||||
return new ModelAndView("/plat/function", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Function> list(HttpServletRequest request, Page<Function> page, String qmoduleId, String qname) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Function>();
|
||||
}
|
||||
|
||||
return functionService.getPage(page.getPageIndex(), page.getLimit(),qmoduleId, qname);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request,
|
||||
Function function) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
// 判断数据合法性
|
||||
ErrorMessage message = invalid(function);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 判断是否已经存在此名称
|
||||
if (functionService.getByName(function.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "功能名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 判断是否已经存在此名称
|
||||
if (functionService.getByUrl(function.getUrl()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "功能URL已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
function.setId(null);
|
||||
functionService.add(function);
|
||||
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
modelMap.put(RESULT, true);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request,
|
||||
Function function) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
// 判断数据合法性
|
||||
ErrorMessage message = invalid(function);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (function.getId() == null) {
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put("function", function);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 判断是否已经存在此名称
|
||||
Function functionP = functionService.getByName(function.getName());
|
||||
if (functionP != null && !functionP.getId().equals(function.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "功能名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
functionP = functionService.getByUrl(function.getUrl());
|
||||
if (functionP != null && !functionP.getId().equals(function.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "功能URL已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
functionService.update(function);
|
||||
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
modelMap.put(RESULT, true);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
Function function = functionService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("function_", function);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids == null || ids.length() == 0) {
|
||||
ids = "";
|
||||
}
|
||||
|
||||
String[] ids_ = ids.split(",");
|
||||
|
||||
functionService.delete(ids_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Function function) {
|
||||
|
||||
if (function == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(function.getName())
|
||||
|| function.getName().length() > 50) {
|
||||
return new ErrorMessage("功能名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(function.getUrl())
|
||||
|| function.getUrl().length() > 256) {
|
||||
return new ErrorMessage("URL不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(function.getIsLog())
|
||||
|| function.getIsLog().length() != 2) {
|
||||
return new ErrorMessage("是否记录日志信息有误!", false);
|
||||
}
|
||||
|
||||
if (function.getModuleId() == null) {
|
||||
return new ErrorMessage("功能所属模块信息有误!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(function.getDescription())
|
||||
&& function.getDescription().length() > 128) {
|
||||
return new ErrorMessage("功能描述长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
|
||||
@RequestMapping("/plat")
|
||||
@Controller
|
||||
public class PIndexController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* springboot 启动访问的页面,如果不写默认访问index
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/index")
|
||||
public String index(HttpServletRequest request, HttpServletResponse response) {
|
||||
return "/plat/login";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.kelp.plat.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.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.google.code.kaptcha.Constants;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.CookieUtil;
|
||||
import com.kelp.common.utils.jwt.JwtUtil;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.plat.entity.Account;
|
||||
import com.kelp.plat.entity.TSMenu;
|
||||
import com.kelp.plat.service.AccountService;
|
||||
import com.kelp.plat.service.MenuService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/plat")
|
||||
@Controller
|
||||
public class PLoginController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Value("${token.alive.time}")
|
||||
private int tokenLiveCount;
|
||||
|
||||
@RequestMapping("/login")
|
||||
public @ResponseBody ModelMap login(HttpServletRequest request, HttpServletResponse response,String telephone,
|
||||
String password, String timestamp, String captcha) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtil.isEmpty(telephone) || telephone.length() != 11) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "手机号格式有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(password) || password.length() > 50) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "密码不能为空或长度错误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(timestamp) || timestamp.length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(captcha) || captcha.length() > 4) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String captcha_ = redisBean.hget(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||
if(captcha_ == null || !captcha_.equals(captcha)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "验证码不正确或已过期!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 验证登录信息
|
||||
Account account = accountService.getByTelephone(telephone);
|
||||
if (account == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "账号不存在!");
|
||||
return modelMap;
|
||||
}
|
||||
if ((account != null && !account.getPassword().equals(password))) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "账号或密码错误!");
|
||||
return modelMap;
|
||||
}
|
||||
if (account.getState().equals("10")) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "账号已禁用!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// 删除redis中的验证码
|
||||
redisBean.hdel(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||
|
||||
String token = JwtUtil.sign(account.getId().toString(), request.getSession().getId(), KeyConstant.JWTKEY);
|
||||
// 设置token到cookie
|
||||
CookieUtil.addCookie(response, "token", token);
|
||||
|
||||
// 向redis中写入
|
||||
redisBean.hset(account.getId().toString(), "mis_token", token + "|" + tokenLiveCount);
|
||||
redisBean.hset(account.getId().toString(), "mis_token_backup", token + "|" + tokenLiveCount);
|
||||
redisBean.hset(account.getId().toString(), "mis_role", String.valueOf(account.getRoleId()));
|
||||
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "登录成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/main")
|
||||
public ModelAndView main(HttpServletRequest request) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
String token = getToken(request);
|
||||
|
||||
List<TSMenu> list = menuService.getMenus(getRoleId(token,"mis_role"));
|
||||
|
||||
modelMap.put("tsmenus", list);
|
||||
|
||||
Account account = accountService.getById(getAccountId(token)).mask();
|
||||
|
||||
modelMap.put("paccount", account);
|
||||
|
||||
return new ModelAndView("/plat/index", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/logout")
|
||||
public @ResponseBody ModelMap logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
String token = getToken(request);
|
||||
request.getSession().setMaxInactiveInterval(0);
|
||||
request.getSession().invalidate();
|
||||
|
||||
String accountId = JwtUtil.getId(token);
|
||||
|
||||
redisBean.hdel(accountId, "mis_role");
|
||||
redisBean.hdel(accountId, "mis_token");
|
||||
|
||||
CookieUtil.delCookie(request, response, "token");
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "退出成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.entity.Menu;
|
||||
import com.kelp.plat.service.FunctionService;
|
||||
import com.kelp.plat.service.MenuService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/plat/menu")
|
||||
public class PMenuController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private FunctionService functionService;
|
||||
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public ModelAndView toPage(HttpServletRequest request) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put("menus", menuService.getMenus());
|
||||
modelMap.put("functions", functionService.getFunctions());
|
||||
|
||||
return new ModelAndView("plat/menu", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Menu> list(HttpServletRequest request,Page<Menu> page, String qname, String qpId) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Menu>();
|
||||
}
|
||||
|
||||
return menuService.getPage(page.getPageIndex(), page.getLimit(), qname,qpId);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
Menu menu = menuService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("menu", menu);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, Menu menu) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(menu);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
menu.setId(null);
|
||||
menuService.add(menu);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "添加成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, Menu menu) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(menu);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
menuService.update(menu);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "修改成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
menuService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 取得pid为参数id的所有直接下级
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/dsubs")
|
||||
public @ResponseBody List<Menu> dsubs(HttpServletRequest request,String id){
|
||||
|
||||
if(StringUtil.isEmpty(id)) {
|
||||
id = "0";
|
||||
}
|
||||
|
||||
return menuService.listdsub(id);
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Menu menu) {
|
||||
|
||||
if (menu == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(menu.getName())
|
||||
|| menu.getName().length() > 20) {
|
||||
return new ErrorMessage("菜单名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (menu.getpId() == null
|
||||
|| menu.getpId() == null) {
|
||||
return new ErrorMessage("上级菜单不能为空或数据非法!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(menu.getFunctionUrl())
|
||||
&& menu.getFunctionUrl().length() > 256) {
|
||||
return new ErrorMessage("关联的功能数据非法!", false);
|
||||
}
|
||||
|
||||
if (menu.getCss() != null && menu.getCss().length() > 128) {
|
||||
return new ErrorMessage("css长度有误!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(menu.getDescription())
|
||||
&& menu.getDescription().length() > 256) {
|
||||
return new ErrorMessage("说明长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.entity.Module;
|
||||
import com.kelp.plat.service.ModuleService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/plat/module")
|
||||
@Controller
|
||||
public class PModuleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
return new ModelAndView("/plat/module");
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Module> list(HttpServletRequest request, Page<Module> page, String qname,String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Module>();
|
||||
}
|
||||
|
||||
return moduleService.getPage(page.getPageIndex(), page.getLimit(), qname,qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request,Module module) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(module);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (moduleService.getByName(module.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "模块名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
module.setId(null);
|
||||
moduleService.add(module);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request,Module module) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(module);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (module.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("module", module);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
Module moduleP = moduleService.getByName(module.getName());
|
||||
if (moduleP != null && !module.getId().equals(moduleP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "模块名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
moduleService.update(module);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
Module module = moduleService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "操作成功");
|
||||
modelMap.put("module", module);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids == null || ids.length() == 0) {
|
||||
ids = "";
|
||||
}
|
||||
|
||||
String[] ids_ = ids.split(",");
|
||||
|
||||
moduleService.delete(ids_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Module module) {
|
||||
|
||||
if (module == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(module.getName())
|
||||
|| module.getName().length() > 20) {
|
||||
return new ErrorMessage("模块名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(module.getState())
|
||||
|| module.getState().length() != 2) {
|
||||
return new ErrorMessage("模块状态不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(module.getDescription()) && module.getDescription().length() >128) {
|
||||
return new ErrorMessage("模块说明长度有误!", false);
|
||||
}
|
||||
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.entity.Role;
|
||||
import com.kelp.plat.service.RFService;
|
||||
import com.kelp.plat.service.RoleService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
|
||||
@RequestMapping("/plat/role")
|
||||
@Controller
|
||||
public class PRoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private RFService rfService;
|
||||
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("mfs", rfService.getMFs());
|
||||
|
||||
return new ModelAndView("/plat/role","modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<Role> list(HttpServletRequest request, Page<Role> page, String qname,String qtype,Integer qlevel) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<Role>();
|
||||
}
|
||||
|
||||
return roleService.getPage(page.getPageIndex(), page.getLimit(), qname, qlevel);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request,Role role) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(role);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (roleService.getByName(role.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "角色名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
role.setId(null);
|
||||
roleService.add(role);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request,Role role) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(role);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (role.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("role", role);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
Role roleP = roleService.getByName(role.getName());
|
||||
if (roleP != null && !role.getId().equals(roleP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "角色名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
roleService.update(role);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
Role role = roleService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "操作成功");
|
||||
modelMap.put("role", role);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids == null || ids.length() == 0) {
|
||||
ids = "";
|
||||
}
|
||||
|
||||
String[] ids_ = ids.split(",");
|
||||
|
||||
roleService.delete(ids_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(Role role) {
|
||||
|
||||
if (role == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(role.getName())
|
||||
|| role.getName().length() > 20) {
|
||||
return new ErrorMessage("角色名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (role.getLevel() == null) {
|
||||
return new ErrorMessage("角色级别不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(role.getDescription()) && role.getDescription().length() > 128) {
|
||||
return new ErrorMessage("角色说明长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
@RequestMapping("/toGrant")
|
||||
public @ResponseBody ModelMap toGrant(HttpServletRequest request,
|
||||
String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (id == null || id.length() > 32) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put("role", roleService.getById(id));
|
||||
modelMap.put("rfs", rfService.getRFs(id));
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/grant")
|
||||
public @ResponseBody ModelMap grant(HttpServletRequest request,
|
||||
String roleId, String functionIds) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtil.isEmpty(roleId) || roleId.length() > 32) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法数据!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(functionIds)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "授权成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (functionIds.endsWith(",")) {
|
||||
functionIds = functionIds.substring(0, functionIds.length() - 1);
|
||||
}
|
||||
|
||||
String[] functionIds_ = functionIds.split(",");
|
||||
rfService.setRFs(roleId, functionIds_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "授权成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
# 项目相关配置
|
||||
# 项目名称
|
||||
kelp.name=kelp
|
||||
# 版本
|
||||
kelp.version=4.1.0
|
||||
# 版权年份
|
||||
kelp.copyright=2021
|
||||
|
||||
# 防止XSS攻击
|
||||
# 过滤开关
|
||||
xss.enabled=true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
xss.excludes=
|
||||
# 匹配链接
|
||||
xss.urlPatterns=/api/*,/plat/*
|
||||
|
||||
# oscache全局缓存
|
||||
# 过滤开关
|
||||
oscache.enabled=true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
oscache.excludes=/notice/*
|
||||
# 匹配链接
|
||||
oscache.urlPatterns=/html/*
|
||||
|
||||
# 用户配置 密码错误{error.count}次锁定{error.locked.minute}分钟
|
||||
user.password.error.count=5
|
||||
user.password.error.locked.minute=10
|
||||
|
||||
#对姓名、手机号进行掩码:1-不掩码;0-掩码
|
||||
mask.show=1
|
||||
|
||||
#每个手机号每天获取短信上限
|
||||
sms.maxcount=10
|
||||
#短信验证码有效时间
|
||||
sms.captcha.validtime=30
|
||||
#阿里短信网关配置
|
||||
sms.ali.accessKeyId=
|
||||
sms.ali.accessKeySecret=
|
||||
sms.ali.signName=
|
||||
sms.ali.connect.timeout=1000
|
||||
sms.ali.read.timeout=1000
|
||||
sms.ali.product=Dysmsapi
|
||||
sms.ali.domain=dysmsapi.aliyuncs.com
|
||||
sms.ali.region=cn-hangzhou
|
||||
sms.ali.template.code=
|
||||
|
||||
#微信小程序相关配置
|
||||
wx.app.id=
|
||||
wx.app.secret=
|
||||
wx.app.url=
|
||||
|
||||
#Scheduler Interval
|
||||
scheduler.interval=* */1 * * * ?
|
||||
|
||||
#对外api appid
|
||||
api.appid=5521
|
||||
api.secret=161119
|
||||
@@ -0,0 +1,31 @@
|
||||
#在service的方法上使用如@DataSource(value = DataSourceType.SLAVE)注解即可切换数据源
|
||||
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
spring.datasource.master.url=jdbc:mysql://192.168.31.57:3306/ksafepack?serverTimezone=UTC&useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
||||
#spring.datasource.master.username=ENC(aRWpysKMOtKt12BiuB6ngQ==)
|
||||
#spring.datasource.master.password=ENC(s94iPGH9KTaOAnbutmXky5DDi9CF68EG)
|
||||
spring.datasource.master.username=root
|
||||
spring.datasource.master.password=ergergerg45346t5gyg4eg5
|
||||
|
||||
spring.datasource.slave.enabled=false
|
||||
spring.datasource.slave.url=jdbc:mysql://127.0.0.1:3306/ksafepack?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Hongkong
|
||||
spring.datasource.slave.username=ENC(aRWpysKMOtKt12BiuB6ngQ==)
|
||||
spring.datasource.slave.password=ENC(s94iPGH9KTaOAnbutmXky5DDi9CF68EG)
|
||||
|
||||
spring.datasource.maxActive=10
|
||||
spring.datasource.initialSize=5
|
||||
spring.datasource.maxWait=60000
|
||||
spring.datasource.minIdle=10
|
||||
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||
spring.datasource.maxEvictableIdleTimeMillis=300000
|
||||
spring.datasource.validationQuery=select 'x'
|
||||
spring.datasource.testWhileIdle=true
|
||||
spring.datasource.testOnBorrow=false
|
||||
spring.datasource.testOnReturn=false
|
||||
|
||||
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
|
||||
spring.jpa.properties.hibernate.hbm2ddl.auto=update
|
||||
spring.jpa.show-sql=true
|
||||
24
ksafepack-admin/src/main/resources/application-es.properties
Normal file
@@ -0,0 +1,24 @@
|
||||
# Elasticsearch-核心配置
|
||||
|
||||
elasticsearch.username=
|
||||
elasticsearch.password=
|
||||
|
||||
# http连接超时时间
|
||||
elasticsearch.connectTimeout=1000
|
||||
# socket连接超时时间
|
||||
elasticsearch.socketTimeout=30000
|
||||
# 获取连接的超时时间
|
||||
elasticsearch.connectionRequestTimeout=500
|
||||
# 最大连接数
|
||||
elasticsearch.maxConnTotal=100
|
||||
# 最大路由连接数
|
||||
elasticsearch.maxConnPerRoute=100
|
||||
#shard 数量
|
||||
elasticsearch.shards=3
|
||||
#replicas 数量
|
||||
elasticsearch.replicas=2
|
||||
#协议
|
||||
elasticsearch.protocol=http
|
||||
#集群主机
|
||||
#elasticsearch.hosts=127.0.0.1:9200,127.0.0.1:9300,127.0.0.1:9400
|
||||
elasticsearch.hosts=192.168.1.151:9200,192.168.1.152:9200,192.168.1.153:9200
|
||||
@@ -0,0 +1,8 @@
|
||||
spring.redis.database=3
|
||||
spring.redis.host=127.0.0.1
|
||||
#spring.redis.port=6324
|
||||
#spring.redis.password=ENC(a+PuvaA1K5Vy7GA0dmlKdD4buTQBV7R+)
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=xxxxxxx
|
||||
|
||||
spring.redis.timeout=2000
|
||||
@@ -0,0 +1,26 @@
|
||||
# Whether to enable support of multipart uploads.
|
||||
spring.servlet.multipart.enabled=true
|
||||
# Threshold after which files are written to disk.
|
||||
spring.servlet.multipart.file-size-threshold=0
|
||||
# Intermediate location of uploaded files.
|
||||
#spring.servlet.multipart.location=d:/upload
|
||||
spring.servlet.multipart.location=/home/kelp
|
||||
# Max file size.
|
||||
spring.servlet.multipart.max-file-size=5MB
|
||||
# Max request size.
|
||||
spring.servlet.multipart.max-request-size=10MB
|
||||
# Whether to resolve the multipart request lazily at the time of file or parameter access.
|
||||
spring.servlet.multipart.resolve-lazily=false
|
||||
|
||||
#与spring保持一致
|
||||
file.max-file-size=5M
|
||||
|
||||
#ftp ftp上传文件后通过nginx来访问图片, img/iframe/link/script不遵从同源策略
|
||||
ftp.server=127.0.0.1
|
||||
ftp.port=8008
|
||||
ftp.userName=123
|
||||
ftp.userPassword=321
|
||||
#ftp基础目录
|
||||
ftp.basePath=kelp
|
||||
# http图片地址,可以使用nginx来处理
|
||||
ftp.baseUrl=http://127.0.0.1:8082/
|
||||
35
ksafepack-admin/src/main/resources/application.properties
Normal file
@@ -0,0 +1,35 @@
|
||||
#context-path
|
||||
server.servlet.context-path=/ycsafe
|
||||
server.port=8082
|
||||
server.max-http-header-size=102400
|
||||
|
||||
#处理freemarker中的long型数据
|
||||
spring.freemarker.settings.number_format=0.##
|
||||
|
||||
#静态资源路径
|
||||
spring.mvc.static-path-pattern=/static/**
|
||||
# 资源缓存时间,单位秒
|
||||
spring.resources.cache.period=604800
|
||||
# 开启gzip压缩
|
||||
spring.resources.chain.compressed=true
|
||||
# 启用缓存
|
||||
spring.resources.chain.cache=true
|
||||
|
||||
# 热部署开关
|
||||
devtools.restart=
|
||||
devtools.enabled=true
|
||||
|
||||
|
||||
#spring.profiles.active=datasources,redis,activemq
|
||||
spring.profiles.active=datasources,redis,config,dxxconfig,upload,es
|
||||
|
||||
#加密的盐值
|
||||
jasypt.encryptor.password=kelp
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
|
||||
#token
|
||||
token.alive.time=10
|
||||
|
||||
#日志
|
||||
#logging.config=classpath:logback-core.xml
|
||||
13
ksafepack-admin/src/main/resources/data/about.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
重剑无锋,大巧不工,在任何时候,架构都优于算法和技巧。
|
||||
|
||||
现在,也许是一个框架时代,许多的开发人员能够使用如Spring系列框架写出用户需要的应用程序,却可能忽略了架构,忽略了代码的优化。
|
||||
|
||||
也许有开发人员并不知道架构的三大原则、五小原则,并不知道Gof的23种设计模式。
|
||||
也许有开发人员写过上千行代码的类,写过上百行代码的方法,if-else/swich-case满天飞。
|
||||
也许有开发人员不知道对堆、栈的使用,不知道接口的使用,多态的静态联编、动态联编。
|
||||
也许有开发人员并不知道如何处理XSS、CSRF、框架内的SQL注入、反序列化等漏洞。
|
||||
……
|
||||
|
||||
但这并不妨碍我们追求代码的极致,让架构的思想传承下去。
|
||||
krefactory平台是一个为软件开发人员提供代码重构与优化的技术交流平台,希望大家喜欢。
|
||||
krefactory平台只有一种注册用户,所有用户享有同等权力,平台不设有任何特权用户。
|
||||
4069
ksafepack-admin/src/main/resources/data/district.csv
Normal file
4819
ksafepack-admin/src/main/resources/data/ksafepack.sql
Normal file
72
ksafepack-admin/src/main/resources/data/protocol.txt
Normal file
@@ -0,0 +1,72 @@
|
||||
一、欢迎使用
|
||||
感谢您注册krefactory平台。
|
||||
用户确认本服务协议后,本服务协议即在用户和krefactory之间产生法律效力,请用户务必在注册之前认真阅读本服务协议内容。
|
||||
无论用户事实上是否在注册之前认真阅读过本服务协议内容,只要用户点击“我已仔细阅读并接受krefactory平台用户服务条款”按钮并按照krefactory平台注册流程注册成功,其行为将被视为同意并签署本服务协议。
|
||||
krefactory平台有权根据业务需要修订“条款”,并以网站公告的形式进行更新,不再单独通知予您。经修订的“条款”一经在krefactory平台公布,即产生效力。如您不同意相关修订,请您立即停止使用krefactory平台。如您继续使用,则将视为您已接受经修订的“条款”,当您与krefactory平台发生争议时,应以最新的“条款”为准。
|
||||
注册用户须遵守《中华人民共和国保守国家秘密法》、《中华人民共和国计算机信息系统安全保护条例》、《计算机软件保护条例》等有关计算机及互联网规定的法律和法规、实施办法。在任何情况下,krefactory平台合理地认为用户的行为可能违反上述法律、法规,krefactory平台可以在任何时候不经事先通知终止向该用户提供服务,不需对用户或第三方负责。
|
||||
二、定义
|
||||
1、krefacotry平台:指krefactory网站平台,网址为www.krefactory.com。
|
||||
2、注册用户:krefactory平台注册用户。
|
||||
三、服务内容
|
||||
krefactory平台只提供一项服务,即注册用户可利用平台发布软件代码重构/优化问题寻求帮助或解答其他用户问题。
|
||||
四、用户的权利和义务
|
||||
4.1 用户权利
|
||||
4.1.1 在遵守本服务条款及各语言版块行为准则的前提下,用户有在krefactory平台发布问题或解答他人问题的权力。
|
||||
4.1.2用户同意授予krefactory平台对用户发布的问题或回复有修改、编辑的权利。
|
||||
4.2用户义务
|
||||
4.2.1用户应遵守下列规则:
|
||||
(1)遵守中华人民共和国关于网络的相关法律、法规。
|
||||
(2)遵守所有使用网络服务的网络协议、规定、程序和惯例以及产品的使用说明。
|
||||
(3)不非法使用网络服务,不干扰或混乱网络服务。
|
||||
4.2.2用户在发布或回答问题时,应保证:
|
||||
(1)不发布与代码重构、优化无关的帖子。
|
||||
(2)不得发布煽动抗拒、破坏宪法和法律、行政法规实施的言论,煽动颠覆国家政权,推翻社会主义制度的言论,煽动分裂国家、破坏国家统一的言论,煽动民族仇恨、民族歧视、破坏民族团结的言论或内容。
|
||||
(3)不得发布任何非法的、淫秽的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的、侵权等信息。
|
||||
(4)不得发布任何教唆他人可能构成犯罪行为的信息。
|
||||
(5)不得发布任何不符合国家法律及国际惯例的信息。
|
||||
(6)在讨论的时候遵守krefactory平台行为准则。
|
||||
4.2.3用户不得利用krefactory平台或其提供的服务实施下列行为:
|
||||
(1)损害他人名誉或隐私权;
|
||||
(2)使用自己名义、匿名或冒用他人或以krefactory平台经营者的名义散播诽谤、不实、威胁、不雅、不法、攻击性或侵害他人权利的消息或文字;
|
||||
(3)传播或散布计算机病毒;
|
||||
(4)发布与代码重构、优化无关的垃圾广告或信息,售卖商品;
|
||||
(5)其他krefactory平台经营者认为不适当的行为。
|
||||
4.2.4用户知悉并同意
|
||||
(1)用户须依据本服务条款享有对krefactory平台账户及krefactory平台相关功能、服务的使用权,用户仅能为学习、技术交流等非营利性目的使用krefactory平台账户及krefactory平台提供的功能、服务;
|
||||
(2)用户不得出于任何非法或未经krefactory平台授权的目的使用krefactory平台账户或krefactory平台提供的功能、服务,包括但不限于以营利为目的恶意注册帐号;
|
||||
(3)用户不得利用krefactory平台账户或krefactory平台提供的功能、服务从事营利活动,不得以营利或非营利目的任何方式向任何第三方提供krefactory平台账户或krefactory平台提供的功能、服务或其任何部分;
|
||||
(4)用户不得利用krefactory平台账户或krefactory平台提供的功能、服务从事任何违法或侵犯第三方知识产权或其他合法权益的活动。
|
||||
4.2.5用户须妥善保管krefactory平台账号及密码,任何于用户账号下发生的行为将被视为用户行为或经用户授权的行为,用户须就此承担责任。
|
||||
4.2.6用户应当对自己的言行负责,不得通过任何方式发布、散播诋毁或攻击krefactory平台或可能对krefactory平台造成任何负面、不良影响言论的信息。
|
||||
4.2.7用户违反本服务条款项下任何用户义务的,krefactory平台经营者有权不经通知用户而采取下列一项或多项措施,且无须向用户或任何第三方承担任何法律责任;因用户行为引发的风险、责任及损失由用户自行承担,造成krefactory平台或第三方损失的,用户还须赔偿全部损失:
|
||||
(1)删除不符合本服务条款规定的相关信息、内容;
|
||||
(2)断开相关信息、内容在krefactory平台上的链接;
|
||||
(3)暂停用户对账户的使用或限制部分功能或服务;
|
||||
(4)永久封禁账户并禁止任何功能或服务;
|
||||
(5)将用户信息列入krefactory平台及krefactory平台经营者黑名单,不予接受以相同用户信息注册krefactory平台用户或krefactory平台经营者运营的任何其他平台的申请,不再进行任何形式的合作;
|
||||
(6)向有关第三方平台投诉或举报用户的违法违规行为;
|
||||
(7)向征信部门报送用户不诚信信息;
|
||||
(8)向有关部门就用户的违法行为进行举报或报案,协助有关部门追究违法犯罪活动的法律责任;
|
||||
(9)法律法规及本服务条款规定的其他措施。
|
||||
4.2.8用户停止对krefactory平台的使用的,用户仍须就此前已发生的使用行为承担责任。
|
||||
五、知识产权保护
|
||||
5.1 krefactory的外观设计、应用程序、源代码、商标、标示图案(LOGO)、界面设计、应用程序编程接口及相关著作权,以及与krefactory平台经营者提供的服务有关的任何著作权及其他知识产权(包括但不限于著作权、专利权、商标权、商业秘密、专有技术等,下同)均归krefactory平台经营者所有,其它本协议中未经提及的权利亦由krefactory平台经营者保留。用户不能复制、拷贝、模仿或者使用任何部分的代码和外观设计。
|
||||
5.2用户知悉,krefactory平台上存储及提供的内容、信息等由平台用户或krefactory平台经营者提供;由krefactory平台经营者提供的内容、信息等的知识产权及其相关权利归属krefactory平台经营者或相关权利人所有,由其他用户提供的内容、信息等的知识产权及其相关权利归属其他用户或相关权利人所有。未经上述内容、信息等的知识产权权利人同意,用户不得下载、转载、摘编或以其他方式使用。
|
||||
5.3用户同意,用户一旦接受本协议,即表明用户同意将其在任何时间在krefactory平台发布、存储、传播的任何形式的信息、内容无偿、无条件、无期限、无地域限制的授予krefactory经营者使用、共享及商业利用的权利,包括但不限于对信息、内容进行复制、下载、展示及其信息网络传播权等权利。当任何第三方侵犯用户权益时,用户同意授权krefactory平台采用任何合法途径进行维权,用户积极配合。
|
||||
六、有限保证及服务免责
|
||||
6.1 krefactory平台经营者保证提供的功能、服务与相应功能、服务的介绍及krefactory公布的服务承诺相符。除上述保证外,krefactory平台经营者不对krefactory平台及其功能、服务作出任何其他明示或暗示的保证。
|
||||
6.2用户在krefactory平台上进行的任何行为均是用户的个人行为。因用户行为或用户存储、发布、传播的任何信息、内容等引发的任何争议,或由此产生的任何直接、间接、偶然、特殊的损害,均由用户自行承担法律责任,krefactory平台经营者不承担任何责任;如用户行为对krefactory平台造成损失或不良影响,krefactory平台经营者保留追究相关用户法律责任的权利。
|
||||
6.3用户使用krefactory平台服务,应遵守法律、法规以及本服务条款的规范,否则krefactory平台经营者有权依照本服务条款处分或终止用户使用krefactory平台服务,由此造成的损失krefactory平台经营者不负任何责任。
|
||||
6.4 krefactory平台无法对用户传播的信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论krefactory平台经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
|
||||
6.5用户应自行、独立对其在krefactory平台知悉的其他用户传播的任何信息、内容等进行独立判断及考虑、衡量其真实性、有效性及相关风险,用户因使用该等信息、内容等所遭受的风险及损失等,由用户与信息、内容的传播者自行处理,krefactory平台经营者不承担任何责任。其他用户在其发表的作品信息中加入宣传资料或广告信息、人才招聘需求,或以其他方式在krefactory平台上展示其产品或服务等,用户因该等信息、内容与发布用户产生的法律关系或纠纷,应由其自行解决,krefactory平台经营者不承担任何责任。
|
||||
6.6 krefactory平台经营者对用户所发布信息的删除或储存失败不承担任何法律责任。
|
||||
6.7不论在何种情况下,krefactory平台经营者均不对由于Internet连接故障,电力故障,罢工,劳动争议,暴乱,起义,骚乱,火灾,洪水,风暴,爆炸,不可抗力,战争,政府行为,国际、国内法院的命令,第三方的不作为或任何krefactory平台经营者不能合理控制的原因而造成的krefactory平台不能访问、信息及数据的延误、停滞或错误,不能提供或延迟提供服务而承担责任。
|
||||
6.8不论是否可以预见,不论是源于何种形式的行为或不作为,krefactory平台经营者不对因任何原因造成的任何特别的、间接的、惩罚性的、突发性的或其他任何损害(包括但不限于利润或其他可得利益的损失)承担责任。
|
||||
6.9基于互联网的开放性属性,用户知悉用户将信息、内容等上传到互联网上,有可能会被其他组织或个人复制、转载、擅改或做其它非法用途,用户必须充分意识到此类风险的存在。用户明确同意使用krefactory平台过程中所存在的上述风险将完全由用户自行承担,krefactory平台经营者对此不承担任何责任。
|
||||
七、服务变更、中断或终止
|
||||
7.1如因krefactory平台维护或升级的需要而暂停服务、调整服务功能的,krefactory经营者将尽可能事先在krefactory平台上进行通告。
|
||||
7.2 krefactory平台经营者有权对krefactory平台、及其提供的功能、服务等进行变更,届时krefactory经营者将通过在krefactory平台发布公告、公示或其他适当方式通知该等变更,用户有义务注意该等变更公示或通知。如果用户继续使用krefactory平台提供的服务,则视为其同意接受变更后的功能及服务。如果用户拒绝接受变更后的功能或服务,应立即停止使用krefactory平台。
|
||||
7.3 krefactory平台经营者有权终止其服务,并通过在krefactory平台发布公告、公示或其他适当方式通知该等终止。
|
||||
7.4 krefactory平台经营者无须就krefactory平台或其提供的功能、服务的变更、中断或终止向用户或任何第三方承担任何责任。
|
||||
八、解释权
|
||||
本注册协议的解释权归krefactory网站平台所有。如果其中有任何条款与国家的有关法律相抵触,则以国家法律的明文规定为准。
|
||||
74
ksafepack-admin/src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
|
||||
<property name="LOG_HOME" value="D:/logs" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名 -->
|
||||
<FileNamePattern>${LOG_HOME}/ksafepack.log.%d{yyyy-MM-dd}.%i.log </FileNamePattern>
|
||||
<!--日志文件保留天数 -->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<!--日志文件最大的大小 -->
|
||||
<MaxFileSize>10MB</MaxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 每天生成一个html格式的日志开始 -->
|
||||
<appender name="HTML"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名 -->
|
||||
<FileNamePattern>${LOG_HOME}/ksafepack.log.%d{yyyy-MM-dd}.%i.html</FileNamePattern>
|
||||
<!--日志文件保留天数 -->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<!--日志文件最大的大小 -->
|
||||
<MaxFileSize>10MB</MaxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="ch.qos.logback.classic.html.HTMLLayout">
|
||||
<pattern>%p%d%msg%M%F{32}%L</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 每天生成一个html格式的日志结束 -->
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="ERROR">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
<appender-ref ref="HTML" />
|
||||
</root>
|
||||
|
||||
<!--日志异步到数据库 -->
|
||||
<!--
|
||||
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
|
||||
<connectionSource
|
||||
class="ch.qos.logback.core.db.DriverManagerConnectionSource">
|
||||
<dataSource
|
||||
class="com.mchange.v2.c3p0.ComboPooledDataSource">
|
||||
<driverClass>com.mysql.jdbc.Driver</driverClass>
|
||||
<url>jdbc:mysql://127.0.0.1:3306/databaseName</url>
|
||||
<user>root</user>
|
||||
<password>root</password>
|
||||
</dataSource>
|
||||
</connectionSource>
|
||||
</appender>
|
||||
-->
|
||||
</configuration>
|
||||
140
ksafepack-admin/src/main/resources/oscache.properties
Normal file
@@ -0,0 +1,140 @@
|
||||
# CACHE IN MEMORY
|
||||
#
|
||||
# If you want to disable memory caching, just uncomment this line.
|
||||
#
|
||||
# cache.memory=false
|
||||
|
||||
|
||||
# CACHE KEY
|
||||
#
|
||||
# This is the key that will be used to store the cache in the application
|
||||
# and session scope.
|
||||
#
|
||||
# If you want to set the cache key to anything other than the default
|
||||
# uncomment this line and change the cache.key
|
||||
#
|
||||
# cache.key=__oscache_cache
|
||||
|
||||
|
||||
# USE HOST DOMAIN NAME IN KEY
|
||||
#
|
||||
# Servers for multiple host domains may wish to add host name info to
|
||||
# the generation of the key. If this is true, then uncomment the
|
||||
# following line.
|
||||
#
|
||||
# cache.use.host.domain.in.key=true
|
||||
|
||||
|
||||
# CACHE LISTENERS
|
||||
#
|
||||
# These hook OSCache events and perform various actions such as logging
|
||||
# cache hits and misses, or broadcasting to other cache instances across a cluster.
|
||||
# See the documentation for further information.
|
||||
#
|
||||
# cache.event.listeners=com.opensymphony.oscache.plugins.clustersupport.JMSBroadcastingListener, \
|
||||
# com.opensymphony.oscache.extra.CacheEntryEventListenerImpl, \
|
||||
# com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl, \
|
||||
# com.opensymphony.oscache.extra.ScopeEventListenerImpl, \
|
||||
# com.opensymphony.oscache.extra.StatisticListenerImpl
|
||||
|
||||
|
||||
# CACHE PERSISTENCE CLASS
|
||||
#
|
||||
# Specify the class to use for persistence. If you use the supplied DiskPersistenceListener,
|
||||
# don't forget to supply the cache.path property to specify the location of the cache
|
||||
# directory.
|
||||
#
|
||||
# If a persistence class is not specified, OSCache will use memory caching only.
|
||||
#
|
||||
# cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.DiskPersistenceListener
|
||||
# cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.HashDiskPersistenceListener
|
||||
|
||||
# CACHE OVERFLOW PERSISTENCE
|
||||
# Use persistent cache in overflow or not. The default value is false, which means
|
||||
# the persistent cache will be used at all times for every entry. true is the recommended setting.
|
||||
#
|
||||
# cache.persistence.overflow.only=true
|
||||
|
||||
# CACHE DIRECTORY
|
||||
#
|
||||
# This is the directory on disk where caches will be stored by the DiskPersistenceListener.
|
||||
# it will be created if it doesn't already exist. Remember that OSCache must have
|
||||
# write permission to this directory.
|
||||
#
|
||||
# Note: for Windows machines, this needs \ to be escaped
|
||||
# ie Windows:
|
||||
#cache.path=d:\\cache\\
|
||||
# or *ix:
|
||||
cache.path=/opt/ycsafe/cache
|
||||
#
|
||||
# cache.path=c:\\app\\cache
|
||||
|
||||
|
||||
# CACHE ALGORITHM
|
||||
#
|
||||
# Default cache algorithm to use. Note that in order to use an algorithm
|
||||
# the cache size must also be specified. If the cache size is not specified,
|
||||
# the cache algorithm will be Unlimited cache.
|
||||
#
|
||||
# cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache
|
||||
# cache.algorithm=com.opensymphony.oscache.base.algorithm.FIFOCache
|
||||
# cache.algorithm=com.opensymphony.oscache.base.algorithm.UnlimitedCache
|
||||
|
||||
# THREAD BLOCKING BEHAVIOR
|
||||
#
|
||||
# When a request is made for a stale cache entry, it is possible that another thread is already
|
||||
# in the process of rebuilding that entry. This setting specifies how OSCache handles the
|
||||
# subsequent 'non-building' threads. The default behaviour (cache.blocking=false) is to serve
|
||||
# the old content to subsequent threads until the cache entry has been updated. This provides
|
||||
# the best performance (at the cost of serving slightly stale data). When blocking is enabled,
|
||||
# threads will instead block until the new cache entry is ready to be served. Once the new entry
|
||||
# is put in the cache the blocked threads will be restarted and given the new entry.
|
||||
# Note that even if blocking is disabled, when there is no stale data available to be served
|
||||
# threads will block until the data is added to the cache by the thread that is responsible
|
||||
# for building the data.
|
||||
#
|
||||
# cache.blocking=false
|
||||
|
||||
# CACHE SIZE
|
||||
#
|
||||
# Default cache size in number of items. If a size is specified but not
|
||||
# an algorithm, the cache algorithm used will be LRUCache.
|
||||
#
|
||||
cache.capacity=10000
|
||||
|
||||
|
||||
# CACHE UNLIMITED DISK
|
||||
# Use unlimited disk cache or not. The default value is false, which means
|
||||
# the disk cache will be limited in size to the value specified by cache.capacity.
|
||||
#
|
||||
# cache.unlimited.disk=false
|
||||
|
||||
|
||||
# JMS CLUSTER PROPERTIES
|
||||
#
|
||||
# Configuration properties for JMS clustering. See the clustering documentation
|
||||
# for more information on these settings.
|
||||
#
|
||||
#cache.cluster.jms.topic.factory=java:comp/env/jms/TopicConnectionFactory
|
||||
#cache.cluster.jms.topic.name=java:comp/env/jms/OSCacheTopic
|
||||
#cache.cluster.jms.node.name=node1
|
||||
|
||||
|
||||
# JAVAGROUPS CLUSTER PROPERTIES
|
||||
#
|
||||
# Configuration properites for the JavaGroups clustering. Only one of these
|
||||
# should be specified. Default values (as shown below) will be used if niether
|
||||
# property is set. See the clustering documentation and the JavaGroups project
|
||||
# (www.javagroups.com) for more information on these settings.
|
||||
#
|
||||
#cache.cluster.properties=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32;\
|
||||
#mcast_send_buf_size=150000;mcast_recv_buf_size=80000):\
|
||||
#PING(timeout=2000;num_initial_members=3):\
|
||||
#MERGE2(min_interval=5000;max_interval=10000):\
|
||||
#FD_SOCK:VERIFY_SUSPECT(timeout=1500):\
|
||||
#pbcast.NAKACK(gc_lag=50;retransmit_timeout=300,600,1200,2400,4800;max_xmit_size=8192):\
|
||||
#UNICAST(timeout=300,600,1200,2400):\
|
||||
#pbcast.STABLE(desired_avg_gossip=20000):\
|
||||
#FRAG(frag_size=8096;down_thread=false;up_thread=false):\
|
||||
#pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true)
|
||||
#cache.cluster.multicast.ip=231.12.21.132
|
||||
19
ksafepack-admin/src/main/resources/readme/jasypt.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
jasypt官网上有几种方式,下面使用的是最简单的一种方案:
|
||||
1.添加依赖:
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
2.spring启动类保证有@SpringBootApplication注解
|
||||
3.使用如下指令来得到加密串:
|
||||
mvn jasypt:encrypt-value -Djasypt.encryptor.password="the salt" -Djasypt.plugin.value="theValueYouWantToEncrypt"
|
||||
或在命令行下执行:
|
||||
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input=root password=kelp algorithm=PBEWithMD5AndDES
|
||||
4.在使用加密串的地方加上ENC(your encypted string)
|
||||
如:spring.datasource.slave.username=ENC(aRWpysKMOtKt12BiuB6ngQ==)
|
||||
5.在spring配置文件中加入:
|
||||
jasypt.encryptor.password=kelp #salt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
6.目前使用到的有database/redis等串
|
||||
12
ksafepack-admin/src/main/resources/readme/nginx.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
1.使用nginx作为图片服务器
|
||||
1.在server中添加location配置
|
||||
location /jpeg/ {
|
||||
root d:/upload/kelp/;#实际路径,Linux可作修改
|
||||
autoindex on; #生产环境要注释这一行
|
||||
}
|
||||
|
||||
当访问如http://127.0.0.1:8082/jpeg/1.jpg时,转到访问d:/upload/kelp/jpeg/1.jpg文件
|
||||
2.上传文件
|
||||
上传文件时首先检查文件格式;
|
||||
然后上传到FTP服务器,虚拟目录为d:/upload/kelp
|
||||
上传时注意文件夹权限的问题,文件夹权限的读写权限一定要处理好
|
||||
12
ksafepack-admin/src/main/resources/readme/ssl.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
1.使用HTTPS的话,需要生成证书,在本地测试时,可以使用JDK中的keytool生成证书
|
||||
2.keytool生成证书:
|
||||
keytool -genkey -alias kelp -keyalg RSA -keystore /home/kelp/kelp.keystore
|
||||
3.application.properties中添加配置:
|
||||
#端口号
|
||||
server.port: 8443
|
||||
#你生成的证书名字
|
||||
server.ssl.key-store: /home/kelp/kelp.keystore
|
||||
#密钥库密码
|
||||
server.ssl.key-store-password: kelp
|
||||
server.ssl.keyStoreType: JKS
|
||||
server.ssl.keyAlias: kelp
|
||||
3385
ksafepack-admin/src/main/resources/sensitiveword.txt
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 299 KiB |
|
After Width: | Height: | Size: 289 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 724 B |
|
After Width: | Height: | Size: 126 KiB |
@@ -0,0 +1,562 @@
|
||||
.page {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
position: relative;
|
||||
width: 1920px;
|
||||
height: 1997px;
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.group_1 {
|
||||
box-shadow: 0px 0px 6px 0px rgba(8, 15, 53, 0.3);
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
width: 1920px;
|
||||
height: 70px;
|
||||
justify-content: flex-center;
|
||||
}
|
||||
|
||||
.image_1 {
|
||||
width: 118px;
|
||||
height: 36px;
|
||||
margin: 17px 0 0 390px;
|
||||
}
|
||||
|
||||
.text_1 {
|
||||
width: 70px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 27px 0 0 32px;
|
||||
}
|
||||
|
||||
.text_2 {
|
||||
width: 70px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 27px 0 0 30px;
|
||||
}
|
||||
|
||||
.text_3 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 27px 0 0 30px;
|
||||
}
|
||||
|
||||
.text_4 {
|
||||
width: 73px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 27px 0 0 22px;
|
||||
}
|
||||
|
||||
.text_5 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 27px 0 0 30px;
|
||||
}
|
||||
|
||||
.text_6 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 27px 0 0 30px;
|
||||
}
|
||||
|
||||
.text_7 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 27px 0 0 30px;
|
||||
}
|
||||
|
||||
.label_1 {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin: 23px 0 0 114px;
|
||||
}
|
||||
|
||||
.text_8 {
|
||||
width: 95px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 26px 0 0 8px;
|
||||
}
|
||||
|
||||
.text-wrapper_1 {
|
||||
background-color: rgba(21, 170, 125, 1);
|
||||
height: 70px;
|
||||
width: 120px;
|
||||
margin: 0 390px 0 20px;
|
||||
}
|
||||
|
||||
.text_9 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 26px 0 0 32px;
|
||||
}
|
||||
|
||||
.group_5 {
|
||||
position: relative;
|
||||
width: 1920px;
|
||||
height: 1718px;
|
||||
}
|
||||
|
||||
.text-wrapper_2 {
|
||||
width: 1920px;
|
||||
height: 300px;
|
||||
background: url(./img/FigmaDDSSlicePNG2ca2b744177aa14589b1a0fa8ba0dfa4.png)
|
||||
100% no-repeat;
|
||||
background-size: 100% 100%;
|
||||
justify-content: flex-center;
|
||||
}
|
||||
|
||||
.text_10 {
|
||||
width: 120px;
|
||||
height: 45px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 30px;
|
||||
font-family: Microsoft YaHei-Bold;
|
||||
font-weight: 700;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 45px;
|
||||
margin: 110px 0 0 390px;
|
||||
}
|
||||
|
||||
.text_11 {
|
||||
width: 297px;
|
||||
height: 24px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
margin: 10px 0 111px 390px;
|
||||
}
|
||||
|
||||
.text-wrapper_3 {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
width: 1920px;
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.text_12 {
|
||||
width: 64px;
|
||||
height: 24px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(94, 94, 97, 1);
|
||||
font-size: 16px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
margin: 23px 0 0 688px;
|
||||
}
|
||||
|
||||
.text_13 {
|
||||
width: 64px;
|
||||
height: 24px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(94, 94, 97, 1);
|
||||
font-size: 16px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
margin: 23px 0 0 56px;
|
||||
}
|
||||
|
||||
.text_14 {
|
||||
width: 64px;
|
||||
height: 24px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(21, 170, 125, 1);
|
||||
font-size: 16px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
margin: 23px 0 0 56px;
|
||||
}
|
||||
|
||||
.text_15 {
|
||||
width: 64px;
|
||||
height: 24px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(94, 94, 97, 1);
|
||||
font-size: 16px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
margin: 23px 0 0 56px;
|
||||
}
|
||||
|
||||
.text_16 {
|
||||
width: 64px;
|
||||
height: 24px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(94, 94, 97, 1);
|
||||
font-size: 16px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
margin: 23px 688px 0 56px;
|
||||
}
|
||||
|
||||
.group_6 {
|
||||
width: 96px;
|
||||
height: 22px;
|
||||
margin: 50px 0 0 390px;
|
||||
}
|
||||
|
||||
.block_2 {
|
||||
background-color: rgba(21, 170, 125, 1);
|
||||
width: 14px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.text_17 {
|
||||
width: 72px;
|
||||
height: 20px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 18px;
|
||||
font-family: Microsoft YaHei-Bold;
|
||||
font-weight: 700;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.text_18 {
|
||||
width: 1140px;
|
||||
height: 84px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
line-height: 24px;
|
||||
margin: 28px 0 0 390px;
|
||||
}
|
||||
|
||||
.image_2 {
|
||||
width: 860px;
|
||||
height: 522px;
|
||||
margin: 40px 0 0 530px;
|
||||
}
|
||||
|
||||
.group_7 {
|
||||
width: 96px;
|
||||
height: 20px;
|
||||
margin: 40px 0 0 390px;
|
||||
}
|
||||
|
||||
.group_3 {
|
||||
background-color: rgba(21, 170, 125, 1);
|
||||
width: 14px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.text_19 {
|
||||
width: 72px;
|
||||
height: 20px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 18px;
|
||||
font-family: Microsoft YaHei-Bold;
|
||||
font-weight: 700;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.text_20 {
|
||||
width: 1140px;
|
||||
height: 78px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
line-height: 24px;
|
||||
margin: 26px 0 438px 390px;
|
||||
}
|
||||
|
||||
.block_4 {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 1415px;
|
||||
width: 1922px;
|
||||
height: 302px;
|
||||
background: url(./img/FigmaDDSSlicePNGddc8cdd4c8327ecd775806c103060d4e.png)
|
||||
100% no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.text_21 {
|
||||
width: 480px;
|
||||
height: 40px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(0, 0, 0, 1);
|
||||
font-size: 30px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 30px;
|
||||
margin: 96px 0 0 410px;
|
||||
}
|
||||
|
||||
.text-wrapper_4 {
|
||||
background-color: rgba(21, 170, 125, 1);
|
||||
border-radius: 5px;
|
||||
height: 44px;
|
||||
width: 180px;
|
||||
margin: 35px 0 87px 560px;
|
||||
}
|
||||
|
||||
.text_22 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin: 13px 0 0 62px;
|
||||
}
|
||||
|
||||
.group_4 {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
width: 1920px;
|
||||
height: 210px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.image-text_2 {
|
||||
width: 277px;
|
||||
height: 129px;
|
||||
margin: 35px 0 0 390px;
|
||||
}
|
||||
|
||||
.image_3 {
|
||||
width: 167px;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
.text-group_1 {
|
||||
width: 277px;
|
||||
height: 64px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
line-height: 32px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.block_6 {
|
||||
width: 682px;
|
||||
height: 103px;
|
||||
margin: 62px 390px 0 0;
|
||||
}
|
||||
|
||||
.text-wrapper_6 {
|
||||
width: 572px;
|
||||
height: 18px;
|
||||
margin-left: 280px;
|
||||
}
|
||||
|
||||
.text_23 {
|
||||
width: 28px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.text_24 {
|
||||
width: 70px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.text_25 {
|
||||
width: 70px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.text_26 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.text_27 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.text_28 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.text_29 {
|
||||
width: 56px;
|
||||
height: 18px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(26, 27, 28, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 14px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.paragraph_1 {
|
||||
width: 865px;
|
||||
height: 65px;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(146, 151, 157, 1);
|
||||
font-size: 14px;
|
||||
font-family: Microsoft YaHei-Regular;
|
||||
font-weight: NaN;
|
||||
text-align: right;
|
||||
line-height: 28px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 504 B |
|
After Width: | Height: | Size: 556 B |
|
After Width: | Height: | Size: 219 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 724 B |
|
After Width: | Height: | Size: 126 KiB |
@@ -0,0 +1,478 @@
|
||||
(function umd(root,factory){
|
||||
if(typeof module==='object' && typeof exports === 'object' )
|
||||
module.exports=factory()
|
||||
else if(typeof define==='function' && define.amd)
|
||||
define([],factory)
|
||||
else
|
||||
root.httpVueLoader=factory()
|
||||
})(this,function factory() {
|
||||
'use strict';
|
||||
|
||||
var scopeIndex = 0;
|
||||
|
||||
StyleContext.prototype = {
|
||||
|
||||
withBase: function(callback) {
|
||||
|
||||
var tmpBaseElt;
|
||||
if ( this.component.baseURI ) {
|
||||
|
||||
// firefox and chrome need the <base> to be set while inserting or modifying <style> in a document.
|
||||
tmpBaseElt = document.createElement('base');
|
||||
tmpBaseElt.href = this.component.baseURI;
|
||||
|
||||
var headElt = this.component.getHead();
|
||||
headElt.insertBefore(tmpBaseElt, headElt.firstChild);
|
||||
}
|
||||
|
||||
callback.call(this);
|
||||
|
||||
if ( tmpBaseElt )
|
||||
this.component.getHead().removeChild(tmpBaseElt);
|
||||
},
|
||||
|
||||
scopeStyles: function(styleElt, scopeName) {
|
||||
|
||||
function process() {
|
||||
|
||||
var sheet = styleElt.sheet;
|
||||
var rules = sheet.cssRules;
|
||||
|
||||
for ( var i = 0; i < rules.length; ++i ) {
|
||||
|
||||
var rule = rules[i];
|
||||
if ( rule.type !== 1 )
|
||||
continue;
|
||||
|
||||
var scopedSelectors = [];
|
||||
|
||||
rule.selectorText.split(/\s*,\s*/).forEach(function(sel) {
|
||||
|
||||
scopedSelectors.push(scopeName+' '+sel);
|
||||
var segments = sel.match(/([^ :]+)(.+)?/);
|
||||
scopedSelectors.push(segments[1] + scopeName + (segments[2]||''));
|
||||
});
|
||||
|
||||
var scopedRule = scopedSelectors.join(',') + rule.cssText.substr(rule.selectorText.length);
|
||||
sheet.deleteRule(i);
|
||||
sheet.insertRule(scopedRule, i);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// firefox may fail sheet.cssRules with InvalidAccessError
|
||||
process();
|
||||
} catch (ex) {
|
||||
|
||||
if ( ex instanceof DOMException && ex.code === DOMException.INVALID_ACCESS_ERR ) {
|
||||
|
||||
styleElt.sheet.disabled = true;
|
||||
styleElt.addEventListener('load', function onStyleLoaded() {
|
||||
|
||||
styleElt.removeEventListener('load', onStyleLoaded);
|
||||
|
||||
// firefox need this timeout otherwise we have to use document.importNode(style, true)
|
||||
setTimeout(function() {
|
||||
|
||||
process();
|
||||
styleElt.sheet.disabled = false;
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
throw ex;
|
||||
}
|
||||
},
|
||||
|
||||
compile: function() {
|
||||
|
||||
var hasTemplate = this.template !== null;
|
||||
|
||||
var scoped = this.elt.hasAttribute('scoped');
|
||||
|
||||
if ( scoped ) {
|
||||
|
||||
// no template, no scopable style needed
|
||||
if ( !hasTemplate )
|
||||
return;
|
||||
|
||||
// firefox does not tolerate this attribute
|
||||
this.elt.removeAttribute('scoped');
|
||||
}
|
||||
|
||||
this.withBase(function() {
|
||||
|
||||
this.component.getHead().appendChild(this.elt);
|
||||
});
|
||||
|
||||
if ( scoped )
|
||||
this.scopeStyles(this.elt, '['+this.component.getScopeId()+']');
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
getContent: function() {
|
||||
|
||||
return this.elt.textContent;
|
||||
},
|
||||
|
||||
setContent: function(content) {
|
||||
|
||||
this.withBase(function() {
|
||||
|
||||
this.elt.textContent = content;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function StyleContext(component, elt) {
|
||||
|
||||
this.component = component;
|
||||
this.elt = elt;
|
||||
}
|
||||
|
||||
|
||||
ScriptContext.prototype = {
|
||||
|
||||
getContent: function() {
|
||||
|
||||
return this.elt.textContent;
|
||||
},
|
||||
|
||||
setContent: function(content) {
|
||||
|
||||
this.elt.textContent = content;
|
||||
},
|
||||
|
||||
compile: function(module) {
|
||||
|
||||
var childModuleRequire = function(childURL) {
|
||||
|
||||
return httpVueLoader.require(resolveURL(this.component.baseURI, childURL));
|
||||
}.bind(this);
|
||||
|
||||
var childLoader = function(childURL, childName) {
|
||||
|
||||
return httpVueLoader(resolveURL(this.component.baseURI, childURL), childName);
|
||||
}.bind(this);
|
||||
|
||||
try {
|
||||
Function('exports', 'require', 'httpVueLoader', 'module', this.getContent()).call(this.module.exports, this.module.exports, childModuleRequire, childLoader, this.module);
|
||||
} catch(ex) {
|
||||
|
||||
if ( !('lineNumber' in ex) ) {
|
||||
|
||||
return Promise.reject(ex);
|
||||
}
|
||||
var vueFileData = responseText.replace(/\r?\n/g, '\n');
|
||||
var lineNumber = vueFileData.substr(0, vueFileData.indexOf(script)).split('\n').length + ex.lineNumber - 1;
|
||||
throw new (ex.constructor)(ex.message, url, lineNumber);
|
||||
}
|
||||
|
||||
return Promise.resolve(this.module.exports)
|
||||
.then(httpVueLoader.scriptExportsHandler.bind(this))
|
||||
.then(function(exports) {
|
||||
|
||||
this.module.exports = exports;
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
function ScriptContext(component, elt) {
|
||||
|
||||
this.component = component;
|
||||
this.elt = elt;
|
||||
this.module = { exports:{} };
|
||||
}
|
||||
|
||||
|
||||
TemplateContext.prototype = {
|
||||
|
||||
getContent: function() {
|
||||
|
||||
return this.elt.innerHTML;
|
||||
},
|
||||
|
||||
setContent: function(content) {
|
||||
|
||||
this.elt.innerHTML = content;
|
||||
},
|
||||
|
||||
getRootElt: function() {
|
||||
|
||||
var tplElt = this.elt.content || this.elt;
|
||||
|
||||
if ( 'firstElementChild' in tplElt )
|
||||
return tplElt.firstElementChild;
|
||||
|
||||
for ( tplElt = tplElt.firstChild; tplElt !== null; tplElt = tplElt.nextSibling )
|
||||
if ( tplElt.nodeType === Node.ELEMENT_NODE )
|
||||
return tplElt;
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
compile: function() {
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
};
|
||||
|
||||
function TemplateContext(component, elt) {
|
||||
|
||||
this.component = component;
|
||||
this.elt = elt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Component.prototype = {
|
||||
|
||||
getHead: function() {
|
||||
|
||||
return document.head || document.getElementsByTagName('head')[0];
|
||||
},
|
||||
|
||||
getScopeId: function() {
|
||||
|
||||
if ( this._scopeId === '' ) {
|
||||
|
||||
this._scopeId = 'data-s-' + (scopeIndex++).toString(36);
|
||||
this.template.getRootElt().setAttribute(this._scopeId, '');
|
||||
}
|
||||
return this._scopeId;
|
||||
},
|
||||
|
||||
load: function(componentURL) {
|
||||
|
||||
return httpVueLoader.httpRequest(componentURL)
|
||||
.then(function(responseText) {
|
||||
|
||||
this.baseURI = componentURL.substr(0, componentURL.lastIndexOf('/')+1);
|
||||
var doc = document.implementation.createHTMLDocument('');
|
||||
|
||||
// IE requires the <base> to come with <style>
|
||||
doc.body.innerHTML = (this.baseURI ? '<base href="'+this.baseURI+'">' : '') + responseText;
|
||||
|
||||
for ( var it = doc.body.firstChild; it; it = it.nextSibling ) {
|
||||
|
||||
switch ( it.nodeName ) {
|
||||
case 'TEMPLATE':
|
||||
this.template = new TemplateContext(this, it);
|
||||
break;
|
||||
case 'SCRIPT':
|
||||
this.script = new ScriptContext(this, it);
|
||||
break;
|
||||
case 'STYLE':
|
||||
this.styles.push(new StyleContext(this, it));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
_normalizeSection: function(eltCx) {
|
||||
|
||||
var p;
|
||||
|
||||
if ( eltCx === null || !eltCx.elt.hasAttribute('src') ) {
|
||||
|
||||
p = Promise.resolve(null);
|
||||
} else {
|
||||
|
||||
p = httpVueLoader.httpRequest(eltCx.elt.getAttribute('src'))
|
||||
.then(function(content) {
|
||||
|
||||
eltCx.elt.removeAttribute('src');
|
||||
return content;
|
||||
});
|
||||
}
|
||||
|
||||
return p
|
||||
.then(function(content) {
|
||||
|
||||
if ( eltCx !== null && eltCx.elt.hasAttribute('lang') ) {
|
||||
|
||||
var lang = eltCx.elt.getAttribute('lang');
|
||||
eltCx.elt.removeAttribute('lang');
|
||||
return httpVueLoader.langProcessor[lang.toLowerCase()].call(this, content === null ? eltCx.getContent() : content);
|
||||
}
|
||||
return content;
|
||||
}.bind(this))
|
||||
.then(function(content) {
|
||||
|
||||
if ( content !== null )
|
||||
eltCx.setContent(content);
|
||||
});
|
||||
},
|
||||
|
||||
normalize: function() {
|
||||
|
||||
return Promise.all(Array.prototype.concat(
|
||||
this._normalizeSection(this.template),
|
||||
this._normalizeSection(this.script),
|
||||
this.styles.map(this._normalizeSection)
|
||||
))
|
||||
.then(function() {
|
||||
|
||||
return this;
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
compile: function() {
|
||||
|
||||
return Promise.all(Array.prototype.concat(
|
||||
this.template && this.template.compile(),
|
||||
this.script && this.script.compile(),
|
||||
this.styles.map(function(style) { return style.compile(); })
|
||||
))
|
||||
.then(function() {
|
||||
|
||||
return this;
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
function Component(name) {
|
||||
|
||||
this.name = name;
|
||||
this.template = null;
|
||||
this.script = null;
|
||||
this.styles = [];
|
||||
this._scopeId = '';
|
||||
}
|
||||
|
||||
function identity(value) {
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function parseComponentURL(url) {
|
||||
|
||||
var comp = url.match(/(.*?)([^/]+?)\/?(\.vue)?(\?.*|#.*|$)/);
|
||||
return {
|
||||
name: comp[2],
|
||||
url: comp[1] + comp[2] + (comp[3] === undefined ? '/index.vue' : comp[3]) + comp[4]
|
||||
};
|
||||
}
|
||||
|
||||
function resolveURL(baseURL, url) {
|
||||
|
||||
if (url.substr(0, 2) === './' || url.substr(0, 3) === '../') {
|
||||
return baseURL + url;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
httpVueLoader.load = function(url, name) {
|
||||
|
||||
return function() {
|
||||
|
||||
return new Component(name).load(url)
|
||||
.then(function(component) {
|
||||
|
||||
return component.normalize();
|
||||
})
|
||||
.then(function(component) {
|
||||
|
||||
return component.compile();
|
||||
})
|
||||
.then(function(component) {
|
||||
|
||||
var exports = component.script !== null ? component.script.module.exports : {};
|
||||
|
||||
if ( component.template !== null )
|
||||
exports.template = component.template.getContent();
|
||||
|
||||
if ( exports.name === undefined )
|
||||
if ( component.name !== undefined )
|
||||
exports.name = component.name;
|
||||
|
||||
exports._baseURI = component.baseURI;
|
||||
|
||||
return exports;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
httpVueLoader.register = function(Vue, url) {
|
||||
|
||||
var comp = parseComponentURL(url);
|
||||
Vue.component(comp.name, httpVueLoader.load(comp.url));
|
||||
};
|
||||
|
||||
httpVueLoader.install = function(Vue) {
|
||||
|
||||
Vue.mixin({
|
||||
|
||||
beforeCreate: function () {
|
||||
|
||||
var components = this.$options.components;
|
||||
|
||||
for ( var componentName in components ) {
|
||||
|
||||
if ( typeof(components[componentName]) === 'string' && components[componentName].substr(0, 4) === 'url:' ) {
|
||||
|
||||
var comp = parseComponentURL(components[componentName].substr(4));
|
||||
|
||||
var componentURL = ('_baseURI' in this.$options) ? resolveURL(this.$options._baseURI, comp.url) : comp.url;
|
||||
|
||||
if ( isNaN(componentName) )
|
||||
components[componentName] = httpVueLoader.load(componentURL, componentName);
|
||||
else
|
||||
components[componentName] = Vue.component(comp.name, httpVueLoader.load(componentURL, comp.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
httpVueLoader.require = function(moduleName) {
|
||||
|
||||
return window[moduleName];
|
||||
};
|
||||
|
||||
httpVueLoader.httpRequest = function(url) {
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'text';
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
|
||||
if ( xhr.readyState === 4 ) {
|
||||
|
||||
if ( xhr.status >= 200 && xhr.status < 300 )
|
||||
resolve(xhr.responseText);
|
||||
else
|
||||
reject(xhr.status);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(null);
|
||||
});
|
||||
};
|
||||
|
||||
httpVueLoader.langProcessor = {
|
||||
html: identity,
|
||||
js: identity,
|
||||
css: identity
|
||||
};
|
||||
|
||||
httpVueLoader.scriptExportsHandler = identity;
|
||||
|
||||
function httpVueLoader(url, name) {
|
||||
|
||||
var comp = parseComponentURL(url);
|
||||
return httpVueLoader.load(comp.url, name);
|
||||
}
|
||||
|
||||
return httpVueLoader;
|
||||
});
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 883 B |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 880 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 11 KiB |
340
ksafepack-admin/src/main/resources/static/business/app/index.css
Normal file
@@ -0,0 +1,340 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #49D1AC;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
ul, li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.app {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #49D1AC;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.topbg {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.corporateName {
|
||||
font-size: 0.18rem;
|
||||
font-family: HYLingXinJ, HYLingXinJ-regular;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
line-height: 0.42rem;
|
||||
position: absolute;
|
||||
left: 0.3rem;
|
||||
top: 0rem;
|
||||
}
|
||||
|
||||
.page__img {
|
||||
width: 60%;
|
||||
/* height: 0.62rem; */
|
||||
font-size: 0.64rem;
|
||||
font-family: HYLingXinJ, HYLingXinJ-regular;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
color: #ffffff;
|
||||
line-height: 0.39rem;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.page__box {
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.page__top {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
color: white;
|
||||
padding-top: 0.6rem;
|
||||
}
|
||||
|
||||
.page__top p {
|
||||
font-size: 0.22rem;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.page__top p:first-child {
|
||||
font-size: 0.34rem;
|
||||
}
|
||||
|
||||
.page__title {
|
||||
width: 90%;
|
||||
height: 0.46rem;
|
||||
background: #fc9801;
|
||||
margin: auto;
|
||||
margin-bottom: 0.3rem;
|
||||
border-radius: 0.31rem 0rem 0.31rem 0rem;
|
||||
box-shadow: -0.04rem 0rem 0rem NaNpx #fb9701;
|
||||
font-size: 0.16rem;
|
||||
font-family: PingFang SC, PingFang SC-Medium;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
line-height: 0.46rem;
|
||||
}
|
||||
|
||||
.question {
|
||||
background-color: white;
|
||||
border-radius: 0.16rem;
|
||||
padding: 0.15rem;
|
||||
margin-top: 0.12rem;
|
||||
}
|
||||
|
||||
.question__title {
|
||||
width: 90%;
|
||||
height: 0.64rem;
|
||||
background: #49d1ac;
|
||||
border-radius: 0.42rem;
|
||||
font-size: 0.24rem;
|
||||
font-family: PingFang SC, PingFang SC-Bold;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
line-height: 0.64rem;
|
||||
margin: auto;
|
||||
margin-bottom: 0.26rem;
|
||||
}
|
||||
|
||||
.question__con {
|
||||
width: 100%;
|
||||
background: #dafef8;
|
||||
border-radius: 0.16rem;
|
||||
position: relative;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
margin-top: 0.1rem;
|
||||
}
|
||||
|
||||
.question__picture {
|
||||
width: 0.7rem;
|
||||
height: 0.54rem;
|
||||
position: absolute;
|
||||
right: 0.05rem;
|
||||
top: 0.02rem;
|
||||
}
|
||||
|
||||
.question__icon {
|
||||
margin-top: 0.35rem;
|
||||
margin-left: 0.22rem;
|
||||
}
|
||||
|
||||
.question__text {
|
||||
width: 80%;
|
||||
margin-top: 0.24rem;
|
||||
margin-left: 0.12rem;
|
||||
padding-bottom: 0.22rem;
|
||||
}
|
||||
|
||||
.question__icon img {
|
||||
width: 0.2rem;
|
||||
height: 0.2rem;
|
||||
}
|
||||
|
||||
.question__text__title {
|
||||
font-size: 0.24rem;
|
||||
font-family: PingFang SC, PingFang SC-Bold;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
color: #3f3f42;
|
||||
line-height: 0.39rem;
|
||||
}
|
||||
|
||||
.question__text__content {
|
||||
color: #818181;
|
||||
}
|
||||
|
||||
.sort__table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th, td {
|
||||
height: 0.5rem;
|
||||
font-family: PingFang SC, PingFang SC-Medium;
|
||||
font-weight: 500;
|
||||
color: #818181;
|
||||
line-height: 0.39rem;
|
||||
border: 0.01rem solid #CFE0E7;
|
||||
}
|
||||
|
||||
.sort {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.project td {
|
||||
padding-left: 0.1rem;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #DAFEF8;
|
||||
}
|
||||
|
||||
.combo {
|
||||
padding: 0.15rem;
|
||||
margin-bottom: 0.12rem;
|
||||
}
|
||||
|
||||
.from {
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.combo__title, .from__title {
|
||||
width: 90%;
|
||||
height: 0.64rem;
|
||||
background: #ffffff;
|
||||
border-radius: 0.42rem;
|
||||
font-size: 0.24rem;
|
||||
font-family: PingFang SC, PingFang SC-Bold;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #49d1ac;
|
||||
line-height: 0.64rem;
|
||||
margin: auto;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.combo__con {
|
||||
text-indent: 0.36rem;
|
||||
font-size: 0.18rem;
|
||||
font-family: PingFang SC, PingFang SC-Medium;
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
color: #ffffff;
|
||||
line-height: 0.4rem;
|
||||
}
|
||||
|
||||
.combo__box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.combo__right {
|
||||
width: 42%;
|
||||
padding: 0.08rem;
|
||||
background: rgba(51, 92, 81, .1);
|
||||
border-radius: 0.1rem;
|
||||
}
|
||||
|
||||
.combo__right__title {
|
||||
font-size: 0.2rem;
|
||||
font-family: PingFang SC, PingFang SC-Bold;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
line-height: 0.39rem;
|
||||
}
|
||||
|
||||
li {
|
||||
font-size: 0.16rem;
|
||||
font-family: PingFang SC, PingFang SC-Medium;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 0.34rem;
|
||||
}
|
||||
|
||||
li img {
|
||||
width: 0.18rem;
|
||||
height: 0.18rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.isborder {
|
||||
border-bottom: 0.01rem dashed #fff;
|
||||
}
|
||||
|
||||
.combo__price {
|
||||
font-size: 0.2rem;
|
||||
font-family: PingFang SC, PingFang SC-Bold;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
line-height: 0.39rem;
|
||||
}
|
||||
|
||||
.from__box {
|
||||
width: 90%;
|
||||
margin: auto;
|
||||
border-bottom: 0.01rem solid #F0F0F0;
|
||||
}
|
||||
|
||||
.from__name {
|
||||
font-size: 0.22rem;
|
||||
font-family: PingFang SC, PingFang SC-Bold;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
color: #324b44;
|
||||
line-height: 0.39rem;
|
||||
}
|
||||
|
||||
.from__box input {
|
||||
width: 100%;
|
||||
font-size: 0.2rem;
|
||||
font-family: PingFang SC, PingFang SC-Medium;
|
||||
text-align: left;
|
||||
/* color: #cfdad7; */
|
||||
line-height: 0.39rem;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
input-placeholder {
|
||||
color: #cfdad7;
|
||||
}
|
||||
|
||||
.bot {
|
||||
width: 100%;
|
||||
height: 0.62rem;
|
||||
background: #ffb638;
|
||||
text-align: center;
|
||||
line-height: 0.62rem;
|
||||
color: #FFFFFF;
|
||||
font-size: 0.26rem;
|
||||
font-family: PingFang SC, PingFang SC-Medium;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.mark {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 40%;
|
||||
right: 0;
|
||||
left: 0;
|
||||
margin: auto;
|
||||
line-height: 0.3rem;
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
font-size: 0.16rem;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
border-radius: 0.05rem;
|
||||
padding: 0.1rem;
|
||||
z-index: 99999;
|
||||
}
|
||||
2
ksafepack-admin/src/main/resources/static/business/app/jquery-3.4.1.min.js
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
; (function (designWidth, maxWidth) {
|
||||
var doc = document,
|
||||
win = window;
|
||||
var docEl = doc.documentElement;
|
||||
var tid;
|
||||
var rootItem, rootStyle;
|
||||
|
||||
function refreshRem() {
|
||||
var width = docEl.getBoundingClientRect().width;
|
||||
if (!maxWidth) {
|
||||
maxWidth = 540;
|
||||
}
|
||||
;
|
||||
if (width > maxWidth) {
|
||||
width = maxWidth;
|
||||
}
|
||||
//与淘宝做法不同,直接采用简单的rem换算方法1rem=100px
|
||||
var rem = width * 100 / designWidth;
|
||||
console.log(rem);
|
||||
|
||||
//兼容UC开始
|
||||
rootStyle = "html{font-size:" + rem + 'px !important}';
|
||||
rootItem = document.getElementById('rootsize') || document.createElement("style");
|
||||
if (!document.getElementById('rootsize')) {
|
||||
document.getElementsByTagName("head")[0].appendChild(rootItem);
|
||||
rootItem.id = 'rootsize';
|
||||
}
|
||||
if (rootItem.styleSheet) {
|
||||
rootItem.styleSheet.disabled || (rootItem.styleSheet.cssText = rootStyle)
|
||||
} else {
|
||||
try {
|
||||
rootItem.innerHTML = rootStyle
|
||||
} catch (f) {
|
||||
rootItem.innerText = rootStyle
|
||||
}
|
||||
}
|
||||
//兼容UC结束
|
||||
docEl.style.fontSize = rem + "px";
|
||||
};
|
||||
refreshRem();
|
||||
|
||||
win.addEventListener("resize", function () {
|
||||
clearTimeout(tid); //防止执行两次
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}, false);
|
||||
|
||||
win.addEventListener("pageshow", function (e) {
|
||||
if (e.persisted) { // 浏览器后退的时候重新计算
|
||||
clearTimeout(tid);
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (doc.readyState === "complete") {
|
||||
doc.body.style.fontSize = "16px";
|
||||
} else {
|
||||
doc.addEventListener("DOMContentLoaded", function (e) {
|
||||
doc.body.style.fontSize = "16px";
|
||||
}, false);
|
||||
}
|
||||
})(375, 750);
|
||||
344
ksafepack-admin/src/main/resources/static/business/app/tool.js
Normal file
@@ -0,0 +1,344 @@
|
||||
/**
|
||||
* 动态设置rem单位
|
||||
* @param doc
|
||||
* @param win
|
||||
*/
|
||||
function setRem(doc = document, win = window) {
|
||||
let resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
|
||||
//页面加载和改变大小时执行初始化操作
|
||||
let initialize = () => {
|
||||
let width = 750 //设计稿的宽度(1rem = 100px)
|
||||
let docEl = doc.documentElement
|
||||
let clientWidth = docEl.clientWidth
|
||||
if (clientWidth) {
|
||||
if (/Android|webOS|iPhone|iPad|BlackBerry/i.test(navigator.userAgent)) {//移动端
|
||||
docEl.style.fontSize = 100 * (clientWidth / width) + 'px'
|
||||
} else {//桌面端
|
||||
docEl.style.fontSize = '55.55px'
|
||||
//docEl.style.fontSize = 100 * (clientWidth / width) + 'px'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
win.addEventListener(resizeEvt, initialize, false)
|
||||
doc.addEventListener('DOMContentLoaded', initialize, false)
|
||||
}
|
||||
|
||||
// 设置rem大小
|
||||
// setRem()
|
||||
|
||||
/**
|
||||
* 获取图片预览图
|
||||
* @param {*} file
|
||||
* @returns
|
||||
*/
|
||||
function getPreviewUrl(file) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const read = new FileReader()
|
||||
|
||||
read.readAsDataURL(file)
|
||||
read.onload = res => {
|
||||
resolve(res.target.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件Base64
|
||||
* @param {*} file
|
||||
* @returns
|
||||
*/
|
||||
function getFilBase64(file) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const imageMaxSize = 1024 * 500 // 500kb
|
||||
const imgaeSize = file.size
|
||||
const imageCompressionRatio = 0.5
|
||||
|
||||
if (imgaeSize > imageMaxSize) {
|
||||
compressionImage(file, imageCompressionRatio).then(res => {
|
||||
let imgResult = res
|
||||
imgResult = imgResult.substring(imgResult.indexOf('base64,') + 7)
|
||||
|
||||
resolve(imgResult)
|
||||
})
|
||||
} else {
|
||||
let reader = new FileReader();
|
||||
let imgResult = ""
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function () {
|
||||
imgResult = reader.result
|
||||
imgResult = imgResult.substring(imgResult.indexOf('base64,') + 7)
|
||||
}
|
||||
reader.onerror = function (error) {
|
||||
reject(error);
|
||||
}
|
||||
reader.onloadend = function () {
|
||||
resolve(imgResult)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片压缩
|
||||
* @param {*} file
|
||||
* @param {*} imageRatio
|
||||
* @returns
|
||||
*/
|
||||
function compressionImage(file, imageCompressionRatio) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let img = new Image()
|
||||
let reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = function () {
|
||||
img.src = reader.result
|
||||
}
|
||||
reader.onerror = function (error) {
|
||||
reject(error);
|
||||
}
|
||||
|
||||
img.onload = function () {
|
||||
let imgaeSizeRatio = 1080 / img.width
|
||||
let width = img.width * imgaeSizeRatio
|
||||
let height = img.height * imgaeSizeRatio
|
||||
|
||||
// 创建画布
|
||||
const canvas = document.createElement('canvas')
|
||||
const context = canvas.getContext('2d')
|
||||
canvas.width = width
|
||||
canvas.height = height
|
||||
context.clearRect(0, 0, width, height)
|
||||
context.drawImage(img, 0, 0, width, height)
|
||||
|
||||
let imageResult = canvas.toDataURL(file.type, imageCompressionRatio)
|
||||
resolve(imageResult)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片处理
|
||||
* @param {*} file
|
||||
* @returns
|
||||
*/
|
||||
function upload(file) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
getFilBase64(file).then(res => {
|
||||
let index = file.name.lastIndexOf('.')
|
||||
let suffix = file.name.substr(index + 1)
|
||||
|
||||
$.ajax({
|
||||
url: impUploadUrl + '/rc/api/file/base64upload.do',
|
||||
type: 'post',
|
||||
dataType: "json",
|
||||
data: {
|
||||
fileContent: res,
|
||||
fileName: suffix,
|
||||
bizId: 'mch',
|
||||
accountId: 'admin',
|
||||
accountName: 'admin',
|
||||
},
|
||||
success: res => {
|
||||
if (res.status) {
|
||||
resolve(res.url)
|
||||
} else {
|
||||
reject(res)
|
||||
}
|
||||
},
|
||||
error: res => {
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//获取url路径
|
||||
function getQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = decodeURI(window.location.search).substr(1).match(reg);
|
||||
if (r != null)
|
||||
return unescape(r[2]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成uuid的没4位数
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
function S4() {
|
||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建32位id
|
||||
* @returns
|
||||
*/
|
||||
function createId() {
|
||||
const self = this
|
||||
|
||||
return (self.S4() + self.S4() + self.S4() + self.S4() + self.S4() + self.S4() + self.S4() + self.S4())
|
||||
}
|
||||
|
||||
//提示框
|
||||
function myalert(str, time = 3000) {
|
||||
let el = document.createElement('div')
|
||||
let id = 'mark_' + createId()
|
||||
|
||||
el.classList.add('mark')
|
||||
el.setAttribute('id', id)
|
||||
|
||||
$('body').append(el)
|
||||
$('#' + id).html(str)
|
||||
$('#' + id).show();
|
||||
setTimeout(function () {
|
||||
$('#' + id).hide();
|
||||
$('#' + id).remove();
|
||||
}, time)
|
||||
}
|
||||
|
||||
// 工具类
|
||||
let tool = {
|
||||
/**
|
||||
* 全局存储对象
|
||||
*/
|
||||
store: {
|
||||
// 需要保持每个项目唯一
|
||||
key: 'yjk_junlebao_h5',
|
||||
|
||||
/**
|
||||
* 设置存储的值
|
||||
* @param {*} key
|
||||
* @param {*} value
|
||||
*/
|
||||
set(key, value) {
|
||||
let data = {
|
||||
...JSON.parse(localStorage.getItem(this.key))
|
||||
}
|
||||
|
||||
data[key] = value
|
||||
data = JSON.stringify(data)
|
||||
|
||||
localStorage.setItem(this.key, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取存储的值
|
||||
* @param {*} key
|
||||
* @returns
|
||||
*/
|
||||
get(key) {
|
||||
let res = localStorage.getItem(this.key)
|
||||
res = JSON.parse(res)
|
||||
|
||||
return res[key]
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 生成id
|
||||
* @returns
|
||||
*/
|
||||
createId() {
|
||||
const self = this
|
||||
|
||||
return (self.S4() + self.S4() + self.S4())
|
||||
},
|
||||
|
||||
/**
|
||||
* 生成4位随机数
|
||||
* @returns
|
||||
*/
|
||||
S4() {
|
||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取去url参数值
|
||||
* @param {*} key
|
||||
* @returns
|
||||
*/
|
||||
getQuery(key) {
|
||||
let reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)", "i")
|
||||
let r = decodeURI(window.location.search).substr(1).match(reg)
|
||||
if (r != null) {
|
||||
return unescape(r[2])
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面重定向
|
||||
* @param {*} url
|
||||
*/
|
||||
locationReplace(url) {
|
||||
if (history.replaceState) {
|
||||
history.replaceState(null, document.title, url);
|
||||
history.go(0);
|
||||
} else {
|
||||
location.replace(url);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面再次打开时重新加载
|
||||
*/
|
||||
locationReload() {
|
||||
let isPageHide = false
|
||||
|
||||
window.addEventListener('pagehide', function () {
|
||||
isPageHide = true
|
||||
})
|
||||
|
||||
window.addEventListener('pageshow', function () {
|
||||
if (isPageHide) {
|
||||
window.location.reload()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 消息提示
|
||||
* @param {*} message
|
||||
* @param {*} time
|
||||
*/
|
||||
toast(message, time = 3000) {
|
||||
const self = this
|
||||
let el = document.createElement('div')
|
||||
let id = 'mark_' + self.createId()
|
||||
|
||||
el.setAttribute('id', id)
|
||||
el.classList.add('mark')
|
||||
|
||||
$('body').append(el)
|
||||
$('#' + id).html(message)
|
||||
$('#' + id).show()
|
||||
|
||||
setTimeout(() => {
|
||||
$('#' + id).hide()
|
||||
$('#' + id).remove()
|
||||
}, time)
|
||||
},
|
||||
|
||||
/**
|
||||
* 日期格式化
|
||||
* @param date
|
||||
* @param format
|
||||
* @returns {string}
|
||||
*/
|
||||
dateFormat(data) {
|
||||
let createDate = new Date(data)
|
||||
Y = createDate.getFullYear() + '-';
|
||||
M = (createDate.getMonth() + 1 < 10 ? '0' + (createDate.getMonth() + 1) : createDate.getMonth() + 1) + '-';
|
||||
D = createDate.getDate() + ' ';
|
||||
createDate = Y + M + D
|
||||
return createDate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 页面回退重载
|
||||
tool.locationReload()
|
||||
6
ksafepack-admin/src/main/resources/static/business/app/vue.min.js
vendored
Normal file
6
ksafepack-admin/src/main/resources/static/business/css/bootstrap/3.3.7/bootstrap.min.css
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
body * {
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
body {
|
||||
font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma,
|
||||
Arial, PingFang SC-Light, Microsoft YaHei;
|
||||
}
|
||||
input {
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
}
|
||||
button {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 1px solid transparent;
|
||||
outline: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
button:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
.flex-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.justify-start {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.justify-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.justify-end {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.justify-evenly {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
.justify-around {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
.justify-between {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.align-start {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.align-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.align-end {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
Skin Name: Nivo Slider Bar Theme
|
||||
Skin URI: http://nivo.dev7studios.com
|
||||
Description: The bottom bar skin for the Nivo Slider.
|
||||
Version: 1.0
|
||||
Author: Gilbert Pellegrom
|
||||
Author URI: http://dev7studios.com
|
||||
Supports Thumbs: false
|
||||
*/
|
||||
|
||||
.theme-bar.slider-wrapper {
|
||||
position: relative;
|
||||
border: 1px solid #333;
|
||||
overflow: hidden;
|
||||
}
|
||||
.theme-bar .nivoSlider {
|
||||
position:relative;
|
||||
background:#fff url(loading.gif) no-repeat 50% 50%;
|
||||
}
|
||||
.theme-bar .nivoSlider img {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
display:none;
|
||||
}
|
||||
.theme-bar .nivoSlider a {
|
||||
border:0;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.theme-bar .nivo-controlNav {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -41px;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
padding: 5px 0;
|
||||
border-top: 1px solid #333;
|
||||
background: #333;
|
||||
background: -moz-linear-gradient(top, #565656 0%, #333333 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#565656), color-stop(100%,#333333)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #565656 0%,#333333 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #565656 0%,#333333 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, #565656 0%,#333333 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, #565656 0%,#333333 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#565656', endColorstr='#333333',GradientType=0 ); /* IE6-9 */
|
||||
opacity: 0.5;
|
||||
-webkit-transition: all 200ms ease-in-out;
|
||||
-moz-transition: all 200ms ease-in-out;
|
||||
-o-transition: all 200ms ease-in-out;
|
||||
transition: all 200ms ease-in-out;
|
||||
}
|
||||
.theme-bar:hover .nivo-controlNav {
|
||||
bottom: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
.theme-bar .nivo-controlNav a {
|
||||
display:inline-block;
|
||||
width:22px;
|
||||
height:22px;
|
||||
background:url(bullets.png) no-repeat;
|
||||
text-indent:-9999px;
|
||||
border:0;
|
||||
margin: 5px 2px 0 2px;
|
||||
}
|
||||
.theme-bar .nivo-controlNav a.active {
|
||||
background-position:0 -22px;
|
||||
}
|
||||
|
||||
.theme-bar .nivo-directionNav a {
|
||||
display:block;
|
||||
border:0;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
top: auto;
|
||||
bottom: 10px;
|
||||
z-index: 11;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
opacity: 0.5;
|
||||
-webkit-transition: all 200ms ease-in-out;
|
||||
-moz-transition: all 200ms ease-in-out;
|
||||
-o-transition: all 200ms ease-in-out;
|
||||
transition: all 200ms ease-in-out;
|
||||
}
|
||||
.theme-bar a.nivo-nextNav { right: -50px; }
|
||||
.theme-bar a.nivo-prevNav { left: -50px; }
|
||||
.theme-bar:hover a.nivo-nextNav {
|
||||
right: 15px;
|
||||
opacity: 1;
|
||||
}
|
||||
.theme-bar:hover a.nivo-prevNav {
|
||||
left: 15px;
|
||||
opacity: 1;
|
||||
}
|
||||
.theme-bar .nivo-directionNav a:hover { color: #ddd; }
|
||||
|
||||
.theme-bar .nivo-caption {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
-webkit-transition: all 200ms ease-in-out;
|
||||
-moz-transition: all 200ms ease-in-out;
|
||||
-o-transition: all 200ms ease-in-out;
|
||||
transition: all 200ms ease-in-out;
|
||||
}
|
||||
.theme-bar:hover .nivo-caption {
|
||||
bottom: 41px;
|
||||
}
|
||||
.theme-bar .nivo-caption a {
|
||||
color:#fff;
|
||||
border-bottom:1px dotted #fff;
|
||||
}
|
||||
.theme-bar .nivo-caption a:hover {
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled {
|
||||
width: 100%;
|
||||
}
|
||||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled a {
|
||||
width: auto;
|
||||
height: auto;
|
||||
background: none;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled img {
|
||||
display: block;
|
||||
width: 120px;
|
||||
height: auto;
|
||||
}
|
||||
|
After Width: | Height: | Size: 824 B |
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
Skin Name: Nivo Slider Bar Theme
|
||||
Skin URI: http://nivo.dev7studios.com
|
||||
Description: The bottom bar skin for the Nivo Slider.
|
||||
Version: 1.0
|
||||
Author: Gilbert Pellegrom
|
||||
Author URI: http://dev7studios.com
|
||||
Supports Thumbs: false
|
||||
*/
|
||||
|
||||
.theme-bar.slider-wrapper {
|
||||
position: relative;
|
||||
border: 1px solid #333;
|
||||
overflow: hidden;
|
||||
}
|
||||
.theme-bar .nivoSlider {
|
||||
position:relative;
|
||||
background:#fff url(loading.gif) no-repeat 50% 50%;
|
||||
}
|
||||
.theme-bar .nivoSlider img {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
display:none;
|
||||
}
|
||||
.theme-bar .nivoSlider a {
|
||||
border:0;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.theme-bar .nivo-controlNav {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -41px;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
padding: 5px 0;
|
||||
border-top: 1px solid #333;
|
||||
background: #333;
|
||||
background: -moz-linear-gradient(top, #565656 0%, #333333 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#565656), color-stop(100%,#333333)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #565656 0%,#333333 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #565656 0%,#333333 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, #565656 0%,#333333 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, #565656 0%,#333333 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#565656', endColorstr='#333333',GradientType=0 ); /* IE6-9 */
|
||||
opacity: 0.5;
|
||||
-webkit-transition: all 200ms ease-in-out;
|
||||
-moz-transition: all 200ms ease-in-out;
|
||||
-o-transition: all 200ms ease-in-out;
|
||||
transition: all 200ms ease-in-out;
|
||||
}
|
||||
.theme-bar:hover .nivo-controlNav {
|
||||
bottom: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
.theme-bar .nivo-controlNav a {
|
||||
display:inline-block;
|
||||
width:22px;
|
||||
height:22px;
|
||||
background:url(bullets.png) no-repeat;
|
||||
text-indent:-9999px;
|
||||
border:0;
|
||||
margin: 5px 2px 0 2px;
|
||||
}
|
||||
.theme-bar .nivo-controlNav a.active {
|
||||
background-position:0 -22px;
|
||||
}
|
||||
|
||||
.theme-bar .nivo-directionNav a {
|
||||
display:block;
|
||||
border:0;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
top: auto;
|
||||
bottom: 10px;
|
||||
z-index: 11;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
opacity: 0.5;
|
||||
-webkit-transition: all 200ms ease-in-out;
|
||||
-moz-transition: all 200ms ease-in-out;
|
||||
-o-transition: all 200ms ease-in-out;
|
||||
transition: all 200ms ease-in-out;
|
||||
}
|
||||
.theme-bar a.nivo-nextNav { right: -50px; }
|
||||
.theme-bar a.nivo-prevNav { left: -50px; }
|
||||
.theme-bar:hover a.nivo-nextNav {
|
||||
right: 15px;
|
||||
opacity: 1;
|
||||
}
|
||||
.theme-bar:hover a.nivo-prevNav {
|
||||
left: 15px;
|
||||
opacity: 1;
|
||||
}
|
||||
.theme-bar .nivo-directionNav a:hover { color: #ddd; }
|
||||
|
||||
.theme-bar .nivo-caption {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
-webkit-transition: all 200ms ease-in-out;
|
||||
-moz-transition: all 200ms ease-in-out;
|
||||
-o-transition: all 200ms ease-in-out;
|
||||
transition: all 200ms ease-in-out;
|
||||
}
|
||||
.theme-bar:hover .nivo-caption {
|
||||
bottom: 41px;
|
||||
}
|
||||
.theme-bar .nivo-caption a {
|
||||
color:#fff;
|
||||
border-bottom:1px dotted #fff;
|
||||
}
|
||||
.theme-bar .nivo-caption a:hover {
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled {
|
||||
width: 100%;
|
||||
}
|
||||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled a {
|
||||
width: auto;
|
||||
height: auto;
|
||||
background: none;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled img {
|
||||
display: block;
|
||||
width: 120px;
|
||||
height: auto;
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
Skin Name: Nivo Slider Dark Theme
|
||||
Skin URI: http://nivo.dev7studios.com
|
||||
Description: A dark skin for the Nivo Slider.
|
||||
Version: 1.0
|
||||
Author: Gilbert Pellegrom
|
||||
Author URI: http://dev7studios.com
|
||||
Supports Thumbs: true
|
||||
*/
|
||||
|
||||
.theme-dark.slider-wrapper {
|
||||
background: #222;
|
||||
padding: 10px;
|
||||
}
|
||||
.theme-dark .nivoSlider {
|
||||
position:relative;
|
||||
background:#fff url(loading.gif) no-repeat 50% 50%;
|
||||
margin-bottom:10px;
|
||||
overflow: visible;
|
||||
}
|
||||
.theme-dark .nivoSlider img {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
display:none;
|
||||
}
|
||||
.theme-dark .nivoSlider a {
|
||||
border:0;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.theme-dark .nivo-controlNav {
|
||||
text-align: left;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
.theme-dark .nivo-controlNav a {
|
||||
display:inline-block;
|
||||
width:10px;
|
||||
height:10px;
|
||||
background:url(bullets.png) no-repeat 0 2px;
|
||||
text-indent:-9999px;
|
||||
border:0;
|
||||
margin: 0 2px;
|
||||
}
|
||||
.theme-dark .nivo-controlNav a.active {
|
||||
background-position:0 100%;
|
||||
}
|
||||
|
||||
.theme-dark .nivo-directionNav a {
|
||||
display:block;
|
||||
width:30px;
|
||||
height:30px;
|
||||
background: url(arrows.png) no-repeat;
|
||||
text-indent:-9999px;
|
||||
border:0;
|
||||
top: auto;
|
||||
bottom: -36px;
|
||||
z-index: 11;
|
||||
}
|
||||
.theme-dark .nivo-directionNav a:hover {
|
||||
background-color: #333;
|
||||
-webkit-border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.theme-dark a.nivo-nextNav {
|
||||
background-position:-16px 50%;
|
||||
right:0px;
|
||||
}
|
||||
.theme-dark a.nivo-prevNav {
|
||||
background-position:11px 50%;
|
||||
left: auto;
|
||||
right: 35px;
|
||||
}
|
||||
|
||||
.theme-dark .nivo-caption {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.theme-dark .nivo-caption a {
|
||||
color:#fff;
|
||||
border-bottom:1px dotted #fff;
|
||||
}
|
||||
.theme-dark .nivo-caption a:hover {
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
.theme-dark .nivo-controlNav.nivo-thumbs-enabled {
|
||||
width: 80%;
|
||||
}
|
||||
.theme-dark .nivo-controlNav.nivo-thumbs-enabled a {
|
||||
width: auto;
|
||||
height: auto;
|
||||
background: none;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.theme-dark .nivo-controlNav.nivo-thumbs-enabled img {
|
||||
display: block;
|
||||
width: 120px;
|
||||
height: auto;
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 824 B |
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
Skin Name: Nivo Slider Default Theme
|
||||
Skin URI: http://nivo.dev7studios.com
|
||||
Description: The default skin for the Nivo Slider.
|
||||
Version: 1.3
|
||||
Author: Gilbert Pellegrom
|
||||
Author URI: http://dev7studios.com
|
||||
Supports Thumbs: true
|
||||
*/
|
||||
|
||||
.theme-default .nivoSlider {
|
||||
position:relative;
|
||||
background:#fff url(loading.gif) no-repeat 50% 50%;
|
||||
margin-bottom:10px;
|
||||
-webkit-box-shadow: 0px 0px 0px 0px #4a4a4a;
|
||||
-moz-box-shadow: 0px 0px 0px 0px #4a4a4a;
|
||||
box-shadow: 0px 0px 0px 0px #4a4a4a;
|
||||
}
|
||||
.theme-default .nivoSlider img {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
display:none;
|
||||
}
|
||||
.theme-default .nivoSlider a {
|
||||
border:0;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.theme-default .nivo-controlNav {
|
||||
text-align: center;
|
||||
padding: 20px 0;
|
||||
}
|
||||
.theme-default .nivo-controlNav a {
|
||||
display:inline-block;
|
||||
width:22px;
|
||||
height:22px;
|
||||
background:url(bullets.png) no-repeat;
|
||||
text-indent:-9999px;
|
||||
border:0;
|
||||
margin: 0 2px;
|
||||
}
|
||||
.theme-default .nivo-controlNav a.active {
|
||||
background-position:0 -22px;
|
||||
}
|
||||
|
||||
.theme-default .nivo-directionNav a {
|
||||
display:block;
|
||||
width:30px;
|
||||
height:30px;
|
||||
background:url(arrows.png) no-repeat;
|
||||
text-indent:-9999px;
|
||||
border:0;
|
||||
opacity: 0;
|
||||
-webkit-transition: all 200ms ease-in-out;
|
||||
-moz-transition: all 200ms ease-in-out;
|
||||
-o-transition: all 200ms ease-in-out;
|
||||
transition: all 200ms ease-in-out;
|
||||
}
|
||||
.theme-default:hover .nivo-directionNav a { opacity: 1; }
|
||||
.theme-default a.nivo-nextNav {
|
||||
background-position:-30px 0;
|
||||
right:15px;
|
||||
}
|
||||
.theme-default a.nivo-prevNav {
|
||||
left:15px;
|
||||
}
|
||||
|
||||
.theme-default .nivo-caption {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.theme-default .nivo-caption a {
|
||||
color:#fff;
|
||||
border-bottom:1px dotted #fff;
|
||||
}
|
||||
.theme-default .nivo-caption a:hover {
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
.theme-default .nivo-controlNav.nivo-thumbs-enabled {
|
||||
width: 100%;
|
||||
}
|
||||
.theme-default .nivo-controlNav.nivo-thumbs-enabled a {
|
||||
width: auto;
|
||||
height: auto;
|
||||
background: none;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.theme-default .nivo-controlNav.nivo-thumbs-enabled img {
|
||||
display: block;
|
||||
width: 120px;
|
||||
height: auto;
|
||||
}
|
||||