Commit ea5ef384 by zhangdaihao

2.1.3 大屏版本发布

parent 728d62f8
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-boot-base-common</artifactId> <artifactId>jeecg-boot-base-common</artifactId>
<version>2.1.2</version> <version>2.1.3</version>
<parent> <parent>
<groupId>org.jeecgframework.boot</groupId> <groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-parent</artifactId> <artifactId>jeecg-boot-parent</artifactId>
<version>2.1.2</version> <version>2.1.3</version>
</parent> </parent>
<repositories> <repositories>
......
...@@ -12,4 +12,13 @@ public interface CommonSendStatus { ...@@ -12,4 +12,13 @@ public interface CommonSendStatus {
public static final String PUBLISHED_STATUS_1 = "1"; //已发布 public static final String PUBLISHED_STATUS_1 = "1"; //已发布
public static final String REVOKE_STATUS_2 = "2"; //撤销 public static final String REVOKE_STATUS_2 = "2"; //撤销
/**流程催办——系统通知消息模板*/
public static final String TZMB_BPM_CUIBAN = "bpm_cuiban";
/**标准模板—系统消息通知*/
public static final String TZMB_SYS_TS_NOTE = "sys_ts_note";
/**流程超时提醒——系统通知消息模板*/
public static final String TZMB_BPM_CHAOSHI_TIP = "bpm_chaoshi_tip";
} }
...@@ -64,9 +64,22 @@ public class JeecgBootExceptionHandler { ...@@ -64,9 +64,22 @@ public class JeecgBootExceptionHandler {
* @return * @return
*/ */
@ExceptionHandler(HttpRequestMethodNotSupportedException.class) @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public Result<?> HttpRequestMethodNotSupportedException(Exception e){ public Result<?> HttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){
log.error(e.getMessage(), e); StringBuffer sb = new StringBuffer();
return Result.error("没有权限,请联系管理员授权"); sb.append("不支持");
sb.append(e.getMethod());
sb.append("请求方法,");
sb.append("支持以下");
String [] methods = e.getSupportedMethods();
if(methods!=null){
for(String str:methods){
sb.append(str);
sb.append("、");
}
}
log.error(sb.toString(), e);
//return Result.error("没有权限,请联系管理员授权");
return Result.error(405,sb.toString());
} }
/** /**
......
...@@ -10,6 +10,11 @@ import com.alibaba.fastjson.JSONObject; ...@@ -10,6 +10,11 @@ import com.alibaba.fastjson.JSONObject;
*/ */
public interface IFillRuleHandler { public interface IFillRuleHandler {
/**
* @param params 页面配置固定参数
* @param formData 动态表单参数
* @return
*/
public Object execute(JSONObject params, JSONObject formData); public Object execute(JSONObject params, JSONObject formData);
} }
......
...@@ -2,6 +2,7 @@ package org.jeecg.common.system.api; ...@@ -2,6 +2,7 @@ package org.jeecg.common.system.api;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.Map;
import org.jeecg.common.system.vo.ComboModel; import org.jeecg.common.system.vo.ComboModel;
import org.jeecg.common.system.vo.DictModel; import org.jeecg.common.system.vo.DictModel;
...@@ -101,6 +102,36 @@ public interface ISysBaseAPI { ...@@ -101,6 +102,36 @@ public interface ISysBaseAPI {
public void sendSysAnnouncement(String fromUser,String toUser,String title, String msgContent); public void sendSysAnnouncement(String fromUser,String toUser,String title, String msgContent);
/** /**
* 发送系统消息
* @param fromUser 发送人(用户登录账户)
* @param toUser 发送给(用户登录账户)
* @param title 通知标题
* @param map 模板参数
* @param templateCode 模板编码
*/
public void sendSysAnnouncement(String fromUser, String toUser,String title, Map<String, String> map, String templateCode);
/**
* 通过消息中心模板,生成推送内容
*
* @param templateCode 模板编码
* @param map 模板参数
* @return
*/
public String parseTemplateByCode(String templateCode, Map<String, String> map);
/**
* 发送系统消息
* @param fromUser 发送人(用户登录账户)
* @param toUser 发送给(用户登录账户)
* @param title 消息主题
* @param msgContent 消息内容
* @param setMsgCategory 消息类型 1:消息2:系统消息
*/
public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent, String setMsgCategory);
/**
* 查询表字典 支持过滤数据 * 查询表字典 支持过滤数据
* @param table * @param table
* @param text * @param text
......
...@@ -23,6 +23,13 @@ public enum MatchTypeEnum { ...@@ -23,6 +23,13 @@ public enum MatchTypeEnum {
return value; return value;
} }
public static MatchTypeEnum getByValue(Object value) {
if (oConvertUtils.isEmpty(value)) {
return null;
}
return getByValue(value.toString());
}
public static MatchTypeEnum getByValue(String value) { public static MatchTypeEnum getByValue(String value) {
if (oConvertUtils.isEmpty(value)) { if (oConvertUtils.isEmpty(value)) {
return null; return null;
......
...@@ -17,11 +17,14 @@ import java.util.regex.Pattern; ...@@ -17,11 +17,14 @@ import java.util.regex.Pattern;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DataBaseConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.util.JeecgDataAutorUtils; import org.jeecg.common.system.util.JeecgDataAutorUtils;
import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.SysPermissionDataRuleModel; import org.jeecg.common.system.vo.SysPermissionDataRuleModel;
import org.jeecg.common.util.SqlInjectionUtil; import org.jeecg.common.util.SqlInjectionUtil;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.springframework.util.NumberUtils; import org.springframework.util.NumberUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -31,7 +34,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -31,7 +34,6 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class QueryGenerator { public class QueryGenerator {
public static final String SQL_RULES_COLUMN = "SQL_RULES_COLUMN"; public static final String SQL_RULES_COLUMN = "SQL_RULES_COLUMN";
private static final String BEGIN = "_begin"; private static final String BEGIN = "_begin";
...@@ -315,7 +317,7 @@ public class QueryGenerator { ...@@ -315,7 +317,7 @@ public class QueryGenerator {
} }
private static void addQueryByRule(QueryWrapper<?> queryWrapper,String name,String type,String value,QueryRuleEnum rule) throws ParseException { private static void addQueryByRule(QueryWrapper<?> queryWrapper,String name,String type,String value,QueryRuleEnum rule) throws ParseException {
if(!"".equals(value)) { if(oConvertUtils.isNotEmpty(value)) {
Object temp; Object temp;
switch (type) { switch (type) {
case "class java.lang.Integer": case "class java.lang.Integer":
...@@ -380,7 +382,7 @@ public class QueryGenerator { ...@@ -380,7 +382,7 @@ public class QueryGenerator {
* @param value 查询条件值 * @param value 查询条件值
*/ */
private static void addEasyQuery(QueryWrapper<?> queryWrapper, String name, QueryRuleEnum rule, Object value) { private static void addEasyQuery(QueryWrapper<?> queryWrapper, String name, QueryRuleEnum rule, Object value) {
if (value == null || rule == null) { if (value == null || rule == null || oConvertUtils.isEmpty(value)) {
return; return;
} }
name = oConvertUtils.camelToUnderline(name); name = oConvertUtils.camelToUnderline(name);
...@@ -590,7 +592,11 @@ public class QueryGenerator { ...@@ -590,7 +592,11 @@ public class QueryGenerator {
str = str.substring(1); str = str.substring(1);
} }
if(isString) { if(isString) {
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
return " N'"+str+"' ";
}else{
return " '"+str+"' "; return " '"+str+"' ";
}
}else { }else {
return value.toString(); return value.toString();
} }
...@@ -601,8 +607,12 @@ public class QueryGenerator { ...@@ -601,8 +607,12 @@ public class QueryGenerator {
String temp[] = value.toString().split(","); String temp[] = value.toString().split(",");
String res=""; String res="";
for (String string : temp) { for (String string : temp) {
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
res+=",N'"+string+"'";
}else{
res+=",'"+string+"'"; res+=",'"+string+"'";
} }
}
return "("+res.substring(1)+")"; return "("+res.substring(1)+")";
}else { }else {
return "("+value.toString()+")"; return "("+value.toString()+")";
...@@ -612,19 +622,39 @@ public class QueryGenerator { ...@@ -612,19 +622,39 @@ public class QueryGenerator {
private static String getLikeConditionValue(Object value) { private static String getLikeConditionValue(Object value) {
String str = value.toString().trim(); String str = value.toString().trim();
if(str.startsWith("*") && str.endsWith("*")) { if(str.startsWith("*") && str.endsWith("*")) {
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
return "N'%"+str.substring(1,str.length()-1)+"%'";
}else{
return "'%"+str.substring(1,str.length()-1)+"%'"; return "'%"+str.substring(1,str.length()-1)+"%'";
}
}else if(str.startsWith("*")) { }else if(str.startsWith("*")) {
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
return "N'%"+str.substring(1)+"'";
}else{
return "'%"+str.substring(1)+"'"; return "'%"+str.substring(1)+"'";
}
}else if(str.endsWith("*")) { }else if(str.endsWith("*")) {
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
return "N'"+str.substring(0,str.length()-1)+"%'";
}else{
return "'"+str.substring(0,str.length()-1)+"%'"; return "'"+str.substring(0,str.length()-1)+"%'";
}
}else { }else {
if(str.indexOf("%")>=0) { if(str.indexOf("%")>=0) {
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
return "N"+str;
}else{
return str; return str;
}
}else { }else {
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
return "N'%"+str+"%'";
}else{
return "'%"+str+"%'"; return "'%"+str+"%'";
} }
} }
} }
}
/** /**
* 根据权限相关配置生成相关的SQL 语句 * 根据权限相关配置生成相关的SQL 语句
...@@ -696,4 +726,24 @@ public class QueryGenerator { ...@@ -696,4 +726,24 @@ public class QueryGenerator {
} }
} }
/** 当前系统数据库类型 */
private static String DB_TYPE;
/**
* 获取系统数据库类型
*/
private static String getDbType(){
if(oConvertUtils.isNotEmpty(DB_TYPE)){
return DB_TYPE;
}
try {
ISysBaseAPI sysBaseAPI = ApplicationContextUtil.getContext().getBean(ISysBaseAPI.class);
DB_TYPE = sysBaseAPI.getDatabaseType();
return DB_TYPE;
} catch (Exception e) {
e.printStackTrace();
}
return DB_TYPE;
}
} }
package org.jeecg.common.util;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.util.HtmlUtils;
/**
* HTML 工具类
*/
public class HTMLUtils {
/**
* 获取HTML内的文本,不包含标签
*
* @param html HTML 代码
*/
public static String getInnerText(String html) {
if (StringUtils.isNotBlank(html)) {
//去掉 html 的标签
String content = html.replaceAll("</?[^>]+>", "");
// 将多个空格合并成一个空格
content = content.replaceAll("(&nbsp;)+", "&nbsp;");
// 反向转义字符
content = HtmlUtils.htmlUnescape(content);
return content.trim();
}
return "";
}
}
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-boot-module-system</artifactId> <artifactId>jeecg-boot-module-system</artifactId>
<version>2.1.2</version> <version>2.1.3</version>
<parent> <parent>
<groupId>org.jeecgframework.boot</groupId> <groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-parent</artifactId> <artifactId>jeecg-boot-parent</artifactId>
<version>2.1.2</version> <version>2.1.3</version>
</parent> </parent>
<repositories> <repositories>
......
...@@ -34,22 +34,8 @@ public class JeecgApplication { ...@@ -34,22 +34,8 @@ public class JeecgApplication {
"Application Jeecg-Boot is running! Access URLs:\n\t" + "Application Jeecg-Boot is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:" + port + path + "/\n\t" + "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
"External: \thttp://" + ip + ":" + port + path + "/\n\t" + "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
"swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" + "swagger-ui: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
"Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------"); "----------------------------------------------------------");
} }
/**
* tomcat-embed-jasper引用后提示jar找不到的问题
*/
@Bean
public TomcatServletWebServerFactory tomcatFactory() {
return new TomcatServletWebServerFactory() {
@Override
protected void postProcessContext(Context context) {
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
}
};
}
} }
\ No newline at end of file
...@@ -66,6 +66,10 @@ public class ShiroConfig { ...@@ -66,6 +66,10 @@ public class ShiroConfig {
filterChainDefinitionMap.put(url,"anon"); filterChainDefinitionMap.put(url,"anon");
} }
} }
//大屏请求排除
filterChainDefinitionMap.put("/big/screen/**", "anon");
filterChainDefinitionMap.put("/bigscreen/**", "anon");
//cas验证登录 //cas验证登录
filterChainDefinitionMap.put("/cas/client/validateLogin", "anon"); filterChainDefinitionMap.put("/cas/client/validateLogin", "anon");
// 配置不会被拦截的链接 顺序判断 // 配置不会被拦截的链接 顺序判断
......
...@@ -45,32 +45,20 @@ public class MybatisInterceptor implements Interceptor { ...@@ -45,32 +45,20 @@ public class MybatisInterceptor implements Interceptor {
return invocation.proceed(); return invocation.proceed();
} }
if (SqlCommandType.INSERT == sqlCommandType) { if (SqlCommandType.INSERT == sqlCommandType) {
LoginUser sysUser = this.getLoginUser();
Field[] fields = oConvertUtils.getAllFields(parameter); Field[] fields = oConvertUtils.getAllFields(parameter);
for (Field field : fields) { for (Field field : fields) {
log.debug("------field.name------" + field.getName()); log.debug("------field.name------" + field.getName());
try { try {
//update-begin--Author:scott Date:20190828 for:关于使用Quzrtz 开启线程任务, #465
// 获取登录用户信息
LoginUser sysUser = null;
try{
sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
}catch (Exception e){
sysUser = null;
}
//update-end--Author:scott Date:20190828 for:关于使用Quzrtz 开启线程任务, #465
if ("createBy".equals(field.getName())) { if ("createBy".equals(field.getName())) {
field.setAccessible(true); field.setAccessible(true);
Object local_createBy = field.get(parameter); Object local_createBy = field.get(parameter);
field.setAccessible(false); field.setAccessible(false);
if (local_createBy == null || local_createBy.equals("")) { if (local_createBy == null || local_createBy.equals("")) {
String createBy = "jeecg";
if (sysUser != null) { if (sysUser != null) {
// 登录账号 // 登录人账号
createBy = sysUser.getUsername();
}
if (oConvertUtils.isNotEmpty(createBy)) {
field.setAccessible(true); field.setAccessible(true);
field.set(parameter, createBy); field.set(parameter, sysUser.getUsername());
field.setAccessible(false); field.setAccessible(false);
} }
} }
...@@ -92,15 +80,10 @@ public class MybatisInterceptor implements Interceptor { ...@@ -92,15 +80,10 @@ public class MybatisInterceptor implements Interceptor {
Object local_sysOrgCode = field.get(parameter); Object local_sysOrgCode = field.get(parameter);
field.setAccessible(false); field.setAccessible(false);
if (local_sysOrgCode == null || local_sysOrgCode.equals("")) { if (local_sysOrgCode == null || local_sysOrgCode.equals("")) {
String sysOrgCode = "";
// 获取登录用户信息 // 获取登录用户信息
if (sysUser != null) { if (sysUser != null) {
// 登录账号
sysOrgCode = sysUser.getOrgCode();
}
if (oConvertUtils.isNotEmpty(sysOrgCode)) {
field.setAccessible(true); field.setAccessible(true);
field.set(parameter, sysOrgCode); field.set(parameter, sysUser.getOrgCode());
field.setAccessible(false); field.setAccessible(false);
} }
} }
...@@ -110,6 +93,7 @@ public class MybatisInterceptor implements Interceptor { ...@@ -110,6 +93,7 @@ public class MybatisInterceptor implements Interceptor {
} }
} }
if (SqlCommandType.UPDATE == sqlCommandType) { if (SqlCommandType.UPDATE == sqlCommandType) {
LoginUser sysUser = this.getLoginUser();
Field[] fields = null; Field[] fields = null;
if (parameter instanceof ParamMap) { if (parameter instanceof ParamMap) {
ParamMap<?> p = (ParamMap<?>) parameter; ParamMap<?> p = (ParamMap<?>) parameter;
...@@ -137,12 +121,10 @@ public class MybatisInterceptor implements Interceptor { ...@@ -137,12 +121,10 @@ public class MybatisInterceptor implements Interceptor {
try { try {
if ("updateBy".equals(field.getName())) { if ("updateBy".equals(field.getName())) {
//获取登录用户信息 //获取登录用户信息
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (sysUser != null) { if (sysUser != null) {
// 登录账号 // 登录账号
String updateBy = sysUser.getUsername();
field.setAccessible(true); field.setAccessible(true);
field.set(parameter, updateBy); field.set(parameter, sysUser.getUsername());
field.setAccessible(false); field.setAccessible(false);
} }
} }
...@@ -169,4 +151,17 @@ public class MybatisInterceptor implements Interceptor { ...@@ -169,4 +151,17 @@ public class MybatisInterceptor implements Interceptor {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
//update-begin--Author:scott Date:20191213 for:关于使用Quzrtz 开启线程任务, #465
private LoginUser getLoginUser() {
LoginUser sysUser = null;
try {
sysUser = SecurityUtils.getSubject().getPrincipal() != null ? (LoginUser) SecurityUtils.getSubject().getPrincipal() : null;
} catch (Exception e) {
//e.printStackTrace();
sysUser = null;
}
return sysUser;
}
//update-end--Author:scott Date:20191213 for:关于使用Quzrtz 开启线程任务, #465
} }
package org.jeecg.modules.demo.test.controller;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.demo.test.entity.JeecgDemo;
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 大屏预览入口
* @Author: scott
* @Date:2019-12-12
* @Version:V1.0
*/
@Slf4j
@Controller
@RequestMapping("/big/screen")
public class BigScreenController extends JeecgController<JeecgDemo, IJeecgDemoService> {
/**
* @param modelAndView
* @return
*/
@RequestMapping("/html")
public ModelAndView ftl(ModelAndView modelAndView) {
modelAndView.setViewName("demo3");
List<String> userList = new ArrayList<String>();
userList.add("admin");
userList.add("user1");
userList.add("user2");
log.info("--------------test--------------");
modelAndView.addObject("userList", userList);
return modelAndView;
}
/**
* 生产销售监控模版
* @param modelAndView
* @return
*/
@RequestMapping("/index1")
public ModelAndView index1(ModelAndView modelAndView) {
modelAndView.setViewName("/bigscreen/template1/index");
return modelAndView;
}
/**
* 智慧物流监控模版
* @param modelAndView
* @return
*/
@RequestMapping("/index2")
public ModelAndView index2(ModelAndView modelAndView) {
modelAndView.setViewName("/bigscreen/template2/index");
return modelAndView;
}
}
...@@ -4,9 +4,14 @@ import org.jeecg.common.util.SpringContextUtils; ...@@ -4,9 +4,14 @@ import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.message.handle.ISendMsgHandle; import org.jeecg.modules.message.handle.ISendMsgHandle;
import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
public class EmailSendMsgHandle implements ISendMsgHandle { public class EmailSendMsgHandle implements ISendMsgHandle {
static String emailFrom; static String emailFrom;
public static void setEmailFrom(String emailFrom) { public static void setEmailFrom(String emailFrom) {
EmailSendMsgHandle.emailFrom = emailFrom; EmailSendMsgHandle.emailFrom = emailFrom;
} }
...@@ -14,13 +19,19 @@ public class EmailSendMsgHandle implements ISendMsgHandle { ...@@ -14,13 +19,19 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
@Override @Override
public void SendMsg(String es_receiver, String es_title, String es_content) { public void SendMsg(String es_receiver, String es_title, String es_content) {
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender"); JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
SimpleMailMessage message = new SimpleMailMessage(); MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = null;
try {
helper = new MimeMessageHelper(message, true);
// 设置发送方邮箱地址 // 设置发送方邮箱地址
message.setFrom(emailFrom); helper.setFrom(emailFrom);
message.setTo(es_receiver); helper.setTo(es_receiver);
message.setSubject(es_title); helper.setSubject(es_title);
message.setText(es_content); helper.setText(es_content, true);
mailSender.send(message); mailSender.send(message);
} catch (MessagingException e) {
e.printStackTrace();
}
} }
} }
...@@ -17,10 +17,14 @@ import com.alibaba.fastjson.JSONObject; ...@@ -17,10 +17,14 @@ import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/**
* @Author scott
* @Date 2019/11/29 9:41
* @Description: 此注解相当于设置访问URL
*/
@Component @Component
@Slf4j @Slf4j
@ServerEndpoint("/websocket/{userId}") @ServerEndpoint("/websocket/{userId}") //此注解相当于设置访问URL
//此注解相当于设置访问URL
public class WebSocket { public class WebSocket {
private Session session; private Session session;
...@@ -50,7 +54,8 @@ public class WebSocket { ...@@ -50,7 +54,8 @@ public class WebSocket {
@OnMessage @OnMessage
public void onMessage(String message) { public void onMessage(String message) {
//log.info("【websocket消息】收到客户端消息:"+message); //todo 现在有个定时任务刷,应该去掉
log.debug("【websocket消息】收到客户端消息:"+message);
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("cmd", "heartcheck");//业务类型 obj.put("cmd", "heartcheck");//业务类型
obj.put("msgTxt", "心跳响应");//消息内容 obj.put("msgTxt", "心跳响应");//消息内容
......
...@@ -249,7 +249,6 @@ public class SysDepartController { ...@@ -249,7 +249,6 @@ public class SysDepartController {
* 导出excel * 导出excel
* *
* @param request * @param request
* @param response
*/ */
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) { public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
......
...@@ -151,19 +151,9 @@ public class SysRoleController { ...@@ -151,19 +151,9 @@ public class SysRoleController {
* @return * @return
*/ */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE) @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
public Result<SysRole> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name="id",required=true) String id) {
Result<SysRole> result = new Result<SysRole>(); sysRoleService.deleteRole(id);
SysRole sysrole = sysRoleService.getById(id); return Result.ok("删除角色成功");
if(sysrole==null) {
result.error500("未找到对应实体");
}else {
boolean ok = sysRoleService.removeById(id);
if(ok) {
result.success("删除成功!");
}
}
return result;
} }
/** /**
...@@ -174,11 +164,11 @@ public class SysRoleController { ...@@ -174,11 +164,11 @@ public class SysRoleController {
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
public Result<SysRole> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<SysRole> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<SysRole> result = new Result<SysRole>(); Result<SysRole> result = new Result<SysRole>();
if(ids==null || "".equals(ids.trim())) { if(oConvertUtils.isEmpty(ids)) {
result.error500("参数不识别!"); result.error500("未选中角色!");
}else { }else {
this.sysRoleService.removeByIds(Arrays.asList(ids.split(","))); sysRoleService.deleteBatchRole(ids.split(","));
result.success("删除成功!"); result.success("删除角色成功!");
} }
return result; return result;
} }
......
...@@ -137,7 +137,7 @@ public class SysUserController { ...@@ -137,7 +137,7 @@ public class SysUserController {
} }
@RequestMapping(value = "/edit", method = RequestMethod.PUT) @RequestMapping(value = "/edit", method = RequestMethod.PUT)
//@RequiresPermissions("user:edit") @RequiresPermissions("user:edit")
public Result<SysUser> edit(@RequestBody JSONObject jsonObject) { public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
Result<SysUser> result = new Result<SysUser>(); Result<SysUser> result = new Result<SysUser>();
try { try {
......
package org.jeecg.modules.system.mapper; package org.jeecg.modules.system.mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.system.entity.SysRole; import org.jeecg.modules.system.entity.SysRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -14,4 +17,21 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -14,4 +17,21 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface SysRoleMapper extends BaseMapper<SysRole> { public interface SysRoleMapper extends BaseMapper<SysRole> {
/**
* @Author scott
* @Date 2019/12/13 16:12
* @Description: 删除角色与用户关系
*/
@Delete("delete from sys_user_role where role_id = #{roleId}")
void deleteRoleUserRelation(@Param("roleId") String roleId);
/**
* @Author scott
* @Date 2019/12/13 16:12
* @Description: 删除角色与权限关系
*/
@Delete("delete from sys_role_permission where role_id = #{roleId}")
void deleteRolePermissionRelation(@Param("roleId") String roleId);
} }
...@@ -83,4 +83,17 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -83,4 +83,17 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
*/ */
Integer getUserByOrgCodeTotal(@Param("orgCode") String orgCode, @Param("userParams") SysUser userParams); Integer getUserByOrgCodeTotal(@Param("orgCode") String orgCode, @Param("userParams") SysUser userParams);
/**
* @Author scott
* @Date 2019/12/13 16:10
* @Description: 批量删除角色与用户关系
*/
void deleteBathRoleUserRelation(@Param("roleIdArray") String[] roleIdArray);
/**
* @Author scott
* @Date 2019/12/13 16:10
* @Description: 批量删除角色与权限关系
*/
void deleteBathRolePermissionRelation(@Param("roleIdArray") String[] roleIdArray);
} }
...@@ -81,4 +81,20 @@ ...@@ -81,4 +81,20 @@
SELECT COUNT(1) <include refid="getUserByOrgCodeFromSql"/> SELECT COUNT(1) <include refid="getUserByOrgCodeFromSql"/>
</select> </select>
<!-- 批量删除角色的与用户关系-->
<update id="deleteBathRoleUserRelation">
delete from sys_user_role
where role_id in
<foreach item="id" collection="roleIdArray" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 批量删除角色的与权限关系-->
<update id="deleteBathRolePermissionRelation">
delete from sys_role_permission
where role_id in
<foreach item="id" collection="roleIdArray" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file
package org.jeecg.modules.system.rule;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.handler.IFillRuleHandler;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.YouBianCodeUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysCategory;
import org.jeecg.modules.system.mapper.SysCategoryMapper;
import java.util.List;
/**
* @Author scott
* @Date 2019/12/9 11:32
* @Description: 分类字典编码生成规则
*/
public class CategoryCodeRule implements IFillRuleHandler {
public static final String ROOT_PID_VALUE = "0";
@Override
public Object execute(JSONObject params, JSONObject formData) {
String categoryPid = ROOT_PID_VALUE;
String categoryCode = null;
if (formData != null && formData.size() > 0) {
Object obj = formData.get("pid");
if (oConvertUtils.isNotEmpty(obj)) categoryPid = obj.toString();
} else {
if (params != null) {
Object obj = params.get("pid");
if (oConvertUtils.isNotEmpty(obj)) categoryPid = obj.toString();
}
}
/*
* 分成三种情况
* 1.数据库无数据 调用YouBianCodeUtil.getNextYouBianCode(null);
* 2.添加子节点,无兄弟元素 YouBianCodeUtil.getSubYouBianCode(parentCode,null);
* 3.添加子节点有兄弟元素 YouBianCodeUtil.getNextYouBianCode(lastCode);
* */
//找同类 确定上一个最大的code值
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>().eq(SysCategory::getPid, categoryPid).orderByDesc(SysCategory::getCode);
SysCategoryMapper baseMapper = (SysCategoryMapper) SpringContextUtils.getBean("sysCategoryMapper");
List<SysCategory> list = baseMapper.selectList(query);
if (list == null || list.size() == 0) {
if (ROOT_PID_VALUE.equals(categoryPid)) {
//情况1
categoryCode = YouBianCodeUtil.getNextYouBianCode(null);
} else {
//情况2
SysCategory parent = (SysCategory) baseMapper.selectById(categoryPid);
categoryCode = YouBianCodeUtil.getSubYouBianCode(parent.getCode(), null);
}
} else {
//情况3
categoryCode = YouBianCodeUtil.getNextYouBianCode(list.get(0).getCode());
}
return categoryCode;
}
}
package org.jeecg.modules.system.rule;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.netty.util.internal.StringUtil;
import org.jeecg.common.handler.IFillRuleHandler;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.YouBianCodeUtil;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.service.ISysDepartService;
import java.util.ArrayList;
import java.util.List;
/**
* @Author scott
* @Date 2019/12/9 11:33
* @Description: 机构编码生成规则
*/
public class OrgCodeRule implements IFillRuleHandler {
@Override
public Object execute(JSONObject params, JSONObject formData) {
ISysDepartService sysDepartService = (ISysDepartService) SpringContextUtils.getBean("sysDepartServiceImpl");
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
LambdaQueryWrapper<SysDepart> query1 = new LambdaQueryWrapper<SysDepart>();
// 创建一个List集合,存储查询返回的所有SysDepart对象
List<SysDepart> departList = new ArrayList<>();
String[] strArray = new String[2];
//定义部门类型
String orgType = "";
// 定义新编码字符串
String newOrgCode = "";
// 定义旧编码字符串
String oldOrgCode = "";
String parentId = null;
if (formData != null && formData.size() > 0) {
Object obj = formData.get("parentId");
if (obj != null) parentId = obj.toString();
} else {
if (params != null) {
Object obj = params.get("parentId");
if (obj != null) parentId = obj.toString();
}
}
//如果是最高级,则查询出同级的org_code, 调用工具类生成编码并返回
if (StringUtil.isNullOrEmpty(parentId)) {
// 线判断数据库中的表是否为空,空则直接返回初始编码
query1.eq(SysDepart::getParentId, "").or().isNull(SysDepart::getParentId);
query1.orderByDesc(SysDepart::getOrgCode);
departList = sysDepartService.list(query1);
if (departList == null || departList.size() == 0) {
strArray[0] = YouBianCodeUtil.getNextYouBianCode(null);
strArray[1] = "1";
return strArray;
} else {
SysDepart depart = departList.get(0);
oldOrgCode = depart.getOrgCode();
orgType = depart.getOrgType();
newOrgCode = YouBianCodeUtil.getNextYouBianCode(oldOrgCode);
}
} else {//反之则查询出所有同级的部门,获取结果后有两种情况,有同级和没有同级
// 封装查询同级的条件
query.eq(SysDepart::getParentId, parentId);
// 降序排序
query.orderByDesc(SysDepart::getOrgCode);
// 查询出同级部门的集合
List<SysDepart> parentList = sysDepartService.list(query);
// 查询出父级部门
SysDepart depart = sysDepartService.getById(parentId);
// 获取父级部门的Code
String parentCode = depart.getOrgCode();
// 根据父级部门类型算出当前部门的类型
orgType = String.valueOf(Integer.valueOf(depart.getOrgType()) + 1);
// 处理同级部门为null的情况
if (parentList == null || parentList.size() == 0) {
// 直接生成当前的部门编码并返回
newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, null);
} else { //处理有同级部门的情况
// 获取同级部门的编码,利用工具类
String subCode = parentList.get(0).getOrgCode();
// 返回生成的当前部门编码
newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, subCode);
}
}
// 返回最终封装了部门编码和部门类型的数组
strArray[0] = newOrgCode;
strArray[1] = orgType;
return strArray;
}
}
...@@ -26,4 +26,18 @@ public interface ISysRoleService extends IService<SysRole> { ...@@ -26,4 +26,18 @@ public interface ISysRoleService extends IService<SysRole> {
*/ */
Result importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception; Result importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception;
/**
* 删除角色
* @param roleid
* @return
*/
public boolean deleteRole(String roleid);
/**
* 批量删除角色
* @param roleids
* @return
*/
public boolean deleteBatchRole(String[] roleids);
} }
...@@ -6,6 +6,7 @@ import java.sql.SQLException; ...@@ -6,6 +6,7 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -25,6 +26,8 @@ import org.jeecg.common.system.vo.SysDepartModel; ...@@ -25,6 +26,8 @@ import org.jeecg.common.system.vo.SysDepartModel;
import org.jeecg.common.util.IPUtils; import org.jeecg.common.util.IPUtils;
import org.jeecg.common.util.SpringContextUtils; import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.message.entity.SysMessageTemplate;
import org.jeecg.modules.message.service.ISysMessageTemplateService;
import org.jeecg.modules.message.websocket.WebSocket; import org.jeecg.modules.message.websocket.WebSocket;
import org.jeecg.modules.system.entity.*; import org.jeecg.modules.system.entity.*;
import org.jeecg.modules.system.mapper.*; import org.jeecg.modules.system.mapper.*;
...@@ -51,7 +54,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -51,7 +54,8 @@ import lombok.extern.slf4j.Slf4j;
public class SysBaseApiImpl implements ISysBaseAPI { public class SysBaseApiImpl implements ISysBaseAPI {
/** 当前系统数据库类型 */ /** 当前系统数据库类型 */
public static String DB_TYPE = ""; public static String DB_TYPE = "";
@Autowired
private ISysMessageTemplateService sysMessageTemplateService;
@Resource @Resource
private SysLogMapper sysLogMapper; private SysLogMapper sysLogMapper;
@Autowired @Autowired
...@@ -182,6 +186,11 @@ public class SysBaseApiImpl implements ISysBaseAPI { ...@@ -182,6 +186,11 @@ public class SysBaseApiImpl implements ISysBaseAPI {
@Override @Override
public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent) { public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent) {
this.sendSysAnnouncement(fromUser, toUser, title, msgContent, CommonConstant.MSG_CATEGORY_2);
}
@Override
public void sendSysAnnouncement(String fromUser, String toUser, String title, String msgContent, String setMsgCategory) {
SysAnnouncement announcement = new SysAnnouncement(); SysAnnouncement announcement = new SysAnnouncement();
announcement.setTitile(title); announcement.setTitile(title);
announcement.setMsgContent(msgContent); announcement.setMsgContent(msgContent);
...@@ -190,7 +199,7 @@ public class SysBaseApiImpl implements ISysBaseAPI { ...@@ -190,7 +199,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
announcement.setMsgType(CommonConstant.MSG_TYPE_UESR); announcement.setMsgType(CommonConstant.MSG_TYPE_UESR);
announcement.setSendStatus(CommonConstant.HAS_SEND); announcement.setSendStatus(CommonConstant.HAS_SEND);
announcement.setSendTime(new Date()); announcement.setSendTime(new Date());
announcement.setMsgCategory(CommonConstant.MSG_CATEGORY_2); announcement.setMsgCategory(setMsgCategory);
announcement.setDelFlag(String.valueOf(CommonConstant.DEL_FLAG_0)); announcement.setDelFlag(String.valueOf(CommonConstant.DEL_FLAG_0));
sysAnnouncementMapper.insert(announcement); sysAnnouncementMapper.insert(announcement);
// 2.插入用户通告阅读标记表记录 // 2.插入用户通告阅读标记表记录
...@@ -218,6 +227,80 @@ public class SysBaseApiImpl implements ISysBaseAPI { ...@@ -218,6 +227,80 @@ public class SysBaseApiImpl implements ISysBaseAPI {
} }
} }
@Override
public String parseTemplateByCode(String templateCode,Map<String, String> map) {
List<SysMessageTemplate> sysSmsTemplates = sysMessageTemplateService.selectByCode(templateCode);
if(sysSmsTemplates==null||sysSmsTemplates.size()==0){
throw new JeecgBootException("消息模板不存在,模板编码:"+templateCode);
}
SysMessageTemplate sysSmsTemplate = sysSmsTemplates.get(0);
//模板内容
String content = sysSmsTemplate.getTemplateContent();
if(map!=null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String str = "${" + entry.getKey() + "}";
content = content.replace(str, entry.getValue());
}
}
return content;
}
@Override
public void sendSysAnnouncement(String fromUser, String toUser,String title,Map<String, String> map, String templateCode) {
List<SysMessageTemplate> sysSmsTemplates = sysMessageTemplateService.selectByCode(templateCode);
if(sysSmsTemplates==null||sysSmsTemplates.size()==0){
throw new JeecgBootException("消息模板不存在,模板编码:"+templateCode);
}
SysMessageTemplate sysSmsTemplate = sysSmsTemplates.get(0);
//模板标题
title = title==null?sysSmsTemplate.getTemplateName():title;
//模板内容
String content = sysSmsTemplate.getTemplateContent();
if(map!=null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String str = "${" + entry.getKey() + "}";
title = title.replace(str, entry.getValue());
content = content.replace(str, entry.getValue());
}
}
SysAnnouncement announcement = new SysAnnouncement();
announcement.setTitile(title);
announcement.setMsgContent(content);
announcement.setSender(fromUser);
announcement.setPriority(CommonConstant.PRIORITY_M);
announcement.setMsgType(CommonConstant.MSG_TYPE_UESR);
announcement.setSendStatus(CommonConstant.HAS_SEND);
announcement.setSendTime(new Date());
announcement.setMsgCategory(CommonConstant.MSG_CATEGORY_2);
announcement.setDelFlag(String.valueOf(CommonConstant.DEL_FLAG_0));
sysAnnouncementMapper.insert(announcement);
// 2.插入用户通告阅读标记表记录
String userId = toUser;
String[] userIds = userId.split(",");
String anntId = announcement.getId();
for(int i=0;i<userIds.length;i++) {
if(oConvertUtils.isNotEmpty(userIds[i])) {
SysUser sysUser = userMapper.getUserByName(userIds[i]);
if(sysUser==null) {
continue;
}
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
announcementSend.setAnntId(anntId);
announcementSend.setUserId(sysUser.getId());
announcementSend.setReadFlag(CommonConstant.NO_READ_FLAG);
sysAnnouncementSendMapper.insert(announcementSend);
JSONObject obj = new JSONObject();
obj.put("cmd", "user");
obj.put("userId", sysUser.getId());
obj.put("msgId", announcement.getId());
obj.put("msgTxt", announcement.getTitile());
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
}
}
}
/** /**
* 获取数据库类型 * 获取数据库类型
* @param dataSource * @param dataSource
......
...@@ -3,7 +3,9 @@ package org.jeecg.modules.system.service.impl; ...@@ -3,7 +3,9 @@ package org.jeecg.modules.system.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.FillRuleUtil;
import org.jeecg.common.util.YouBianCodeUtil; import org.jeecg.common.util.YouBianCodeUtil;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysCategory; import org.jeecg.modules.system.entity.SysCategory;
...@@ -42,29 +44,11 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa ...@@ -42,29 +44,11 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
} }
} }
} }
/* //update-begin--Author:baihailong Date:20191209 for:分类字典编码规则生成器做成公用配置
* 分成三种情况 JSONObject formData = new JSONObject();
* 1.数据库无数据 调用YouBianCodeUtil.getNextYouBianCode(null); formData.put("pid",categoryPid);
* 2.添加子节点,无兄弟元素 YouBianCodeUtil.getSubYouBianCode(parentCode,null); categoryCode = (String) FillRuleUtil.executeRule("category_code_rule",formData);
* 3.添加子节点有兄弟元素 YouBianCodeUtil.getNextYouBianCode(lastCode); //update-end--Author:baihailong Date:20191209 for:分类字典编码规则生成器做成公用配置
* */
//找同类 确定上一个最大的code值
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>()
.eq(SysCategory::getPid,categoryPid)
.orderByDesc(SysCategory::getCode);
List<SysCategory> list = baseMapper.selectList(query);
if(list==null || list.size()==0){
if(ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)){
//情况1
categoryCode = YouBianCodeUtil.getNextYouBianCode(null);
}else{
//情况2
categoryCode = YouBianCodeUtil.getSubYouBianCode(parentCode,null);
}
}else{
//情况3
categoryCode = YouBianCodeUtil.getNextYouBianCode(list.get(0).getCode());
}
sysCategory.setCode(categoryCode); sysCategory.setCode(categoryCode);
sysCategory.setPid(categoryPid); sysCategory.setPid(categoryPid);
baseMapper.insert(sysCategory); baseMapper.insert(sysCategory);
......
...@@ -5,8 +5,10 @@ import java.util.Date; ...@@ -5,8 +5,10 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.constant.CacheConstant; import org.jeecg.common.constant.CacheConstant;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.FillRuleUtil;
import org.jeecg.common.util.YouBianCodeUtil; import org.jeecg.common.util.YouBianCodeUtil;
import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.mapper.SysDepartMapper; import org.jeecg.modules.system.mapper.SysDepartMapper;
...@@ -76,7 +78,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart ...@@ -76,7 +78,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
// 先判断该对象有无父级ID,有则意味着不是最高级,否则意味着是最高级 // 先判断该对象有无父级ID,有则意味着不是最高级,否则意味着是最高级
// 获取父级ID // 获取父级ID
String parentId = sysDepart.getParentId(); String parentId = sysDepart.getParentId();
String[] codeArray = generateOrgCode(parentId); //update-begin--Author:baihailong Date:20191209 for:部门编码规则生成器做成公用配置
JSONObject formData = new JSONObject();
formData.put("parentId",parentId);
String[] codeArray = (String[]) FillRuleUtil.executeRule("org_num_role",formData);
//update-end--Author:baihailong Date:20191209 for:部门编码规则生成器做成公用配置
sysDepart.setOrgCode(codeArray[0]); sysDepart.setOrgCode(codeArray[0]);
String orgType = codeArray[1]; String orgType = codeArray[1];
sysDepart.setOrgType(String.valueOf(orgType)); sysDepart.setOrgType(String.valueOf(orgType));
...@@ -88,8 +94,8 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart ...@@ -88,8 +94,8 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
} }
/** /**
* saveDepartData 的调用方法,生成部门编码和部门类型 * saveDepartData 的调用方法,生成部门编码和部门类型(作废逻辑)
* * @deprecated
* @param parentId * @param parentId
* @return * @return
*/ */
......
...@@ -6,14 +6,18 @@ import org.jeecg.common.api.vo.Result; ...@@ -6,14 +6,18 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.PmsUtil; import org.jeecg.common.util.PmsUtil;
import org.jeecg.modules.system.entity.SysRole; import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.mapper.SysRoleMapper; import org.jeecg.modules.system.mapper.SysRoleMapper;
import org.jeecg.modules.system.mapper.SysUserMapper;
import org.jeecg.modules.system.service.ISysRoleService; import org.jeecg.modules.system.service.ISysRoleService;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -26,6 +30,10 @@ import java.util.List; ...@@ -26,6 +30,10 @@ import java.util.List;
*/ */
@Service @Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService { public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
@Autowired
SysRoleMapper sysRoleMapper;
@Autowired
SysUserMapper sysUserMapper;
@Override @Override
public Result importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception { public Result importExcelCheckRoleCode(MultipartFile file, ImportParams params) throws Exception {
...@@ -80,4 +88,28 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl ...@@ -80,4 +88,28 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
res.setMessage("文件导入成功,但有错误。"); res.setMessage("文件导入成功,但有错误。");
return res; return res;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteRole(String roleid) {
//1.删除角色和用户关系
sysRoleMapper.deleteRoleUserRelation(roleid);
//2.删除角色和权限关系
sysRoleMapper.deleteRolePermissionRelation(roleid);
//3.删除角色
this.removeById(roleid);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteBatchRole(String[] roleIds) {
//1.删除角色和用户关系
sysUserMapper.deleteBathRoleUserRelation(roleIds);
//2.删除角色和权限关系
sysUserMapper.deleteBathRolePermissionRelation(roleIds);
//3.删除角色
this.removeByIds(Arrays.asList(roleIds));
return true;
}
} }
...@@ -13,11 +13,15 @@ public class SysUserRoleVO implements Serializable{ ...@@ -13,11 +13,15 @@ public class SysUserRoleVO implements Serializable{
private String roleId; private String roleId;
/**对应的用户id集合*/ /**对应的用户id集合*/
private List<String> userIdList; private List<String> userIdList;
public SysUserRoleVO() {
super();
}
public SysUserRoleVO(String roleId, List<String> userIdList) { public SysUserRoleVO(String roleId, List<String> userIdList) {
super(); super();
this.roleId = roleId; this.roleId = roleId;
this.userIdList = userIdList; this.userIdList = userIdList;
} }
} }
...@@ -157,6 +157,12 @@ jeecg : ...@@ -157,6 +157,12 @@ jeecg :
elasticsearch: elasticsearch:
cluster-name: jeecg-ES cluster-name: jeecg-ES
cluster-nodes: 127.0.0.1:9200 cluster-nodes: 127.0.0.1:9200
# 表单设计器配置
desform:
# 主题颜色(仅支持 16进制颜色代码)
theme-color: "#1890ff"
# 在线预览文件服务器地址配置
file-view-domain: http://127.0.0.1:8012
#Mybatis输出sql日志 #Mybatis输出sql日志
logging: logging:
level: level:
......
...@@ -154,6 +154,12 @@ jeecg : ...@@ -154,6 +154,12 @@ jeecg :
elasticsearch: elasticsearch:
cluster-name: jeecg-ES cluster-name: jeecg-ES
cluster-nodes: 127.0.0.1:9200 cluster-nodes: 127.0.0.1:9200
# 表单设计器配置
desform:
# 主题颜色(仅支持 16进制颜色代码)
theme-color: "#1890ff"
# 在线预览文件服务器地址配置
file-view-domain: 127.0.0.1:8012
#cas单点登录 #cas单点登录
cas: cas:
prefixUrl: http://cas.example.org:8443/cas prefixUrl: http://cas.example.org:8443/cas
......
...@@ -157,6 +157,12 @@ jeecg : ...@@ -157,6 +157,12 @@ jeecg :
elasticsearch: elasticsearch:
cluster-name: jeecg-ES cluster-name: jeecg-ES
cluster-nodes: 127.0.0.1:9200 cluster-nodes: 127.0.0.1:9200
# 表单设计器配置
desform:
# 主题颜色(仅支持 16进制颜色代码)
theme-color: "#1890ff"
# 在线预览文件服务器地址配置
file-view-domain: 127.0.0.1:8012
#cas单点登录 #cas单点登录
cas: cas:
prefixUrl: http://cas.example.org:8443/cas prefixUrl: http://cas.example.org:8443/cas
\ No newline at end of file
...@@ -9,6 +9,6 @@ ${AnsiColor.BRIGHT_BLUE} ...@@ -9,6 +9,6 @@ ${AnsiColor.BRIGHT_BLUE}
${AnsiColor.BRIGHT_GREEN} ${AnsiColor.BRIGHT_GREEN}
Jeecg Boot Version: 2.1.2 Jeecg Boot Version: 2.1.3
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version} Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
${AnsiColor.BLACK} ${AnsiColor.BLACK}
package ${bussiPackage}.${entityPackage}.controller;
import org.jeecg.common.system.query.QueryGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import org.jeecg.common.util.oConvertUtils;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service;
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> {
@Autowired
private I${entityName}Service ${entityName?uncap_first}Service;
<#list subTables as sub>
@Autowired
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
</#list>
/*---------------------------------主表处理-begin-------------------------------------*/
/**
* 分页列表查询
* @param ${entityName?uncap_first}
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.ok(pageList);
}
/**
* 添加
* @param ${entityName?uncap_first}
* @return
*/
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.save(${entityName?uncap_first});
return Result.ok("添加成功!");
}
/**
* 编辑
* @param ${entityName?uncap_first}
* @return
*/
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
return Result.ok("编辑成功!");
}
/**
* 通过id删除
* @param id
* @return
*/
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.delMain(id);
return Result.ok("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
return Result.ok("批量删除成功!");
}
/**
* 导出
* @return
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
}
/**
* 导入
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ${entityName}.class);
}
/*---------------------------------主表处理-end-------------------------------------*/
<#list subTables as sub>
/*--------------------------------子表处理-${sub.ftlDescription}-begin----------------------------------------------*/
/**
* 查询子表信息 会传入主表ID
* @return
*/
@GetMapping(value = "/list${sub.entityName}ByMainId")
public Result<?> list${sub.entityName}ByMainId(${sub.entityName} ${sub.entityName?uncap_first},
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${sub.entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${sub.entityName?uncap_first}, req.getParameterMap());
Page<${sub.entityName}> page = new Page<${sub.entityName}>(pageNo, pageSize);
IPage<${sub.entityName}> pageList = ${sub.entityName?uncap_first}Service.page(page, queryWrapper);
return Result.ok(pageList);
}
/**
* 添加
* @param ${sub.entityName?uncap_first}
* @return
*/
@PostMapping(value = "/add${sub.entityName}")
public Result<?> add${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
${sub.entityName?uncap_first}Service.save(${sub.entityName?uncap_first});
return Result.ok("添加成功!");
}
/**
* 编辑
* @param ${sub.entityName?uncap_first}
* @return
*/
@PutMapping(value = "/edit${sub.entityName}")
public Result<?> edit${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
${sub.entityName?uncap_first}Service.updateById(${sub.entityName?uncap_first});
return Result.ok("编辑成功!");
}
/**
* 通过id删除
* @param id
* @return
*/
@DeleteMapping(value = "/delete${sub.entityName}")
public Result<?> delete${sub.entityName}(@RequestParam(name="id",required=true) String id) {
${sub.entityName?uncap_first}Service.removeById(id);
return Result.ok("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@DeleteMapping(value = "/deleteBatch${sub.entityName}")
public Result<?> deleteBatch${sub.entityName}(@RequestParam(name="ids",required=true) String ids) {
this.${sub.entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
return Result.ok("批量删除成功!");
}
/*--------------------------------子表处理-${sub.ftlDescription}-end----------------------------------------------*/
</#list>
}
package ${bussiPackage}.${entityPackage}.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import org.jeecgframework.poi.excel.annotation.Excel;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Data
@TableName("${tableName}")
public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#list originalColumns as po>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ID_WORKER_STR)
<#else>
<#if po.fieldDbType =='Date'>
<#if po.classType=='date'>
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#else>
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
@Excel(name = "${po.filedComment}", width = 15)
</#if>
</#if>
<#if po.fieldDbType=='Blob'>
private transient java.lang.String ${po.fieldName}String;
private byte[] ${po.fieldName};
public byte[] get${po.fieldName?cap_first}(){
if(${po.fieldName}String==null){
return null;
}
try {
return ${po.fieldName}String.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
public String get${po.fieldName?cap_first}String(){
if(${po.fieldName}==null || ${po.fieldName}.length==0){
return "";
}
try {
return new String(${po.fieldName},"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return "";
}
<#else>
private ${po.fieldType} ${po.fieldName};
</#if>
</#list>
}
<#list subTables as subTab>
#segment#${subTab.entityName}.java
package ${bussiPackage}.${entityPackage}.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.Date;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Data
@TableName("${subTab.tableName}")
public class ${subTab.entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#list subTab.originalColumns as po>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ID_WORKER_STR)
<#else>
<#if po.fieldDbType =='Date'>
<#if po.classType=='date'>
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#else>
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
@Excel(name = "${po.filedComment}", width = 15)
</#if>
</#if>
<#if po.classType =='list' || po.classType =='radio' || po.classType =='list_multi' || po.classType =='checkbox' || po.classType =='sel_search'>
<#if po.dictTable?default("")?trim?length gt 1>
@Dict(dicCode = "${po.dictField}",dicText = "${po.dictText}",dictTable = "${po.dictTable}")
<#elseif po.dictField?default("")?trim?length gt 1>
@Dict(dicCode = "${po.dictField}")
</#if>
</#if>
<#if po.classType =='cat_tree'>
@Dict(dicCode = "id",dicText = "name",dictTable = "sys_category")
</#if>
<#if po.classType =='sel_depart'>
@Dict(dicCode = "id",dicText = "depart_name",dictTable = "sys_depart")
</#if>
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
</#list>
}
</#list>
\ No newline at end of file
package ${bussiPackage}.${entityPackage}.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
}
<#list subTables as subTab>
#segment#${subTab.entityName}Mapper.java
package ${bussiPackage}.${entityPackage}.mapper;
import java.util.List;
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> {
public boolean deleteByMainId(@Param("mainId") String mainId);
public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId);
}
</#list>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
</mapper>
\ No newline at end of file
<#list subTables as subTab>
<#assign originalForeignKeys = subTab.originalForeignKeys>
#segment#${subTab.entityName}Mapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM ${subTab.tableName}
WHERE
<#list originalForeignKeys as key>
${key} = ${r'#'}{mainId} <#rt/>
</#list>
</delete>
<select id="selectByMainId" parameterType="java.lang.String" resultType="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
SELECT *
FROM ${subTab.tableName}
WHERE
<#list originalForeignKeys as key>
${key} = ${r'#'}{mainId} <#rt/>
</#list>
</select>
</mapper>
</#list>
\ No newline at end of file
package ${bussiPackage}.${entityPackage}.service;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface I${entityName}Service extends IService<${entityName}> {
/**
* 删除一对多
*/
public void delMain (String id);
/**
* 批量删除一对多
*/
public void delBatchMain (Collection<? extends Serializable> idList);
}
<#list subTables as subTab>
#segment#I${subTab.entityName}Service.java
package ${bussiPackage}.${entityPackage}.service;
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> {
public List<${subTab.entityName}> selectByMainId(String mainId);
}
</#list>
package ${bussiPackage}.${entityPackage}.service.impl;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.mapper.${sub.entityName}Mapper;
</#list>
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Service
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
@Autowired
private ${entityName}Mapper ${entityName?uncap_first}Mapper;
<#list subTables as sub>
@Autowired
private ${sub.entityName}Mapper ${sub.entityName?uncap_first}Mapper;
</#list>
@Override
@Transactional
public void delMain(String id) {
<#list subTables as sub>
${sub.entityName?uncap_first}Mapper.deleteByMainId(id);
</#list>
${entityName?uncap_first}Mapper.deleteById(id);
}
@Override
@Transactional
public void delBatchMain(Collection<? extends Serializable> idList) {
for(Serializable id:idList) {
<#list subTables as sub>
${sub.entityName?uncap_first}Mapper.deleteByMainId(id.toString());
</#list>
${entityName?uncap_first}Mapper.deleteById(id);
}
}
}
<#list subTables as subTab>
#segment#${subTab.entityName}ServiceImpl.java
package ${bussiPackage}.${entityPackage}.service.impl;
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
import ${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper;
import ${bussiPackage}.${entityPackage}.service.I${subTab.entityName}Service;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Service
public class ${subTab.entityName}ServiceImpl extends ServiceImpl<${subTab.entityName}Mapper, ${subTab.entityName}> implements I${subTab.entityName}Service {
@Autowired
private ${subTab.entityName}Mapper ${subTab.entityName?uncap_first}Mapper;
@Override
public List<${subTab.entityName}> selectByMainId(String mainId) {
return ${subTab.entityName?uncap_first}Mapper.selectByMainId(mainId);
}
}
</#list>
\ No newline at end of file
<#list subTables as sub>
#segment#${sub.entityName}List.vue
<template>
<a-card :bordered="false" :class="'cust-erp-sub-tab'">
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button v-if="mainId" @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="uploadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</span>
</a-table>
</div>
<${sub.entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></${sub.entityName?uncap_first}-modal>
</a-card>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ${sub.entityName}Modal from './modules/${sub.entityName}Modal'
export default {
name: "${sub.entityName}List",
mixins:[JeecgListMixin],
components: { ${sub.entityName}Modal },
props:{
mainId:{
type:String,
default:'',
required:false
}
},
watch:{
mainId:{
immediate: true,
handler(val) {
if(!this.mainId){
this.clearList()
}else{
<#list sub.foreignKeys as key>
this.queryParam['${key?uncap_first}'] = val
</#list>
this.loadData(1);
}
}
}
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
disableMixinCreated:true,
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
<#assign showColNum=0>
<#list sub.originalColumns as po>
<#if po.isShowList =='Y'>
<#assign showColNum=showColNum+1>
{
title:'${po.filedComment}',
align:"center",
<#if po.classType=='date'>
dataIndex: '${po.fieldName}',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
<#elseif po.fieldDbType=='Blob'>
dataIndex: '${po.fieldName}String'
<#elseif po.classType=='umeditor'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'htmlSlot'}
<#elseif po.classType=='file'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'fileSlot'}
<#elseif po.classType=='image'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'imgSlot'}
<#elseif po.classType =='list' || po.classType =='radio' || po.classType =='list_multi' || po.classType =='checkbox' || po.classType =='sel_search' || po.classType =='cat_tree' || po.classType =='sel_depart'>
dataIndex: '${po.fieldName}_dictText',
<#else>
dataIndex: '${po.fieldName}'
</#if>
},
</#if>
</#list>
{
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list${sub.entityName}ByMainId",
delete: "/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}"
},
dictOptions:{
<#list columns as po>
<#if (po.isQuery=='Y' || po.isShowList=='Y')>
<#if po.classType='sel_depart' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
${po.fieldName}:[],
</#if>
</#if>
</#list>
},
}
},
methods: {
clearList(){
this.dataSource=[]
this.selectedRowKeys=[]
this.ipagination.current = 1
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</#list>
\ No newline at end of file
<template>
<a-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<#assign form_date = false>
<#assign form_select = false>
<#assign form_select_multi = false>
<#assign form_select_search = false>
<#assign form_popup = false>
<#assign form_sel_depart = false>
<#assign form_sel_user = false>
<#assign form_file = false>
<#assign form_editor = false>
<#assign form_cat_tree = false>
<#assign form_cat_back = "">
<#list columns as po>
<#if po.isShow =='Y'>
<#assign form_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictField}">
</#if>
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
<#if po.classType =='date'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" style="width: 100%"/>
<#elseif po.classType =='datetime'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
<#elseif po.classType =='popup'>
<#assign form_popup=true>
<j-popup
v-decorator="['${po.fieldName}']"
:trigger-change="true"
org-fields="${po.dictField}"
dest-fields="${po.dictText}"
code="${po.dictTable}"
@callback="popupCallback"/>
<#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}']" :trigger-change="true"/>
<#elseif po.classType =='sel_user'>
<#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}']" :trigger-change="true"/>
<#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}']" rows="4" placeholder="请输入${po.filedComment}"/>
<#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='sel_search'>
<#assign form_select_search = true>
<j-search-select-tag v-decorator="['${po.fieldName}']" dict="${form_field_dictCode}" />
<#elseif po.classType=='cat_tree'>
<#assign form_cat_tree = true>
<j-category-select v-decorator="['${po.fieldName}']" <#if po.dictField?default("")?trim?length gt 1>pcode="${po.dictField}"<#else>pcode="0"</#if> placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
<#if po.dictText?default("")?trim?length gt 1>
<#assign form_cat_back = "${po.dictText}">
</#if>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
<#elseif po.classType=='file' || po.classType=='image'>
<#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}']" :trigger-change="true"></j-upload>
<#elseif po.classType=='umeditor'>
<#assign form_editor = true>
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
<#elseif po.fieldDbType=='Blob'>
<a-input v-decorator="[ '${po.fieldName}String', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input>
<#else>
<a-input v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input>
</#if>
</a-form-item>
</#if>
</#list>
<#if form_cat_tree && form_cat_back?length gt 1>
<a-form-item v-show="false">
<a-input v-decorator="[ '${form_cat_back}']"></a-input>
</a-form-item>
</#if>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
<#if form_date>
import JDate from '@/components/jeecg/JDate'
</#if>
<#if form_file>
import JUpload from '@/components/jeecg/JUpload'
</#if>
<#if form_sel_depart>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if form_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if form_select>
import JDictSelectTag from "@/components/dict/JDictSelectTag"
</#if>
<#if form_select_multi>
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
</#if>
<#if form_select_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
<#if form_editor>
import JEditor from '@/components/jeecg/JEditor'
</#if>
<#if form_cat_tree>
import JCategorySelect from '@/components/jeecg/JCategorySelect'
</#if>
export default {
name: "${entityName}Modal",
components: {
<#if form_date>
JDate,
</#if>
<#if form_file>
JUpload,
</#if>
<#if form_sel_depart>
JSelectDepart,
</#if>
<#if form_sel_user>
JSelectUserByDep,
</#if>
<#if form_select>
JDictSelectTag,
</#if>
<#if form_select_multi>
JMultiSelectTag,
</#if>
<#if form_select_search>
JSearchSelectTag,
</#if>
<#if form_editor>
JEditor,
</#if>
<#if form_cat_tree>
JCategorySelect
</#if>
},
data () {
return {
form: this.$form.createForm(this),
title:"操作",
width:800,
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules:{
<#list columns as po>
<#if po.isShow =='Y'>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
<#else>
${po.fieldName}:{},
</#if>
</#if>
</#if>
</#list>
},
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
}
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
console.log("表单提交数据",formData)
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
popupCallback(row){
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
},
<#if form_cat_tree>
handleCategoryChange(value,backObj){
this.form.setFieldsValue(backObj)
}
</#if>
}
}
</script>
\ No newline at end of file
<#list subTables as sub>
#segment#${sub.entityName}Modal.vue
<template>
<a-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<#assign form_date = false>
<#assign form_select = false>
<#assign form_select_multi = false>
<#assign form_select_search = false>
<#assign form_popup = false>
<#assign form_sel_depart = false>
<#assign form_sel_user = false>
<#assign form_file = false>
<#assign form_editor = false>
<#assign form_cat_tree = false>
<#assign form_cat_back = "">
<#list sub.originalColumns as po>
<#if po.isShow =='Y'>
<#assign form_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictField}">
</#if>
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
<#if po.classType =='date'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" style="width: 100%"/>
<#elseif po.classType =='datetime'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
<#elseif po.classType =='popup'>
<#assign form_popup=true>
<j-popup
v-decorator="['${po.fieldName}']"
:trigger-change="true"
org-fields="${po.dictField}"
dest-fields="${po.dictText}"
code="${po.dictTable}"
@callback="popupCallback"/>
<#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}']" :trigger-change="true"/>
<#elseif po.classType =='sel_user'>
<#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}']" :trigger-change="true"/>
<#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}']" rows="4" placeholder="请输入${po.filedComment}"/>
<#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='sel_search'>
<#assign form_select_search = true>
<j-search-select-tag v-decorator="['${po.fieldName}']" dict="${form_field_dictCode}" />
<#elseif po.classType=='cat_tree'>
<#assign form_cat_tree = true>
<j-category-select v-decorator="['${po.fieldName}']" <#if po.dictField?default("")?trim?length gt 1>pcode="${po.dictField}"<#else>pcode="0"</#if> placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
<#if po.dictText?default("")?trim?length gt 1>
<#assign form_cat_back = "${po.dictText}">
</#if>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
<#elseif po.classType=='file' || po.classType=='image'>
<#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}']" :trigger-change="true"></j-upload>
<#elseif po.classType=='umeditor'>
<#assign form_editor = true>
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
<#elseif po.fieldDbType=='Blob'>
<a-input v-decorator="[ '${po.fieldName}String', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input>
<#else>
<a-input v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input>
</#if>
</a-form-item>
</#if>
</#list>
<#if form_cat_tree && form_cat_back?length gt 1>
<a-form-item v-show="false">
<a-input v-decorator="[ '${form_cat_back}']"></a-input>
</a-form-item>
</#if>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
<#if form_date>
import JDate from '@/components/jeecg/JDate'
</#if>
<#if form_file>
import JUpload from '@/components/jeecg/JUpload'
</#if>
<#if form_sel_depart>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if form_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if form_select>
import JDictSelectTag from "@/components/dict/JDictSelectTag"
</#if>
<#if form_select_multi>
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
</#if>
<#if form_select_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
<#if form_editor>
import JEditor from '@/components/jeecg/JEditor'
</#if>
<#if form_cat_tree>
import JCategorySelect from '@/components/jeecg/JCategorySelect'
</#if>
export default {
name: "${sub.entityName}Modal",
components: {
<#if form_date>
JDate,
</#if>
<#if form_file>
JUpload,
</#if>
<#if form_sel_depart>
JSelectDepart,
</#if>
<#if form_sel_user>
JSelectUserByDep,
</#if>
<#if form_select>
JDictSelectTag,
</#if>
<#if form_select_multi>
JMultiSelectTag,
</#if>
<#if form_select_search>
JSearchSelectTag,
</#if>
<#if form_editor>
JEditor,
</#if>
<#if form_cat_tree>
JCategorySelect
</#if>
},
props:{
mainId:{
type:String,
required:false,
default:''
}
},
data () {
return {
form: this.$form.createForm(this),
title:"操作",
width:800,
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules:{
<#list sub.originalColumns as po>
<#if po.isShow =='Y'>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
<#else>
${po.fieldName}:{},
</#if>
</#if>
</#if>
</#list>
},
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add${sub.entityName}",
edit: "/${entityPackage}/${entityName?uncap_first}/edit${sub.entityName}",
}
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model<#list sub.originalColumns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
<#list sub.foreignKeys as key>
formData['${key?uncap_first}'] = this.mainId
</#list>
console.log("表单提交数据",formData)
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
popupCallback(row){
this.form.setFieldsValue(pick(row<#list sub.originalColumns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
},
<#if form_cat_tree>
handleCategoryChange(value,backObj){
this.form.setFieldsValue(backObj)
}
</#if>
}
}
</script>
</#list>
\ No newline at end of file
validatorRules: {
<#list columns as po>
<#if po.isShow == 'Y'>
<#if po.fieldName != 'id'>
${po.fieldName}: {rules: [
<#assign fieldValidType = po.fieldValidType!''>
<#-- 非空校验 -->
<#if po.nullable == 'N' || fieldValidType == '*'>
{required: true, message: '请输入${po.filedComment}!'},
</#if>
<#-- 唯一校验 -->
<#if fieldValidType == 'only'>
{ validator: (rule, value, callback) => validateDuplicateValue('${tableName}', '${po.fieldDbName}', value, this.model.id, callback)},
<#-- 6到16位数字 -->
<#elseif fieldValidType == 'n6-16'>
{pattern:/\d{6,18}/, message: '请输入6到16位数字!'},
<#-- 6到16位任意字符 -->
<#elseif fieldValidType == '*6-16'>
{pattern:/^.{6,16}$/, message: '请输入6到16位任意字符!'},
<#-- 6到18位字符串 -->
<#elseif fieldValidType == 's6-18'>
{pattern:/^.{6,18}$/, message: '请输入6到18位任意字符!'},
<#-- 网址 -->
<#elseif fieldValidType == 'url'>
{pattern:/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/, message: '请输入正确的网址!'},
<#-- 电子邮件 -->
<#elseif fieldValidType == 'e'>
{pattern:/^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
<#-- 手机号码 -->
<#elseif fieldValidType == 'm'>
{pattern:/^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
<#-- 邮政编码 -->
<#elseif fieldValidType == 'p'>
{pattern:/^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'},
<#-- 字母 -->
<#elseif fieldValidType == 's'>
{pattern:/^[A-Z|a-z]+$/, message: '请输入字母!'},
<#-- 数字 -->
<#elseif fieldValidType == 'n'>
{pattern:/^-?\d+\.?\d*$/, message: '请输入数字!'},
<#-- 整数 -->
<#elseif fieldValidType == 'z'>
{pattern:/^-?\d+$/, message: '请输入整数!'},
<#-- 金额 -->
<#elseif fieldValidType == 'money'>
{pattern:/^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
<#-- 无校验 -->
<#else>
<#t>
</#if>
]},
</#if>
</#if>
</#list>
},
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<#elseif po.classType =='popup'> <#elseif po.classType =='popup'>
<#assign form_popup=true> <#assign form_popup=true>
<j-popup <j-popup
v-decorator="['${po.fieldName}']" v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]"
:trigger-change="true" :trigger-change="true"
org-fields="${po.dictField}" org-fields="${po.dictField}"
dest-fields="${po.dictText}" dest-fields="${po.dictText}"
...@@ -47,24 +47,24 @@ ...@@ -47,24 +47,24 @@
@callback="popupCallback"/> @callback="popupCallback"/>
<#elseif po.classType =='sel_depart'> <#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true> <#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}']" :trigger-change="true"/> <j-select-depart v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true"/>
<#elseif po.classType =='sel_user'> <#elseif po.classType =='sel_user'>
<#assign form_sel_user = true> <#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}']" :trigger-change="true"/> <j-select-user-by-dep v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true"/>
<#elseif po.classType =='textarea'> <#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}']" rows="4" placeholder="请输入${po.filedComment}"/> <a-textarea v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" rows="4" placeholder="请输入${po.filedComment}"/>
<#elseif po.classType=='list' || po.classType=='radio'> <#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true> <#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> <j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'> <#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true> <#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> <j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='sel_search'> <#elseif po.classType=='sel_search'>
<#assign form_select_search = true> <#assign form_select_search = true>
<j-search-select-tag v-decorator="['${po.fieldName}']" dict="${form_field_dictCode}" /> <j-search-select-tag v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" dict="${form_field_dictCode}" />
<#elseif po.classType=='cat_tree'> <#elseif po.classType=='cat_tree'>
<#assign form_cat_tree = true> <#assign form_cat_tree = true>
<j-category-select v-decorator="['${po.fieldName}']" pcode="${po.dictField}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/> <j-category-select v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" pcode="${po.dictField}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
<#if po.dictText?default("")?trim?length gt 1> <#if po.dictText?default("")?trim?length gt 1>
<#assign form_cat_back = "${po.dictText}"> <#assign form_cat_back = "${po.dictText}">
</#if> </#if>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/> <a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
<#elseif po.classType=='file' || po.classType=='image'> <#elseif po.classType=='file' || po.classType=='image'>
<#assign form_file = true> <#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}']" :trigger-change="true"></j-upload> <j-upload v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true"></j-upload>
<#elseif po.classType=='umeditor'> <#elseif po.classType=='umeditor'>
<#assign form_editor = true> <#assign form_editor = true>
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/> <j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
import { httpAction } from '@/api/manage' import { httpAction } from '@/api/manage'
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
<#if form_date> <#if form_date>
import JDate from '@/components/jeecg/JDate' import JDate from '@/components/jeecg/JDate'
</#if> </#if>
...@@ -173,26 +174,12 @@ ...@@ -173,26 +174,12 @@
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 }, sm: { span: 16 },
}, },
confirmLoading: false, confirmLoading: false,
validatorRules:{ <#include "/common/validatorRulesTemplate.ftl">
<#list columns as po>
<#if po.isShow =='Y'>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
<#else>
${po.fieldName}:{},
</#if>
</#if>
</#if>
</#list>
},
url: { url: {
add: "/${entityPackage}/${entityName?uncap_first}/add", add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit", edit: "/${entityPackage}/${entityName?uncap_first}/edit",
} }
} }
}, },
created () { created () {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<#elseif po.classType =='popup'> <#elseif po.classType =='popup'>
<#assign form_popup=true> <#assign form_popup=true>
<j-popup <j-popup
v-decorator="['${po.fieldName}']" v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]"
:trigger-change="true" :trigger-change="true"
org-fields="${po.dictField}" org-fields="${po.dictField}"
dest-fields="${po.dictText}" dest-fields="${po.dictText}"
...@@ -43,23 +43,23 @@ ...@@ -43,23 +43,23 @@
@callback="popupCallback"/> @callback="popupCallback"/>
<#elseif po.classType =='sel_depart'> <#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true> <#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}']" :trigger-change="true"/> <j-select-depart v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true"/>
<#elseif po.classType =='sel_user'> <#elseif po.classType =='sel_user'>
<#assign form_sel_user = true> <#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}']" :trigger-change="true"/> <j-select-user-by-dep v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true"/>
<#elseif po.classType =='textarea'> <#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}']" rows="4" placeholder="请输入${po.filedComment}"/> <a-textarea v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" rows="4" placeholder="请输入${po.filedComment}"/>
<#elseif po.classType=='list' || po.classType=='radio'> <#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true> <#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> <j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'> <#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true> <#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}']" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/> <j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'> <#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/> <a-input-number v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
<#elseif po.classType=='file' || po.classType=='image'> <#elseif po.classType=='file' || po.classType=='image'>
<#assign form_file = true> <#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}']" :trigger-change="true"></j-upload> <j-upload v-decorator="['${po.fieldName}', validatorRules.${po.fieldName}]" :trigger-change="true"></j-upload>
<#else> <#else>
<a-input v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input> <a-input v-decorator="[ '${po.fieldName}', validatorRules.${po.fieldName}]" placeholder="请输入${po.filedComment}"></a-input>
</#if> </#if>
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
import { httpAction } from '@/api/manage' import { httpAction } from '@/api/manage'
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
<#if form_date> <#if form_date>
import JDate from '@/components/jeecg/JDate' import JDate from '@/components/jeecg/JDate'
</#if> </#if>
...@@ -134,26 +135,12 @@ ...@@ -134,26 +135,12 @@
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 }, sm: { span: 16 },
}, },
confirmLoading: false, confirmLoading: false,
validatorRules:{ <#include "/common/validatorRulesTemplate.ftl">
<#list columns as po>
<#if po.isShow =='Y'>
<#if po.fieldName !='id'>
<#if po.nullable =='N'>
${po.fieldName}:{rules: [{ required: true, message: '请输入${po.filedComment}!' }]},
<#else>
${po.fieldName}:{},
</#if>
</#if>
</#if>
</#list>
},
url: { url: {
add: "/${entityPackage}/${entityName?uncap_first}/add", add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit", edit: "/${entityPackage}/${entityName?uncap_first}/edit",
} }
} }
}, },
created () { created () {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<#if po.fieldName !='id'> <#if po.fieldName !='id'>
<#list [po_index, po_index+1] as idx><#rt/> <#list [po_index, po_index+1] as idx><#rt/>
<#if idx lt columns?size> <#if idx lt columns?size>
<a-col :span="12" :gutter="8"> <a-col :span="12">
<a-form-item <a-form-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
......
body,html{width:100%;height:100%;margin:0px;padding:0px;font-size:12px;color:#555;background-color:#000;font-family:'微软雅黑'}
#main{width:4352px;height:1536px;display:inline-block; background:url(../images/screenbg_design1.jpg) left top no-repeat}
/*年月日文字*/
#currentYear{width:213px;height:107px;position:absolute;left:430px;top:100px;color:#FFF;font-size:36px; font-family:'微软雅黑';text-align:center}
#currentMonth{width:213px;height:107px;position:absolute;left:1504px;top:75px;color:#FFF;font-size:36px; font-family:'微软雅黑';text-align:center}
#currentDay{width:213px;height:107px;position:absolute;left:2574px;top:100px;color:#FFF;font-size:36px; font-family:'微软雅黑';text-align:center}
/*年的进度条*/
#y_gauge1{width:250px;height:250px;position:absolute;left:60px;top:200px;}
#y_gauge2{width:250px;height:250px;position:absolute;left:290px;top:200px;}
#y_gauge3{width:250px;height:250px;position:absolute;left:530px;top:200px;}
#y_gauge4{width:250px;height:250px;position:absolute;left:770px;top:200px;}
/*月的进度条*/
#m_gauge1{width:250px;height:250px;position:absolute;left:1140px;top:130px;}
#m_gauge2{width:250px;height:250px;position:absolute;left:1370px;top:130px;}
#m_gauge3{width:250px;height:250px;position:absolute;left:1610px;top:130px;}
#m_gauge4{width:250px;height:250px;position:absolute;left:1850px;top:130px;}
/*日的进度条*/
#d_gauge1{width:250px;height:250px;position:absolute;left:2210px;top:200px;}
#d_gauge2{width:250px;height:250px;position:absolute;left:2440px;top:200px;}
#d_gauge3{width:250px;height:250px;position:absolute;left:2680px;top:200px;}
#d_gauge4{width:250px;height:250px;position:absolute;left:2920px;top:200px;}
/*监控的仪表盘*/
#gauge1{width:250px;height:250px;position:absolute;left:2200px;top:1050px;}
#gauge2{width:250px;height:250px;position:absolute;left:2550px;top:1050px;}
#gauge3{width:250px;height:250px;position:absolute;left:2910px;top:1050px;}
#gauge4{width:250px;height:250px;position:absolute;left:2380px;top:1190px;}
#gauge5{width:250px;height:250px;position:absolute;left:2730px;top:1190px;}
/*仪表盘文字*/
.gaugeTitle{width:250px;height:40px;position:absolute;left:0px;top:200px;color:#B7E1FF;font-size:24px;display:inline-block;text-align:center;font-family:Arial;}
/*地图*/
#map{width:1100px;height:800px;position:absolute;left:0px;top:620px;display:inline-block;color:#E1E1E1;font-size:24px;}
#plan{width:900px;height:420px;position:absolute;left:1170px;top:520px;display:inline-block;color:#E1E1E1;font-size:24px;}
#quality{width:900px;height:420px;position:absolute;left:1170px;top:1030px;display:inline-block;color:#E1E1E1;font-size:24px;}
#orderTable{width:1000px;height:430px;position:absolute;left:2160px;top:930px;display:inline-block}
#orderTable table{width:100%;color:#666;font-size:24px}
#orderTable table td{text-align:center;}
#orderTable table .head{height:80px;font-size:24px;color:#FFF}
#orderTable table .row2{color:#000}
#orderTable table .row1{background-color:#CCC}
#orderMessage{width:800px;position:absolute;left:33px;top:1420px;display:inline-block;color:#E1E1E1;font-size:24px}
/*生产情况展示表*/
#produce{width:1000px;height:380px;position:absolute;left:2190px;top:600px;display:inline-block;color:#B7E2FF;font-size:24px;}
#produce table{width:100%;font-size:24px;}
#produce table td{text-align:center;border:1px solid #069}
#produce table .row1{}
#produce table .row2{}
/*视频*/
#video{width:960px;height:540px;position:absolute;left:3280px;top:140px;display:inline-block;}
/*监控视频*/
#Monitor{width:960px;height:540px;position:absolute;left:3280px;top:940px;display:inline-block;color:#E1E1E1;font-size:24px;}
/*刷新时间*/
#refresh{width:800px;position:absolute;left:3350px;top:40px;display:inline-block;color:#FFF;font-size:24px;}
\ No newline at end of file
body,html{width:100%;height:100%;margin:0px;padding:0px;font-size:12px;color:#555;background-color:#000;font-family:'微软雅黑'}
#main{width:4352px;height:1536px;display:inline-block; background:url(../images/war_room_main.jpg) left top no-repeat}
/*下钻按钮*/
.contentButton{width:218px;height:100px;position:absolute;}
.contentButton a{width:218px;height:100px;display:inline-block; background:url(../images/content_comm.png) no-repeat top left}
.contentButton a:hover{width:218px;height:100px;display:inline-block; background:url(../images/content_down.png) no-repeat top left}
.contentButton .a1{width:218px;height:100px;display:inline-block; background:url(../images/content_comm1.png) no-repeat top left}
.contentButton .a1:hover{width:218px;height:100px;display:inline-block; background:url(../images/content_down1.png) no-repeat top left}
/*弹出窗口*/
#popWindow{width:2200px;height:1000px;display:inline-block;position:absolute;top:240px;left:1070px;background-color:#06274A;border:1px solid #09f}
/*年的进度条*/
#y_gauge1{width:250px;height:250px;position:absolute;left:60px;top:200px;}
#y_gauge2{width:250px;height:250px;position:absolute;left:290px;top:200px;}
#y_gauge3{width:250px;height:250px;position:absolute;left:530px;top:200px;}
#y_gauge4{width:250px;height:250px;position:absolute;left:770px;top:200px;}
/*螺旋DNA*/
#orderStatus{width:1000px;height:320px;position:absolute;left:80px;top:460px;}
/*监控的仪表盘*/
#gauge1{width:250px;height:250px;position:absolute;left:2200px;top:280px;}
#gauge2{width:250px;height:250px;position:absolute;left:2550px;top:280px;}
#gauge3{width:250px;height:250px;position:absolute;left:2910px;top:280px;}
#gauge4{width:250px;height:250px;position:absolute;left:2380px;top:550px;}
#gauge5{width:250px;height:250px;position:absolute;left:2730px;top:550px;}
/*仪表盘文字*/
.gaugeTitle{width:250px;height:40px;position:absolute;left:0px;top:200px;color:#B7E1FF;font-size:24px;display:inline-block;text-align:center;font-family:Arial;}
/*地图*/
#map{width:1100px;height:800px;position:absolute;left:1080px;top:170px;display:inline-block;color:#E1E1E1;font-size:24px;}
#productPie{width:1000px;height:680px;position:absolute;left:2210px;top:260px;display:inline-block;color:#E1E1E1;font-size:24px;}
/*业务进展图*/
#businessProgress{width:1000px;height:640px;position:absolute;left:3330px;top:180px;display:inline-block;color:#E1E1E1;font-size:24px;}
/*计划完成情况*/
#plan{width:1000px;height:400px;position:absolute;left:80px;top:1020px;display:inline-block;color:#E1E1E1;font-size:24px;}
/*质量指标分析*/
#quality{width:1000px;height:400px;position:absolute;left:1170px;top:1020px;display:inline-block;color:#E1E1E1;font-size:24px;}
/*舆情文字云*/
#wordCloud{width:900px;height:420px;position:absolute;left:3330px;top:1000px;display:inline-block;color:#E1E1E1;font-size:24px;}
/*投诉情况展示表*/
#produce{width:900px;height:380px;position:absolute;left:2250px;top:1050px;display:inline-block;color:#B7E2FF;font-size:24px;}
#produce table{width:100%;font-size:24px;}
#produce table td{text-align:center;border:1px solid #069}
#produce table .row1{}
#produce table .row2{}
/*视频*/
#video{width:960px;height:540px;position:absolute;left:3280px;top:140px;display:inline-block;}
/*监控视频*/
#Monitor{width:960px;height:540px;position:absolute;left:3280px;top:940px;display:inline-block;color:#E1E1E1;font-size:24px;}
/*刷新时间*/
#refresh{width:800px;position:absolute;left:3350px;top:40px;display:inline-block;color:#FFF;font-size:24px;}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
var geoCoordMap = {
'上海': [121.4648,31.2891],
'东莞': [113.8953,22.901],
'东营': [118.7073,37.5513],
'中山': [113.4229,22.478],
'临汾': [111.4783,36.1615],
'临沂': [118.3118,35.2936],
'丹东': [124.541,40.4242],
'丽水': [119.5642,28.1854],
'乌鲁木齐': [87.9236,43.5883],
'佛山': [112.8955,23.1097],
'保定': [115.0488,39.0948],
'兰州': [103.5901,36.3043],
'包头': [110.3467,41.4899],
'北京': [116.4551,40.2539],
'北海': [109.314,21.6211],
'南京': [118.8062,31.9208],
'南宁': [108.479,23.1152],
'南昌': [116.0046,28.6633],
'南通': [121.1023,32.1625],
'厦门': [118.1689,24.6478],
'台州': [121.1353,28.6688],
'合肥': [117.29,32.0581],
'呼和浩特': [111.4124,40.4901],
'咸阳': [108.4131,34.8706],
'哈尔滨': [127.9688,45.368],
'唐山': [118.4766,39.6826],
'嘉兴': [120.9155,30.6354],
'大同': [113.7854,39.8035],
'大连': [122.2229,39.4409],
'天津': [117.4219,39.4189],
'太原': [112.3352,37.9413],
'威海': [121.9482,37.1393],
'宁波': [121.5967,29.6466],
'宝鸡': [107.1826,34.3433],
'宿迁': [118.5535,33.7775],
'常州': [119.4543,31.5582],
'广州': [113.5107,23.2196],
'廊坊': [116.521,39.0509],
'延安': [109.1052,36.4252],
'张家口': [115.1477,40.8527],
'徐州': [117.5208,34.3268],
'德州': [116.6858,37.2107],
'惠州': [114.6204,23.1647],
'成都': [103.9526,30.7617],
'扬州': [119.4653,32.8162],
'承德': [117.5757,41.4075],
'拉萨': [91.1865,30.1465],
'无锡': [120.3442,31.5527],
'日照': [119.2786,35.5023],
'昆明': [102.9199,25.4663],
'杭州': [119.5313,29.8773],
'枣庄': [117.323,34.8926],
'柳州': [109.3799,24.9774],
'株洲': [113.5327,27.0319],
'武汉': [114.3896,30.6628],
'汕头': [117.1692,23.3405],
'江门': [112.6318,22.1484],
'沈阳': [123.1238,42.1216],
'沧州': [116.8286,38.2104],
'河源': [114.917,23.9722],
'泉州': [118.3228,25.1147],
'泰安': [117.0264,36.0516],
'泰州': [120.0586,32.5525],
'济南': [117.1582,36.8701],
'济宁': [116.8286,35.3375],
'海口': [110.3893,19.8516],
'淄博': [118.0371,36.6064],
'淮安': [118.927,33.4039],
'深圳': [114.5435,22.5439],
'清远': [112.9175,24.3292],
'温州': [120.498,27.8119],
'渭南': [109.7864,35.0299],
'湖州': [119.8608,30.7782],
'湘潭': [112.5439,27.7075],
'滨州': [117.8174,37.4963],
'潍坊': [119.0918,36.524],
'烟台': [120.7397,37.5128],
'玉溪': [101.9312,23.8898],
'珠海': [113.7305,22.1155],
'盐城': [120.2234,33.5577],
'盘锦': [121.9482,41.0449],
'石家庄': [114.4995,38.1006],
'福州': [119.4543,25.9222],
'秦皇岛': [119.2126,40.0232],
'绍兴': [120.564,29.7565],
'聊城': [115.9167,36.4032],
'肇庆': [112.1265,23.5822],
'舟山': [122.2559,30.2234],
'苏州': [120.6519,31.3989],
'莱芜': [117.6526,36.2714],
'菏泽': [115.6201,35.2057],
'营口': [122.4316,40.4297],
'葫芦岛': [120.1575,40.578],
'衡水': [115.8838,37.7161],
'衢州': [118.6853,28.8666],
'西宁': [101.4038,36.8207],
'西安': [109.1162,34.2004],
'贵阳': [106.6992,26.7682],
'连云港': [119.1248,34.552],
'邢台': [114.8071,37.2821],
'邯郸': [114.4775,36.535],
'郑州': [113.4668,34.6234],
'鄂尔多斯': [108.9734,39.2487],
'重庆': [107.7539,30.1904],
'金华': [120.0037,29.1028],
'铜川': [109.0393,35.1947],
'银川': [106.3586,38.1775],
'镇江': [119.4763,31.9702],
'长春': [125.8154,44.2584],
'长沙': [113.0823,28.2568],
'长治': [112.8625,36.4746],
'阳泉': [113.4778,38.0951],
'青岛': [120.4651,36.3373],
'韶关': [113.7964,24.7028]
};
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment