New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | |
| | | <artifactId>guns-admin</artifactId> |
| | | <name>guns-admin</name> |
| | | <description>guns 的spring boot版本</description> |
| | | <parent> |
| | | <groupId>com.stylefeng</groupId> |
| | | <artifactId>guns-parent</artifactId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | <packaging>jar</packaging> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.amazonaws</groupId> |
| | | <artifactId>aws-java-sdk-core</artifactId> |
| | | <version>1.11.24</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.amazonaws</groupId> |
| | | <artifactId>aws-java-sdk-s3</artifactId> |
| | | <version>1.11.24</version> |
| | | </dependency> |
| | | <!--<dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> |
| | | </dependency>--> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.22</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.stylefeng</groupId> |
| | | <artifactId>guns-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.stylefeng</groupId> |
| | | <artifactId>guns-generator</artifactId> |
| | | </dependency> |
| | | |
| | | <!--spring boot依赖--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-aop</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-cache</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-validation</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | |
| | | <!-- 导入Excel数据依赖 start --> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | <version>3.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>3.9</version> |
| | | </dependency> |
| | | |
| | | <!--shiro依赖--> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-core</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <groupId>org.slf4j</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-spring</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-ehcache</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <groupId>org.slf4j</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.ehcache</groupId> |
| | | <artifactId>ehcache</artifactId> |
| | | </dependency> |
| | | |
| | | <!--极光推送--> |
| | | <dependency> |
| | | <groupId>cn.jpush.api</groupId> |
| | | <artifactId>jpush-client</artifactId> |
| | | <version>3.2.17</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.jpush.api</groupId> |
| | | <artifactId>jiguang-common</artifactId> |
| | | <version>1.1.1</version> |
| | | </dependency> |
| | | |
| | | <!--需要分布式session的话需要放开注释--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.session</groupId>--> |
| | | <!--<artifactId>spring-session-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.boot</groupId>--> |
| | | <!--<artifactId>spring-boot-starter-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.penggle</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ibeetl</groupId> |
| | | <artifactId>beetl</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>2.6</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>2.5.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.code.gson</groupId> |
| | | <artifactId>gson</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <version>2.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.rongcloud.im</groupId> |
| | | <artifactId>server-sdk-java</artifactId> |
| | | <version>3.0.4</version> |
| | | </dependency> |
| | | <!-- 计算两坐标间的直线距离 --> |
| | | <dependency> |
| | | <groupId>org.gavaghan</groupId> |
| | | <artifactId>geodesy</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpclient</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | |
| | | <!--引入本地工行支付jar start--> |
| | | |
| | | |
| | | <!--引入本地工行支付jar end--> |
| | | </dependencies> |
| | | |
| | | |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <fork>true</fork><!-- 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart --> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skip>true</skip> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | |
| | | <!--打包war包引入本地jar的打包方式--> |
| | | <!--<plugins>--> |
| | | <!--<plugin>--> |
| | | <!--<groupId>org.apache.maven.plugins</groupId>--> |
| | | <!--<artifactId>maven-war-plugin</artifactId>--> |
| | | <!--<configuration>--> |
| | | <!--<!– 设置成false,否则检查web.xml是否存在。因为springboot是没有web.xml的 –>--> |
| | | <!--<failOnMissingWebXml>false</failOnMissingWebXml>--> |
| | | <!--<!–打包后的项目名–>--> |
| | | <!--<!–<warName>example</warName>–>--> |
| | | <!--<webResources>--> |
| | | <!--<resource>--> |
| | | <!--<!–把本地lib里面的jar复制到lib–>--> |
| | | <!--<directory>${project.basedir}/lib</directory>--> |
| | | <!--<targetPath>WEB-INF/lib/</targetPath>--> |
| | | <!--<includes>--> |
| | | <!--<include>**/*.jar</include>--> |
| | | <!--</includes>--> |
| | | <!--</resource>--> |
| | | <!--</webResources>--> |
| | | <!--</configuration>--> |
| | | <!--</plugin>--> |
| | | <!--</plugins>--> |
| | | |
| | | <resources> |
| | | <resource> |
| | | <directory>lib</directory> |
| | | <targetPath>/BOOT-INF/lib/</targetPath> |
| | | <includes> |
| | | <include>**/*.jar</include> |
| | | </includes> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/webapp</directory> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/resources</directory> |
| | | <filtering>true</filtering> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/java</directory> |
| | | <includes> |
| | | <include>**/*.xml</include> |
| | | </includes> |
| | | </resource> |
| | | </resources> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | /* |
| | | Navicat MySQL Data Transfer |
| | | |
| | | Source Server : localhost_3306(123456) |
| | | Source Server Version : 50721 |
| | | Source Host : localhost:3306 |
| | | Source Database : basepro |
| | | |
| | | Target Server Type : MYSQL |
| | | Target Server Version : 50721 |
| | | File Encoding : 65001 |
| | | |
| | | Date: 2019-01-11 16:23:18 |
| | | */ |
| | | |
| | | SET FOREIGN_KEY_CHECKS=0; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_dept |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_dept`; |
| | | CREATE TABLE `sys_dept` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', |
| | | `num` int(11) DEFAULT NULL COMMENT '排序', |
| | | `pid` int(11) DEFAULT NULL COMMENT '父部门id', |
| | | `pids` varchar(255) DEFAULT NULL COMMENT '父级ids', |
| | | `simplename` varchar(45) DEFAULT NULL COMMENT '简称', |
| | | `fullname` varchar(255) DEFAULT NULL COMMENT '全称', |
| | | `tips` varchar(255) DEFAULT NULL COMMENT '提示', |
| | | `version` int(11) DEFAULT NULL COMMENT '版本(乐观锁保留字段)', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COMMENT='部门表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_dept |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_dept` VALUES ('24', '1', '0', '[0],', '总公司', '总公司', '', null); |
| | | INSERT INTO `sys_dept` VALUES ('25', '2', '24', '[0],[24],', '开发部', '开发部', '', null); |
| | | INSERT INTO `sys_dept` VALUES ('26', '3', '24', '[0],[24],', '运营部', '运营部', '', null); |
| | | INSERT INTO `sys_dept` VALUES ('27', '4', '24', '[0],[24],', '战略部', '战略部', '', null); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_dict |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_dict`; |
| | | CREATE TABLE `sys_dict` ( |
| | | `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', |
| | | `num` int(11) DEFAULT NULL COMMENT '排序', |
| | | `pid` int(11) DEFAULT NULL COMMENT '父级字典', |
| | | `name` varchar(255) DEFAULT NULL COMMENT '名称', |
| | | `tips` varchar(255) DEFAULT NULL COMMENT '提示', |
| | | `code` varchar(255) DEFAULT NULL COMMENT '值', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8 COMMENT='字典表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_dict |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_dict` VALUES ('50', '0', '0', '性别', null, 'sys_sex'); |
| | | INSERT INTO `sys_dict` VALUES ('51', '1', '50', '男', null, '1'); |
| | | INSERT INTO `sys_dict` VALUES ('52', '2', '50', '女', null, '2'); |
| | | INSERT INTO `sys_dict` VALUES ('53', '0', '0', '状态', null, 'sys_state'); |
| | | INSERT INTO `sys_dict` VALUES ('54', '1', '53', '启用', null, '1'); |
| | | INSERT INTO `sys_dict` VALUES ('55', '2', '53', '禁用', null, '2'); |
| | | INSERT INTO `sys_dict` VALUES ('56', '0', '0', '账号状态', null, 'account_state'); |
| | | INSERT INTO `sys_dict` VALUES ('57', '1', '56', '启用', null, '1'); |
| | | INSERT INTO `sys_dict` VALUES ('58', '2', '56', '冻结', null, '2'); |
| | | INSERT INTO `sys_dict` VALUES ('59', '3', '56', '已删除', null, '3'); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_expense |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_expense`; |
| | | CREATE TABLE `sys_expense` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT, |
| | | `money` decimal(20,2) DEFAULT NULL COMMENT '报销金额', |
| | | `desc` varchar(255) DEFAULT '' COMMENT '描述', |
| | | `createtime` datetime DEFAULT NULL COMMENT '创建时间', |
| | | `state` int(11) DEFAULT NULL COMMENT '状态: 1.待提交 2:待审核 3.审核通过 4:驳回', |
| | | `userid` int(11) DEFAULT NULL COMMENT '用户id', |
| | | `processId` varchar(255) DEFAULT NULL COMMENT '流程定义id', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='报销表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_expense |
| | | -- ---------------------------- |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_login_log |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_login_log`; |
| | | CREATE TABLE `sys_login_log` ( |
| | | `id` int(65) NOT NULL AUTO_INCREMENT COMMENT '主键', |
| | | `logname` varchar(255) DEFAULT NULL COMMENT '日志名称', |
| | | `userid` int(65) DEFAULT NULL COMMENT '管理员id', |
| | | `createtime` datetime DEFAULT NULL COMMENT '创建时间', |
| | | `succeed` varchar(255) DEFAULT NULL COMMENT '是否执行成功', |
| | | `message` text COMMENT '具体消息', |
| | | `ip` varchar(255) DEFAULT NULL COMMENT '登录ip', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=259 DEFAULT CHARSET=utf8 COMMENT='登录记录'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_login_log |
| | | -- ---------------------------- |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_menu |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_menu`; |
| | | CREATE TABLE `sys_menu` ( |
| | | `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', |
| | | `code` varchar(255) DEFAULT NULL COMMENT '菜单编号', |
| | | `pcode` varchar(255) DEFAULT NULL COMMENT '菜单父编号', |
| | | `pcodes` varchar(255) DEFAULT NULL COMMENT '当前菜单的所有父菜单编号', |
| | | `name` varchar(255) DEFAULT NULL COMMENT '菜单名称', |
| | | `icon` varchar(255) DEFAULT NULL COMMENT '菜单图标', |
| | | `url` varchar(255) DEFAULT NULL COMMENT 'url地址', |
| | | `num` int(65) DEFAULT NULL COMMENT '菜单排序号', |
| | | `levels` int(65) DEFAULT NULL COMMENT '菜单层级', |
| | | `ismenu` int(11) DEFAULT NULL COMMENT '是否是菜单(1:是 0:不是)', |
| | | `tips` varchar(255) DEFAULT NULL COMMENT '备注', |
| | | `status` int(65) DEFAULT NULL COMMENT '菜单状态 : 1:启用 0:不启用', |
| | | `isopen` int(11) DEFAULT NULL COMMENT '是否打开: 1:打开 0:不打开', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=561 DEFAULT CHARSET=utf8 COMMENT='菜单表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_menu |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_menu` VALUES ('1', 'code', '0', '[0],', '代码生成', 'fa-code', '/code', '1', '1', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('100', 'system', '0', '[0],', '系统管理', 'fa-user', '#', '100', '1', '1', null, '1', '1'); |
| | | INSERT INTO `sys_menu` VALUES ('101', 'mgr', 'system', '[0],[system],', '平台管理员', '', '/mgr', '101', '2', '1', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('102', 'mgr_list', 'mgr', '[0],[system],[mgr],', '用户列表', '', '/mgr/list', '102', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('103', 'mgr_add', 'mgr', '[0],[system],[mgr],', '添加用户', null, '/mgr/add', '103', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('104', 'mgr_edit', 'mgr', '[0],[system],[mgr],', '修改用户', null, '/mgr/edit', '104', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('105', 'mgr_delete', 'mgr', '[0],[system],[mgr],', '删除用户', null, '/mgr/delete', '105', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('106', 'mgr_reset', 'mgr', '[0],[system],[mgr],', '重置密码', null, '/mgr/reset', '106', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('107', 'mgr_freeze', 'mgr', '[0],[system],[mgr],', '冻结用户', null, '/mgr/freeze', '107', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('108', 'mgr_unfreeze', 'mgr', '[0],[system],[mgr],', '解除冻结用户', null, '/mgr/unfreeze', '108', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('109', 'mgr_setRole', 'mgr', '[0],[system],[mgr],', '分配角色', null, '/mgr/setRole', '109', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('110', 'to_assign_role', 'mgr', '[0],[system],[mgr],', '分配角色跳转', '', '/mgr/role_assign', '110', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('111', 'to_user_edit', 'mgr', '[0],[system],[mgr],', '编辑用户跳转', '', '/mgr/user_edit', '111', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('120', 'role', 'system', '[0],[system],', '角色管理', null, '/role', '120', '2', '1', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('121', 'role_list', 'role', '[0],[system],[role],', '角色列表', '', '/role/list', '121', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('122', 'role_add', 'role', '[0],[system],[role],', '添加角色', null, '/role/add', '122', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('123', 'role_edit', 'role', '[0],[system],[role],', '修改角色', null, '/role/edit', '123', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('124', 'role_remove', 'role', '[0],[system],[role],', '删除角色', null, '/role/remove', '124', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('125', 'role_setAuthority', 'role', '[0],[system],[role],', '配置权限', null, '/role/setAuthority', '125', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('126', 'to_role_edit', 'role', '[0],[system],[role],', '修改角色跳转', '', '/role/role_edit', '126', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('127', 'to_role_assign', 'role', '[0],[system],[role],', '角色分配跳转', '', '/role/role_assign', '127', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('130', 'menu', 'system', '[0],[system],', '菜单管理', null, '/menu', '130', '2', '1', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('131', 'menu_list', 'menu', '[0],[system],[menu],', '菜单列表', '', '/menu/list', '131', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('132', 'menu_add', 'menu', '[0],[system],[menu],', '添加菜单', null, '/menu/add', '132', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('133', 'menu_edit', 'menu', '[0],[system],[menu],', '修改菜单', null, '/menu/edit', '133', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('134', 'menu_remove', 'menu', '[0],[system],[menu],', '删除菜单', null, '/menu/remove', '134', '3', '0', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('135', 'to_menu_edit', 'menu', '[0],[system],[menu],', '菜单编辑跳转', '', '/menu/menu_edit', '135', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('140', 'dept', 'system', '[0],[system],', '部门管理', null, '/dept', '140', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('141', 'dept_list', 'dept', '[0],[system],[dept],', '部门列表', '', '/dept/list', '141', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('142', 'dept_add', 'dept', '[0],[system],[dept],', '添加部门', null, '/dept/add', '142', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('143', 'dept_update', 'dept', '[0],[system],[dept],', '修改部门', null, '/dept/update', '143', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('144', 'dept_delete', 'dept', '[0],[system],[dept],', '删除部门', null, '/dept/delete', '144', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('145', 'dept_detail', 'dept', '[0],[system],[dept],', '部门详情', '', '/dept/detail', '145', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('146', 'to_dept_update', 'dept', '[0],[system],[dept],', '修改部门跳转', '', '/dept/dept_update', '146', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('200', 'loginLog', 'system', '[0],[system],', '登录日志', null, '/loginLog', '200', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('201', 'login_log_list', 'loginLog', '[0],[system],[loginLog],', '登录日志列表', '', '/loginLog/list', '201', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('202', 'del_login_log', 'loginLog', '[0],[system],[loginLog],', '清空登录日志', '', '/loginLog/delLoginLog', '202', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('210', 'log', 'system', '[0],[system],', '业务日志', null, '/log', '210', '2', '1', null, '1', '0'); |
| | | INSERT INTO `sys_menu` VALUES ('211', 'log_list', 'log', '[0],[system],[log],', '日志列表', '', '/log/list', '211', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('212', 'log_detail', 'log', '[0],[system],[log],', '日志详情', '', '/log/detail', '212', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('213', 'log_clean', 'log', '[0],[system],[log],', '清空日志', null, '/log/delLog', '213', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('220', 'druid', 'system', '[0],[system],', '监控管理', null, '/druid', '220', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('230', 'dict', 'system', '[0],[system],', '字典管理', null, '/dict', '230', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('231', 'dict_list', 'dict', '[0],[system],[dict],', '字典列表', '', '/dict/list', '231', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('232', 'dict_add', 'dict', '[0],[system],[dict],', '添加字典', null, '/dict/add', '232', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('233', 'dict_update', 'dict', '[0],[system],[dict],', '修改字典', null, '/dict/update', '233', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('234', 'dict_delete', 'dict', '[0],[system],[dict],', '删除字典', null, '/dict/delete', '234', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('235', 'dict_detail', 'dict', '[0],[system],[dict],', '字典详情', '', '/dict/detail', '235', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('236', 'to_dict_edit', 'dict', '[0],[system],[dict],', '修改菜单跳转', '', '/dict/dict_edit', '236', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('240', 'notice', 'system', '[0],[system],', '通知管理', null, '/notice', '240', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('242', 'notice_add', 'notice', '[0],[system],[notice],', '添加通知', null, '/notice/add', '242', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('243', 'notice_update', 'notice', '[0],[system],[notice],', '修改通知', null, '/notice/update', '243', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('244', 'notice_delete', 'notice', '[0],[system],[notice],', '删除通知', null, '/notice/delete', '244', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('300', 'tUser_msg', '0', '[0],', '用户管理', 'fa-bars', '#', '300', '1', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('301', 'tUser_list', 'tUser_msg', '[0],[tUser_msg],', '用户列表', 'fa-bars', '/tUser', '301', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('520', 'tNotice_mgt', '0', '[0],', '公告管理', 'fa-bars', '#', '520', '1', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('521', 'tNotice_list', 'tNotice_mgt', '[0],[tNotice_mgt],', '公告列表', 'fa-bars', '/tNotice', '521', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('522', 'tNotice_add', 'tNotice_list', '[0],[tNotice_mgt],[tNotice_list],', '发布公告', 'fa-bars', '/tNotice/add', '522', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('523', 'tNotice_update', 'tNotice_list', '[0],[tNotice_mgt],[tNotice_list],', '编辑公告', 'fa-bars', '/tNotice/update', '523', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('524', 'tNotice_delete', 'tNotice_list', '[0],[tNotice_mgt],[tNotice_list],', '删除公告', 'fa-bars', '/tNotice/delete', '524', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('530', 'tFeedback_mgt', '0', '[0],', '反馈管理', 'fa-bars', '#', '530', '1', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('531', 'tFeedback_list', 'tFeedback_mgt', '[0],[tFeedback_mgt],', '反馈管理', 'fa-bars', '/tFeedback', '531', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('534', 'tFeedback_delete', 'tFeedback_list', '[0],[tFeedback_mgt],[tFeedback_list],', '删除反馈', 'fa-bars', '/tFeedback/delete', '534', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('535', 'tFeedback_updateState', 'tFeedback_list', '[0],[tFeedback_mgt],[tFeedback_list],', '处理反馈', 'fa-bars', '/tFeedback/updateState', '535', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('542', 'tBanner_list', 'tAppSet_mgt', '[0],[tAppSet_mgt],', 'Banner管理', 'fa-bars', '/tBanner', '542', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('543', 'tBanner_add', 'tBanner_list', '[0],[tAppSet_mgt],[tBanner_list],', '添加Banner', 'fa-bars', '/tBanner/add', '543', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('544', 'tBanner_update', 'tBanner_list', '[0],[tAppSet_mgt],[tBanner_list],', '编辑Banner', 'fa-bars', '/tBanner/update', '544', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('545', 'tBanner_delete', 'tBanner_list', '[0],[tAppSet_mgt],[tBanner_list],', '删除Banner', 'fa-bars', '/tBanner/delete', '545', '3', '0', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('550', 'tAppSet_mgt', '0', '[0],', 'APP管理', 'fa-bars', '#', '550', '1', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('551', 'tAppSet_html', 'tAppSet_mgt', '[0],[tAppSet_mgt],', '协议设置', 'fa-bars', '/tAppSet/html', '551', '2', '1', null, '1', null); |
| | | INSERT INTO `sys_menu` VALUES ('560', 'tSystemSet_mgt', '0', '[0],', '系统设置', 'fa-bars', '/tSystemSet', '560', '1', '1', null, '1', null); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_notice |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_notice`; |
| | | CREATE TABLE `sys_notice` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', |
| | | `title` varchar(255) DEFAULT NULL COMMENT '标题', |
| | | `type` int(11) DEFAULT NULL COMMENT '类型', |
| | | `content` text COMMENT '内容', |
| | | `createtime` datetime DEFAULT NULL COMMENT '创建时间', |
| | | `creater` int(11) DEFAULT NULL COMMENT '创建人', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='通知表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_notice |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_notice` VALUES ('6', '世界', '10', '欢迎使用game管理系统', '2017-01-11 08:53:20', '1'); |
| | | INSERT INTO `sys_notice` VALUES ('8', '你好', null, '你好', '2017-05-10 19:28:57', '1'); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_operation_log |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_operation_log`; |
| | | CREATE TABLE `sys_operation_log` ( |
| | | `id` int(65) NOT NULL AUTO_INCREMENT COMMENT '主键', |
| | | `logtype` varchar(255) DEFAULT NULL COMMENT '日志类型', |
| | | `logname` varchar(255) DEFAULT NULL COMMENT '日志名称', |
| | | `userid` int(65) DEFAULT NULL COMMENT '用户id', |
| | | `classname` varchar(255) DEFAULT NULL COMMENT '类名称', |
| | | `method` text COMMENT '方法名称', |
| | | `createtime` datetime DEFAULT NULL COMMENT '创建时间', |
| | | `succeed` varchar(255) DEFAULT NULL COMMENT '是否成功', |
| | | `message` text COMMENT '备注', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=597 DEFAULT CHARSET=utf8 COMMENT='操作日志'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_operation_log |
| | | -- ---------------------------- |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_relation |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_relation`; |
| | | CREATE TABLE `sys_relation` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', |
| | | `menuid` bigint(11) DEFAULT NULL COMMENT '菜单id', |
| | | `roleid` int(11) DEFAULT NULL COMMENT '角色id', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=4871 DEFAULT CHARSET=utf8 COMMENT='角色和菜单关联表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_relation |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_relation` VALUES ('4661', null, '5'); |
| | | INSERT INTO `sys_relation` VALUES ('4800', '1', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4801', '100', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4802', '101', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4803', '102', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4804', '103', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4805', '104', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4806', '105', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4807', '106', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4808', '107', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4809', '108', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4810', '109', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4811', '110', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4812', '111', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4813', '120', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4814', '121', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4815', '122', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4816', '123', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4817', '124', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4818', '125', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4819', '126', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4820', '127', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4821', '130', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4822', '131', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4823', '132', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4824', '133', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4825', '134', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4826', '135', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4827', '140', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4828', '141', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4829', '142', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4830', '143', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4831', '144', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4832', '145', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4833', '146', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4834', '200', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4835', '201', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4836', '202', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4837', '210', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4838', '211', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4839', '212', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4840', '213', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4841', '220', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4842', '230', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4843', '231', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4844', '232', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4845', '233', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4846', '234', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4847', '235', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4848', '236', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4849', '240', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4850', '242', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4851', '243', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4852', '244', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4853', '300', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4854', '301', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4855', '520', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4856', '521', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4857', '522', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4858', '523', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4859', '524', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4860', '530', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4861', '531', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4862', '534', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4863', '535', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4864', '550', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4865', '542', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4866', '543', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4867', '544', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4868', '545', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4869', '551', '1'); |
| | | INSERT INTO `sys_relation` VALUES ('4870', '560', '1'); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_role |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_role`; |
| | | CREATE TABLE `sys_role` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', |
| | | `num` int(11) DEFAULT NULL COMMENT '序号', |
| | | `pid` int(11) DEFAULT NULL COMMENT '父角色id', |
| | | `name` varchar(255) DEFAULT NULL COMMENT '角色名称', |
| | | `deptid` int(11) DEFAULT NULL COMMENT '部门名称', |
| | | `tips` varchar(255) DEFAULT NULL COMMENT '提示', |
| | | `version` int(11) DEFAULT NULL COMMENT '保留字段(暂时没用)', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='角色表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_role |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_role` VALUES ('1', '1', '0', '超级管理员', '24', 'administrator', '1'); |
| | | INSERT INTO `sys_role` VALUES ('5', '2', '1', '临时', '26', 'temp', null); |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sys_user |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sys_user`; |
| | | CREATE TABLE `sys_user` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', |
| | | `avatar` varchar(255) DEFAULT NULL COMMENT '头像', |
| | | `account` varchar(45) DEFAULT NULL COMMENT '账号', |
| | | `password` varchar(45) DEFAULT NULL COMMENT '密码', |
| | | `salt` varchar(45) DEFAULT NULL COMMENT 'md5密码盐', |
| | | `name` varchar(45) DEFAULT NULL COMMENT '名字', |
| | | `birthday` datetime DEFAULT NULL COMMENT '生日', |
| | | `sex` int(11) DEFAULT NULL COMMENT '性别(1:男 2:女)', |
| | | `email` varchar(45) DEFAULT NULL COMMENT '电子邮件', |
| | | `phone` varchar(45) DEFAULT NULL COMMENT '电话', |
| | | `roleid` varchar(255) DEFAULT NULL COMMENT '角色id', |
| | | `deptid` int(11) DEFAULT NULL COMMENT '部门id', |
| | | `status` int(11) DEFAULT NULL COMMENT '状态(1:启用 2:冻结 3:删除)', |
| | | `createtime` datetime DEFAULT NULL COMMENT '创建时间', |
| | | `version` int(11) DEFAULT NULL COMMENT '保留字段', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COMMENT='管理员表'; |
| | | |
| | | -- ---------------------------- |
| | | -- Records of sys_user |
| | | -- ---------------------------- |
| | | INSERT INTO `sys_user` VALUES ('1', 'girl.gif', 'admin', 'ecfadcde9305f8891bcfe5a1e28c253e', '8pgby', '张三', '2017-05-05 00:00:00', '2', 'sn93@qq.com', '18200000000', '1', '27', '1', '2016-01-29 08:49:53', '25'); |
| | | INSERT INTO `sys_user` VALUES ('44', null, 'test', '45abb7879f6a8268f1ef600e6038ac73', 'ssts3', 'test', '2017-05-01 00:00:00', '1', 'abc@123.com', '', '5', '26', '3', '2017-05-16 20:33:37', null); |
| | | INSERT INTO `sys_user` VALUES ('45', null, 'boss', '71887a5ad666a18f709e1d4e693d5a35', '1f7bf', '老板', '2017-12-04 00:00:00', '1', '', '', '1', '24', '1', '2017-12-04 22:24:02', null); |
| | | INSERT INTO `sys_user` VALUES ('46', null, 'manager', 'b53cac62e7175637d4beb3b16b2f7915', 'j3cs9', '经理', '2017-12-04 00:00:00', '1', '', '', '1', '24', '1', '2017-12-04 22:24:24', null); |
| | | |
New file |
| | |
| | | package com.stylefeng.guns; |
| | | |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.config.SocketConfig; |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * SpringBoot方式启动类 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/21 12:06 |
| | | */ |
| | | @EnableScheduling//开启定时任务 |
| | | @SpringBootApplication |
| | | public class GunsApplication { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | logger.info("GunsApplication is success!"); |
| | | } |
| | | |
| | | @Bean //通过ip地址调用 |
| | | public RestTemplate restTemplate() { |
| | | PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); |
| | | connectionManager.setDefaultSocketConfig(SocketConfig.custom().setTcpNoDelay(true).build()); |
| | | connectionManager.setDefaultMaxPerRoute(100);//最大并发连接 |
| | | connectionManager.setMaxTotal(200); // 总的最大连接数 |
| | | HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager).build(); |
| | | HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); |
| | | httpRequestFactory.setConnectionRequestTimeout(30 * 1000); |
| | | httpRequestFactory.setConnectTimeout(30 * 3000); |
| | | httpRequestFactory.setReadTimeout(30 * 3000); |
| | | RestTemplate restTemplate = new RestTemplate(httpRequestFactory); |
| | | restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); |
| | | return restTemplate; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns; |
| | | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | |
| | | /** |
| | | * Guns Web程序启动类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-21 9:43 |
| | | */ |
| | | public class GunsServletInitializer extends SpringBootServletInitializer { |
| | | |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | return builder.sources(GunsApplication.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import net.sf.ehcache.CacheManager; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | | import org.springframework.cache.ehcache.EhCacheCacheManager; |
| | | import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | |
| | | /** |
| | | * ehcache配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-20 23:11 |
| | | */ |
| | | @Configuration |
| | | @EnableCaching |
| | | public class EhCacheConfig { |
| | | |
| | | /** |
| | | * EhCache的配置 |
| | | */ |
| | | @Bean |
| | | public EhCacheCacheManager cacheManager(CacheManager cacheManager) { |
| | | return new EhCacheCacheManager(cacheManager); |
| | | } |
| | | |
| | | /** |
| | | * EhCache的配置 |
| | | */ |
| | | @Bean |
| | | public EhCacheManagerFactoryBean ehcache() { |
| | | EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); |
| | | ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml")); |
| | | return ehCacheManagerFactoryBean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | |
| | | /** |
| | | * spring session配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-07-13 21:05 |
| | | */ |
| | | //@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 1800) //session过期时间 如果部署多机环境,需要打开注释 |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | public class SpringSessionConfig { |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * swagger配置类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年6月1日19:42:59 |
| | | */ |
| | | @Configuration |
| | | @EnableSwagger2 |
| | | @ConditionalOnProperty(prefix = "guns", name = "swagger-open", havingValue = "true") |
| | | public class SwaggerConfig{ |
| | | |
| | | @Bean |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) //这里采用包含注解的方式来确定要显示的接口 |
| | | //.apis(RequestHandlerSelectors.basePackage("com.stylefeng.guns.controller.system.controller")) //这里采用包扫描的方式来确定要显示的接口 |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("Guns Doc") |
| | | .description("Guns Api文档") |
| | | .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | | .contact("stylefeng") |
| | | .version("2.0") |
| | | .build(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.datasource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.stylefeng.guns.core.config.properties.DruidProperties; |
| | | import com.stylefeng.guns.core.config.properties.MutiDataSourceProperties; |
| | | import com.stylefeng.guns.core.datascope.DataScopeInterceptor; |
| | | import com.stylefeng.guns.core.mutidatasource.DynamicDataSource; |
| | | import com.stylefeng.guns.core.mutidatasource.aop.MultiSourceExAop; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 多数据源配置<br/> |
| | | * <p> |
| | | * 注:由于引入多数据源,所以让spring事务的aop要在多数据源切换aop的后面 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/20 21:58 |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "true") |
| | | @EnableTransactionManagement(order = 2) |
| | | @MapperScan(basePackages = {"com.stylefeng.guns.modular.system.dao"}) |
| | | public class MultiDataSourceConfig { |
| | | |
| | | @Bean |
| | | @ConfigurationProperties(prefix = "guns.muti-datasource") |
| | | public MutiDataSourceProperties mutiDataSourceProperties() { |
| | | return new MutiDataSourceProperties(); |
| | | } |
| | | |
| | | @Bean |
| | | public MultiSourceExAop multiSourceExAop() { |
| | | return new MultiSourceExAop(); |
| | | } |
| | | |
| | | /** |
| | | * guns的数据源 |
| | | */ |
| | | private DruidDataSource dataSource(DruidProperties druidProperties) { |
| | | DruidDataSource dataSource = new DruidDataSource(); |
| | | druidProperties.config(dataSource); |
| | | return dataSource; |
| | | } |
| | | |
| | | /** |
| | | * 多数据源,第二个数据源 |
| | | */ |
| | | private DruidDataSource bizDataSource(DruidProperties druidProperties, MutiDataSourceProperties mutiDataSourceProperties) { |
| | | DruidDataSource dataSource = new DruidDataSource(); |
| | | druidProperties.config(dataSource); |
| | | mutiDataSourceProperties.config(dataSource); |
| | | return dataSource; |
| | | } |
| | | |
| | | /** |
| | | * 多数据源连接池配置 |
| | | */ |
| | | @Bean |
| | | public DynamicDataSource mutiDataSource(DruidProperties druidProperties, MutiDataSourceProperties mutiDataSourceProperties) { |
| | | |
| | | DruidDataSource dataSourceGuns = dataSource(druidProperties); |
| | | DruidDataSource bizDataSource = bizDataSource(druidProperties, mutiDataSourceProperties); |
| | | |
| | | try { |
| | | dataSourceGuns.init(); |
| | | bizDataSource.init(); |
| | | } catch (SQLException sql) { |
| | | sql.printStackTrace(); |
| | | } |
| | | |
| | | DynamicDataSource dynamicDataSource = new DynamicDataSource(); |
| | | HashMap<Object, Object> hashMap = new HashMap<>(); |
| | | hashMap.put(mutiDataSourceProperties.getDataSourceNames()[0], dataSourceGuns); |
| | | hashMap.put(mutiDataSourceProperties.getDataSourceNames()[1], bizDataSource); |
| | | dynamicDataSource.setTargetDataSources(hashMap); |
| | | dynamicDataSource.setDefaultTargetDataSource(dataSourceGuns); |
| | | return dynamicDataSource; |
| | | } |
| | | |
| | | /** |
| | | * mybatis-plus分页插件 |
| | | */ |
| | | @Bean |
| | | public PaginationInterceptor paginationInterceptor() { |
| | | return new PaginationInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 数据范围mybatis插件 |
| | | */ |
| | | @Bean |
| | | public DataScopeInterceptor dataScopeInterceptor() { |
| | | return new DataScopeInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 乐观锁mybatis插件 |
| | | */ |
| | | @Bean |
| | | public OptimisticLockerInterceptor optimisticLockerInterceptor() { |
| | | return new OptimisticLockerInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 事务配置 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/6/27 23:11 |
| | | */ |
| | | @Bean |
| | | public DataSourceTransactionManager dataSourceTransactionManager(DynamicDataSource mutiDataSource) { |
| | | return new DataSourceTransactionManager(mutiDataSource); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.datasource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.stylefeng.guns.core.config.properties.DruidProperties; |
| | | import com.stylefeng.guns.core.datascope.DataScopeInterceptor; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 多数据源配置 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/20 21:58 |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "false", matchIfMissing = true) |
| | | @EnableTransactionManagement |
| | | @MapperScan(basePackages = {"com.stylefeng.guns.modular.system.dao"}) |
| | | public class SingleDataSourceConfig { |
| | | |
| | | /** |
| | | * 单数据源连接池配置 |
| | | */ |
| | | @Bean |
| | | public DruidDataSource dataSource(DruidProperties druidProperties) { |
| | | DruidDataSource dataSource = new DruidDataSource(); |
| | | druidProperties.config(dataSource); |
| | | return dataSource; |
| | | } |
| | | |
| | | /** |
| | | * mybatis-plus分页插件 |
| | | */ |
| | | @Bean |
| | | public PaginationInterceptor paginationInterceptor() { |
| | | return new PaginationInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 数据范围mybatis插件 |
| | | */ |
| | | @Bean |
| | | public DataScopeInterceptor dataScopeInterceptor() { |
| | | return new DataScopeInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 乐观锁mybatis插件 |
| | | */ |
| | | @Bean |
| | | public OptimisticLockerInterceptor optimisticLockerInterceptor() { |
| | | return new OptimisticLockerInterceptor(); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.config.properties; |
| | | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * beetl配置(如果需要配置别的配置可参照这个形式自己添加) |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-24 20:37 |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = BeetlProperties.BEETLCONF_PREFIX) |
| | | public class BeetlProperties { |
| | | |
| | | public static final String BEETLCONF_PREFIX = "beetl"; |
| | | |
| | | private String delimiterStatementStart; |
| | | |
| | | private String delimiterStatementEnd; |
| | | |
| | | private String resourceTagroot; |
| | | |
| | | private String resourceTagsuffix; |
| | | |
| | | private String resourceAutoCheck; |
| | | |
| | | @Value("${spring.mvc.view.prefix}") |
| | | private String prefix; |
| | | |
| | | public Properties getProperties(){ |
| | | Properties properties = new Properties(); |
| | | if(ToolUtil.isNotEmpty(delimiterStatementStart)){ |
| | | if(delimiterStatementStart.startsWith("\\")){ |
| | | delimiterStatementStart = delimiterStatementStart.substring(1); |
| | | } |
| | | properties.setProperty("DELIMITER_STATEMENT_START",delimiterStatementStart); |
| | | } |
| | | if(ToolUtil.isNotEmpty(delimiterStatementEnd)){ |
| | | properties.setProperty("DELIMITER_STATEMENT_END",delimiterStatementEnd); |
| | | }else{ |
| | | properties.setProperty("DELIMITER_STATEMENT_END","null"); |
| | | } |
| | | if(ToolUtil.isNotEmpty(resourceTagroot)){ |
| | | properties.setProperty("RESOURCE.tagRoot",resourceTagroot); |
| | | } |
| | | if(ToolUtil.isNotEmpty(resourceTagsuffix)){ |
| | | properties.setProperty("RESOURCE.tagSuffix",resourceTagsuffix); |
| | | } |
| | | if(ToolUtil.isNotEmpty(resourceAutoCheck)){ |
| | | properties.setProperty("RESOURCE.autoCheck",resourceAutoCheck); |
| | | } |
| | | return properties; |
| | | } |
| | | |
| | | public String getPrefix() { |
| | | return prefix; |
| | | } |
| | | |
| | | public String getDelimiterStatementStart() { |
| | | return delimiterStatementStart; |
| | | } |
| | | |
| | | public void setDelimiterStatementStart(String delimiterStatementStart) { |
| | | this.delimiterStatementStart = delimiterStatementStart; |
| | | } |
| | | |
| | | public String getDelimiterStatementEnd() { |
| | | return delimiterStatementEnd; |
| | | } |
| | | |
| | | public void setDelimiterStatementEnd(String delimiterStatementEnd) { |
| | | this.delimiterStatementEnd = delimiterStatementEnd; |
| | | } |
| | | |
| | | public String getResourceTagroot() { |
| | | return resourceTagroot; |
| | | } |
| | | |
| | | public void setResourceTagroot(String resourceTagroot) { |
| | | this.resourceTagroot = resourceTagroot; |
| | | } |
| | | |
| | | public String getResourceTagsuffix() { |
| | | return resourceTagsuffix; |
| | | } |
| | | |
| | | public void setResourceTagsuffix(String resourceTagsuffix) { |
| | | this.resourceTagsuffix = resourceTagsuffix; |
| | | } |
| | | |
| | | public String getResourceAutoCheck() { |
| | | return resourceAutoCheck; |
| | | } |
| | | |
| | | public void setResourceAutoCheck(String resourceAutoCheck) { |
| | | this.resourceAutoCheck = resourceAutoCheck; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.properties; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | |
| | | import static com.stylefeng.guns.core.util.ToolUtil.getTempPath; |
| | | import static com.stylefeng.guns.core.util.ToolUtil.isEmpty; |
| | | |
| | | /** |
| | | * guns项目配置 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/23 22:31 |
| | | */ |
| | | @Component |
| | | @ConfigurationProperties(prefix = GunsProperties.PREFIX) |
| | | public class GunsProperties { |
| | | |
| | | public static final String PREFIX = "guns"; |
| | | |
| | | private Boolean kaptchaOpen = false; |
| | | |
| | | private Boolean swaggerOpen = false; |
| | | |
| | | // 文件上传位置配置 |
| | | private String fileUploadPath; |
| | | |
| | | // 文件服务器访问地址 |
| | | private String pictureServerAddress; |
| | | |
| | | private Boolean haveCreatePath = false; |
| | | |
| | | private Boolean springSessionOpen = false; |
| | | |
| | | /** |
| | | * session 失效时间(默认为30分钟 单位:秒) |
| | | */ |
| | | private Integer sessionInvalidateTime = 30 * 60; |
| | | |
| | | /** |
| | | * session 验证失效时间(默认为15分钟 单位:秒) |
| | | */ |
| | | private Integer sessionValidationInterval = 15 * 60; |
| | | /** |
| | | *前端接口调用基础路径 |
| | | */ |
| | | private String restUrl; |
| | | |
| | | public String getFileUploadPath() { |
| | | //如果没有写文件上传路径,保存到临时目录 |
| | | if (isEmpty(fileUploadPath)) { |
| | | return getTempPath(); |
| | | } else { |
| | | //判断有没有结尾符,没有得加上 |
| | | if (!fileUploadPath.endsWith(File.separator)) { |
| | | fileUploadPath = fileUploadPath + File.separator; |
| | | } |
| | | //判断目录存不存在,不存在得加上 |
| | | if (!haveCreatePath) { |
| | | File file = new File(fileUploadPath); |
| | | file.mkdirs(); |
| | | haveCreatePath = true; |
| | | } |
| | | return fileUploadPath; |
| | | } |
| | | } |
| | | |
| | | public void setFileUploadPath(String fileUploadPath) { |
| | | this.fileUploadPath = fileUploadPath; |
| | | } |
| | | |
| | | public String getPictureServerAddress() { |
| | | return pictureServerAddress; |
| | | } |
| | | |
| | | public void setPictureServerAddress(String pictureServerAddress) { |
| | | this.pictureServerAddress = pictureServerAddress; |
| | | } |
| | | |
| | | public Boolean getKaptchaOpen() { |
| | | return kaptchaOpen; |
| | | } |
| | | |
| | | public void setKaptchaOpen(Boolean kaptchaOpen) { |
| | | this.kaptchaOpen = kaptchaOpen; |
| | | } |
| | | |
| | | public Boolean getSwaggerOpen() { |
| | | return swaggerOpen; |
| | | } |
| | | |
| | | public void setSwaggerOpen(Boolean swaggerOpen) { |
| | | this.swaggerOpen = swaggerOpen; |
| | | } |
| | | |
| | | public Boolean getSpringSessionOpen() { |
| | | return springSessionOpen; |
| | | } |
| | | |
| | | public void setSpringSessionOpen(Boolean springSessionOpen) { |
| | | this.springSessionOpen = springSessionOpen; |
| | | } |
| | | |
| | | public Integer getSessionInvalidateTime() { |
| | | return sessionInvalidateTime; |
| | | } |
| | | |
| | | public void setSessionInvalidateTime(Integer sessionInvalidateTime) { |
| | | this.sessionInvalidateTime = sessionInvalidateTime; |
| | | } |
| | | |
| | | public Integer getSessionValidationInterval() { |
| | | return sessionValidationInterval; |
| | | } |
| | | |
| | | public void setSessionValidationInterval(Integer sessionValidationInterval) { |
| | | this.sessionValidationInterval = sessionValidationInterval; |
| | | } |
| | | |
| | | public String getRestUrl() { |
| | | return restUrl; |
| | | } |
| | | |
| | | public void setRestUrl(String restUrl) { |
| | | this.restUrl = restUrl; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.web; |
| | | |
| | | import com.stylefeng.guns.config.properties.BeetlProperties; |
| | | import com.stylefeng.guns.core.beetl.BeetlConfiguration; |
| | | import org.beetl.core.resource.ClasspathResourceLoader; |
| | | import org.beetl.ext.spring.BeetlSpringViewResolver; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * web 配置类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月12日 下午5:03:32 |
| | | */ |
| | | @Configuration |
| | | public class BeetlConfig { |
| | | |
| | | @Autowired |
| | | BeetlProperties beetlProperties; |
| | | |
| | | /** |
| | | * beetl的配置 |
| | | */ |
| | | @Bean(initMethod = "init") |
| | | public BeetlConfiguration beetlConfiguration() { |
| | | BeetlConfiguration beetlConfiguration = new BeetlConfiguration(); |
| | | beetlConfiguration.setResourceLoader(new ClasspathResourceLoader(BeetlConfig.class.getClassLoader(), beetlProperties.getPrefix())); |
| | | beetlConfiguration.setConfigProperties(beetlProperties.getProperties()); |
| | | return beetlConfiguration; |
| | | } |
| | | |
| | | /** |
| | | * beetl的视图解析器 |
| | | */ |
| | | @Bean |
| | | public BeetlSpringViewResolver beetlViewResolver() { |
| | | BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver(); |
| | | beetlSpringViewResolver.setConfig(beetlConfiguration()); |
| | | beetlSpringViewResolver.setContentType("text/html;charset=UTF-8"); |
| | | beetlSpringViewResolver.setOrder(0); |
| | | return beetlSpringViewResolver; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.web; |
| | | |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.intercept.GunsUserFilter; |
| | | import com.stylefeng.guns.core.shiro.ShiroDbRealm; |
| | | import org.apache.shiro.cache.CacheManager; |
| | | import org.apache.shiro.cache.ehcache.EhCacheManager; |
| | | import org.apache.shiro.codec.Base64; |
| | | import org.apache.shiro.session.mgt.SessionManager; |
| | | import org.apache.shiro.spring.LifecycleBeanPostProcessor; |
| | | import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; |
| | | import org.apache.shiro.spring.web.ShiroFilterFactoryBean; |
| | | import org.apache.shiro.web.mgt.CookieRememberMeManager; |
| | | import org.apache.shiro.web.mgt.DefaultWebSecurityManager; |
| | | import org.apache.shiro.web.servlet.Cookie; |
| | | import org.apache.shiro.web.servlet.ShiroHttpSession; |
| | | import org.apache.shiro.web.servlet.SimpleCookie; |
| | | import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; |
| | | import org.apache.shiro.web.session.mgt.ServletContainerSessionManager; |
| | | import org.springframework.beans.factory.config.MethodInvokingFactoryBean; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.servlet.Filter; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * shiro权限管理的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月14日 下午3:03:44 |
| | | */ |
| | | @Configuration |
| | | public class ShiroConfig { |
| | | |
| | | /** |
| | | * 安全管理器 |
| | | */ |
| | | @Bean |
| | | public DefaultWebSecurityManager securityManager(CookieRememberMeManager rememberMeManager, CacheManager cacheShiroManager, SessionManager sessionManager) { |
| | | DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); |
| | | securityManager.setRealm(this.shiroDbRealm()); |
| | | securityManager.setCacheManager(cacheShiroManager); |
| | | securityManager.setRememberMeManager(rememberMeManager); |
| | | securityManager.setSessionManager(sessionManager); |
| | | return securityManager; |
| | | } |
| | | |
| | | /** |
| | | * spring session管理器(多机环境) |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | public ServletContainerSessionManager servletContainerSessionManager() { |
| | | return new ServletContainerSessionManager(); |
| | | } |
| | | |
| | | /** |
| | | * session管理器(单机环境) |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "false") |
| | | public DefaultWebSessionManager defaultWebSessionManager(CacheManager cacheShiroManager, GunsProperties gunsProperties) { |
| | | DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); |
| | | sessionManager.setCacheManager(cacheShiroManager); |
| | | sessionManager.setSessionValidationInterval(gunsProperties.getSessionValidationInterval() * 1000); |
| | | sessionManager.setGlobalSessionTimeout(gunsProperties.getSessionInvalidateTime() * 1000); |
| | | sessionManager.setDeleteInvalidSessions(true); |
| | | sessionManager.setSessionValidationSchedulerEnabled(true); |
| | | Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME); |
| | | cookie.setName("shiroCookie"); |
| | | cookie.setHttpOnly(true); |
| | | sessionManager.setSessionIdCookie(cookie); |
| | | return sessionManager; |
| | | } |
| | | |
| | | /** |
| | | * 缓存管理器 使用Ehcache实现 |
| | | */ |
| | | @Bean |
| | | public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) { |
| | | EhCacheManager ehCacheManager = new EhCacheManager(); |
| | | ehCacheManager.setCacheManager(ehcache.getObject()); |
| | | return ehCacheManager; |
| | | } |
| | | |
| | | /** |
| | | * 项目自定义的Realm |
| | | */ |
| | | @Bean |
| | | public ShiroDbRealm shiroDbRealm() { |
| | | return new ShiroDbRealm(); |
| | | } |
| | | |
| | | /** |
| | | * rememberMe管理器, cipherKey生成见{@code Base64Test.java} |
| | | */ |
| | | @Bean |
| | | public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) { |
| | | CookieRememberMeManager manager = new CookieRememberMeManager(); |
| | | manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA==")); |
| | | manager.setCookie(rememberMeCookie); |
| | | return manager; |
| | | } |
| | | |
| | | /** |
| | | * 记住密码Cookie |
| | | */ |
| | | @Bean |
| | | public SimpleCookie rememberMeCookie() { |
| | | SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); |
| | | simpleCookie.setHttpOnly(true); |
| | | simpleCookie.setMaxAge(7 * 24 * 60 * 60);//7天 |
| | | return simpleCookie; |
| | | } |
| | | |
| | | /** |
| | | * Shiro的过滤器链 |
| | | */ |
| | | @Bean |
| | | public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) { |
| | | ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); |
| | | shiroFilter.setSecurityManager(securityManager); |
| | | /** |
| | | * 默认的登陆访问url |
| | | */ |
| | | shiroFilter.setLoginUrl("/login"); |
| | | /** |
| | | * 登陆成功后跳转的url |
| | | */ |
| | | shiroFilter.setSuccessUrl("/"); |
| | | /** |
| | | * 没有权限跳转的url |
| | | */ |
| | | shiroFilter.setUnauthorizedUrl("/global/error"); |
| | | |
| | | /** |
| | | * 覆盖默认的user拦截器(默认拦截器解决不了ajax请求 session超时的问题,若有更好的办法请及时反馈作者) |
| | | */ |
| | | HashMap<String, Filter> myFilters = new HashMap<>(); |
| | | myFilters.put("user", new GunsUserFilter()); |
| | | shiroFilter.setFilters(myFilters); |
| | | |
| | | /** |
| | | * 配置shiro拦截器链 |
| | | * |
| | | * anon 不需要认证 |
| | | * authc 需要认证 |
| | | * user 验证通过或RememberMe登录的都可以 |
| | | * |
| | | * 当应用开启了rememberMe时,用户下次访问时可以是一个user,但不会是authc,因为authc是需要重新认证的 |
| | | * |
| | | * 顺序从上到下,优先级依次降低 |
| | | * |
| | | * api开头的接口,走rest api鉴权,不走shiro鉴权 |
| | | * |
| | | */ |
| | | Map<String, String> hashMap = new LinkedHashMap<>(); |
| | | hashMap.put("/static/**", "anon"); |
| | | hashMap.put("/gunsApi/**", "anon"); |
| | | hashMap.put("/login", "anon"); |
| | | hashMap.put("/global/sessionError", "anon"); |
| | | hashMap.put("/kaptcha", "anon"); |
| | | hashMap.put("/**", "user"); |
| | | shiroFilter.setFilterChainDefinitionMap(hashMap); |
| | | return shiroFilter; |
| | | } |
| | | |
| | | /** |
| | | * 在方法中 注入 securityManager,进行代理控制 |
| | | */ |
| | | @Bean |
| | | public MethodInvokingFactoryBean methodInvokingFactoryBean(DefaultWebSecurityManager securityManager) { |
| | | MethodInvokingFactoryBean bean = new MethodInvokingFactoryBean(); |
| | | bean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager"); |
| | | bean.setArguments(new Object[]{securityManager}); |
| | | return bean; |
| | | } |
| | | |
| | | /** |
| | | * Shiro生命周期处理器: |
| | | * 用于在实现了Initializable接口的Shiro bean初始化时调用Initializable接口回调(例如:UserRealm) |
| | | * 在实现了Destroyable接口的Shiro bean销毁时调用 Destroyable接口回调(例如:DefaultSecurityManager) |
| | | */ |
| | | @Bean |
| | | public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { |
| | | return new LifecycleBeanPostProcessor(); |
| | | } |
| | | |
| | | /** |
| | | * 启用shrio授权注解拦截方式,AOP式方法级权限检查 |
| | | */ |
| | | @Bean |
| | | public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) { |
| | | AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = |
| | | new AuthorizationAttributeSourceAdvisor(); |
| | | authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); |
| | | return authorizationAttributeSourceAdvisor; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.web; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.alibaba.druid.support.http.StatViewServlet; |
| | | import com.alibaba.druid.support.http.WebStatFilter; |
| | | import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator; |
| | | import com.alibaba.druid.support.spring.stat.DruidStatInterceptor; |
| | | import com.google.code.kaptcha.impl.DefaultKaptcha; |
| | | import com.google.code.kaptcha.util.Config; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.intercept.RestApiInteceptor; |
| | | import com.stylefeng.guns.core.listener.ConfigListener; |
| | | import com.stylefeng.guns.core.xss.XssFilter; |
| | | import org.springframework.aop.Advisor; |
| | | import org.springframework.aop.support.DefaultPointcutAdvisor; |
| | | import org.springframework.aop.support.JdkRegexpMethodPointcut; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; |
| | | import org.springframework.boot.web.servlet.ServletRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.context.request.RequestContextListener; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * web 配置类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月12日 下午5:03:32 |
| | | */ |
| | | @Configuration |
| | | public class WebConfig extends WebMvcConfigurerAdapter { |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | /** |
| | | * 增加swagger的支持 |
| | | */ |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | if (gunsProperties.getSwaggerOpen()) { |
| | | registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); |
| | | registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 增加对rest api鉴权的spring mvc拦截器 |
| | | */ |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | registry.addInterceptor(new RestApiInteceptor()).addPathPatterns("/gunsApi/**"); |
| | | } |
| | | |
| | | /** |
| | | * druidServlet注册 |
| | | */ |
| | | @Bean |
| | | public ServletRegistrationBean druidServletRegistration() { |
| | | ServletRegistrationBean registration = new ServletRegistrationBean(new StatViewServlet()); |
| | | registration.addUrlMappings("/druid/*"); |
| | | return registration; |
| | | } |
| | | |
| | | /** |
| | | * druid监控 配置URI拦截策略 |
| | | */ |
| | | @Bean |
| | | public FilterRegistrationBean druidStatFilter() { |
| | | FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter()); |
| | | //添加过滤规则. |
| | | filterRegistrationBean.addUrlPatterns("/*"); |
| | | //添加不需要忽略的格式信息. |
| | | filterRegistrationBean.addInitParameter( |
| | | "exclusions", "/static/*,*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid,/druid/*"); |
| | | //用于session监控页面的用户名显示 需要登录后主动将username注入到session里 |
| | | filterRegistrationBean.addInitParameter("principalSessionName", "username"); |
| | | return filterRegistrationBean; |
| | | } |
| | | |
| | | /** |
| | | * druid数据库连接池监控 |
| | | */ |
| | | @Bean |
| | | public DruidStatInterceptor druidStatInterceptor() { |
| | | return new DruidStatInterceptor(); |
| | | } |
| | | |
| | | @Bean |
| | | public JdkRegexpMethodPointcut druidStatPointcut() { |
| | | JdkRegexpMethodPointcut druidStatPointcut = new JdkRegexpMethodPointcut(); |
| | | String patterns = "com.stylefeng.guns.controller.*.service.*"; |
| | | //可以set多个 |
| | | druidStatPointcut.setPatterns(patterns); |
| | | return druidStatPointcut; |
| | | } |
| | | |
| | | /** |
| | | * druid数据库连接池监控 |
| | | */ |
| | | @Bean |
| | | public BeanTypeAutoProxyCreator beanTypeAutoProxyCreator() { |
| | | BeanTypeAutoProxyCreator beanTypeAutoProxyCreator = new BeanTypeAutoProxyCreator(); |
| | | beanTypeAutoProxyCreator.setTargetBeanType(DruidDataSource.class); |
| | | beanTypeAutoProxyCreator.setInterceptorNames("druidStatInterceptor"); |
| | | return beanTypeAutoProxyCreator; |
| | | } |
| | | |
| | | /** |
| | | * druid 为druidStatPointcut添加拦截 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public Advisor druidStatAdvisor() { |
| | | return new DefaultPointcutAdvisor(druidStatPointcut(), druidStatInterceptor()); |
| | | } |
| | | |
| | | /** |
| | | * xssFilter注册 |
| | | */ |
| | | @Bean |
| | | public FilterRegistrationBean xssFilterRegistration() { |
| | | XssFilter xssFilter = new XssFilter(); |
| | | xssFilter.setUrlExclusion(Arrays.asList("/tAgreement/updateAppParam","/tAdvertisement/add","/tAdvertisement/update","/tNotices/addSystem","/tNotices/updateSystem" |
| | | ,"/tIntegralGoods/add","/tIntegralGoods/update")); |
| | | FilterRegistrationBean registration = new FilterRegistrationBean(xssFilter); |
| | | registration.addUrlPatterns("/*"); |
| | | return registration; |
| | | } |
| | | |
| | | /** |
| | | * RequestContextListener注册 |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<RequestContextListener> requestContextListenerRegistration() { |
| | | return new ServletListenerRegistrationBean<>(new RequestContextListener()); |
| | | } |
| | | |
| | | /** |
| | | * ConfigListener注册 |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<ConfigListener> configListenerRegistration() { |
| | | return new ServletListenerRegistrationBean<>(new ConfigListener()); |
| | | } |
| | | |
| | | /** |
| | | * 验证码生成相关 |
| | | */ |
| | | @Bean |
| | | public DefaultKaptcha kaptcha() { |
| | | Properties properties = new Properties(); |
| | | properties.put("kaptcha.border", "no"); |
| | | properties.put("kaptcha.border.color", "105,179,90"); |
| | | properties.put("kaptcha.textproducer.font.color", "blue"); |
| | | properties.put("kaptcha.image.width", "125"); |
| | | properties.put("kaptcha.image.height", "45"); |
| | | properties.put("kaptcha.textproducer.font.size", "45"); |
| | | properties.put("kaptcha.session.key", "code"); |
| | | properties.put("kaptcha.textproducer.char.length", "4"); |
| | | properties.put("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑"); |
| | | Config config = new Config(properties); |
| | | DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); |
| | | defaultKaptcha.setConfig(config); |
| | | return defaultKaptcha; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.aop; |
| | | |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.common.exception.InvalidKaptchaException; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | | import com.stylefeng.guns.core.log.factory.LogTaskFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import org.apache.shiro.authc.AuthenticationException; |
| | | import org.apache.shiro.authc.CredentialsException; |
| | | import org.apache.shiro.authc.DisabledAccountException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.ResponseStatus; |
| | | |
| | | import java.lang.reflect.UndeclaredThrowableException; |
| | | |
| | | import static com.stylefeng.guns.core.support.HttpKit.getIp; |
| | | import static com.stylefeng.guns.core.support.HttpKit.getRequest; |
| | | |
| | | /** |
| | | * 全局的的异常拦截器(拦截所有的控制器)(带有@RequestMapping注解的方法上都会拦截) |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月12日 下午3:19:56 |
| | | */ |
| | | @ControllerAdvice |
| | | @Order(-1) |
| | | public class GlobalExceptionHandler { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | /** |
| | | * 拦截业务异常 |
| | | */ |
| | | @ExceptionHandler(GunsException.class) |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ErrorTip notFount(GunsException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", e.getMessage()); |
| | | log.error("业务异常:", e); |
| | | return new ErrorTip(e.getCode(), e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 用户未登录异常 |
| | | */ |
| | | @ExceptionHandler(AuthenticationException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String unAuth(AuthenticationException e) { |
| | | log.error("用户未登陆:", e); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 账号被冻结异常 |
| | | */ |
| | | @ExceptionHandler(DisabledAccountException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String accountLocked(DisabledAccountException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号被冻结", getIp())); |
| | | model.addAttribute("tips", "账号被冻结"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 账号密码错误异常 |
| | | */ |
| | | @ExceptionHandler(CredentialsException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String credentials(CredentialsException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号密码错误", getIp())); |
| | | model.addAttribute("tips", "账号密码错误"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 验证码错误异常 |
| | | */ |
| | | @ExceptionHandler(InvalidKaptchaException.class) |
| | | @ResponseStatus(HttpStatus.BAD_REQUEST) |
| | | public String credentials(InvalidKaptchaException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "验证码错误", getIp())); |
| | | model.addAttribute("tips", "验证码错误"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 无权访问该资源异常 |
| | | */ |
| | | @ExceptionHandler(UndeclaredThrowableException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | @ResponseBody |
| | | public ErrorTip credentials(UndeclaredThrowableException e) { |
| | | getRequest().setAttribute("tip", "权限异常"); |
| | | log.error("权限异常!", e); |
| | | return new ErrorTip(BizExceptionEnum.NO_PERMITION.getCode(), BizExceptionEnum.NO_PERMITION.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截未知的运行时异常 |
| | | */ |
| | | @ExceptionHandler(RuntimeException.class) |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ErrorTip notFount(RuntimeException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", "服务器未知运行时异常"); |
| | | log.error("运行时异常:", e); |
| | | return new ErrorTip(BizExceptionEnum.SERVER_ERROR.getCode(), BizExceptionEnum.SERVER_ERROR.getMessage()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.aop; |
| | | |
| | | import com.stylefeng.guns.core.common.annotion.BussinessLog; |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.log.factory.LogTaskFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | | import com.stylefeng.guns.core.util.Contrast; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.Signature; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月6日 下午8:48:30 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class LogAop { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | @Pointcut(value = "@annotation(com.stylefeng.guns.core.common.annotion.BussinessLog)") |
| | | public void cutService() { |
| | | } |
| | | |
| | | @Around("cutService()") |
| | | public Object recordSysLog(ProceedingJoinPoint point) throws Throwable { |
| | | |
| | | //先执行业务 |
| | | Object result = point.proceed(); |
| | | |
| | | try { |
| | | handle(point); |
| | | } catch (Exception e) { |
| | | log.error("日志记录出错!", e); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private void handle(ProceedingJoinPoint point) throws Exception { |
| | | |
| | | //获取拦截的方法名 |
| | | Signature sig = point.getSignature(); |
| | | MethodSignature msig = null; |
| | | if (!(sig instanceof MethodSignature)) { |
| | | throw new IllegalArgumentException("该注解只能用于方法"); |
| | | } |
| | | msig = (MethodSignature) sig; |
| | | Object target = point.getTarget(); |
| | | Method currentMethod = target.getClass().getMethod(msig.getName(), msig.getParameterTypes()); |
| | | String methodName = currentMethod.getName(); |
| | | |
| | | //如果当前用户未登录,不做日志 |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return; |
| | | } |
| | | |
| | | //获取拦截方法的参数 |
| | | String className = point.getTarget().getClass().getName(); |
| | | Object[] params = point.getArgs(); |
| | | |
| | | //获取操作名称 |
| | | BussinessLog annotation = currentMethod.getAnnotation(BussinessLog.class); |
| | | String bussinessName = annotation.value(); |
| | | String key = annotation.key(); |
| | | Class dictClass = annotation.dict(); |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Object param : params) { |
| | | sb.append(param); |
| | | sb.append(" & "); |
| | | } |
| | | |
| | | //如果涉及到修改,比对变化 |
| | | String msg; |
| | | if (bussinessName.indexOf("修改") != -1 || bussinessName.indexOf("编辑") != -1) { |
| | | Object obj1 = LogObjectHolder.me().get(); |
| | | Map<String, String> obj2 = HttpKit.getRequestParameters(); |
| | | msg = Contrast.contrastObj(dictClass, key, obj1, obj2); |
| | | } else { |
| | | Map<String, String> parameters = HttpKit.getRequestParameters(); |
| | | AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); |
| | | msg = Contrast.parseMutiKey(dictMap,key,parameters); |
| | | } |
| | | |
| | | LogManager.me().executeLog(LogTaskFactory.bussinessLog(user.getId(), bussinessName, className, methodName, msg)); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.aop; |
| | | |
| | | import com.stylefeng.guns.core.common.annotion.Permission; |
| | | import com.stylefeng.guns.core.shiro.check.PermissionCheckManager; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.naming.NoPermissionException; |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * AOP 权限自定义检查 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | @Order(200) |
| | | public class PermissionAop { |
| | | |
| | | @Pointcut(value = "@annotation(com.stylefeng.guns.core.common.annotion.Permission)") |
| | | private void cutPermission() { |
| | | |
| | | } |
| | | |
| | | @Around("cutPermission()") |
| | | public Object doPermission(ProceedingJoinPoint point) throws Throwable { |
| | | MethodSignature ms = (MethodSignature) point.getSignature(); |
| | | Method method = ms.getMethod(); |
| | | Permission permission = method.getAnnotation(Permission.class); |
| | | Object[] permissions = permission.value(); |
| | | if (permissions == null || permissions.length == 0) { |
| | | //检查全体角色 |
| | | boolean result = PermissionCheckManager.checkAll(); |
| | | if (result) { |
| | | return point.proceed(); |
| | | } else { |
| | | throw new NoPermissionException(); |
| | | } |
| | | } else { |
| | | //检查指定角色 |
| | | boolean result = PermissionCheckManager.check(permissions); |
| | | if (result) { |
| | | return point.proceed(); |
| | | } else { |
| | | throw new NoPermissionException(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.beetl; |
| | | |
| | | import com.stylefeng.guns.core.tag.DictSelectorTag; |
| | | import com.stylefeng.guns.core.util.KaptchaUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.beetl.core.Context; |
| | | import org.beetl.core.Function; |
| | | import org.beetl.core.Tag; |
| | | import org.beetl.core.TagFactory; |
| | | import org.beetl.ext.spring.BeetlGroupUtilConfiguration; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.core.env.Environment; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | /** |
| | | * beetl拓展配置,绑定一些工具类,方便在模板中直接调用 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/2/22 21:03 |
| | | */ |
| | | public class BeetlConfiguration extends BeetlGroupUtilConfiguration { |
| | | |
| | | @Autowired |
| | | Environment env; |
| | | |
| | | @Autowired |
| | | ApplicationContext applicationContext; |
| | | |
| | | @Autowired |
| | | DictSelectorTag dictSelectorTag; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void initOther() { |
| | | groupTemplate.registerFunctionPackage("shiro", new ShiroExt()); |
| | | groupTemplate.registerFunctionPackage("tool", new ToolUtil()); |
| | | groupTemplate.registerFunctionPackage("kaptcha", new KaptchaUtil()); |
| | | groupTemplate.registerTagFactory("dictSelector", new TagFactory() { |
| | | @Override |
| | | public Tag createTag() { |
| | | return dictSelectorTag; |
| | | } |
| | | }); |
| | | |
| | | groupTemplate.registerFunction("env", new Function() { |
| | | @Override |
| | | public String call(Object[] paras, Context ctx) { |
| | | String key = (String)paras[0]; |
| | | String value = env.getProperty(key); |
| | | if(value!=null) { |
| | | return getStr(value); |
| | | } |
| | | if(paras.length==2) { |
| | | return (String)paras[1]; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | protected String getStr(String str) { |
| | | try { |
| | | return new String(str.getBytes("iso8859-1"),"UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.beetl; |
| | | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.beetl.core.GroupTemplate; |
| | | |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | |
| | | public class ShiroExt { |
| | | private static final String NAMES_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 获取当前 Subject |
| | | * |
| | | * @return Subject |
| | | */ |
| | | protected static Subject getSubject() { |
| | | return SecurityUtils.getSubject(); |
| | | } |
| | | |
| | | /** |
| | | * 获取封装的 ShiroUser |
| | | * |
| | | * @return ShiroUser |
| | | */ |
| | | public ShiroUser getUser() { |
| | | if (isGuest()) { |
| | | return null; |
| | | } else { |
| | | return (ShiroUser) getSubject().getPrincipals().getPrimaryPrincipal(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于该角色?,使用时与lacksRole 搭配使用 |
| | | * |
| | | * @param roleName 角色名 |
| | | * @return 属于该角色:true,否则false |
| | | */ |
| | | public boolean hasRole(String roleName) { |
| | | return getSubject() != null && roleName != null |
| | | && roleName.length() > 0 && getSubject().hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 |
| | | * |
| | | * @param roleName 角色名 |
| | | * @return 不属于该角色:true,否则false |
| | | */ |
| | | public boolean lacksRole(String roleName) { |
| | | return !hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下任意一个角色。 |
| | | * |
| | | * @param roleNames 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public boolean hasAnyRoles(String roleNames) { |
| | | boolean hasAnyRole = false; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (subject.hasRole(role.trim())) { |
| | | hasAnyRole = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAnyRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下所有角色。 |
| | | * |
| | | * @param roleNames 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public boolean hasAllRoles(String roleNames) { |
| | | boolean hasAllRole = true; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (!subject.hasRole(role.trim())) { |
| | | hasAllRole = false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAllRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 |
| | | * |
| | | * @param permission 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public boolean hasPermission(String permission) { |
| | | return getSubject() != null && permission != null |
| | | && permission.length() > 0 |
| | | && getSubject().isPermitted(permission); |
| | | } |
| | | |
| | | /** |
| | | * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 |
| | | * |
| | | * @param permission 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public boolean lacksPermission(String permission) { |
| | | return !hasPermission(permission); |
| | | } |
| | | |
| | | /** |
| | | * 已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 |
| | | * |
| | | * @return 通过身份验证:true,否则false |
| | | */ |
| | | public boolean authenticated() { |
| | | return getSubject() != null && getSubject().isAuthenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 |
| | | * |
| | | * @return 没有通过身份验证:true,否则false |
| | | */ |
| | | public boolean notAuthenticated() { |
| | | return !authenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 认证通过或已记住的用户。与guset搭配使用。 |
| | | * |
| | | * @return 用户:true,否则 false |
| | | */ |
| | | public boolean isUser() { |
| | | return getSubject() != null && getSubject().getPrincipal() != null; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 |
| | | * |
| | | * @return 访客:true,否则false |
| | | */ |
| | | public boolean isGuest() { |
| | | return !isUser(); |
| | | } |
| | | |
| | | /** |
| | | * 输出当前用户信息,通常为登录帐号信息。 |
| | | * |
| | | * @return 当前用户信息 |
| | | */ |
| | | public String principal() { |
| | | if (getSubject() != null) { |
| | | Object principal = getSubject().getPrincipal(); |
| | | return principal.toString(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | GroupTemplate gt = new GroupTemplate(); |
| | | gt.registerFunctionPackage("shiro", new ShiroExt()); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.annotion; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.SystemDict; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 标记需要做业务日志的方法 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-03-31 12:46 |
| | | */ |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ElementType.METHOD}) |
| | | public @interface BussinessLog { |
| | | |
| | | /** |
| | | * 业务的名称,例如:"修改菜单" |
| | | */ |
| | | String value() default ""; |
| | | |
| | | /** |
| | | * 被修改的实体的唯一标识,例如:菜单实体的唯一标识为"id" |
| | | */ |
| | | String key() default "id"; |
| | | |
| | | /** |
| | | * 字典(用于查找key的中文名称和字段的中文名称) |
| | | */ |
| | | Class<? extends AbstractDictMap> dict() default SystemDict.class; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.annotion; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 权限注解 用于检查权限 规定访问权限 |
| | | * |
| | | * @example @Permission({role1,role2}) |
| | | * @example @Permission |
| | | */ |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ElementType.METHOD}) |
| | | public @interface Permission { |
| | | |
| | | /** |
| | | * <p>角色英文名称</p> |
| | | * <p>使用注解时加上这个值表示限制只有某个角色的才可以访问对应的资源</p> |
| | | * <p>常用在某些资源限制只有超级管理员角色才可访问</p> |
| | | */ |
| | | String[] value() default {}; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant; |
| | | |
| | | /** |
| | | * 系统常量 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月12日 下午9:42:53 |
| | | */ |
| | | public interface Const { |
| | | |
| | | /** |
| | | * 系统默认的管理员密码 |
| | | */ |
| | | String DEFAULT_PWD = "111111"; |
| | | |
| | | /** |
| | | * 管理员角色的名字 |
| | | */ |
| | | String ADMIN_NAME = "administrator"; |
| | | |
| | | /** |
| | | * 管理员id |
| | | */ |
| | | Integer ADMIN_ID = 1; |
| | | |
| | | /** |
| | | * 超级管理员角色id |
| | | */ |
| | | Integer ADMIN_ROLE_ID = 1; |
| | | |
| | | /** |
| | | * 接口文档的菜单名 |
| | | */ |
| | | String API_MENU_NAME = "接口文档"; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant; |
| | | |
| | | /** |
| | | * |
| | | * 多数据源的枚举 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年3月5日 上午10:15:02 |
| | | */ |
| | | public interface DatasourceEnum { |
| | | |
| | | String DATA_SOURCE_GUNS = "dataSourceGuns"; //guns数据源 |
| | | |
| | | String DATA_SOURCE_BIZ = "dataSourceBiz"; //其他业务的数据源 |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant; |
| | | |
| | | /** |
| | | * jwt相关配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-08-23 9:23 |
| | | */ |
| | | public interface JwtConstants { |
| | | |
| | | String AUTH_HEADER = "Authorization"; |
| | | |
| | | String SECRET = "defaultSecret"; |
| | | |
| | | Long EXPIRATION = 604800L; |
| | | |
| | | String AUTH_PATH = "/gunsApi/auth"; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.cache; |
| | | |
| | | /** |
| | | * 所有缓存名称的集合 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-24 21:56 |
| | | */ |
| | | public interface Cache { |
| | | |
| | | /** |
| | | * 常量缓存 |
| | | */ |
| | | String CONSTANT = "CONSTANT"; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.cache; |
| | | |
| | | /** |
| | | * 缓存标识前缀集合,常用在ConstantFactory类中 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-25 9:37 |
| | | */ |
| | | public interface CacheKey { |
| | | |
| | | /** |
| | | * 角色名称(多个) |
| | | */ |
| | | String ROLES_NAME = "roles_name_"; |
| | | |
| | | /** |
| | | * 角色名称(单个) |
| | | */ |
| | | String SINGLE_ROLE_NAME = "single_role_name_"; |
| | | |
| | | /** |
| | | * 角色英文名称 |
| | | */ |
| | | String SINGLE_ROLE_TIP = "single_role_tip_"; |
| | | |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | String DEPT_NAME = "dept_name_"; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 用于删除业务的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class DeleteDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("roleId","角色名称"); |
| | | put("deptId", "部门名称"); |
| | | put("menuId", "菜单名称"); |
| | | put("dictId", "字典名称"); |
| | | put("noticeId", "标题"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("roleId","getCacheObject"); |
| | | putFieldWrapperMethodName("deptId","getCacheObject"); |
| | | putFieldWrapperMethodName("menuId","getCacheObject"); |
| | | putFieldWrapperMethodName("dictId","getCacheObject"); |
| | | putFieldWrapperMethodName("noticeId","getCacheObject"); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 部门的映射 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class DeptDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("deptId", "部门名称"); |
| | | put("num", "部门排序"); |
| | | put("pid", "上级名称"); |
| | | put("simplename", "部门简称"); |
| | | put("fullname", "部门全称"); |
| | | put("tips", "备注"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("deptId", "getDeptName"); |
| | | putFieldWrapperMethodName("pid", "getDeptName"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 车牌品牌日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class BrandDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","车辆品牌id"); |
| | | put("addTime","添加时间"); |
| | | put("name","品牌名称"); |
| | | put("brandImg","品牌图片(多个用逗号隔开)"); |
| | | put("state","状态(1正常,2停用)"); |
| | | put("specialMode","专车计费"); |
| | | put("charteredMode","包车计费"); |
| | | put("seatNum","座位数"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 车辆日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class CarDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","车辆id"); |
| | | put("addTime","添加时间"); |
| | | put("carImg","车辆图片"); |
| | | put("plateNumber","车牌号"); |
| | | put("licenseNumber","行驶证编号"); |
| | | put("licenseImg","行驶证照片"); |
| | | put("brandId","关联品牌id"); |
| | | put("color","车辆颜色"); |
| | | put("serviceMode","服务模式(1专车,2包车)"); |
| | | put("state","状态(1正常,2停用)"); |
| | | put("insuranceNumber","保险编号"); |
| | | put("insuranceImg","保险图片"); |
| | | put("insuranceDate","保险到期时间"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 司机日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class DriverDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","司机id"); |
| | | put("addTime","添加时间"); |
| | | put("name","司机姓名"); |
| | | put("headImg","头像"); |
| | | put("phone","电话"); |
| | | put("sex","性别"); |
| | | put("password","登录密码"); |
| | | put("state","状态(1正常,2停用)"); |
| | | put("serviceMode","服务模式(1专车,2包车)"); |
| | | put("driveNumber","驾驶证编号"); |
| | | put("driveImg","驾驶证照片"); |
| | | put("carId","车辆id"); |
| | | put("driverId","司机id"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 评价标签日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class LabelDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","标签id"); |
| | | put("appLabelId","标签id"); |
| | | put("addTime","添加时间"); |
| | | put("name","标签名称"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 系统通知日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class NoticeDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","通知id"); |
| | | put("addTime","添加时间"); |
| | | put("title","标题"); |
| | | put("issue","是否发布(1未发布,2已发布)"); |
| | | put("content","内容"); |
| | | put("sendType","发送对象(1用户,2司机 ,3用户和司机)"); |
| | | put("sendTime","发送时间"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class ObjectDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("appOrderTopupId","充值订单id"); |
| | | put("id","提现记录id"); |
| | | put("appInvoiceId","发票记录id"); |
| | | put("appOrderEvaluateId","订单评价id"); |
| | | put("appComplaintId","投诉id"); |
| | | put("appFeedbackId","意见反馈id"); |
| | | put("appDriverRecruitId","司机招募id"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 订单日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class OrderDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","订单id"); |
| | | put("appOrderId","订单id"); |
| | | put("addTime","添加时间"); |
| | | put("orderNum","订单编号"); |
| | | put("userName","乘车人名称"); |
| | | put("userPhone","乘车人手机"); |
| | | put("number","乘车人数"); |
| | | put("chargeMode","计费方式(1时间,2里程)"); |
| | | put("rideTime","乘车时间"); |
| | | put("startName","起点名称"); |
| | | put("endName","终点名称"); |
| | | put("driverId","接单司机id"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 用户日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class UserAuthenticationDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","实名认证id"); |
| | | put("state","审核状态(1待审核,2审核成功,3审核失败)"); |
| | | put("isDelete","是否删除(1正常,2删除)"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 用户日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class UserDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","用户id"); |
| | | put("state","用户状态(1正常,2冻结)"); |
| | | put("gold","用户金币数"); |
| | | put("balance","用户余额数"); |
| | | put("nickName","用户昵称"); |
| | | put("phone","用户手机号"); |
| | | put("level","等级(1普通用户,2白银会员,3黄金会员,4白金会员)"); |
| | | put("sex","性别"); |
| | | put("birthday","生日"); |
| | | put("industry","行业"); |
| | | put("job","职业"); |
| | | put("company","公司"); |
| | | put("education","学历"); |
| | | put("signature","个性签名"); |
| | | put("addTime","添加时间"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.Dict; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 版本控制日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class VersionDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("id","版本id"); |
| | | put("createDate","添加时间"); |
| | | put("type","类型(1用户端,2司机端)"); |
| | | put("versions","版本号"); |
| | | put("mark","版本描述"); |
| | | put("state","是否强制更新 1否,2 是"); |
| | | put("url","版本链接"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 字典map |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:43 |
| | | */ |
| | | public class DictMap extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("dictId","字典名称"); |
| | | put("dictName","字典名称"); |
| | | put("dictValues","字典内容"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 日志的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class LogDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("tips","备注"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 菜单的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class MenuDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("menuId","菜单id"); |
| | | put("id","菜单id"); |
| | | put("code","菜单编号"); |
| | | put("pcode","菜单父编号"); |
| | | put("name","菜单名称"); |
| | | put("icon","菜单图标"); |
| | | put("url","url地址"); |
| | | put("num","菜单排序号"); |
| | | put("levels","菜单层级"); |
| | | put("tips","备注"); |
| | | put("status","菜单状态"); |
| | | put("isopen","是否打开"); |
| | | put("",""); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 通知的映射 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class NoticeMap extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("title", "标题"); |
| | | put("content", "内容"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 角色的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class RoleDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("roleId","角色名称"); |
| | | put("num","角色排序"); |
| | | put("pid","角色的父级"); |
| | | put("name","角色名称"); |
| | | put("deptid","部门名称"); |
| | | put("tips","备注"); |
| | | put("ids","资源名称"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("pid","getSingleRoleName"); |
| | | putFieldWrapperMethodName("deptid","getDeptName"); |
| | | putFieldWrapperMethodName("roleId","getSingleRoleName"); |
| | | putFieldWrapperMethodName("ids","getMenuNames"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 用户的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class UserDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("userId","账号"); |
| | | put("avatar","头像"); |
| | | put("account","账号"); |
| | | put("name","名字"); |
| | | put("birthday","生日"); |
| | | put("sex","性别"); |
| | | put("email","电子邮件"); |
| | | put("phone","电话"); |
| | | put("roleid","角色名称"); |
| | | put("deptid","部门名称"); |
| | | put("roleIds","角色名称集合"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("sex","getSexName"); |
| | | putFieldWrapperMethodName("deptid","getDeptName"); |
| | | putFieldWrapperMethodName("roleid","getSingleRoleName"); |
| | | putFieldWrapperMethodName("userId","getUserAccountById"); |
| | | putFieldWrapperMethodName("roleIds","getRoleName"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.base; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 字典映射抽象类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 14:58 |
| | | */ |
| | | public abstract class AbstractDictMap { |
| | | |
| | | protected HashMap<String, String> dictory = new HashMap<>(); |
| | | protected HashMap<String, String> fieldWarpperDictory = new HashMap<>(); |
| | | |
| | | public AbstractDictMap(){ |
| | | put("id","主键id"); |
| | | init(); |
| | | initBeWrapped(); |
| | | } |
| | | |
| | | /** |
| | | * 初始化字段英文名称和中文名称对应的字典 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:39 |
| | | */ |
| | | public abstract void init(); |
| | | |
| | | /** |
| | | * 初始化需要被包装的字段(例如:性别为1:男,2:女,需要被包装为汉字) |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:35 |
| | | */ |
| | | protected abstract void initBeWrapped(); |
| | | |
| | | public String get(String key) { |
| | | return this.dictory.get(key); |
| | | } |
| | | |
| | | public void put(String key, String value) { |
| | | this.dictory.put(key, value); |
| | | } |
| | | |
| | | public String getFieldWarpperMethodName(String key){ |
| | | return this.fieldWarpperDictory.get(key); |
| | | } |
| | | |
| | | public void putFieldWrapperMethodName(String key,String methodName){ |
| | | this.fieldWarpperDictory.put(key,methodName); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.base; |
| | | |
| | | /** |
| | | * 系统相关的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:48 |
| | | */ |
| | | public class SystemDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | | import com.stylefeng.guns.core.common.constant.factory.IConstantFactory; |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * 字典字段的包装器(从ConstantFactory中获取包装值) |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:12 |
| | | */ |
| | | public class DictFieldWarpperFactory { |
| | | |
| | | public static Object createFieldWarpper(Object parameter, String methodName) { |
| | | IConstantFactory constantFactory = ConstantFactory.me(); |
| | | try { |
| | | Method method = IConstantFactory.class.getMethod(methodName, parameter.getClass()); |
| | | return method.invoke(constantFactory, parameter); |
| | | } catch (Exception e) { |
| | | try { |
| | | Method method = IConstantFactory.class.getMethod(methodName, Integer.class); |
| | | return method.invoke(constantFactory, Integer.parseInt(parameter.toString())); |
| | | } catch (Exception e1) { |
| | | throw new GunsException(BizExceptionEnum.ERROR_WRAPPER_FIELD); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.stylefeng.guns.core.common.constant.cache.Cache; |
| | | import com.stylefeng.guns.core.common.constant.cache.CacheKey; |
| | | import com.stylefeng.guns.core.common.constant.state.ManagerStatus; |
| | | import com.stylefeng.guns.core.common.constant.state.MenuStatus; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.support.StrKit; |
| | | import com.stylefeng.guns.core.util.Convert; |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.DeptMapper; |
| | | import com.stylefeng.guns.modular.system.dao.DictMapper; |
| | | import com.stylefeng.guns.modular.system.dao.MenuMapper; |
| | | import com.stylefeng.guns.modular.system.dao.NoticeMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RoleMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.Dept; |
| | | import com.stylefeng.guns.modular.system.model.Dict; |
| | | import com.stylefeng.guns.modular.system.model.Menu; |
| | | import com.stylefeng.guns.modular.system.model.Notice; |
| | | import com.stylefeng.guns.modular.system.model.Role; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | |
| | | /** |
| | | * 常量的生产工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月13日 下午10:55:21 |
| | | */ |
| | | @Component |
| | | @DependsOn("springContextHolder") |
| | | public class ConstantFactory implements IConstantFactory { |
| | | |
| | | private RoleMapper roleMapper = SpringContextHolder.getBean(RoleMapper.class); |
| | | private DeptMapper deptMapper = SpringContextHolder.getBean(DeptMapper.class); |
| | | private DictMapper dictMapper = SpringContextHolder.getBean(DictMapper.class); |
| | | private UserMapper userMapper = SpringContextHolder.getBean(UserMapper.class); |
| | | private MenuMapper menuMapper = SpringContextHolder.getBean(MenuMapper.class); |
| | | private NoticeMapper noticeMapper = SpringContextHolder.getBean(NoticeMapper.class); |
| | | |
| | | public static IConstantFactory me() { |
| | | return SpringContextHolder.getBean("constantFactory"); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id获取用户名称 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 23:41 |
| | | */ |
| | | @Override |
| | | public String getUserNameById(Integer userId) { |
| | | User user = userMapper.selectById(userId); |
| | | if (user != null) { |
| | | return user.getName(); |
| | | } else { |
| | | return "--"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id获取用户账号 |
| | | * |
| | | * @author stylefeng |
| | | * @date 2017年5月16日21:55:371 |
| | | */ |
| | | @Override |
| | | public String getUserAccountById(Integer userId) { |
| | | User user = userMapper.selectById(userId); |
| | | if (user != null) { |
| | | return user.getAccount(); |
| | | } else { |
| | | return "--"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ids获取角色名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.ROLES_NAME + "'+#roleIds") |
| | | public String getRoleName(String roleIds) { |
| | | Integer[] roles = Convert.toIntArray(roleIds); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int role : roles) { |
| | | Role roleObj = roleMapper.selectById(role); |
| | | if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { |
| | | sb.append(roleObj.getName()).append(","); |
| | | } |
| | | } |
| | | return StrKit.removeSuffix(sb.toString(), ","); |
| | | } |
| | | |
| | | /** |
| | | * 通过角色id获取角色名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleId") |
| | | public String getSingleRoleName(Integer roleId) { |
| | | if (0 == roleId) { |
| | | return "--"; |
| | | } |
| | | Role roleObj = roleMapper.selectById(roleId); |
| | | if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { |
| | | return roleObj.getName(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 通过角色id获取角色英文名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_TIP + "'+#roleId") |
| | | public String getSingleRoleTip(Integer roleId) { |
| | | if (0 == roleId) { |
| | | return "--"; |
| | | } |
| | | Role roleObj = roleMapper.selectById(roleId); |
| | | if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { |
| | | return roleObj.getTips(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取部门名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.DEPT_NAME + "'+#deptId") |
| | | public String getDeptName(Integer deptId) { |
| | | Dept dept = deptMapper.selectById(deptId); |
| | | if (ToolUtil.isNotEmpty(dept) && ToolUtil.isNotEmpty(dept.getFullname())) { |
| | | return dept.getFullname(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单的名称们(多个) |
| | | */ |
| | | @Override |
| | | public String getMenuNames(String menuIds) { |
| | | Integer[] menus = Convert.toIntArray(menuIds); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int menu : menus) { |
| | | Menu menuObj = menuMapper.selectById(menu); |
| | | if (ToolUtil.isNotEmpty(menuObj) && ToolUtil.isNotEmpty(menuObj.getName())) { |
| | | sb.append(menuObj.getName()).append(","); |
| | | } |
| | | } |
| | | return StrKit.removeSuffix(sb.toString(), ","); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单名称 |
| | | */ |
| | | @Override |
| | | public String getMenuName(Long menuId) { |
| | | if (ToolUtil.isEmpty(menuId)) { |
| | | return ""; |
| | | } else { |
| | | Menu menu = menuMapper.selectById(menuId); |
| | | if (menu == null) { |
| | | return ""; |
| | | } else { |
| | | return menu.getName(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单名称通过编号 |
| | | */ |
| | | @Override |
| | | public String getMenuNameByCode(String code) { |
| | | if (ToolUtil.isEmpty(code)) { |
| | | return ""; |
| | | } else { |
| | | Menu param = new Menu(); |
| | | param.setCode(code); |
| | | Menu menu = menuMapper.selectOne(param); |
| | | if (menu == null) { |
| | | return ""; |
| | | } else { |
| | | return menu.getName(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取字典名称 |
| | | */ |
| | | @Override |
| | | public String getDictName(Integer dictId) { |
| | | if (ToolUtil.isEmpty(dictId)) { |
| | | return ""; |
| | | } else { |
| | | Dict dict = dictMapper.selectById(dictId); |
| | | if (dict == null) { |
| | | return ""; |
| | | } else { |
| | | return dict.getName(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取通知标题 |
| | | */ |
| | | @Override |
| | | public String getNoticeTitle(Integer dictId) { |
| | | if (ToolUtil.isEmpty(dictId)) { |
| | | return ""; |
| | | } else { |
| | | Notice notice = noticeMapper.selectById(dictId); |
| | | if (notice == null) { |
| | | return ""; |
| | | } else { |
| | | return notice.getTitle(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据字典名称和字典中的值获取对应的名称 |
| | | */ |
| | | @Override |
| | | public String getDictsByName(String name, Integer val) { |
| | | Dict temp = new Dict(); |
| | | temp.setName(name); |
| | | Dict dict = dictMapper.selectOne(temp); |
| | | if (dict == null) { |
| | | return ""; |
| | | } else { |
| | | Wrapper<Dict> wrapper = new EntityWrapper<>(); |
| | | wrapper = wrapper.eq("pid", dict.getId()); |
| | | List<Dict> dicts = dictMapper.selectList(wrapper); |
| | | for (Dict item : dicts) { |
| | | if (item.getNum() != null && item.getNum().equals(val)) { |
| | | return item.getName(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取性别名称 |
| | | */ |
| | | @Override |
| | | public String getSexName(Integer sex) { |
| | | return getDictsByName("性别", sex); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户登录状态 |
| | | */ |
| | | @Override |
| | | public String getStatusName(Integer status) { |
| | | return ManagerStatus.valueOf(status); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单状态 |
| | | */ |
| | | @Override |
| | | public String getMenuStatusName(Integer status) { |
| | | return MenuStatus.valueOf(status); |
| | | } |
| | | |
| | | /** |
| | | * 查询字典 |
| | | */ |
| | | @Override |
| | | public List<Dict> findInDict(Integer id) { |
| | | if (ToolUtil.isEmpty(id)) { |
| | | return null; |
| | | } else { |
| | | EntityWrapper<Dict> wrapper = new EntityWrapper<>(); |
| | | List<Dict> dicts = dictMapper.selectList(wrapper.eq("pid", id)); |
| | | if (dicts == null || dicts.size() == 0) { |
| | | return null; |
| | | } else { |
| | | return dicts; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取被缓存的对象(用户删除业务) |
| | | */ |
| | | @Override |
| | | public String getCacheObject(String para) { |
| | | return LogObjectHolder.me().get().toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取子部门id |
| | | */ |
| | | @Override |
| | | public List<Integer> getSubDeptId(Integer deptid) { |
| | | Wrapper<Dept> wrapper = new EntityWrapper<>(); |
| | | wrapper = wrapper.like("pids", "%[" + deptid + "]%"); |
| | | List<Dept> depts = this.deptMapper.selectList(wrapper); |
| | | |
| | | ArrayList<Integer> deptids = new ArrayList<>(); |
| | | |
| | | if(depts != null && depts.size() > 0){ |
| | | for (Dept dept : depts) { |
| | | deptids.add(dept.getId()); |
| | | } |
| | | } |
| | | |
| | | return deptids; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有父部门id |
| | | */ |
| | | @Override |
| | | public List<Integer> getParentDeptIds(Integer deptid) { |
| | | Dept dept = deptMapper.selectById(deptid); |
| | | String pids = dept.getPids(); |
| | | String[] split = pids.split(","); |
| | | ArrayList<Integer> parentDeptIds = new ArrayList<>(); |
| | | for (String s : split) { |
| | | parentDeptIds.add(Integer.valueOf(StrKit.removeSuffix(StrKit.removePrefix(s, "["), "]"))); |
| | | } |
| | | return parentDeptIds; |
| | | } |
| | | |
| | | /** |
| | | * 根据用户Id获取用户昵称 |
| | | */ |
| | | @Override |
| | | public String getTUserNickNameById(Integer userId) { |
| | | /* TUser user = tUserMapper.selectById(userId); |
| | | if (user != null) { |
| | | return user.getNickName(); |
| | | } else { |
| | | return "--"; |
| | | }*/ |
| | | return "--"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.Dict; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 常量生产工厂的接口 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-06-14 21:12 |
| | | */ |
| | | public interface IConstantFactory { |
| | | |
| | | /** |
| | | * 根据用户id获取用户名称 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 23:41 |
| | | */ |
| | | String getUserNameById(Integer userId); |
| | | |
| | | /** |
| | | * 根据用户id获取用户账号 |
| | | * |
| | | * @author stylefeng |
| | | * @date 2017年5月16日21:55:371 |
| | | */ |
| | | String getUserAccountById(Integer userId); |
| | | |
| | | /** |
| | | * 通过角色ids获取角色名称 |
| | | */ |
| | | String getRoleName(String roleIds); |
| | | |
| | | /** |
| | | * 通过角色id获取角色名称 |
| | | */ |
| | | String getSingleRoleName(Integer roleId); |
| | | |
| | | /** |
| | | * 通过角色id获取角色英文名称 |
| | | */ |
| | | String getSingleRoleTip(Integer roleId); |
| | | |
| | | /** |
| | | * 获取部门名称 |
| | | */ |
| | | String getDeptName(Integer deptId); |
| | | |
| | | /** |
| | | * 获取菜单的名称们(多个) |
| | | */ |
| | | String getMenuNames(String menuIds); |
| | | |
| | | /** |
| | | * 获取菜单名称 |
| | | */ |
| | | String getMenuName(Long menuId); |
| | | |
| | | /** |
| | | * 获取菜单名称通过编号 |
| | | */ |
| | | String getMenuNameByCode(String code); |
| | | |
| | | /** |
| | | * 获取字典名称 |
| | | */ |
| | | String getDictName(Integer dictId); |
| | | |
| | | /** |
| | | * 获取通知标题 |
| | | */ |
| | | String getNoticeTitle(Integer dictId); |
| | | |
| | | /** |
| | | * 根据字典名称和字典中的值获取对应的名称 |
| | | */ |
| | | String getDictsByName(String name, Integer val); |
| | | |
| | | /** |
| | | * 获取性别名称 |
| | | */ |
| | | String getSexName(Integer sex); |
| | | |
| | | /** |
| | | * 获取用户登录状态 |
| | | */ |
| | | String getStatusName(Integer status); |
| | | |
| | | /** |
| | | * 获取菜单状态 |
| | | */ |
| | | String getMenuStatusName(Integer status); |
| | | |
| | | /** |
| | | * 查询字典 |
| | | */ |
| | | List<Dict> findInDict(Integer id); |
| | | |
| | | /** |
| | | * 获取被缓存的对象(用户删除业务) |
| | | */ |
| | | String getCacheObject(String para); |
| | | |
| | | /** |
| | | * 获取子部门id |
| | | */ |
| | | List<Integer> getSubDeptId(Integer deptid); |
| | | |
| | | /** |
| | | * 获取所有父部门id |
| | | */ |
| | | List<Integer> getParentDeptIds(Integer deptid); |
| | | |
| | | /** |
| | | * 根据用户Id获取用户昵称 |
| | | */ |
| | | String getTUserNickNameById(Integer userId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import com.stylefeng.guns.core.support.StrKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 组合字符串生产者 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-27 16:42 |
| | | */ |
| | | public class MutiStrFactory { |
| | | |
| | | /** |
| | | * 每个条目之间的分隔符 |
| | | */ |
| | | public static final String ITEM_SPLIT = ";"; |
| | | |
| | | /** |
| | | * 属性之间的分隔符 |
| | | */ |
| | | public static final String ATTR_SPLIT = ":"; |
| | | |
| | | /** |
| | | * 拼接字符串的id |
| | | */ |
| | | public static final String MUTI_STR_ID = "ID"; |
| | | |
| | | /** |
| | | * 拼接字符串的CODE |
| | | */ |
| | | public static final String MUTI_STR_CODE = "CODE"; |
| | | |
| | | /** |
| | | * 拼接字符串的NAME |
| | | */ |
| | | public static final String MUTI_STR_NAME = "NAME"; |
| | | |
| | | /** |
| | | * 拼接字符串的NUM |
| | | */ |
| | | public static final String MUTI_STR_NUM = "NUM"; |
| | | |
| | | /** |
| | | * 解析一个组合字符串(例如: "1:启用;2:禁用;3:冻结" 这样的字符串) |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/4/27 16:44 |
| | | */ |
| | | public static List<Map<String,String>> parseKeyValue(String mutiString){ |
| | | if(ToolUtil.isEmpty(mutiString)){ |
| | | return new ArrayList<>(); |
| | | }else{ |
| | | ArrayList<Map<String,String>> results = new ArrayList<>(); |
| | | String[] items = StrKit.split(StrKit.removeSuffix(mutiString, ITEM_SPLIT), ITEM_SPLIT); |
| | | for (String item : items) { |
| | | String[] attrs = item.split(ATTR_SPLIT); |
| | | HashMap<String, String> itemMap = new HashMap<>(); |
| | | itemMap.put(MUTI_STR_CODE,attrs[0]); |
| | | itemMap.put(MUTI_STR_NAME,attrs[1]); |
| | | itemMap.put(MUTI_STR_NUM,attrs[2]); |
| | | results.add(itemMap); |
| | | } |
| | | return results; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解析id:key:value这样类型的字符串 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/4/28 11:06 |
| | | */ |
| | | public static List<Map<String,String>> parseIdKeyValue(String mutiString){ |
| | | if(ToolUtil.isEmpty(mutiString)){ |
| | | return new ArrayList<>(); |
| | | }else{ |
| | | ArrayList<Map<String,String>> results = new ArrayList<>(); |
| | | String[] items = StrKit.split(StrKit.removeSuffix(mutiString, ITEM_SPLIT), ITEM_SPLIT); |
| | | for (String item : items) { |
| | | String[] attrs = item.split(ATTR_SPLIT); |
| | | HashMap<String, String> itemMap = new HashMap<>(); |
| | | itemMap.put(MUTI_STR_CODE,attrs[0]); |
| | | itemMap.put(MUTI_STR_NAME,attrs[1]); |
| | | itemMap.put(MUTI_STR_NUM,attrs[2]); |
| | | results.add(itemMap); |
| | | } |
| | | return results; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.common.constant.state.Order; |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * BootStrap Table默认的分页参数创建 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-05 22:25 |
| | | */ |
| | | public class PageFactory<T> { |
| | | |
| | | public Page<T> defaultPage() { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | int limit = Integer.valueOf(request.getParameter("limit")); //每页多少条数据 |
| | | int offset = Integer.valueOf(request.getParameter("offset")); //每页的偏移量(本页当前有多少条) |
| | | String sort = request.getParameter("sort"); //排序字段名称 |
| | | String order = request.getParameter("order"); //asc或desc(升序或降序) |
| | | if (ToolUtil.isEmpty(sort)) { |
| | | Page<T> page = new Page<>((offset / limit + 1), limit); |
| | | page.setOpenSort(false); |
| | | return page; |
| | | } else { |
| | | Page<T> page = new Page<>((offset / limit + 1), limit, sort); |
| | | if (Order.ASC.getDes().equals(order)) { |
| | | page.setAsc(true); |
| | | } else { |
| | | page.setAsc(false); |
| | | } |
| | | return page; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 业务日志类型 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum BizLogType { |
| | | |
| | | ALL(0, null),//全部日志 |
| | | BUSSINESS(1, "业务日志"), |
| | | EXCEPTION(2, "异常日志"); |
| | | |
| | | Integer val; |
| | | String message; |
| | | |
| | | BizLogType(Integer val, String message) { |
| | | this.val = val; |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public Integer getVal() { |
| | | return val; |
| | | } |
| | | |
| | | public void setVal(Integer val) { |
| | | this.val = val; |
| | | } |
| | | |
| | | public static String valueOf(Integer value) { |
| | | if (value == null) { |
| | | return null; |
| | | } else { |
| | | for (BizLogType bizLogType : BizLogType.values()) { |
| | | if (bizLogType.getVal().equals(value)) { |
| | | return bizLogType.getMessage(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 是否是菜单的枚举 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年6月1日22:50:11 |
| | | */ |
| | | public enum ExpenseState { |
| | | |
| | | SUBMITING(1, "待提交"), |
| | | CHECKING(2, "待审核"), |
| | | PASS(3, "审核通过"), |
| | | UN_PASS(4, "未通过"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | ExpenseState(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer status) { |
| | | if (status == null) { |
| | | return ""; |
| | | } else { |
| | | for (ExpenseState s : ExpenseState.values()) { |
| | | if (s.getCode() == status) { |
| | | return s.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 业务是否成功的日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum LogSucceed { |
| | | |
| | | SUCCESS("成功"), |
| | | FAIL("失败"); |
| | | |
| | | String message; |
| | | |
| | | LogSucceed(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 日志类型 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum LogType { |
| | | |
| | | LOGIN("登录日志"), |
| | | LOGIN_FAIL("登录失败日志"), |
| | | EXIT("退出日志"), |
| | | EXCEPTION("异常日志"), |
| | | BUSSINESS("业务日志"); |
| | | |
| | | String message; |
| | | |
| | | LogType(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 管理员的状态 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月10日 下午9:54:13 |
| | | */ |
| | | public enum ManagerStatus { |
| | | |
| | | OK(1, "启用"), FREEZED(2, "冻结"), DELETED(3, "被删除"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | ManagerStatus(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer value) { |
| | | if (value == null) { |
| | | return ""; |
| | | } else { |
| | | for (ManagerStatus ms : ManagerStatus.values()) { |
| | | if (ms.getCode() == value) { |
| | | return ms.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 菜单是否打开的状态 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年4月8日10:12:15 |
| | | */ |
| | | public enum MenuOpenStatus { |
| | | |
| | | OPEN(1, "打开"), |
| | | CLOSE(0, "关闭"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | MenuOpenStatus(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer status) { |
| | | if (status == null) { |
| | | return ""; |
| | | } else { |
| | | for (MenuOpenStatus s : MenuOpenStatus.values()) { |
| | | if (s.getCode() == status) { |
| | | return s.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 菜单的状态 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum MenuStatus { |
| | | |
| | | ENABLE(1, "启用"), |
| | | DISABLE(0, "禁用"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | MenuStatus(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer status) { |
| | | if (status == null) { |
| | | return ""; |
| | | } else { |
| | | for (MenuStatus s : MenuStatus.values()) { |
| | | if (s.getCode() == status) { |
| | | return s.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 数据库排序 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年5月31日20:48:41 |
| | | */ |
| | | public enum Order { |
| | | |
| | | ASC("asc"), DESC("desc"); |
| | | |
| | | private String des; |
| | | |
| | | Order(String des) { |
| | | this.des = des; |
| | | } |
| | | |
| | | public String getDes() { |
| | | return des; |
| | | } |
| | | |
| | | public void setDes(String des) { |
| | | this.des = des; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.exception; |
| | | |
| | | import com.stylefeng.guns.core.exception.ServiceExceptionEnum; |
| | | |
| | | /** |
| | | * @author fengshuonan |
| | | * @Description 所有业务异常的枚举 |
| | | * @date 2016年11月12日 下午5:04:51 |
| | | */ |
| | | public enum BizExceptionEnum implements ServiceExceptionEnum { |
| | | |
| | | /** |
| | | * 字典 |
| | | */ |
| | | DICT_EXISTED(400, "字典已经存在"), |
| | | ERROR_CREATE_DICT(500, "创建字典失败"), |
| | | ERROR_WRAPPER_FIELD(500, "包装字典属性失败"), |
| | | ERROR_CODE_EMPTY(500, "字典类型不能为空"), |
| | | |
| | | /** |
| | | * 文件上传 |
| | | */ |
| | | FILE_READING_ERROR(400, "FILE_READING_ERROR!"), |
| | | FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"), |
| | | UPLOAD_ERROR(500, "上传图片出错"), |
| | | |
| | | /** |
| | | * 权限和数据问题 |
| | | */ |
| | | DB_RESOURCE_NULL(400, "数据库中没有该资源"), |
| | | NO_PERMITION(405, "权限异常"), |
| | | REQUEST_INVALIDATE(400, "请求数据格式不正确"), |
| | | INVALID_KAPTCHA(400, "验证码不正确"), |
| | | CANT_DELETE_ADMIN(600, "不能删除超级管理员"), |
| | | CANT_FREEZE_ADMIN(600, "不能冻结超级管理员"), |
| | | CANT_CHANGE_ADMIN(600, "不能修改超级管理员角色"), |
| | | |
| | | /** |
| | | * 账户问题 |
| | | */ |
| | | USER_ALREADY_REG(401, "该用户已经注册"), |
| | | NO_THIS_USER(400, "没有此用户"), |
| | | USER_NOT_EXISTED(400, "没有此用户"), |
| | | ACCOUNT_FREEZED(401, "账号被冻结"), |
| | | OLD_PWD_NOT_RIGHT(402, "原密码不正确"), |
| | | TWO_PWD_NOT_MATCH(405, "两次输入密码不一致"), |
| | | |
| | | /** |
| | | * 错误的请求 |
| | | */ |
| | | MENU_PCODE_COINCIDENCE(400, "菜单编号和副编号不能一致"), |
| | | EXISTED_THE_MENU(400, "菜单编号重复,不能添加"), |
| | | DICT_MUST_BE_NUMBER(400, "字典的值必须为数字"), |
| | | REQUEST_NULL(400, "请求有错误"), |
| | | SESSION_TIMEOUT(400, "会话超时"), |
| | | SERVER_ERROR(500, "服务器异常"), |
| | | |
| | | /** |
| | | * token异常 |
| | | */ |
| | | TOKEN_EXPIRED(700, "token过期"), |
| | | TOKEN_ERROR(700, "token验证失败"), |
| | | |
| | | /** |
| | | * 签名异常 |
| | | */ |
| | | SIGN_ERROR(700, "签名验证失败"), |
| | | |
| | | /** |
| | | * 其他 |
| | | */ |
| | | AUTH_REQUEST_ERROR(400, "账号密码错误"); |
| | | |
| | | BizExceptionEnum(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | private Integer code; |
| | | |
| | | private String message; |
| | | |
| | | @Override |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(Integer code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.exception; |
| | | |
| | | /** |
| | | * 验证码错误异常 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-05 23:52 |
| | | */ |
| | | public class InvalidKaptchaException extends RuntimeException { |
| | | } |
New file |
| | |
| | | /* |
| | | * Licensed to the Apache Software Foundation (ASF) under one |
| | | * or more contributor license agreements. See the NOTICE file |
| | | * distributed with this work for additional information |
| | | * regarding copyright ownership. The ASF licenses this file |
| | | * to you under the Apache License, Version 2.0 (the |
| | | * "License"); you may not use this file except in compliance |
| | | * with the License. You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, |
| | | * software distributed under the License is distributed on an |
| | | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | * KIND, either express or implied. See the License for the |
| | | * specific language governing permissions and limitations |
| | | * under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.intercept; |
| | | |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.apache.shiro.web.filter.AccessControlFilter; |
| | | import org.apache.shiro.web.util.WebUtils; |
| | | |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * Filter that allows access to resources if the accessor is a known user, which is defined as |
| | | * having a known principal. This means that any user who is authenticated or remembered via a |
| | | * 'remember me' feature will be allowed access from this filter. |
| | | * <p/> |
| | | * If the accessor is not a known user, then they will be redirected to the {@link #setLoginUrl(String) loginUrl}</p> |
| | | * |
| | | * @since 0.9 |
| | | */ |
| | | public class GunsUserFilter extends AccessControlFilter { |
| | | |
| | | /** |
| | | * Returns <code>true</code> if the request is a |
| | | * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or |
| | | * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject} |
| | | * is not <code>null</code>, <code>false</code> otherwise. |
| | | * |
| | | * @return <code>true</code> if the request is a |
| | | * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or |
| | | * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject} |
| | | * is not <code>null</code>, <code>false</code> otherwise. |
| | | */ |
| | | protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { |
| | | if (isLoginRequest(request, response)) { |
| | | return true; |
| | | } else { |
| | | Subject subject = getSubject(request, response); |
| | | // If principal is not null, then the user is known and should be allowed access. |
| | | return subject.getPrincipal() != null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * This default implementation simply calls |
| | | * {@link #saveRequestAndRedirectToLogin(javax.servlet.ServletRequest, javax.servlet.ServletResponse) saveRequestAndRedirectToLogin} |
| | | * and then immediately returns <code>false</code>, thereby preventing the chain from continuing so the redirect may |
| | | * execute. |
| | | */ |
| | | protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { |
| | | HttpServletRequest httpServletRequest = WebUtils.toHttp(request); |
| | | HttpServletResponse httpServletResponse = WebUtils.toHttp(response); |
| | | |
| | | /** |
| | | * 如果是ajax请求则不进行跳转 |
| | | */ |
| | | if (httpServletRequest.getHeader("x-requested-with") != null |
| | | && httpServletRequest.getHeader("x-requested-with").equalsIgnoreCase("XMLHttpRequest")) { |
| | | httpServletResponse.setHeader("sessionstatus", "timeout"); |
| | | return false; |
| | | } else { |
| | | |
| | | /** |
| | | * 第一次点击页面 |
| | | */ |
| | | String referer = httpServletRequest.getHeader("Referer"); |
| | | if (referer == null) { |
| | | saveRequestAndRedirectToLogin(request, response); |
| | | return false; |
| | | } else { |
| | | |
| | | /** |
| | | * 从别的页面跳转过来的 |
| | | */ |
| | | if (ShiroKit.getSession().getAttribute("sessionFlag") == null) { |
| | | httpServletRequest.setAttribute("tips", "请重新登录"); |
| | | httpServletRequest.getRequestDispatcher("/login").forward(request, response); |
| | | return false; |
| | | } else { |
| | | saveRequestAndRedirectToLogin(request, response); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.intercept; |
| | | |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.util.JwtTokenUtil; |
| | | import com.stylefeng.guns.core.util.RenderUtil; |
| | | import io.jsonwebtoken.JwtException; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | |
| | | /** |
| | | * Rest Api接口鉴权 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/7/20 23:11 |
| | | */ |
| | | public class RestApiInteceptor extends HandlerInterceptorAdapter { |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | if (handler instanceof org.springframework.web.servlet.resource.ResourceHttpRequestHandler) { |
| | | return true; |
| | | } |
| | | HandlerMethod handlerMethod = (HandlerMethod) handler; |
| | | return check(request, response, handlerMethod); |
| | | } |
| | | |
| | | private boolean check(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) { |
| | | if (request.getServletPath().equals(JwtConstants.AUTH_PATH)) { |
| | | return true; |
| | | } |
| | | final String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); |
| | | String authToken; |
| | | if (requestHeader != null && requestHeader.startsWith("Bearer ")) { |
| | | authToken = requestHeader.substring(7); |
| | | |
| | | //验证token是否过期,包含了验证jwt是否正确 |
| | | try { |
| | | boolean flag = JwtTokenUtil.isTokenExpired(authToken); |
| | | if (flag) { |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_EXPIRED.getCode(), BizExceptionEnum.TOKEN_EXPIRED.getMessage())); |
| | | return false; |
| | | } |
| | | } catch (JwtException e) { |
| | | //有异常就是token解析失败 |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); |
| | | return false; |
| | | } |
| | | } else { |
| | | //header没有带Bearer字段 |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.intercept; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.util.HttpSessionHolder; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 静态调用session的拦截器 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月13日 下午10:15:42 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class SessionHolderInterceptor extends BaseController { |
| | | |
| | | @Pointcut("execution(* com.stylefeng.guns.*..controller.*.*(..))") |
| | | public void cutService() { |
| | | } |
| | | |
| | | @Around("cutService()") |
| | | public Object sessionKit(ProceedingJoinPoint point) throws Throwable { |
| | | HttpSessionHolder.put(super.getHttpServletRequest().getSession()); |
| | | try { |
| | | return point.proceed(); |
| | | } finally { |
| | | HttpSessionHolder.remove(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.listener; |
| | | |
| | | import javax.servlet.ServletContext; |
| | | import javax.servlet.ServletContextEvent; |
| | | import javax.servlet.ServletContextListener; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ServletContext监听器 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/2/22 21:07 |
| | | */ |
| | | public class ConfigListener implements ServletContextListener { |
| | | |
| | | private static Map<String, String> conf = new HashMap<>(); |
| | | |
| | | public static Map<String, String> getConf() { |
| | | return conf; |
| | | } |
| | | |
| | | @Override |
| | | public void contextDestroyed(ServletContextEvent arg0) { |
| | | conf.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public void contextInitialized(ServletContextEvent evt) { |
| | | ServletContext sc = evt.getServletContext(); |
| | | |
| | | //项目发布,当前运行环境的绝对路径 |
| | | conf.put("realPath", sc.getRealPath("/").replaceFirst("/", "")); |
| | | |
| | | //servletContextPath,默认"" |
| | | conf.put("contextPath", sc.getContextPath()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log; |
| | | |
| | | import java.util.TimerTask; |
| | | import java.util.concurrent.ScheduledThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 日志管理器 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-03-30 16:29 |
| | | */ |
| | | public class LogManager { |
| | | |
| | | //日志记录操作延时 |
| | | private final int OPERATE_DELAY_TIME = 10; |
| | | |
| | | //异步操作记录日志的线程池 |
| | | private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10); |
| | | |
| | | private LogManager() { |
| | | } |
| | | |
| | | public static LogManager logManager = new LogManager(); |
| | | |
| | | public static LogManager me() { |
| | | return logManager; |
| | | } |
| | | |
| | | public void executeLog(TimerTask task) { |
| | | executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log; |
| | | |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.WebApplicationContext; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 被修改的bean临时存放的地方 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-03-31 11:19 |
| | | */ |
| | | @Component |
| | | @Scope(scopeName = WebApplicationContext.SCOPE_SESSION) |
| | | public class LogObjectHolder implements Serializable{ |
| | | |
| | | private Object object = null; |
| | | |
| | | public void set(Object obj) { |
| | | this.object = obj; |
| | | } |
| | | |
| | | public Object get() { |
| | | return object; |
| | | } |
| | | |
| | | public static LogObjectHolder me(){ |
| | | LogObjectHolder bean = SpringContextHolder.getBean(LogObjectHolder.class); |
| | | return bean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.state.LogSucceed; |
| | | import com.stylefeng.guns.core.common.constant.state.LogType; |
| | | import com.stylefeng.guns.modular.system.model.LoginLog; |
| | | import com.stylefeng.guns.modular.system.model.OperationLog; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 日志对象创建工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月6日 下午9:18:27 |
| | | */ |
| | | public class LogFactory { |
| | | |
| | | /** |
| | | * 创建操作日志 |
| | | */ |
| | | public static OperationLog createOperationLog(LogType logType, Integer userId, String bussinessName, String clazzName, String methodName, String msg, LogSucceed succeed) { |
| | | OperationLog operationLog = new OperationLog(); |
| | | operationLog.setLogtype(logType.getMessage()); |
| | | operationLog.setLogname(bussinessName); |
| | | operationLog.setUserid(userId); |
| | | operationLog.setClassname(clazzName); |
| | | operationLog.setMethod(methodName); |
| | | operationLog.setCreatetime(new Date()); |
| | | operationLog.setSucceed(succeed.getMessage()); |
| | | operationLog.setMessage(msg); |
| | | return operationLog; |
| | | } |
| | | |
| | | /** |
| | | * 创建登录日志 |
| | | */ |
| | | public static LoginLog createLoginLog(LogType logType, Integer userId, String msg, String ip) { |
| | | LoginLog loginLog = new LoginLog(); |
| | | loginLog.setLogname(logType.getMessage()); |
| | | loginLog.setUserid(userId); |
| | | loginLog.setCreatetime(new Date()); |
| | | loginLog.setSucceed(LogSucceed.SUCCESS.getMessage()); |
| | | loginLog.setIp(ip); |
| | | loginLog.setMessage(msg); |
| | | return loginLog; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.state.LogSucceed; |
| | | import com.stylefeng.guns.core.common.constant.state.LogType; |
| | | import com.stylefeng.guns.modular.system.dao.LoginLogMapper; |
| | | import com.stylefeng.guns.modular.system.dao.OperationLogMapper; |
| | | import com.stylefeng.guns.modular.system.model.LoginLog; |
| | | import com.stylefeng.guns.modular.system.model.OperationLog; |
| | | import com.stylefeng.guns.core.db.Db; |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * 日志操作任务创建工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月6日 下午9:18:27 |
| | | */ |
| | | public class LogTaskFactory { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(LogManager.class); |
| | | private static LoginLogMapper loginLogMapper = Db.getMapper(LoginLogMapper.class); |
| | | private static OperationLogMapper operationLogMapper = Db.getMapper(OperationLogMapper.class); |
| | | |
| | | public static TimerTask loginLog(final Integer userId, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | LoginLog loginLog = LogFactory.createLoginLog(LogType.LOGIN, userId, null, ip); |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建登录日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask loginLog(final String username, final String msg, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | LoginLog loginLog = LogFactory.createLoginLog( |
| | | LogType.LOGIN_FAIL, null, "账号:" + username + "," + msg, ip); |
| | | try { |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建登录失败异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask exitLog(final Integer userId, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | LoginLog loginLog = LogFactory.createLoginLog(LogType.EXIT, userId, null,ip); |
| | | try { |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建退出日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask bussinessLog(final Integer userId, final String bussinessName, final String clazzName, final String methodName, final String msg) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | OperationLog operationLog = LogFactory.createOperationLog( |
| | | LogType.BUSSINESS, userId, bussinessName, clazzName, methodName, msg, LogSucceed.SUCCESS); |
| | | try { |
| | | operationLogMapper.insert(operationLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建业务日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask exceptionLog(final Integer userId, final Exception exception) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | String msg = ToolUtil.getExceptionMsg(exception); |
| | | OperationLog operationLog = LogFactory.createOperationLog( |
| | | LogType.EXCEPTION, userId, "", null, null, msg, LogSucceed.FAIL); |
| | | try { |
| | | operationLogMapper.insert(operationLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建异常日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro; |
| | | |
| | | import com.stylefeng.guns.core.shiro.factory.IShiro; |
| | | import com.stylefeng.guns.core.shiro.factory.ShiroFactroy; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.AuthenticationException; |
| | | import org.apache.shiro.authc.AuthenticationInfo; |
| | | import org.apache.shiro.authc.AuthenticationToken; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.CredentialsMatcher; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.authz.AuthorizationInfo; |
| | | import org.apache.shiro.authz.SimpleAuthorizationInfo; |
| | | import org.apache.shiro.realm.AuthorizingRealm; |
| | | import org.apache.shiro.subject.PrincipalCollection; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | public class ShiroDbRealm extends AuthorizingRealm { |
| | | |
| | | /** |
| | | * 登录认证 |
| | | */ |
| | | @Override |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) |
| | | throws AuthenticationException { |
| | | IShiro shiroFactory = ShiroFactroy.me(); |
| | | UsernamePasswordToken token = (UsernamePasswordToken) authcToken; |
| | | User user = shiroFactory.user(token.getUsername()); |
| | | ShiroUser shiroUser = shiroFactory.shiroUser(user); |
| | | return shiroFactory.info(shiroUser, user, super.getName()); |
| | | } |
| | | |
| | | /** |
| | | * 权限认证 |
| | | */ |
| | | @Override |
| | | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { |
| | | IShiro shiroFactory = ShiroFactroy.me(); |
| | | ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal(); |
| | | List<Integer> roleList = shiroUser.getRoleList(); |
| | | |
| | | Set<String> permissionSet = new HashSet<>(); |
| | | Set<String> roleNameSet = new HashSet<>(); |
| | | |
| | | for (Integer roleId : roleList) { |
| | | List<String> permissions = shiroFactory.findPermissionsByRoleId(roleId); |
| | | if (permissions != null) { |
| | | for (String permission : permissions) { |
| | | if (ToolUtil.isNotEmpty(permission)) { |
| | | permissionSet.add(permission); |
| | | } |
| | | } |
| | | } |
| | | String roleName = shiroFactory.findRoleNameByRoleId(roleId); |
| | | roleNameSet.add(roleName); |
| | | } |
| | | |
| | | SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); |
| | | info.addStringPermissions(permissionSet); |
| | | info.addRoles(roleNameSet); |
| | | return info; |
| | | } |
| | | |
| | | /** |
| | | * 设置认证加密方式 |
| | | */ |
| | | @Override |
| | | public void setCredentialsMatcher(CredentialsMatcher credentialsMatcher) { |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | | md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); |
| | | super.setCredentialsMatcher(md5CredentialsMatcher); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.shiro; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.Const; |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.crypto.hash.SimpleHash; |
| | | import org.apache.shiro.session.Session; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.apache.shiro.util.ByteSource; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * shiro工具类 |
| | | * |
| | | * @author dafei, Chill Zhuang |
| | | */ |
| | | public class ShiroKit { |
| | | |
| | | private static final String NAMES_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 加盐参数 |
| | | */ |
| | | public final static String hashAlgorithmName = "MD5"; |
| | | |
| | | /** |
| | | * 循环次数 |
| | | */ |
| | | public final static int hashIterations = 1024; |
| | | |
| | | /** |
| | | * shiro密码加密工具类 |
| | | * |
| | | * @param credentials 密码 |
| | | * @param saltSource 密码盐 |
| | | * @return |
| | | */ |
| | | public static String md5(String credentials, String saltSource) { |
| | | ByteSource salt = new Md5Hash(saltSource); |
| | | return new SimpleHash(hashAlgorithmName, credentials, salt, hashIterations).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取随机盐值 |
| | | * @param length |
| | | * @return |
| | | */ |
| | | public static String getRandomSalt(int length) { |
| | | return ToolUtil.getRandomString(length); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前 Subject |
| | | * |
| | | * @return Subject |
| | | */ |
| | | public static Subject getSubject() { |
| | | return SecurityUtils.getSubject(); |
| | | } |
| | | |
| | | /** |
| | | * 获取封装的 ShiroUser |
| | | * |
| | | * @return ShiroUser |
| | | */ |
| | | public static ShiroUser getUser() { |
| | | if (isGuest()) { |
| | | return null; |
| | | } else { |
| | | return (ShiroUser) getSubject().getPrincipals().getPrimaryPrincipal(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 从shiro获取session |
| | | * |
| | | */ |
| | | public static Session getSession() { |
| | | return getSubject().getSession(); |
| | | } |
| | | |
| | | /** |
| | | * 获取shiro指定的sessionKey |
| | | * |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T getSessionAttr(String key) { |
| | | Session session = getSession(); |
| | | return session != null ? (T) session.getAttribute(key) : null; |
| | | } |
| | | |
| | | /** |
| | | * 设置shiro指定的sessionKey |
| | | * |
| | | */ |
| | | public static void setSessionAttr(String key, Object value) { |
| | | Session session = getSession(); |
| | | session.setAttribute(key, value); |
| | | } |
| | | |
| | | /** |
| | | * 移除shiro指定的sessionKey |
| | | */ |
| | | public static void removeSessionAttr(String key) { |
| | | Session session = getSession(); |
| | | if (session != null) |
| | | session.removeAttribute(key); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于该角色?,使用时与lacksRole 搭配使用 |
| | | * |
| | | * @param roleName |
| | | * 角色名 |
| | | * @return 属于该角色:true,否则false |
| | | */ |
| | | public static boolean hasRole(String roleName) { |
| | | return getSubject() != null && roleName != null |
| | | && roleName.length() > 0 && getSubject().hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 |
| | | * |
| | | * @param roleName |
| | | * 角色名 |
| | | * @return 不属于该角色:true,否则false |
| | | */ |
| | | public static boolean lacksRole(String roleName) { |
| | | return !hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下任意一个角色。 |
| | | * |
| | | * @param roleNames |
| | | * 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public static boolean hasAnyRoles(String roleNames) { |
| | | boolean hasAnyRole = false; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (subject.hasRole(role.trim())) { |
| | | hasAnyRole = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAnyRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下所有角色。 |
| | | * |
| | | * @param roleNames |
| | | * 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public static boolean hasAllRoles(String roleNames) { |
| | | boolean hasAllRole = true; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (!subject.hasRole(role.trim())) { |
| | | hasAllRole = false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAllRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 |
| | | * |
| | | * @param permission |
| | | * 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public static boolean hasPermission(String permission) { |
| | | return getSubject() != null && permission != null |
| | | && permission.length() > 0 |
| | | && getSubject().isPermitted(permission); |
| | | } |
| | | |
| | | /** |
| | | * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 |
| | | * |
| | | * @param permission |
| | | * 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public static boolean lacksPermission(String permission) { |
| | | return !hasPermission(permission); |
| | | } |
| | | |
| | | /** |
| | | * 已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 |
| | | * |
| | | * @return 通过身份验证:true,否则false |
| | | */ |
| | | public static boolean isAuthenticated() { |
| | | return getSubject() != null && getSubject().isAuthenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 |
| | | * |
| | | * @return 没有通过身份验证:true,否则false |
| | | */ |
| | | public static boolean notAuthenticated() { |
| | | return !isAuthenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 认证通过或已记住的用户。与guset搭配使用。 |
| | | * |
| | | * @return 用户:true,否则 false |
| | | */ |
| | | public static boolean isUser() { |
| | | return getSubject() != null && getSubject().getPrincipal() != null; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 |
| | | * |
| | | * @return 访客:true,否则false |
| | | */ |
| | | public static boolean isGuest() { |
| | | return !isUser(); |
| | | } |
| | | |
| | | /** |
| | | * 输出当前用户信息,通常为登录帐号信息。 |
| | | * |
| | | * @return 当前用户信息 |
| | | */ |
| | | public static String principal() { |
| | | if (getSubject() != null) { |
| | | Object principal = getSubject().getPrincipal(); |
| | | return principal.toString(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前用户的部门数据范围的集合 |
| | | */ |
| | | public static List<Integer> getDeptDataScope() { |
| | | Integer deptId = getUser().getDeptId(); |
| | | List<Integer> subDeptIds = ConstantFactory.me().getSubDeptId(deptId); |
| | | subDeptIds.add(deptId); |
| | | return subDeptIds; |
| | | } |
| | | |
| | | /** |
| | | * 判断当前用户是否是超级管理员 |
| | | */ |
| | | public static boolean isAdmin() { |
| | | List<Integer> roleList = ShiroKit.getUser().getRoleList(); |
| | | for (Integer integer : roleList) { |
| | | String singleRoleTip = ConstantFactory.me().getSingleRoleTip(integer); |
| | | if (singleRoleTip.equals(Const.ADMIN_NAME)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 自定义Authentication对象,使得Subject除了携带用户的登录名外还可以携带更多信息 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月5日 上午10:26:43 |
| | | */ |
| | | public class ShiroUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public Integer id; // 主键ID |
| | | public String account; // 账号 |
| | | public String name; // 姓名 |
| | | public Integer deptId; // 部门id |
| | | public List<Integer> roleList; // 角色集 |
| | | public String deptName; // 部门名称 |
| | | public List<String> roleNames; // 角色名称集 |
| | | public Integer roleType; // 角色类型 1=平台 2=分公司 3=加盟商 |
| | | public Integer objectId; // 对象ID |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | } |
| | | |
| | | public void setAccount(String account) { |
| | | this.account = account; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getDeptId() { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(Integer deptId) { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | public List<Integer> getRoleList() { |
| | | return roleList; |
| | | } |
| | | |
| | | public void setRoleList(List<Integer> roleList) { |
| | | this.roleList = roleList; |
| | | } |
| | | |
| | | public String getDeptName() { |
| | | return deptName; |
| | | } |
| | | |
| | | public void setDeptName(String deptName) { |
| | | this.deptName = deptName; |
| | | } |
| | | |
| | | public List<String> getRoleNames() { |
| | | return roleNames; |
| | | } |
| | | |
| | | public void setRoleNames(List<String> roleNames) { |
| | | this.roleNames = roleNames; |
| | | } |
| | | |
| | | public Integer getRoleType() { |
| | | return roleType; |
| | | } |
| | | |
| | | public void setRoleType(Integer roleType) { |
| | | this.roleType = roleType; |
| | | } |
| | | |
| | | public Integer getObjectId() { |
| | | return objectId; |
| | | } |
| | | |
| | | public void setObjectId(Integer objectId) { |
| | | this.objectId = objectId; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.shiro.check; |
| | | |
| | | /** |
| | | * 检查用接口 |
| | | */ |
| | | public interface ICheck { |
| | | |
| | | /** |
| | | * 检查当前登录用户是否拥有指定的角色访问当 |
| | | */ |
| | | boolean check(Object[] permissions); |
| | | |
| | | /** |
| | | * 检查当前登录用户是否拥有当前请求的servlet的权限 |
| | | */ |
| | | boolean checkAll(); |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.shiro.check; |
| | | |
| | | import com.stylefeng.guns.core.listener.ConfigListener; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.support.CollectionKit; |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 权限自定义检查 |
| | | */ |
| | | @Service |
| | | @DependsOn("springContextHolder") |
| | | @Transactional(readOnly = true) |
| | | public class PermissionCheckFactory implements ICheck { |
| | | |
| | | public static ICheck me() { |
| | | return SpringContextHolder.getBean(ICheck.class); |
| | | } |
| | | |
| | | @Override |
| | | public boolean check(Object[] permissions) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | | String join = CollectionKit.join(permissions, ","); |
| | | if (ShiroKit.hasAnyRoles(join)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkAll() { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | | String requestURI = request.getRequestURI().replaceFirst(ConfigListener.getConf().get("contextPath"), ""); |
| | | String[] str = requestURI.split("/"); |
| | | if (str.length > 3) { |
| | | requestURI = "/" + str[1] + "/" + str[2]; |
| | | } |
| | | if (ShiroKit.hasPermission(requestURI)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.shiro.check; |
| | | |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | |
| | | /** |
| | | * 权限检查管理器(入口) |
| | | */ |
| | | public class PermissionCheckManager { |
| | | private final static PermissionCheckManager me = new PermissionCheckManager(); |
| | | |
| | | private ICheck defaultCheckFactory = SpringContextHolder.getBean(ICheck.class); |
| | | |
| | | public static PermissionCheckManager me() { |
| | | return me; |
| | | } |
| | | |
| | | private PermissionCheckManager() { |
| | | } |
| | | |
| | | public PermissionCheckManager(ICheck checkFactory) { |
| | | this.defaultCheckFactory = checkFactory; |
| | | } |
| | | |
| | | public void setDefaultCheckFactory(ICheck defaultCheckFactory) { |
| | | this.defaultCheckFactory = defaultCheckFactory; |
| | | } |
| | | |
| | | public static boolean check(Object[] permissions) { |
| | | return me.defaultCheckFactory.check(permissions); |
| | | } |
| | | |
| | | public static boolean checkAll() { |
| | | return me.defaultCheckFactory.checkAll(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro.factory; |
| | | |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 定义shirorealm所需数据的接口 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月5日 上午10:23:34 |
| | | */ |
| | | public interface IShiro { |
| | | |
| | | /** |
| | | * 根据账号获取登录用户 |
| | | * |
| | | * @param account 账号 |
| | | */ |
| | | User user(String account); |
| | | |
| | | /** |
| | | * 根据系统用户获取Shiro的用户 |
| | | * |
| | | * @param user 系统用户 |
| | | */ |
| | | ShiroUser shiroUser(User user); |
| | | |
| | | /** |
| | | * 获取权限列表通过角色id |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | List<String> findPermissionsByRoleId(Integer roleId); |
| | | |
| | | /** |
| | | * 根据角色id获取角色名称 |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | String findRoleNameByRoleId(Integer roleId); |
| | | |
| | | /** |
| | | * 获取shiro的认证信息 |
| | | */ |
| | | SimpleAuthenticationInfo info(ShiroUser shiroUser, User user, String realmName); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | | import com.stylefeng.guns.core.common.constant.state.ManagerStatus; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.Convert; |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import com.stylefeng.guns.modular.system.dao.MenuMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.CredentialsException; |
| | | import org.apache.shiro.authc.LockedAccountException; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @DependsOn("springContextHolder") |
| | | @Transactional(readOnly = true) |
| | | public class ShiroFactroy implements IShiro { |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | | @Autowired |
| | | private MenuMapper menuMapper; |
| | | |
| | | public static IShiro me() { |
| | | return SpringContextHolder.getBean(IShiro.class); |
| | | } |
| | | |
| | | @Override |
| | | public User user(String account) { |
| | | |
| | | User user = userMapper.getByAccount(account); |
| | | |
| | | // 账号不存在 |
| | | if (null == user) { |
| | | throw new CredentialsException(); |
| | | } |
| | | // 账号被冻结 |
| | | if (user.getStatus() != ManagerStatus.OK.getCode()) { |
| | | throw new LockedAccountException(); |
| | | } |
| | | return user; |
| | | } |
| | | |
| | | @Override |
| | | public ShiroUser shiroUser(User user) { |
| | | ShiroUser shiroUser = new ShiroUser(); |
| | | |
| | | shiroUser.setId(user.getId()); |
| | | shiroUser.setAccount(user.getAccount()); |
| | | shiroUser.setDeptId(user.getDeptid()); |
| | | shiroUser.setDeptName(ConstantFactory.me().getDeptName(user.getDeptid())); |
| | | shiroUser.setName(user.getName()); |
| | | |
| | | Integer[] roleArray = Convert.toIntArray(user.getRoleid()); |
| | | List<Integer> roleList = new ArrayList<Integer>(); |
| | | List<String> roleNameList = new ArrayList<String>(); |
| | | for (int roleId : roleArray) { |
| | | roleList.add(roleId); |
| | | roleNameList.add(ConstantFactory.me().getSingleRoleName(roleId)); |
| | | } |
| | | shiroUser.setRoleList(roleList); |
| | | shiroUser.setRoleNames(roleNameList); |
| | | |
| | | return shiroUser; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> findPermissionsByRoleId(Integer roleId) { |
| | | return menuMapper.getResUrlsByRoleId(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public String findRoleNameByRoleId(Integer roleId) { |
| | | return ConstantFactory.me().getSingleRoleTip(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public SimpleAuthenticationInfo info(ShiroUser shiroUser, User user, String realmName) { |
| | | String credentials = user.getPassword(); |
| | | |
| | | // 密码加盐处理 |
| | | String source = user.getSalt(); |
| | | ByteSource credentialsSalt = new Md5Hash(source); |
| | | return new SimpleAuthenticationInfo(shiroUser, credentials, credentialsSalt, realmName); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.tag; |
| | | |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.Dict; |
| | | import com.stylefeng.guns.modular.system.service.IDictService; |
| | | import org.beetl.core.Tag; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.stereotype.Component; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 字典标签渲染 |
| | | * |
| | | * @author zhangjiajia |
| | | * @Date 2018年6月4日17:33:32 |
| | | */ |
| | | @Component |
| | | @Scope("prototype") |
| | | public class DictSelectorTag extends Tag { |
| | | |
| | | @Autowired |
| | | IDictService iDictService; |
| | | |
| | | @Override |
| | | public void render(){ |
| | | //String tagName = (String) this.args[0]; |
| | | Map attrs = (Map) args[1]; |
| | | if(ToolUtil.isEmpty(attrs.get("code"))){ |
| | | throw new GunsException(BizExceptionEnum.ERROR_CODE_EMPTY); |
| | | } |
| | | |
| | | //字典类型编码 |
| | | String code = attrs.get("code").toString(); |
| | | //控件显示类型select 选择框,radio 单选按钮,checkbox 多选按钮 |
| | | String type = ToolUtil.isNotEmpty(attrs.get("type"))?attrs.get("type").toString():"select"; |
| | | //开启多选 |
| | | String multiple = ToolUtil.isNotEmpty(attrs.get("multiple"))?attrs.get("multiple").toString():""; |
| | | //字典名称 |
| | | String label = ToolUtil.isNotEmpty(attrs.get("label"))?attrs.get("label").toString():""; |
| | | //提示 |
| | | String placeholder = (ToolUtil.isNotEmpty(attrs.get("placeholder"))?attrs.get("placeholder").toString():""); |
| | | //宽度 |
| | | String width = ToolUtil.isNotEmpty(attrs.get("width"))?attrs.get("width").toString():"248"; |
| | | //默认值 |
| | | String value = ToolUtil.isNotEmpty(attrs.get("value"))?attrs.get("value").toString():""; |
| | | //id |
| | | String id = ToolUtil.isNotEmpty(attrs.get("id"))?attrs.get("id").toString():""; |
| | | //name |
| | | String name = ToolUtil.isNotEmpty(attrs.get("name"))?attrs.get("name").toString():""; |
| | | //分割线 |
| | | String underline = ToolUtil.isNotEmpty(attrs.get("underline"))?attrs.get("underline").toString():""; |
| | | //onchange事件 |
| | | String onchange = ToolUtil.isNotEmpty(attrs.get("onchange"))?attrs.get("onchange").toString():""; |
| | | //readonly属性 |
| | | String readonly = ToolUtil.isNotEmpty(attrs.get("readonly"))?attrs.get("readonly").toString():""; |
| | | //disabled属性 |
| | | String disabled = ToolUtil.isNotEmpty(attrs.get("disabled"))?attrs.get("disabled").toString():""; |
| | | //searchnum 下拉选项数量达到多少启用搜索,默认10 |
| | | int searchnum = ToolUtil.isNum(attrs.get("searchnum"))?Integer.parseInt(attrs.get("searchnum").toString()):10; |
| | | //根据code查询字典数据 |
| | | List<Dict> list = iDictService.selectByParentCode(code); |
| | | |
| | | StringBuffer html = new StringBuffer(); |
| | | html.append("<div class=\"form-group\">\r\n"); |
| | | html.append("<label class=\"col-sm-3 control-label\">"+label+"</label>\r\n"); |
| | | html.append("<div class=\"col-sm-9\">\r\n"); |
| | | |
| | | //单选按钮 |
| | | if("radio".equals(type)) { |
| | | |
| | | list.forEach(obj->{ |
| | | html.append("<label class=\"radio-inline i-checks\">\r\n<input type=\"radio\" "); |
| | | //判断控件是否禁用 |
| | | if("true".equals(disabled)||"disabled".equals(disabled)) { |
| | | html.append("disabled "); |
| | | }else{ |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | html.append("name=\""+name+"\" "); |
| | | } |
| | | } |
| | | if("true".equals(readonly)||"disabled".equals(readonly)) { |
| | | html.append("disabled "); |
| | | } |
| | | if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ |
| | | html.append("checked "); |
| | | } |
| | | |
| | | html.append("value=\""+obj.getCode()+"\" >"+obj.getName()+"</label>\r\n"); |
| | | }); |
| | | |
| | | //多选按钮 |
| | | }else if("checkbox".equals(type)){ |
| | | list.forEach(obj->{ |
| | | html.append("<label class=\"checkbox-inline i-checks\">\r\n<input type=\"checkbox\" "); |
| | | //判断控件是否禁用 |
| | | if("true".equals(disabled)||"disabled".equals(disabled)) { |
| | | html.append("disabled "); |
| | | }else{ |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | html.append("name=\""+name+"\" "); |
| | | } |
| | | } |
| | | if("true".equals(readonly)||"disabled".equals(readonly)) { |
| | | html.append("disabled "); |
| | | } |
| | | if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ |
| | | html.append("checked "); |
| | | } |
| | | |
| | | html.append("value=\""+obj.getCode()+"\" >"+obj.getName()+"</label>\r\n"); |
| | | }); |
| | | |
| | | //默认select |
| | | }else{ |
| | | //开启多选 |
| | | if("true".equals(multiple)){ |
| | | if(list.size()>=searchnum) { |
| | | html.append("<select multiple "); |
| | | }else{ |
| | | html.append("<select multiple=\"multiple\" size=\"10\" "); |
| | | } |
| | | }else{ |
| | | html.append("<select "); |
| | | } |
| | | |
| | | //判断控件是否启用提示 |
| | | if(ToolUtil.isNotEmpty(placeholder)){ |
| | | html.append(" data-placeholder=\""+placeholder+"\" "); |
| | | } |
| | | |
| | | //判断控件是否禁用 |
| | | if("true".equals(disabled)||"disabled".equals(disabled)) { |
| | | html.append("disabled=\"disabled\" "); |
| | | }else{ |
| | | //启用 |
| | | if(ToolUtil.isNotEmpty(id)){ |
| | | html.append("id=\""+id+"\" "); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | html.append("name=\""+name+"\" "); |
| | | } |
| | | } |
| | | |
| | | //判断是否启用搜索框 |
| | | //判断下拉数据,如果查询出来的条数达到启用搜索的数量就启用 |
| | | |
| | | |
| | | if(list.size()>=searchnum){ |
| | | html.append("class=\"form-control chosen-select\" style=\"width:"+width+"px\" tabindex=\"1\" \r\n"); |
| | | } else{ |
| | | html.append("class=\"form-control\" style=\"width:"+width+"px\" \r\n"); |
| | | } |
| | | |
| | | //判断控件是否只读 |
| | | if("true".equals(readonly)||"readonly".equals(readonly)) { |
| | | if(list.size()>=searchnum) { |
| | | html.append("disabled=\"disabled\" "); |
| | | }else{ |
| | | html.append("onfocus=\"this.defaultIndex=this.selectedIndex;\" onchange=\"this.selectedIndex=this.defaultIndex;\" "); |
| | | } |
| | | } |
| | | |
| | | //判断是否绑定onchange事件 |
| | | if(ToolUtil.isNotEmpty(onchange)){ |
| | | html.append("onchange=\""+onchange+"($(this).children('option:selected').val())\" "); |
| | | } |
| | | |
| | | html.append(">"); |
| | | if(ToolUtil.isNotEmpty(placeholder)){ |
| | | html.append("<option value=\"\">"+placeholder+"</option>\r\n"); |
| | | } |
| | | //将查询出来的数据添加到select中 |
| | | list.forEach(obj->{ |
| | | if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ |
| | | html.append("<option selected value=\""+obj.getCode()+"\">"+obj.getName()+"</option>\r\n"); |
| | | }else{ |
| | | html.append("<option value=\""+obj.getCode()+"\">"+obj.getName()+"</option>\r\n"); |
| | | } |
| | | }); |
| | | html.append("</select>\r\n"); |
| | | } |
| | | |
| | | html.append("</div>\r\n</div>\r\n"); |
| | | //判断是否添加分割线 |
| | | if(ToolUtil.isNotEmpty(underline) && "true".equals(underline)) { |
| | | html.append("<div class=\"hr-line-dashed\" ></div >\r\n"); |
| | | } |
| | | |
| | | try{ |
| | | this.ctx.byteWriter.writeString(html.toString()); |
| | | }catch (IOException e){ |
| | | throw new RuntimeException("输出字典标签错误"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.Const; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.node.MenuNode; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * api接口文档显示过滤 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-08-17 16:55 |
| | | */ |
| | | public class ApiMenuFilter extends MenuNode { |
| | | |
| | | public static List<MenuNode> build(List<MenuNode> nodes) { |
| | | |
| | | //如果关闭了接口文档,则不显示接口文档菜单 |
| | | GunsProperties gunsProperties = SpringContextHolder.getBean(GunsProperties.class); |
| | | if (!gunsProperties.getSwaggerOpen()) { |
| | | List<MenuNode> menuNodesCopy = new ArrayList<>(); |
| | | for (MenuNode menuNode : nodes) { |
| | | if (Const.API_MENU_NAME.equals(menuNode.getName())) { |
| | | continue; |
| | | } else { |
| | | menuNodesCopy.add(menuNode); |
| | | } |
| | | } |
| | | nodes = menuNodesCopy; |
| | | } |
| | | |
| | | return nodes; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.stylefeng.guns.core.common.constant.dictmap.factory.DictFieldWarpperFactory; |
| | | import com.stylefeng.guns.core.support.StrKit; |
| | | |
| | | import java.beans.PropertyDescriptor; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 对比两个对象的变化的工具类 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/3/31 10:36 |
| | | */ |
| | | public class Contrast { |
| | | |
| | | //记录每个修改字段的分隔符 |
| | | public static final String separator = ";;;"; |
| | | |
| | | /** |
| | | * 比较两个对象,并返回不一致的信息 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:34 |
| | | */ |
| | | public static String contrastObj(Object pojo1, Object pojo2) { |
| | | String str = ""; |
| | | try { |
| | | Class clazz = pojo1.getClass(); |
| | | Field[] fields = pojo1.getClass().getDeclaredFields(); |
| | | int i = 1; |
| | | for (Field field : fields) { |
| | | if ("serialVersionUID".equals(field.getName())) { |
| | | continue; |
| | | } |
| | | PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); |
| | | Method getMethod = pd.getReadMethod(); |
| | | Object o1 = getMethod.invoke(pojo1); |
| | | Object o2 = getMethod.invoke(pojo2); |
| | | if (o1 == null || o2 == null) { |
| | | continue; |
| | | } |
| | | if (o1 instanceof Date) { |
| | | o1 = DateUtil.getDay((Date) o1); |
| | | } |
| | | if (!o1.toString().equals(o2.toString())) { |
| | | if (i != 1) { |
| | | str += separator; |
| | | } |
| | | str += "字段名称" + field.getName() + ",旧值:" + o1 + ",新值:" + o2; |
| | | i++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 比较两个对象pojo1和pojo2,并输出不一致信息 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:34 |
| | | */ |
| | | public static String contrastObj(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException { |
| | | AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); |
| | | String str = parseMutiKey(dictMap, key, pojo2) + separator; |
| | | try { |
| | | Class clazz = pojo1.getClass(); |
| | | Field[] fields = pojo1.getClass().getDeclaredFields(); |
| | | int i = 1; |
| | | for (Field field : fields) { |
| | | if ("serialVersionUID".equals(field.getName())) { |
| | | continue; |
| | | } |
| | | PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); |
| | | Method getMethod = pd.getReadMethod(); |
| | | Object o1 = getMethod.invoke(pojo1); |
| | | Object o2 = pojo2.get(StrKit.firstCharToLowerCase(getMethod.getName().substring(3))); |
| | | if (o1 == null || o2 == null) { |
| | | continue; |
| | | } |
| | | if (o1 instanceof Date) { |
| | | o1 = DateUtil.getDay((Date) o1); |
| | | } else if (o1 instanceof Integer) { |
| | | o2 = Integer.parseInt(o2.toString()); |
| | | } |
| | | if (!o1.toString().equals(o2.toString())) { |
| | | if (i != 1) { |
| | | str += separator; |
| | | } |
| | | String fieldName = dictMap.get(field.getName()); |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(field.getName()); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object o1Warpper = DictFieldWarpperFactory.createFieldWarpper(o1, fieldWarpperMethodName); |
| | | Object o2Warpper = DictFieldWarpperFactory.createFieldWarpper(o2, fieldWarpperMethodName); |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1Warpper + ",新值:" + o2Warpper; |
| | | } else { |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1 + ",新值:" + o2; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 比较两个对象pojo1和pojo2,并输出不一致信息 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:34 |
| | | */ |
| | | public static String contrastObjByName(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException { |
| | | AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); |
| | | String str = parseMutiKey(dictMap, key, pojo2) + separator; |
| | | try { |
| | | Class clazz = pojo1.getClass(); |
| | | Field[] fields = pojo1.getClass().getDeclaredFields(); |
| | | int i = 1; |
| | | for (Field field : fields) { |
| | | if ("serialVersionUID".equals(field.getName())) { |
| | | continue; |
| | | } |
| | | String prefix = "get"; |
| | | int prefixLength = 3; |
| | | if (field.getType().getName().equals("java.lang.Boolean")) { |
| | | prefix = "is"; |
| | | prefixLength = 2; |
| | | } |
| | | Method getMethod = null; |
| | | try { |
| | | getMethod = clazz.getDeclaredMethod(prefix + StrKit.firstCharToUpperCase(field.getName())); |
| | | } catch (java.lang.NoSuchMethodException e) { |
| | | System.err.println("this className:" + clazz.getName() + " is not methodName: " + e.getMessage()); |
| | | continue; |
| | | } |
| | | Object o1 = getMethod.invoke(pojo1); |
| | | Object o2 = pojo2.get(StrKit.firstCharToLowerCase(getMethod.getName().substring(prefixLength))); |
| | | if (o1 == null || o2 == null) { |
| | | continue; |
| | | } |
| | | if (o1 instanceof Date) { |
| | | o1 = DateUtil.getDay((Date) o1); |
| | | } else if (o1 instanceof Integer) { |
| | | o2 = Integer.parseInt(o2.toString()); |
| | | } |
| | | if (!o1.toString().equals(o2.toString())) { |
| | | if (i != 1) { |
| | | str += separator; |
| | | } |
| | | String fieldName = dictMap.get(field.getName()); |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(field.getName()); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object o1Warpper = DictFieldWarpperFactory.createFieldWarpper(o1, fieldWarpperMethodName); |
| | | Object o2Warpper = DictFieldWarpperFactory.createFieldWarpper(o2, fieldWarpperMethodName); |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1Warpper + ",新值:" + o2Warpper; |
| | | } else { |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1 + ",新值:" + o2; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 解析多个key(逗号隔开的) |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/16 22:19 |
| | | */ |
| | | public static String parseMutiKey(AbstractDictMap dictMap, String key, Map<String, String> requests) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | if (key.indexOf(",") != -1) { |
| | | String[] keys = key.split(","); |
| | | for (String item : keys) { |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(item); |
| | | String value = requests.get(item); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object valueWarpper = DictFieldWarpperFactory.createFieldWarpper(value, fieldWarpperMethodName); |
| | | sb.append(dictMap.get(item) + "=" + valueWarpper + ","); |
| | | } else { |
| | | if(item.equals("addTime") || item.equals("createDate")){ |
| | | value= com.stylefeng.guns.modular.system.util.DateUtil.todayStr("yyyy-MM-dd HH:mm"); |
| | | } |
| | | sb.append(dictMap.get(item) + "=" + value + ","); |
| | | } |
| | | } |
| | | return StrKit.removeSuffix(sb.toString(), ","); |
| | | } else { |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(key); |
| | | String value = requests.get(key); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object valueWarpper = DictFieldWarpperFactory.createFieldWarpper(value, fieldWarpperMethodName); |
| | | sb.append(dictMap.get(key) + "=" + valueWarpper); |
| | | } else { |
| | | sb.append(dictMap.get(key) + "=" + value); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | | import io.jsonwebtoken.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p>jwt token工具类</p> |
| | | * <pre> |
| | | * jwt的claim里一般包含以下几种数据: |
| | | * 1. iss -- token的发行者 |
| | | * 2. sub -- 该JWT所面向的用户 |
| | | * 3. aud -- 接收该JWT的一方 |
| | | * 4. exp -- token的失效时间 |
| | | * 5. nbf -- 在此时间段之前,不会被处理 |
| | | * 6. iat -- jwt发布时间 |
| | | * 7. jti -- jwt唯一标识,防止重复使用 |
| | | * </pre> |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/8/25 10:59 |
| | | */ |
| | | @Component |
| | | public class JwtTokenUtil { |
| | | |
| | | /** |
| | | * 获取用户名从token中 |
| | | */ |
| | | public static String getUsernameFromToken(String token) { |
| | | return getClaimFromToken(token).getSubject(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt发布时间 |
| | | */ |
| | | public static Date getIssuedAtDateFromToken(String token) { |
| | | return getClaimFromToken(token).getIssuedAt(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt失效时间 |
| | | */ |
| | | public static Date getExpirationDateFromToken(String token) { |
| | | return getClaimFromToken(token).getExpiration(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt接收者 |
| | | */ |
| | | public static String getAudienceFromToken(String token) { |
| | | return getClaimFromToken(token).getAudience(); |
| | | } |
| | | |
| | | /** |
| | | * 获取私有的jwt claim |
| | | */ |
| | | public static String getPrivateClaimFromToken(String token, String key) { |
| | | return getClaimFromToken(token).get(key).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt的payload部分 |
| | | */ |
| | | public static Claims getClaimFromToken(String token) { |
| | | return Jwts.parser() |
| | | .setSigningKey(JwtConstants.SECRET) |
| | | .parseClaimsJws(token) |
| | | .getBody(); |
| | | } |
| | | |
| | | /** |
| | | * 解析token是否正确,不正确会报异常<br> |
| | | */ |
| | | public static void parseToken(String token) throws JwtException { |
| | | Jwts.parser().setSigningKey(JwtConstants.SECRET).parseClaimsJws(token).getBody(); |
| | | } |
| | | |
| | | /** |
| | | * <pre> |
| | | * 验证token是否失效 |
| | | * true:过期 false:没过期 |
| | | * </pre> |
| | | */ |
| | | public static Boolean isTokenExpired(String token) { |
| | | try { |
| | | final Date expiration = getExpirationDateFromToken(token); |
| | | return expiration.before(new Date()); |
| | | } catch (ExpiredJwtException expiredJwtException) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成token(通过用户名和签名时候用的随机数) |
| | | */ |
| | | public static String generateToken(String userId) { |
| | | Map<String, Object> claims = new HashMap<>(); |
| | | return doGenerateToken(claims, userId); |
| | | } |
| | | |
| | | /** |
| | | * 生成token |
| | | */ |
| | | private static String doGenerateToken(Map<String, Object> claims, String subject) { |
| | | final Date createdDate = new Date(); |
| | | final Date expirationDate = new Date(createdDate.getTime() + JwtConstants.EXPIRATION * 1000); |
| | | |
| | | return Jwts.builder() |
| | | .setClaims(claims) |
| | | .setSubject(subject) |
| | | .setIssuedAt(createdDate) |
| | | .setExpiration(expirationDate) |
| | | .signWith(SignatureAlgorithm.HS512, JwtConstants.SECRET) |
| | | .compact(); |
| | | } |
| | | |
| | | /** |
| | | * 获取混淆MD5签名用的随机字符串 |
| | | */ |
| | | public static String getRandomKey() { |
| | | return ToolUtil.getRandomString(6); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | |
| | | /** |
| | | * 验证码工具类 |
| | | */ |
| | | public class KaptchaUtil { |
| | | |
| | | /** |
| | | * 获取验证码开关 |
| | | */ |
| | | public static Boolean getKaptchaOnOff() { |
| | | return SpringContextHolder.getBean(GunsProperties.class).getKaptchaOpen(); |
| | | } |
| | | } |
New file |
| | |
| | | //package com.stylefeng.guns.core.util; |
| | | // |
| | | //import com.obs.services.ObsClient; |
| | | //import com.obs.services.model.ObjectMetadata; |
| | | //import org.springframework.web.multipart.MultipartFile; |
| | | // |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import java.io.IOException; |
| | | //import java.io.InputStream; |
| | | //import java.util.UUID; |
| | | // |
| | | //public class ObsUploadUtil { |
| | | // //OBS图片访问域名 |
| | | // public static String endPoint = "obs.cn-east-3.myhuaweicloud.com"; |
| | | // public static String accessKeyId = "HB7DOVELEVWYYUS7QHYX"; |
| | | // public static String accessKeySecret = "nEwDoSdLRkA1BRfW17pMZL9RlnrVywuTeHSkMn7y"; |
| | | // public static String bucketName = "mian-ju-mi-liao"; |
| | | // public static String oss_domain = "https://mian-ju-mi-liao.obs.cn-east-3.myhuaweicloud.com/"; |
| | | // |
| | | // |
| | | // // 创建ObsClient实例 |
| | | // public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | // |
| | | // public static String obsUpload(HttpServletRequest request, MultipartFile file) throws IOException{ |
| | | // //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | // String fileName = ""; |
| | | // if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | | // InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | // ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | // meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | // String originalFilename = file.getOriginalFilename(); |
| | | // fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | // obsClient.putObject(bucketName,"admin/"+fileName,content,meta);// 上传Object. |
| | | // if(fileName != null && !"".equals(fileName)){ |
| | | // System.out.println(fileName); |
| | | // fileName = oss_domain+"admin/"+fileName; |
| | | // } |
| | | // } |
| | | // return fileName; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 删除某个Object |
| | | // * |
| | | // * @param bucketUrl |
| | | // * @return |
| | | // */ |
| | | // public static boolean deleteObject(String bucketUrl) { |
| | | // try { |
| | | // bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // // 删除Object. |
| | | // obsClient.deleteObject(bucketName, bucketUrl); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return false; |
| | | // } finally { |
| | | // //ossClient.shutdown(); |
| | | // } |
| | | // return true; |
| | | // } |
| | | // |
| | | //// public static void createBucket(String bucketName) |
| | | //// { |
| | | //// //初始化 OSSClient |
| | | ////// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | //// |
| | | //// // 新建一个Bucket |
| | | //// Bucket bucket = ossClient.createBucket(bucketName); |
| | | //// System.out.println(bucket.getName()); |
| | | //// System.out.println(bucket.getCreationDate()); |
| | | //// } |
| | | //// |
| | | //// public static void main(String[] args) { |
| | | //// OssUploadUtil.createBucket("ssfdfsd"); |
| | | //// } |
| | | //} |
New file |
| | |
| | | //package com.stylefeng.guns.core.util; |
| | | // |
| | | //import com.obs.services.ObsClient; |
| | | //import org.springframework.web.multipart.MultipartFile; |
| | | // |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import java.io.IOException; |
| | | //import java.io.InputStream; |
| | | //import java.util.UUID; |
| | | // |
| | | //public class OssUploadUtil { |
| | | // public static String endPoint = "obs.cn-south-1.myhuaweicloud.com"; |
| | | // public static String accessKeyId = "MLJEFPYY0LJKAVA5C4YI"; |
| | | // public static String accessKeySecret = "C8PmdLHAW7OOKR1fbEGYrqIiTh4yaLrRzA0uVZ89"; |
| | | // public static String bucketName = "qinqinzhuanche"; |
| | | // public static String oss_domain = "https://qinqinzhuanche.obs.cn-south-1.myhuaweicloud.com/"; |
| | | // // 创建ObsClient实例 |
| | | // public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | // |
| | | // public static String ossUpload(HttpServletRequest request,MultipartFile file) throws IOException{ |
| | | // //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | // String fileName = ""; |
| | | // if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | | // InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | // com.obs.services.model.ObjectMetadata meta = new com.obs.services.model.ObjectMetadata();// 创建上传Object的Metadata |
| | | // meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | // String originalFilename = file.getOriginalFilename(); |
| | | // fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | // obsClient.putObject(bucketName,fileName,content,meta);// 上传Object. |
| | | // if(fileName != null && !"".equals(fileName)){ |
| | | // System.out.println(fileName); |
| | | // fileName = oss_domain+fileName; |
| | | // } |
| | | // } |
| | | // return fileName; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 删除某个Object |
| | | // * |
| | | // * @param bucketUrl |
| | | // * @return |
| | | // */ |
| | | // public static boolean deleteObject(String bucketUrl) { |
| | | // try { |
| | | // bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // // 删除Object. |
| | | // obsClient.deleteObject(bucketName, bucketUrl); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return false; |
| | | // } finally { |
| | | // //ossClient.shutdown(); |
| | | // } |
| | | // return true; |
| | | // } |
| | | // |
| | | // |
| | | //} |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.text.DecimalFormat; |
| | | import java.text.NumberFormat; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | |
| | | /** |
| | | * 基本数据处理工具类 |
| | | */ |
| | | public class SinataUtil { |
| | | |
| | | |
| | | /** |
| | | * List集合分页<br/> |
| | | * 创建人:Mryang<br/> |
| | | * 时间:2016年7月28日-下午2:58:14 <br/> |
| | | * @param <T> |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param list |
| | | * @throws Exception List<UserOrderList> <br/> |
| | | */ |
| | | public static <T> List<T> listpage(int pageNo, int pageSize, List<T> list) throws Exception { |
| | | List<T> result = new ArrayList<T>(); |
| | | if (list != null && list.size() > 0) { |
| | | int allCount = list.size(); |
| | | if(pageNo > 1 && allCount < pageSize) { |
| | | return new ArrayList<>(); |
| | | } |
| | | int pageCount = (allCount + pageSize - 1) / pageSize; |
| | | if (pageNo >= pageCount) { |
| | | pageNo = pageCount; |
| | | } |
| | | int start = (pageNo - 1) * pageSize; |
| | | int end = pageNo * pageSize; |
| | | if (end >= allCount) { |
| | | end = allCount; |
| | | } |
| | | for (int i = start; i < end; i++) { |
| | | result.add(list.get(i)); |
| | | } |
| | | } |
| | | return (result != null && result.size() > 0) ? result : new ArrayList<T>(); |
| | | } |
| | | |
| | | /** |
| | | * Double类型取整 |
| | | * @param num |
| | | * @return |
| | | */ |
| | | public static String doubleTrans(double num) { |
| | | return String.valueOf((long) num); |
| | | } |
| | | |
| | | /** |
| | | * Double类型保留1位小数 |
| | | * |
| | | * @param num |
| | | * @return |
| | | */ |
| | | public static String doubleRetainOne(double num) { |
| | | DecimalFormat dfs = new DecimalFormat("0.0"); |
| | | return dfs.format(num); |
| | | } |
| | | |
| | | /** |
| | | * 5位随机数 |
| | | * @return |
| | | */ |
| | | public static synchronized String getFive() { |
| | | int i=(int)((Math.random()*9+1)*10000); |
| | | return i+""; |
| | | } |
| | | /** |
| | | * Double类型保留2位小数 |
| | | * |
| | | * @param num |
| | | * @return |
| | | */ |
| | | public static String doubleRetainTwo(double num) { |
| | | DecimalFormat dfs = new DecimalFormat("0.00"); |
| | | String.format("%.2f", num); |
| | | return dfs.format(num); |
| | | } |
| | | |
| | | /** |
| | | * Double类型保留1位小数(四舍五入) |
| | | * |
| | | * @param num |
| | | * @return |
| | | */ |
| | | public static String doubleForwardOne(double num) { |
| | | return String.format("%.1f", num); |
| | | } |
| | | |
| | | /** |
| | | * Double类型保留2位小数(四舍五入) |
| | | * |
| | | * @param num |
| | | * @return |
| | | */ |
| | | public static String doubleForwardTwo(double num) { |
| | | return String.format("%.2f", num); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转换成Ascii |
| | | * |
| | | * @param value |
| | | * @return |
| | | */ |
| | | public static String stringToAscii(String value) { |
| | | StringBuffer sbu = new StringBuffer(); |
| | | char[] chars = value.toCharArray(); |
| | | for (int i = 0; i < chars.length; i++) { |
| | | if (i != chars.length - 1) { |
| | | sbu.append((int) chars[i]); |
| | | } else { |
| | | sbu.append((int) chars[i]); |
| | | } |
| | | } |
| | | return sbu.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 小数转换为百分比 |
| | | * |
| | | * @param decimal |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | public static String decTurnPercent(double decimal) { |
| | | NumberFormat num = NumberFormat.getPercentInstance(); |
| | | num.setMaximumIntegerDigits(3); |
| | | num.setMaximumFractionDigits(2); |
| | | return num.format(decimal); |
| | | } |
| | | |
| | | /** |
| | | * Ascii转换成字符串 |
| | | * |
| | | * @param value |
| | | * @return |
| | | */ |
| | | public static String asciiToString(String value) { |
| | | String[] chars = value.split(","); |
| | | StringBuffer sbu = new StringBuffer(); |
| | | for (int i = 0; i < chars.length; i++) { |
| | | sbu.append((char) Integer.parseInt(chars[i])); |
| | | } |
| | | return sbu.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转换unicode |
| | | * |
| | | * @param string |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | public static String string2Unicode(String string) { |
| | | StringBuffer unicode = new StringBuffer(); |
| | | for (int i = 0; i < string.length(); i++) { |
| | | // 取出每一个字符 |
| | | char c = string.charAt(i); |
| | | // 转换为unicode |
| | | unicode.append("\\u" + Integer.toHexString(c)); |
| | | } |
| | | return unicode.toString(); |
| | | } |
| | | |
| | | /** |
| | | * unicode 转字符串 |
| | | * |
| | | * @param unicode |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | public static String unicode2String(String unicode) { |
| | | StringBuffer string = new StringBuffer(); |
| | | String[] hex = unicode.split("\\\\u"); |
| | | for (int i = 1; i < hex.length; i++) { |
| | | // 转换出每一个代码点 |
| | | int data = Integer.parseInt(hex[i], 16); |
| | | // 追加成string |
| | | string.append((char) data); |
| | | } |
| | | return string.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 字符串编码转换的实现方法 |
| | | * |
| | | * @param str |
| | | * 待转换编码的字符串 |
| | | * @param newCharset |
| | | * 目标编码 |
| | | * @return |
| | | * @throws UnsupportedEncodingException |
| | | */ |
| | | public static String changeCharset(String str, String newCharset) throws UnsupportedEncodingException { |
| | | if (str != null) { |
| | | // 用默认字符编码解码字符串。 |
| | | byte[] bs = str.getBytes(); |
| | | // 用新的字符编码生成字符串 |
| | | return new String(bs, newCharset); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 注: \n 回车( ) \t 水平制表符( ) \s 空格(\u0008) \r 换行( ) |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String replaceBlank(String str) { |
| | | String dest = ""; |
| | | if (str != null) { |
| | | Pattern p = Pattern.compile("\\s*|\t|\r|\n"); |
| | | Matcher m = p.matcher(str); |
| | | dest = m.replaceAll(""); |
| | | } |
| | | return dest; |
| | | } |
| | | |
| | | /** |
| | | * 判断该字符串不能为空 |
| | | * |
| | | * @param str |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | public static boolean isNotEmpty(Object str) { |
| | | return !isEmpty(str); |
| | | } |
| | | |
| | | |
| | | public static boolean isNotEmptyUndefined(Object str) { |
| | | return !isEmpty(str) && !str.toString().equals("undefined"); |
| | | } |
| | | |
| | | /** |
| | | * 字符串编码转换的实现方法 |
| | | * |
| | | * @param str |
| | | * 待转换编码的字符串 |
| | | * @param oldCharset |
| | | * 原编码 |
| | | * @param newCharset |
| | | * 目标编码 |
| | | * @return |
| | | * @throws UnsupportedEncodingException |
| | | */ |
| | | public static String changeCharset(String str, String oldCharset, String newCharset) throws UnsupportedEncodingException { |
| | | if (str != null) { |
| | | // 用旧的字符编码解码字符串。解码可能会出现异常。 |
| | | byte[] bs = str.getBytes(oldCharset); |
| | | // 用新的字符编码生成字符串 |
| | | return new String(bs, newCharset); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 给手机号码加分割符 |
| | | * |
| | | * @param phone |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | public static String splitPhone(String phone) { |
| | | if (isNotEmpty(phone)) { |
| | | String strone = phone.substring(0, 3); |
| | | String strtwo = phone.substring(strone.length(), 7); |
| | | String strthree = phone.substring(strtwo.length() + strone.length(), phone.length()); |
| | | return strone + "-" + strtwo + "-" + strthree; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 非空判断 |
| | | * |
| | | * @param str |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | public static boolean isEmpty(Object str) { |
| | | return str == null || str.toString().length() == 0 || str.equals("") || str.toString().matches("\\s*"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 将List<{@link Object}>转换成List<{@link T}> |
| | | * |
| | | * @param list |
| | | * 将要转换的对象 |
| | | * @param clazs |
| | | * 需要转换的泛型对象 |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> List<T> fromToObject(List<?> list, Class<T> clazs) { |
| | | List<T> t = new ArrayList<T>(); |
| | | for (Object object : list) { |
| | | t.add((T) object); |
| | | } |
| | | return t; |
| | | } |
| | | |
| | | /** |
| | | * 生成 uuid, 即用来标识一笔单,也用做 nonce_str |
| | | * @return |
| | | */ |
| | | public static String generateUUID() { |
| | | return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32); |
| | | } |
| | | |
| | | /** |
| | | * 将List<{@link Object}>转换成List<{@link Map<String, Object>}> |
| | | * |
| | | * @param list |
| | | * @return |
| | | * @author TaoNingBo |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static List<Map<String, Object>> fromToObject_M(List<?> list) { |
| | | List<Map<String, Object>> t = new ArrayList<Map<String, Object>>(); |
| | | for (Object object : list) { |
| | | t.add((Map<String, Object>) object); |
| | | } |
| | | return t; |
| | | } |
| | | |
| | | /** |
| | | * URL编码 |
| | | * |
| | | * @param url |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public static String URLEncode(String url) { |
| | | try { |
| | | return URLEncoder.encode(url, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return URLEncoder.encode(url); |
| | | } |
| | | |
| | | /** |
| | | * URL解码 |
| | | * |
| | | * @param url |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | | public static String URLDecode(String url) { |
| | | try { |
| | | return URLDecoder.decode(url, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return URLDecoder.decode(url); |
| | | } |
| | | public static void main(String[] args) throws ParseException { |
| | | |
| | | System.out.println(doubleRetainTwo(0.0)); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | public class WoUtil { |
| | | public static Workbook ImportFile(MultipartFile importFile) { |
| | | Workbook book = null; |
| | | if(importFile == null) |
| | | { |
| | | //throw new WoException(SysConstant.ERR_EXCEL_NULL); |
| | | } |
| | | String fileName = importFile.getOriginalFilename(); |
| | | try { |
| | | if(fileName.endsWith(".xlsx")) //当表格的后缀是".xlsx时" |
| | | { |
| | | book = new XSSFWorkbook(importFile.getInputStream()); |
| | | }else |
| | | { |
| | | book = new HSSFWorkbook(importFile.getInputStream()); |
| | | } |
| | | } catch (IOException e) { |
| | | //throw new WoException(e,SysConstant.ERR_EXCEL_NO); |
| | | } |
| | | return book; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.JwtTokenUtil; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 接口控制器提供 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/7/20 23:39 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/gunsApi") |
| | | public class ApiController extends BaseController { |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | | /** |
| | | * api登录接口,通过账号密码获取token |
| | | */ |
| | | @RequestMapping("/auth") |
| | | public Object auth(@RequestParam("username") String username, |
| | | @RequestParam("password") String password) { |
| | | |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password.toCharArray()); |
| | | |
| | | //获取数据库中的账号密码,准备比对 |
| | | User user = userMapper.getByAccount(username); |
| | | |
| | | String credentials = user.getPassword(); |
| | | String salt = user.getSalt(); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | | md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | |
| | | if (passwordTrueFlag) { |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("token", JwtTokenUtil.generateToken(String.valueOf(user.getId()))); |
| | | return result; |
| | | } else { |
| | | return new ErrorTip(500, "账号密码错误!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 测试接口是否走鉴权 |
| | | */ |
| | | @RequestMapping(value = "/test", method = RequestMethod.POST) |
| | | public Object test() { |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.modular.code.controller; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.config.properties.DruidProperties; |
| | | import com.stylefeng.guns.generator.action.config.WebGeneratorConfig; |
| | | import com.stylefeng.guns.generator.action.model.GenQo; |
| | | import com.stylefeng.guns.modular.code.factory.DefaultTemplateFactory; |
| | | import com.stylefeng.guns.modular.code.service.TableService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | /** |
| | | * 代码生成控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年11月30日16:39:19 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/code") |
| | | public class CodeController extends BaseController { |
| | | |
| | | private static String PREFIX = "/code"; |
| | | |
| | | @Autowired |
| | | private TableService tableService; |
| | | |
| | | @Autowired |
| | | private DruidProperties druidProperties; |
| | | |
| | | /** |
| | | * 跳转到代码生成主页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String blackboard(Model model) { |
| | | model.addAttribute("tables", tableService.getAllTables()); |
| | | model.addAttribute("params", DefaultTemplateFactory.getDefaultParams()); |
| | | model.addAttribute("templates", DefaultTemplateFactory.getDefaultTemplates()); |
| | | return PREFIX + "/code.html"; |
| | | } |
| | | |
| | | /** |
| | | * 生成代码 |
| | | */ |
| | | @ApiOperation("生成代码") |
| | | @RequestMapping(value = "/generate", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public Object generate(GenQo genQo) { |
| | | genQo.setUrl(druidProperties.getUrl()); |
| | | genQo.setUserName(druidProperties.getUsername()); |
| | | genQo.setPassword(druidProperties.getPassword()); |
| | | WebGeneratorConfig webGeneratorConfig = new WebGeneratorConfig(genQo); |
| | | webGeneratorConfig.doMpGeneration(); |
| | | webGeneratorConfig.doGunsGeneration(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.code.factory; |
| | | |
| | | |
| | | import com.stylefeng.guns.GunsApplication; |
| | | import com.stylefeng.guns.core.CoreFlag; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.generator.action.model.GenQo; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 模板种类构建器 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-12-04-下午2:59 |
| | | */ |
| | | public class DefaultTemplateFactory { |
| | | |
| | | /** |
| | | * 获取所有的模板种类 |
| | | */ |
| | | public static List<Map<String,Object>> getDefaultTemplates(){ |
| | | ArrayList<Map<String, Object>> templates = new ArrayList<>(); |
| | | templates.add(create("controllerSwitch","controller-控制器模板")); |
| | | templates.add(create("entitySwitch","entity-实体模板")); |
| | | templates.add(create("serviceSwitch","service-service模板")); |
| | | templates.add(create("daoSwitch","dao-dao模板")); |
| | | templates.add(create("indexPageSwitch","indexPage-首页模板")); |
| | | templates.add(create("addPageSwitch","addPage-添加页面模板")); |
| | | templates.add(create("editPageSwitch","editPage-编辑页面模板")); |
| | | templates.add(create("jsSwitch","indexJs-主页js模板")); |
| | | templates.add(create("infoJsSwitch","infoJs-详情页js模板")); |
| | | templates.add(create("sqlSwitch","sql-sql语句模板")); |
| | | return templates; |
| | | } |
| | | |
| | | /** |
| | | * 获取默认的参数 |
| | | */ |
| | | public static GenQo getDefaultParams(){ |
| | | GenQo genQo = new GenQo(); |
| | | genQo.setProjectPath(ToolUtil.getWebRootPath(null)); |
| | | genQo.setAuthor("stylefeng"); |
| | | genQo.setProjectPackage(GunsApplication.class.getPackage().getName()); |
| | | genQo.setCorePackage(CoreFlag.class.getPackage().getName()); |
| | | genQo.setIgnoreTabelPrefix("sys_"); |
| | | genQo.setModuleName("system"); |
| | | genQo.setParentMenuName("系统管理"); |
| | | return genQo; |
| | | } |
| | | |
| | | private static Map<String,Object> create(String key,String desc){ |
| | | HashMap<String, Object> template = new HashMap<>(); |
| | | template.put("key",key); |
| | | template.put("desc",desc); |
| | | return template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.code.service; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.SqlRunner; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 获取数据库所有的表 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-12-04-下午1:37 |
| | | */ |
| | | @Service |
| | | public class TableService { |
| | | |
| | | @Value("${spring.datasource.db-name}") |
| | | private String dbName; |
| | | |
| | | /** |
| | | * 获取当前数据库所有的表信息 |
| | | */ |
| | | public List<Map<String, Object>> getAllTables() { |
| | | String sql = "select TABLE_NAME as tableName,TABLE_COMMENT as tableComment from information_schema.`TABLES` where TABLE_SCHEMA = '" + dbName + "'"; |
| | | return SqlRunner.db().selectList(sql); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 20:51:18 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/driverActivity") |
| | | public class DriverActivityController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/driverActivity/"; |
| | | |
| | | @Autowired |
| | | private IDriverActivityService driverActivityService; |
| | | |
| | | @Autowired |
| | | private IDriverActivityOnlineService driverActivityOnlineService; |
| | | |
| | | @Autowired |
| | | private IDriverActivityOrderService driverActivityOrderService; |
| | | |
| | | @Autowired |
| | | private IDriverActivityRegisteredService driverActivityRegisteredService; |
| | | |
| | | @Autowired |
| | | private IDriverActivityHistoryService driverActivityHistoryService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "driverActivity.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/driverActivity_add") |
| | | public String driverActivityAdd() { |
| | | return PREFIX + "driverActivity_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转领取统计 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/receiveRecord") |
| | | public String receiveRecord(Model model,Integer activityId){ |
| | | model.addAttribute("activityId",activityId); |
| | | DriverActivity driverActivity = driverActivityService.selectById(activityId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("startTime", sdf.format(driverActivity.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(driverActivity.getEndTime())); |
| | | DriverActivityRegistered driverActivityRegistered = driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",activityId).eq("type",1)); |
| | | model.addAttribute("id1",driverActivityRegistered.getId()); |
| | | driverActivityRegistered = driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",activityId).eq("type",2)); |
| | | model.addAttribute("id2",driverActivityRegistered.getId()); |
| | | DriverActivityOnline driverActivityOnline = driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",activityId).eq("type",1)); |
| | | model.addAttribute("id3",driverActivityOnline.getId()); |
| | | //统计专车在线 |
| | | driverActivityOnline = driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",activityId).eq("type",2)); |
| | | model.addAttribute("id4",driverActivityOnline.getId()); |
| | | driverActivityOnline = driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",activityId).eq("type",3)); |
| | | model.addAttribute("id5",driverActivityOnline.getId()); |
| | | DriverActivityOrder driverActivityOrder = driverActivityOrderService.selectOne(new EntityWrapper<DriverActivityOrder>().eq("driverActivityId",activityId)); |
| | | model.addAttribute("id6",driverActivityOrder.getId()); |
| | | return PREFIX + "receiveRecord.html"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/receiveRecordDetail") |
| | | @ResponseBody |
| | | public Object receiveRecordDetail(String createTime,Integer activityId) { |
| | | Date startTimes = null; |
| | | Date endTimes = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | startTimes = DateUtil.getDate_str3(timeArray[0]+" 00:00:00"); |
| | | endTimes = DateUtil.getDate_str3(timeArray[1]+" 23:59:59"); |
| | | }else{ |
| | | DriverActivity driverActivity = driverActivityService.selectById(activityId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | startTimes=driverActivity.getStartTime(); |
| | | endTimes=driverActivity.getEndTime(); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | DriverActivityRegistered driverActivityRegistered = driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",activityId) |
| | | .eq("type",1).where("startTime >= '" + sdf.format(startTimes) + "' and endTime < '" + sdf.format(endTimes) + "'").orderBy("insertTime desc limit 0, 1")); |
| | | //统计邀请司机注册 |
| | | List<DriverActivityHistory> historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>() |
| | | .between("insertTime",startTimes,endTimes).eq("type",1).eq("activityId",driverActivityRegistered.getId()).eq("carryOut",2)); |
| | | Double totalMOney=0d; |
| | | Double money=0d; |
| | | Integer number=0; |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money1",money); |
| | | map.put("number1",number); |
| | | driverActivityRegistered = driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",activityId) |
| | | .eq("type",2).where("startTime >= '" + sdf.format(startTimes) + "' and endTime < '" + sdf.format(endTimes) + "'").orderBy("insertTime desc limit 0, 1")); |
| | | //统计邀请用户注册 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",2).eq("activityId",driverActivityRegistered.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money2",money); |
| | | map.put("number2",number); |
| | | DriverActivityOnline driverActivityOnline = driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",activityId) |
| | | .eq("type",1).where("startTime >= '" + sdf.format(startTimes) + "' and endTime < '" + sdf.format(endTimes) + "'").orderBy("insertTime desc limit 0, 1")); |
| | | //统计专车在线 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",3).eq("activityId",driverActivityOnline.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money3",money); |
| | | map.put("number3",number); |
| | | driverActivityOnline = driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",activityId) |
| | | .eq("type",2).where("startTime >= '" + sdf.format(startTimes) + "' and endTime < '" + sdf.format(endTimes) + "'").orderBy("insertTime desc limit 0, 1")); |
| | | //统计出租车在线 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",3).eq("activityId",driverActivityOnline.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money4",money); |
| | | map.put("number4",number); |
| | | driverActivityOnline = driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",activityId) |
| | | .eq("type",3).where("startTime >= '" + sdf.format(startTimes) + "' and endTime < '" + sdf.format(endTimes) + "'").orderBy("insertTime desc limit 0, 1")); |
| | | //统计城际在线 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",3).eq("activityId",driverActivityOnline.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money5",money); |
| | | map.put("number5",number); |
| | | DriverActivityOrder driverActivityOrder = driverActivityOrderService.selectOne(new EntityWrapper<DriverActivityOrder>() |
| | | .eq("driverActivityId",activityId).where("startTime >= '" + sdf.format(startTimes) + "' and endTime < '" + sdf.format(endTimes) + "'").orderBy("insertTime desc limit 0, 1")); |
| | | //统计订单数 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",4).eq("activityId",driverActivityOrder.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money6",money); |
| | | map.put("number6",number); |
| | | map.put("totalMOney",totalMOney); |
| | | return map; |
| | | } |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/driverActivity_update/{driverActivityId}") |
| | | public String driverActivityUpdate(@PathVariable Integer driverActivityId, Model model) { |
| | | DriverActivity driverActivity = driverActivityService.selectById(driverActivityId); |
| | | model.addAttribute("item",driverActivity); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | model.addAttribute("startTime", sdf.format(driverActivity.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(driverActivity.getEndTime())); |
| | | model.addAttribute("online1",driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",driverActivityId).eq("type",1))); |
| | | model.addAttribute("online2",driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",driverActivityId).eq("type",2))); |
| | | model.addAttribute("online3",driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",driverActivityId).eq("type",3))); |
| | | DriverActivityOrder driverActivityOrder = driverActivityOrderService.selectOne(new EntityWrapper<DriverActivityOrder>().eq("driverActivityId",driverActivityId)); |
| | | if(driverActivityOrder!=null){ |
| | | model.addAttribute("startTime1", driverActivityOrder.getStart()+" - "+driverActivityOrder.getEnd()); |
| | | }else{ |
| | | model.addAttribute("startTime1", ""); |
| | | } |
| | | model.addAttribute("order",driverActivityOrder); |
| | | model.addAttribute("regist1",driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",driverActivityId).eq("type",1))); |
| | | model.addAttribute("regist2",driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",driverActivityId).eq("type",2))); |
| | | |
| | | LogObjectHolder.me().set(driverActivity); |
| | | return PREFIX + "driverActivity_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,String name) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(driverActivityService.getList(page,beginTime,endTime,name,user.getRoleType(),user.getObjectId())); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(String staTime, String startTime, String num1, Double num2 |
| | | , Double num3 |
| | | , Integer num4 |
| | | , Double num5 |
| | | , Integer num6 |
| | | , Double num7 |
| | | , Integer num8 |
| | | , Double num9 |
| | | , Integer num10 |
| | | , Double num11) { |
| | | |
| | | driverActivityService.insertOrUpdate(null,staTime,startTime, num1, num2 |
| | | , num3 |
| | | , num4 |
| | | , num5 |
| | | , num6 |
| | | , num7 |
| | | , num8 |
| | | , num9 |
| | | , num10 |
| | | , num11); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer driverActivityId) { |
| | | driverActivityService.deleteById(driverActivityId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(Integer id,String staTime, String startTime, String num1, Double num2 |
| | | , Double num3 |
| | | , Integer num4 |
| | | , Double num5 |
| | | , Integer num6 |
| | | , Double num7 |
| | | , Integer num8 |
| | | , Double num9 |
| | | , Integer num10 |
| | | , Double num11) { |
| | | driverActivityService.insertOrUpdate(id,staTime,startTime, num1, num2 |
| | | , num3 |
| | | , num4 |
| | | , num5 |
| | | , num6 |
| | | , num7 |
| | | , num8 |
| | | , num9 |
| | | , num10 |
| | | , num11); |
| | | return SUCCESS_TIP; |
| | | } |
| | | @RequestMapping(value = "/updateStatus") |
| | | @ResponseBody |
| | | public Object updateStatus(DriverActivity driverActivity) { |
| | | driverActivityService.updateById(driverActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @RequestMapping("/driverActivity_detail/{driverActivityId}") |
| | | public String driverActivityDetail(@PathVariable Integer driverActivityId, Model model) { |
| | | DriverActivity driverActivity = driverActivityService.selectById(driverActivityId); |
| | | model.addAttribute("item",driverActivity); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | model.addAttribute("startTime", sdf.format(driverActivity.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(driverActivity.getEndTime())); |
| | | |
| | | model.addAttribute("online1",driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",driverActivityId).eq("type",1))); |
| | | model.addAttribute("online2",driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",driverActivityId).eq("type",2))); |
| | | model.addAttribute("online3",driverActivityOnlineService.selectOne(new EntityWrapper<DriverActivityOnline>().eq("driverActivityId",driverActivityId).eq("type",3))); |
| | | model.addAttribute("order",driverActivityOrderService.selectOne(new EntityWrapper<DriverActivityOrder>().eq("driverActivityId",driverActivityId))); |
| | | model.addAttribute("regist1",driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",driverActivityId).eq("type",1))); |
| | | model.addAttribute("regist2",driverActivityRegisteredService.selectOne(new EntityWrapper<DriverActivityRegistered>().eq("driverActivityId",driverActivityId).eq("type",2))); |
| | | LogObjectHolder.me().set(driverActivity); |
| | | return PREFIX + "driverActivity_detail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到立即处理页面 |
| | | */ |
| | | @RequestMapping("/driverActivity_immediately/{id}") |
| | | public String driverActivityImmediately(@PathVariable Integer id, Model model) { |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "driverActivity_immediately.html"; |
| | | } |
| | | /** |
| | | * 立即处理操作 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) { |
| | | DriverActivity driverActivity = driverActivityService.selectById(id); |
| | | if (SinataUtil.isNotEmpty(driverActivity)){ |
| | | driverActivity.setStatus(state); |
| | | driverActivity.setRemark(remark); |
| | | driverActivityService.updateById(driverActivity); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.DriverActivityHistory; |
| | | import com.stylefeng.guns.modular.system.service.IDriverActivityHistoryService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 20:51:26 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/driverActivityHistory") |
| | | public class DriverActivityHistoryController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/driverActivityHistory/"; |
| | | |
| | | @Autowired |
| | | private IDriverActivityHistoryService driverActivityHistoryService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model,Integer type,Integer activityId) { |
| | | model.addAttribute("type",type); |
| | | model.addAttribute("activityId",activityId); |
| | | return PREFIX + "driverActivityHistory.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/driverActivityHistory_add") |
| | | public String driverActivityHistoryAdd() { |
| | | return PREFIX + "driverActivityHistory_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/driverActivityHistory_update/{driverActivityHistoryId}") |
| | | public String driverActivityHistoryUpdate(@PathVariable Integer driverActivityHistoryId, Model model) { |
| | | DriverActivityHistory driverActivityHistory = driverActivityHistoryService.selectById(driverActivityHistoryId); |
| | | model.addAttribute("item",driverActivityHistory); |
| | | LogObjectHolder.me().set(driverActivityHistory); |
| | | return PREFIX + "driverActivityHistory_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(Integer type,Integer activityId) { |
| | | |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(driverActivityHistoryService.getList(page,activityId,type)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(DriverActivityHistory driverActivityHistory) { |
| | | driverActivityHistoryService.insert(driverActivityHistory); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer driverActivityHistoryId) { |
| | | driverActivityHistoryService.deleteById(driverActivityHistoryId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(DriverActivityHistory driverActivityHistory) { |
| | | driverActivityHistoryService.updateById(driverActivityHistory); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{driverActivityHistoryId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("driverActivityHistoryId") Integer driverActivityHistoryId) { |
| | | return driverActivityHistoryService.selectById(driverActivityHistoryId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.DriverActivityOnline; |
| | | import com.stylefeng.guns.modular.system.service.IDriverActivityOnlineService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 20:51:31 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/driverActivityOnline") |
| | | public class DriverActivityOnlineController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/driverActivityOnline/"; |
| | | |
| | | @Autowired |
| | | private IDriverActivityOnlineService driverActivityOnlineService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "driverActivityOnline.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/driverActivityOnline_add") |
| | | public String driverActivityOnlineAdd() { |
| | | return PREFIX + "driverActivityOnline_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/driverActivityOnline_update/{driverActivityOnlineId}") |
| | | public String driverActivityOnlineUpdate(@PathVariable Integer driverActivityOnlineId, Model model) { |
| | | DriverActivityOnline driverActivityOnline = driverActivityOnlineService.selectById(driverActivityOnlineId); |
| | | model.addAttribute("item",driverActivityOnline); |
| | | LogObjectHolder.me().set(driverActivityOnline); |
| | | return PREFIX + "driverActivityOnline_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return driverActivityOnlineService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(DriverActivityOnline driverActivityOnline) { |
| | | driverActivityOnlineService.insert(driverActivityOnline); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer driverActivityOnlineId) { |
| | | driverActivityOnlineService.deleteById(driverActivityOnlineId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(DriverActivityOnline driverActivityOnline) { |
| | | driverActivityOnlineService.updateById(driverActivityOnline); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{driverActivityOnlineId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("driverActivityOnlineId") Integer driverActivityOnlineId) { |
| | | return driverActivityOnlineService.selectById(driverActivityOnlineId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.DriverActivityOrder; |
| | | import com.stylefeng.guns.modular.system.service.IDriverActivityOrderService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 20:51:36 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/driverActivityOrder") |
| | | public class DriverActivityOrderController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/driverActivityOrder/"; |
| | | |
| | | @Autowired |
| | | private IDriverActivityOrderService driverActivityOrderService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "driverActivityOrder.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/driverActivityOrder_add") |
| | | public String driverActivityOrderAdd() { |
| | | return PREFIX + "driverActivityOrder_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/driverActivityOrder_update/{driverActivityOrderId}") |
| | | public String driverActivityOrderUpdate(@PathVariable Integer driverActivityOrderId, Model model) { |
| | | DriverActivityOrder driverActivityOrder = driverActivityOrderService.selectById(driverActivityOrderId); |
| | | model.addAttribute("item",driverActivityOrder); |
| | | LogObjectHolder.me().set(driverActivityOrder); |
| | | return PREFIX + "driverActivityOrder_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return driverActivityOrderService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(DriverActivityOrder driverActivityOrder) { |
| | | driverActivityOrderService.insert(driverActivityOrder); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer driverActivityOrderId) { |
| | | driverActivityOrderService.deleteById(driverActivityOrderId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(DriverActivityOrder driverActivityOrder) { |
| | | driverActivityOrderService.updateById(driverActivityOrder); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{driverActivityOrderId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("driverActivityOrderId") Integer driverActivityOrderId) { |
| | | return driverActivityOrderService.selectById(driverActivityOrderId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.DriverActivityRegistered; |
| | | import com.stylefeng.guns.modular.system.service.IDriverActivityRegisteredService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 20:51:43 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/driverActivityRegistered") |
| | | public class DriverActivityRegisteredController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/driverActivityRegistered/"; |
| | | |
| | | @Autowired |
| | | private IDriverActivityRegisteredService driverActivityRegisteredService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "driverActivityRegistered.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/driverActivityRegistered_add") |
| | | public String driverActivityRegisteredAdd() { |
| | | return PREFIX + "driverActivityRegistered_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/driverActivityRegistered_update/{driverActivityRegisteredId}") |
| | | public String driverActivityRegisteredUpdate(@PathVariable Integer driverActivityRegisteredId, Model model) { |
| | | DriverActivityRegistered driverActivityRegistered = driverActivityRegisteredService.selectById(driverActivityRegisteredId); |
| | | model.addAttribute("item",driverActivityRegistered); |
| | | LogObjectHolder.me().set(driverActivityRegistered); |
| | | return PREFIX + "driverActivityRegistered_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return driverActivityRegisteredService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(DriverActivityRegistered driverActivityRegistered) { |
| | | driverActivityRegisteredService.insert(driverActivityRegistered); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer driverActivityRegisteredId) { |
| | | driverActivityRegisteredService.deleteById(driverActivityRegisteredId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(DriverActivityRegistered driverActivityRegistered) { |
| | | driverActivityRegisteredService.updateById(driverActivityRegistered); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{driverActivityRegisteredId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("driverActivityRegisteredId") Integer driverActivityRegisteredId) { |
| | | return driverActivityRegisteredService.selectById(driverActivityRegisteredId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 首页统计 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/home") |
| | | public class HomeController { |
| | | |
| | | @Autowired |
| | | private ITUserService tUserService; |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | @Autowired |
| | | private ITOrderTaxiService tOrderTaxiService; |
| | | |
| | | @Autowired |
| | | private ITCarService tCarService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService tCompanyService; |
| | | |
| | | @Autowired |
| | | private ITCarBrandService carBrandService; |
| | | |
| | | @Autowired |
| | | private ITCarModelService carModelService; |
| | | |
| | | private List<TCompany> companys = null; |
| | | |
| | | |
| | | @Autowired |
| | | private ITOrderPrivateCarService itOrderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private ITOrderCrossCityService itOrderCrossCityService; |
| | | |
| | | @Autowired |
| | | private ITOrderLogisticsService itOrderLogisticsService; |
| | | |
| | | @Autowired |
| | | private IDriverOnlineService driverOnlineService; |
| | | |
| | | |
| | | @RequestMapping("/openNetCarInfo") |
| | | public Object openNetCarInfo(Integer id, Model model){ |
| | | model.addAttribute("id", id); |
| | | return "/netCarInfo.html"; |
| | | } |
| | | |
| | | @RequestMapping("/showDriverOnline") |
| | | public String showDriverOnline(){ |
| | | return "/driverOnline.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSumData") |
| | | public Object getSumData(Integer companyId, Date addDate, Date start, Date end){ |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | if(companyId == null && user.getRoleType() != 1){ |
| | | companyId = user.getObjectId(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Date date = new Date(); |
| | | Calendar calendar1 = Calendar.getInstance(); |
| | | Calendar calendar2 = Calendar.getInstance(); |
| | | Calendar calendar3 = Calendar.getInstance(); |
| | | Calendar calendar4 = Calendar.getInstance(); |
| | | if(addDate == null){ |
| | | calendar1.setTime(date); |
| | | calendar2.setTime(date); |
| | | }else{ |
| | | calendar1.setTime(addDate); |
| | | calendar2.setTime(addDate); |
| | | } |
| | | if(start == null || end == null){ |
| | | calendar3.setTime(date); |
| | | calendar4.setTime(date); |
| | | }else{ |
| | | calendar3.setTime(start); |
| | | calendar4.setTime(end); |
| | | } |
| | | calendar1.set(Calendar.HOUR_OF_DAY, 00); |
| | | calendar1.set(Calendar.MINUTE, 00); |
| | | calendar1.set(Calendar.SECOND, 00); |
| | | calendar2.set(Calendar.HOUR_OF_DAY, 23); |
| | | calendar2.set(Calendar.MINUTE, 59); |
| | | calendar2.set(Calendar.SECOND, 59); |
| | | calendar3.set(Calendar.HOUR_OF_DAY, 00); |
| | | calendar3.set(Calendar.MINUTE, 00); |
| | | calendar3.set(Calendar.SECOND, 00); |
| | | calendar4.set(Calendar.HOUR_OF_DAY, 23); |
| | | calendar4.set(Calendar.MINUTE, 59); |
| | | calendar4.set(Calendar.SECOND, 59); |
| | | |
| | | //【今日运行情况】 |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | Wrapper<TUser> ne = new EntityWrapper<TUser>().between("insertTime", calendar1.getTime(), calendar2.getTime()).ne("flag", 3); |
| | | if(companyId != null){ |
| | | ne.eq("companyId", companyId); |
| | | } |
| | | int i = tUserService.selectCount(ne); |
| | | map1.put("passengerInfo", i); //新增用户 |
| | | |
| | | Wrapper<TDriver> ne1 = new EntityWrapper<TDriver>().ne("state", 1).eq("authState", 2).ne("flag", 3); |
| | | if(companyId != null){ |
| | | ne1.eq("companyId", companyId).or().eq("franchiseeId", companyId); |
| | | } |
| | | List<TDriver> tDrivers = tDriverService.selectList(ne1); |
| | | String keys = ""; |
| | | for(TDriver driver : tDrivers){ |
| | | keys += "DRIVER" + driver.getId() + ","; |
| | | } |
| | | String value = redisUtil.getValues(keys.substring(0, keys.length() - 1)); |
| | | JSONArray jsonArray = JSON.parseArray(value); |
| | | int size = driverOnlineService.queryOnlineDriverCount(null, null); |
| | | map1.put("netcardriver", size); //在线司机 |
| | | |
| | | Wrapper<TOrderTaxi> travelTime1 = new EntityWrapper<TOrderTaxi>().between("travelTime", calendar1.getTime(), calendar2.getTime()); |
| | | if(companyId != null){ |
| | | travelTime1.eq("companyId", companyId); |
| | | } |
| | | int i1 = tOrderTaxiService.selectCount(travelTime1); |
| | | map1.put("orderDetail2", i1); //出租车订单 |
| | | |
| | | Wrapper<TOrderPrivateCar> zcTodayTme = new EntityWrapper<TOrderPrivateCar>().between("travelTime", calendar1.getTime(), calendar2.getTime()); |
| | | if(companyId != null){ |
| | | zcTodayTme.eq("companyId", companyId); |
| | | } |
| | | int zcTodayNum = itOrderPrivateCarService.selectCount(zcTodayTme); |
| | | map1.put("orderDetail1", zcTodayNum); //专车订单 |
| | | |
| | | Wrapper<TOrderCrossCity> kcTodayTme = new EntityWrapper<TOrderCrossCity>().between("travelTime", calendar1.getTime(), calendar2.getTime()); |
| | | if(companyId != null){ |
| | | kcTodayTme.eq("companyId", companyId); |
| | | } |
| | | int kcTodayNum = itOrderCrossCityService.selectCount(kcTodayTme); |
| | | map1.put("orderDetail3", kcTodayNum); //跨城订单 |
| | | |
| | | Wrapper<TOrderLogistics> tcxTodayTme = new EntityWrapper<TOrderLogistics>().between("travelTime", calendar1.getTime(), calendar2.getTime()); |
| | | if(companyId != null){ |
| | | tcxTodayTme.eq("companyId", companyId); |
| | | } |
| | | tcxTodayTme.eq("type",4); |
| | | int tcxTodayNum = itOrderLogisticsService.selectCount(tcxTodayTme); |
| | | map1.put("orderDetail4", tcxTodayNum); //同城物流订单 |
| | | |
| | | Wrapper<TOrderLogistics> kcxTodayTme = new EntityWrapper<TOrderLogistics>().between("travelTime", calendar1.getTime(), calendar2.getTime()); |
| | | if(companyId != null){ |
| | | kcxTodayTme.eq("companyId", companyId); |
| | | } |
| | | tcxTodayTme.eq("type",5); |
| | | int kcxTodayNum = itOrderLogisticsService.selectCount(kcxTodayTme); |
| | | map1.put("orderDetail5", kcxTodayNum); //跨城物流订单 |
| | | |
| | | map.put("operationStatus", map1); |
| | | |
| | | //【全部运营总数据】 |
| | | map1 = new HashMap<>(); |
| | | Wrapper<TUser> flag1 = new EntityWrapper<TUser>().ne("flag", 3); |
| | | if(companyId != null){ |
| | | flag1.eq("companyId", companyId); |
| | | } |
| | | int flag = tUserService.selectCount(flag1); |
| | | map1.put("passengerInfoSum", flag); //总用户 |
| | | |
| | | Wrapper<TDriver> ne4 = new EntityWrapper<TDriver>().eq("authState", 2).ne("flag", 3); |
| | | if(companyId != null){ |
| | | ne4.eq("companyId", companyId).or().eq("franchiseeId", companyId); |
| | | } |
| | | int i2 = tDriverService.selectCount(ne4); |
| | | map1.put("netcarDriverSum", i2); //总司机 |
| | | |
| | | Wrapper<TCar> state3 = new EntityWrapper<TCar>().eq("state", 1); |
| | | if(companyId != null){ |
| | | state3.eq("companyId", companyId).or().eq("franchiseeId", companyId); |
| | | } |
| | | int state1 = tCarService.selectCount(state3); |
| | | map1.put("netCarSum", state1); //总车辆 |
| | | |
| | | Integer i3 = tOrderTaxiService.getAllOrderNum(companyId,null,null); |
| | | map1.put("orderDetailSum", i3); //总订单 |
| | | |
| | | Double allTradeMoney = tOrderTaxiService.getAllTradeMoney(companyId, null, null); |
| | | Double allIncomeMoney = tOrderTaxiService.getAllIncomeMoney(companyId, null, null); |
| | | map1.put("paiceSum", allTradeMoney); //交易总金额 |
| | | map1.put("paySum", allIncomeMoney); //总收益 |
| | | map.put("operationSum", map1); |
| | | |
| | | //【运营数据增长查询】 |
| | | map1 = new HashMap<>(); |
| | | Wrapper<TUser> ne2 = new EntityWrapper<TUser>().between("insertTime", calendar3.getTime(), calendar4.getTime()).ne("flag", 3); |
| | | if(companyId != null){ |
| | | ne2.eq("companyId", companyId); |
| | | } |
| | | int i4 = tUserService.selectCount(ne2); |
| | | map1.put("passengerInfoSum", i4); |
| | | |
| | | Wrapper<TDriver> ne3 = new EntityWrapper<TDriver>().between("insertTime", calendar3.getTime(), calendar4.getTime()).eq("authState", 2).ne("flag", 3); |
| | | if(companyId != null){ |
| | | ne3.eq("companyId", companyId).or().eq("franchiseeId", companyId); |
| | | } |
| | | int i5 = tDriverService.selectCount(ne3); |
| | | map1.put("netcarDriverSum", i5); |
| | | |
| | | Wrapper<TOrderPrivateCar> zcTodayTmeByConditions = new EntityWrapper<TOrderPrivateCar>().between("travelTime", calendar3.getTime(), calendar4.getTime()); |
| | | if(companyId != null){ |
| | | zcTodayTmeByConditions.eq("companyId", companyId); |
| | | } |
| | | int zcTodayNum1 = itOrderPrivateCarService.selectCount(zcTodayTmeByConditions); |
| | | map1.put("orderDetail1", zcTodayNum1); //专车订单 |
| | | |
| | | Wrapper<TOrderTaxi> travelTime2 = new EntityWrapper<TOrderTaxi>().between("travelTime", calendar3.getTime(), calendar4.getTime()); |
| | | if(companyId != null){ |
| | | travelTime2.eq("companyId", companyId); |
| | | } |
| | | int travelTime = tOrderTaxiService.selectCount(travelTime2); |
| | | map1.put("orderDetail2", travelTime); //出租车订单 |
| | | |
| | | Wrapper<TOrderCrossCity> kcTodayTmeByConditions = new EntityWrapper<TOrderCrossCity>().between("travelTime", calendar3.getTime(), calendar4.getTime()); |
| | | if(companyId != null){ |
| | | kcTodayTmeByConditions.eq("companyId", companyId); |
| | | } |
| | | int kcTodayNum1 = itOrderCrossCityService.selectCount(kcTodayTmeByConditions); |
| | | map1.put("orderDetail3", kcTodayNum1); //跨城订单 |
| | | |
| | | Wrapper<TOrderLogistics> tcxTodayTmeByConditions = new EntityWrapper<TOrderLogistics>().between("travelTime", calendar3.getTime(), calendar4.getTime()); |
| | | if(companyId != null){ |
| | | tcxTodayTmeByConditions.eq("companyId", companyId); |
| | | } |
| | | tcxTodayTmeByConditions.eq("type",4); |
| | | int tcxTodayNum1 = itOrderLogisticsService.selectCount(tcxTodayTmeByConditions); |
| | | map1.put("orderDetail4", tcxTodayNum1); //同城物流订单 |
| | | |
| | | Wrapper<TOrderLogistics> kcxTodayTmeByConditions = new EntityWrapper<TOrderLogistics>().between("travelTime", calendar3.getTime(), calendar4.getTime()); |
| | | if(companyId != null){ |
| | | kcxTodayTmeByConditions.eq("companyId", companyId); |
| | | } |
| | | kcxTodayTmeByConditions.eq("type",5); |
| | | int kcxTodayNum1 = itOrderLogisticsService.selectCount(kcxTodayTmeByConditions); |
| | | map1.put("orderDetail5", kcxTodayNum1); //跨城物流订单 |
| | | |
| | | String startTime = null; |
| | | if (SinataUtil.isNotEmpty(start)){ |
| | | startTime = DateUtil.format(start, "yyyy-MM-dd"); |
| | | } |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(end)){ |
| | | endTime = DateUtil.format(end, "yyyy-MM-dd"); |
| | | } |
| | | Double allTradeMoneyByTime = tOrderTaxiService.getAllTradeMoney(companyId, startTime, endTime); |
| | | Double allIncomeMoneyByTime = tOrderTaxiService.getAllIncomeMoney(companyId, startTime, endTime); |
| | | map1.put("paiceSum", allTradeMoneyByTime); //交易总金额 |
| | | map1.put("paySum", allIncomeMoneyByTime); //总收益 |
| | | map.put("operationGrow", map1); |
| | | |
| | | |
| | | //【运营总趋势】 |
| | | Integer[] states = new Integer[]{8, 9}; |
| | | map1 = new HashMap<>(); |
| | | List<Integer> m1 = new ArrayList<>(); |
| | | List<Integer> m2 = new ArrayList<>(); |
| | | List<Integer> m3 = new ArrayList<>(); |
| | | List<Integer> m4 = new ArrayList<>(); |
| | | List<Integer> m5 = new ArrayList<>(); |
| | | List<Integer> m6 = new ArrayList<>(); |
| | | List<Integer> m7 = new ArrayList<>(); |
| | | for(int j = 30; j > 0; j--){ |
| | | Calendar s1 = Calendar.getInstance(); |
| | | s1.setTime(date); |
| | | s1.set(s1.get(Calendar.YEAR), s1.get(Calendar.MONTH), s1.get(Calendar.DAY_OF_MONTH) - j, 0, 0, 1); |
| | | Calendar e1 = Calendar.getInstance(); |
| | | e1.setTime(date); |
| | | e1.set(e1.get(Calendar.YEAR), e1.get(Calendar.MONTH), e1.get(Calendar.DAY_OF_MONTH) - j, 23, 59, 59); |
| | | |
| | | //出租车订单趋势图 |
| | | Wrapper<TOrderTaxi> in = new EntityWrapper<TOrderTaxi>().between("travelTime", s1.getTime(), e1.getTime()).in("state", states); |
| | | if(companyId != null){ |
| | | in.eq("companyId", companyId); |
| | | } |
| | | int i6 = tOrderTaxiService.selectCount(in); |
| | | m1.add(i6); |
| | | |
| | | //用户注册趋势图 |
| | | Wrapper<TUser> ne5 = new EntityWrapper<TUser>().between("insertTime", s1.getTime(), e1.getTime()).ne("flag", 3); |
| | | if(companyId != null){ |
| | | ne5.eq("companyId", companyId); |
| | | } |
| | | int i7 = tUserService.selectCount(ne5); |
| | | m2.add(i7); |
| | | |
| | | //订单数趋势图 |
| | | String startTime1 = DateUtil.format(s1.getTime(), "yyyy-MM-dd"); |
| | | String endTime1 = DateUtil.format(e1.getTime(), "yyyy-MM-dd"); |
| | | Integer allOrderNum = tOrderTaxiService.getAllOrderNum(companyId, startTime1, endTime1); |
| | | m3.add(allOrderNum); |
| | | |
| | | //专车订单趋势图 |
| | | Wrapper<TOrderPrivateCar> inZC = new EntityWrapper<TOrderPrivateCar>().between("travelTime", s1.getTime(), e1.getTime()).in("state", states); |
| | | if(companyId != null){ |
| | | inZC.eq("companyId", companyId); |
| | | } |
| | | int zc = itOrderPrivateCarService.selectCount(inZC); |
| | | m4.add(zc); |
| | | |
| | | //跨城订单趋势图 |
| | | Wrapper<TOrderCrossCity> inKC = new EntityWrapper<TOrderCrossCity>().between("travelTime", s1.getTime(), e1.getTime()).in("state", states); |
| | | if(companyId != null){ |
| | | inKC.eq("companyId", companyId); |
| | | } |
| | | int kc = itOrderCrossCityService.selectCount(inKC); |
| | | m5.add(kc); |
| | | |
| | | //同城物流订单趋势图 |
| | | Wrapper<TOrderLogistics> inTCX = new EntityWrapper<TOrderLogistics>().between("travelTime", s1.getTime(), e1.getTime()).in("state", states); |
| | | if(companyId != null){ |
| | | inTCX.eq("companyId", companyId); |
| | | } |
| | | inTCX.eq("type",4); |
| | | int tcx = itOrderLogisticsService.selectCount(inTCX); |
| | | m6.add(tcx); |
| | | |
| | | //跨城物流订单趋势图 |
| | | Wrapper<TOrderLogistics> inKCX = new EntityWrapper<TOrderLogistics>().between("travelTime", s1.getTime(), e1.getTime()).in("state", states); |
| | | if(companyId != null){ |
| | | inKCX.eq("companyId", companyId); |
| | | } |
| | | inKCX.eq("type",5); |
| | | int kcx = itOrderLogisticsService.selectCount(inKCX); |
| | | m7.add(kcx); |
| | | |
| | | } |
| | | map1.put("orderDetail5", m7); //跨城物流订单数趋势图 |
| | | map1.put("orderDetail4", m6); //同城物流订单数趋势图 |
| | | map1.put("orderDetail3", m5); //跨城订单数趋势图 |
| | | map1.put("orderDetail1", m4); //专车订单数趋势图 |
| | | map1.put("orderDetailSum", m3); //全部订单数趋势图 |
| | | map1.put("passengerInfoSum", m2); //用户注册趋势图 |
| | | map1.put("orderDetail2", m1); //出租车订单趋势图 |
| | | map.put("operationTrend", map1); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getDriverPosition") |
| | | public Object getDriverPosition(Integer companyId){ |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | if(companyId == null && user.getRoleType() != 1){ |
| | | companyId = user.getObjectId(); |
| | | } |
| | | Wrapper<TDriver> ne = new EntityWrapper<TDriver>().eq("authState", 2).eq("state", 2).ne("flag", 3); |
| | | if(companyId != null){ |
| | | ne.eq("companyId", companyId).or().eq("franchiseeId", companyId); |
| | | } |
| | | List<TDriver> tDrivers = tDriverService.selectList(ne); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Object> list = new ArrayList<>(); |
| | | for(TDriver tDriver : tDrivers){ |
| | | Map<String, Object> d = new HashMap<>(); |
| | | String value = redisUtil.getValue("DRIVER" + tDriver.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | d.put("driver", tDriver); |
| | | d.put("lon", value.split(",")[0]); |
| | | d.put("lat", value.split(",")[1]); |
| | | list.add(d); |
| | | } |
| | | map.put("driver", list); |
| | | |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | Wrapper<TOrderTaxi> eq = new EntityWrapper<TOrderTaxi>().eq("state", 1).eq("isDelete", 1); |
| | | if(companyId != null){ |
| | | eq.eq("companyId", companyId); |
| | | } |
| | | List<TOrderTaxi> tOrderTaxis = tOrderTaxiService.selectList(eq); |
| | | list = new ArrayList<>(); |
| | | for(TOrderTaxi t : tOrderTaxis){ |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("start", t.getStartAddress()); |
| | | map1.put("end", t.getEndAddress()); |
| | | map1.put("travelTime", t.getTravelTime()); |
| | | map1.put("carModel", ""); |
| | | map1.put("num", 1); |
| | | list.add(map1); |
| | | } |
| | | map2.put("chuzu", list); |
| | | map.put("order", map2); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getAllOrder") |
| | | public Object getAllOrder(){ |
| | | List<TOrderTaxi> tOrderTaxis = tOrderTaxiService.selectList(new EntityWrapper<TOrderTaxi>().eq("isDelete", 1)); |
| | | List list = new ArrayList<>(); |
| | | for(TOrderTaxi t : tOrderTaxis){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("lon", t.getStartLon()); |
| | | map.put("lat", t.getStartLat()); |
| | | list.add(map); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getCompanyInfoByUserId") |
| | | public Object getCompanyInfoByUserId(){ |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | companys = new ArrayList<>(); |
| | | List<TCompany> ids = new ArrayList<>(); |
| | | TCompany tCompany = null; |
| | | if(user.getRoleType() == 1 && user.getObjectId() == null){ |
| | | tCompany = tCompanyService.selectById(1); |
| | | }else{ |
| | | tCompany = tCompanyService.selectById(user.getObjectId()); |
| | | } |
| | | ids.add(tCompany); |
| | | companys.addAll(ids); |
| | | this.getCompanyIds(ids); |
| | | return companys; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getDriverInfo", method = RequestMethod.POST) |
| | | public Object getDriverInfo(Integer driverId){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | TDriver tDriver = tDriverService.selectById(driverId); |
| | | TCar tCar = tCarService.selectById(tDriver.getCarId()); |
| | | TCarBrand tCarBrand = null; |
| | | TCarModel tCarModel = null; |
| | | if(null != tCar){ |
| | | tCarBrand = carBrandService.selectById(tCar.getCarBrandId()); |
| | | tCarModel = carModelService.selectById(tCar.getCarModelId()); |
| | | } |
| | | Integer[] states = new Integer[]{2, 3, 4, 5, 6, 11}; |
| | | Wrapper<TOrderTaxi> state4 = new EntityWrapper<TOrderTaxi>().in("state", states).eq("driverId", driverId).eq("isDelete", 1); |
| | | List<TOrderTaxi> tOrderTaxis = tOrderTaxiService.selectList(state4); |
| | | map.put("netcarDriver", tDriver); |
| | | map.put("netcar", tCar); |
| | | map.put("carBrand", null != tCarBrand ? tCarBrand.getName() : ""); |
| | | map.put("carModel", null != tCarModel ? tCarModel.getName() : ""); |
| | | map.put("order", tOrderTaxis); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | public void getCompanyIds(List<TCompany> ids){ |
| | | List<TCompany> ids_ = new ArrayList<>(); |
| | | for(TCompany id : ids){ |
| | | if(id.getId() == 1){ |
| | | List<TCompany> tCompanies = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("superiorId", id.getId()).or().isNull("superiorId").eq("state", 0).ne("flag", 3).ne("type", 1)); |
| | | ids_.addAll(tCompanies); |
| | | companys.addAll(tCompanies); |
| | | }else{ |
| | | List<TCompany> tCompanies = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("superiorId", id.getId()).eq("state", 0).ne("flag", 3)); |
| | | ids_.addAll(tCompanies); |
| | | companys.addAll(tCompanies); |
| | | } |
| | | } |
| | | if(ids_.size() == 0){ |
| | | return; |
| | | } |
| | | this.getCompanyIds(ids_); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryOnlineDriver", method = RequestMethod.POST) |
| | | public Object queryOnlineDriver(String name, String phone, Integer offset, Integer limit){ |
| | | try { |
| | | return driverOnlineService.queryOnlineDriver(name, phone, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityDiscount1Service; |
| | | import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserRedPacketRecordService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.net.URLEncoder; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 报表控制器 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/report") |
| | | public class ReportController { |
| | | |
| | | private String PREFIX = "/system/report/"; |
| | | |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService redPacketRecordService; |
| | | |
| | | @Autowired |
| | | private IUserActivityDiscount1Service userActivityDiscount1Service; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到日常运营数据汇总页 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showOperationalData") |
| | | public String showOperationalData(Model model){ |
| | | List<TCompany> tCompanies = companyService.selectList(new EntityWrapper<TCompany>().eq("state", 0).ne("flag", 3)); |
| | | model.addAttribute("company", tCompanies); |
| | | return PREFIX + "operationalData.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到优惠券统计页 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showCouponStatistics") |
| | | public String showCouponStatistics(Model model){ |
| | | List<TCompany> tCompanies = companyService.selectList(new EntityWrapper<TCompany>().eq("state", 0).ne("flag", 3)); |
| | | model.addAttribute("company", tCompanies); |
| | | return PREFIX + "couponStatistics.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到优惠券统计详情页 |
| | | * @param type |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showCouponStatisticsInfo") |
| | | public String showCouponStatisticsInfo(Integer type, Model model){ |
| | | List<TCompany> tCompanies = companyService.selectList(new EntityWrapper<TCompany>().eq("state", 0).ne("flag", 3)); |
| | | model.addAttribute("company", tCompanies); |
| | | model.addAttribute("type", type); |
| | | return PREFIX + "couponStatisticsInfo.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取日常运营数据 |
| | | * @param type |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryOperationalData", method = RequestMethod.POST) |
| | | public Object queryOperationalData(Integer type, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | String start = null; |
| | | String end = null; |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | | start = time.split(" - ")[0]; |
| | | end = time.split(" - ")[1]; |
| | | } |
| | | return companyService.queryOperationalData(type, start, end, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载日常运营数据汇总表 |
| | | * @param type |
| | | * @param time |
| | | * @param companyId |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/downloadOperationalData", method = RequestMethod.GET) |
| | | public void downloadOperationalData(Integer type, String time, Integer companyId, HttpServletResponse response){ |
| | | try { |
| | | String start = null; |
| | | String end = null; |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | | start = time.split(" - ")[0]; |
| | | end = time.split(" - ")[1]; |
| | | } |
| | | HSSFWorkbook hssfWorkbook = companyService.downloadOperationalData(type, start, end, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("日常运营数据汇总表.xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取优惠券统计 |
| | | * @param type |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryCouponRegister", method = RequestMethod.POST) |
| | | public Object queryCouponRegister(Integer type, String name, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | return userCouponRecordService.queryCouponRegister(type, name, time, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载优惠券领取数据 |
| | | * @param type |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/downloadCouponRegister", method = RequestMethod.GET) |
| | | public void downloadCouponRegister(Integer type, String name, String time, Integer companyId, HttpServletResponse response){ |
| | | try { |
| | | String na = ""; |
| | | if(type == 2){ |
| | | na = "注册优惠券奖励"; |
| | | } |
| | | if(type == 3){ |
| | | na = "邀请优惠券奖励"; |
| | | } |
| | | if(type == 4){ |
| | | na = "充值优惠券奖励"; |
| | | } |
| | | HSSFWorkbook hssfWorkbook = userCouponRecordService.downloadCouponRegister(type, name, time, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(na + ".xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取红包统计数据 |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryRedEnvelopes", method = RequestMethod.POST) |
| | | public Object queryRedEnvelopes(String name, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | return redPacketRecordService.queryRedEnvelopes(name, time, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下载红包奖励 |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/downloadRedEnvelopes", method = RequestMethod.GET) |
| | | public void downloadRedEnvelopes(String name, String time, Integer companyId, HttpServletResponse response){ |
| | | try { |
| | | HSSFWorkbook hssfWorkbook = redPacketRecordService.downloadRedEnvelopes(name, time, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("红包奖励.xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取折扣统计 |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryDiscount1", method = RequestMethod.POST) |
| | | public Object queryDiscount1(String name, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | return userActivityDiscount1Service.queryDiscount1(name, time, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载折扣优惠活动 |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/downloadDiscount1", method = RequestMethod.GET) |
| | | public void downloadDiscount1(String name, String time, Integer companyId, HttpServletResponse response){ |
| | | try { |
| | | HSSFWorkbook hssfWorkbook = userActivityDiscount1Service.downloadDiscount1(name, time, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("折扣优惠活动.xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取优惠券统计明细 |
| | | * @param type |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryCouponRegisterInfo", method = RequestMethod.POST) |
| | | public Object queryCouponRegisterInfo(Integer type, String name, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | type += 1; |
| | | return userCouponRecordService.queryCouponRegisterInfo(type, name, time, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取充值赠送优惠券明细 |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryCouponRegisterInfo1", method = RequestMethod.POST) |
| | | public Object queryCouponRegisterInfo1(String name, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | return userCouponRecordService.queryCouponRegisterInfo1( name, time, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取折扣优惠详情 |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryDiscountInfo", method = RequestMethod.POST) |
| | | public Object queryDiscountInfo(String name, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | return userActivityDiscount1Service.queryDiscountInfo(name, time, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取红包领取详情 |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryRedEnvelopesInfo", method = RequestMethod.POST) |
| | | public Object queryRedEnvelopesInfo(String name, String time, Integer companyId, Integer offset, Integer limit){ |
| | | try { |
| | | return redPacketRecordService.queryRedEnvelopesInfo(name, time, companyId, offset, limit); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 优惠明细下载 |
| | | * @param type |
| | | * @param name |
| | | * @param time |
| | | * @param companyId |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/downloadCouponStatisticsInfo", method = RequestMethod.GET) |
| | | public void downloadCouponStatisticsInfo(Integer type, String name, String time, Integer companyId, HttpServletResponse response){ |
| | | try { |
| | | if(type == 1 || type == 2){ |
| | | type += 1; |
| | | HSSFWorkbook hssfWorkbook = userCouponRecordService.downloadCouponRegisterInfo(type, name, time, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode((type == 2 ? "注册奖励明细" : "邀请奖励明细") + ".xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | if(type == 3){ |
| | | HSSFWorkbook hssfWorkbook = userCouponRecordService.downloadCouponRegisterInfo1(name, time, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("充值奖励明细.xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | if(type == 4){ |
| | | HSSFWorkbook hssfWorkbook = userActivityDiscount1Service.downloadDiscountInfo(name, time, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("折扣优惠明细.xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | if(type == 5){ |
| | | HSSFWorkbook hssfWorkbook = redPacketRecordService.downloadRedEnvelopesInfo(name, time, companyId); |
| | | response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("红包优惠明细.xls", "utf-8")); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.SysCouponRecord; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.model.UserCouponRecord; |
| | | import com.stylefeng.guns.modular.system.service.ISysCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.SysCouponActivity; |
| | | import com.stylefeng.guns.modular.system.service.ISysCouponActivityService; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 09:14:59 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/sysCouponActivity") |
| | | public class SysCouponActivityController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/sysCouponActivity/"; |
| | | |
| | | @Autowired |
| | | private ISysCouponActivityService sysCouponActivityService; |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysCouponRecordService couponRecordService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "sysCouponActivity.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到选择优惠券页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/sysCouponRecord") |
| | | public String sysCouponRecord() { |
| | | return PREFIX + "sysCouponRecord.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到选择用户页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("user") |
| | | public String user() { |
| | | return PREFIX + "tUser.html"; |
| | | } |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/sysCouponActivity_add") |
| | | public String sysCouponActivityAdd() { |
| | | return PREFIX + "sysCouponActivity_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/sysCouponActivity_update/{sysCouponActivityId}") |
| | | public String sysCouponActivityUpdate(@PathVariable Integer sysCouponActivityId, Model model) { |
| | | SysCouponActivity sysCouponActivity = sysCouponActivityService.selectById(sysCouponActivityId); |
| | | model.addAttribute("item",sysCouponActivity); |
| | | if(sysCouponActivity.getSendType()==2){ |
| | | model.addAttribute("sendUserInfoList",JSON.parseArray(sysCouponActivity.getSendUserId())); |
| | | }else{ |
| | | model.addAttribute("sendUserInfoList",new ArrayList<>()); |
| | | } |
| | | LogObjectHolder.me().set(sysCouponActivity); |
| | | return PREFIX + "sysCouponActivity_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,Integer couponUseType,Integer status) { |
| | | Date startTimes = null; |
| | | Date endTimes = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | startTimes = DateUtil.getDate_str3(timeArray[0]+" 00:00:00"); |
| | | endTimes = DateUtil.getDate_str3(timeArray[1]+" 23:59:59"); |
| | | } |
| | | Page<SysCouponActivity> page = new PageFactory<SysCouponActivity>().defaultPage(); |
| | | Wrapper wrapper = new EntityWrapper<SysCouponActivity>(); |
| | | if(SinataUtil.isNotEmpty(createTime)){ |
| | | wrapper.between("insertTime",startTimes,endTimes); |
| | | } |
| | | if(SinataUtil.isNotEmpty(couponUseType)){wrapper.eq("couponUseType",couponUseType);} |
| | | if(SinataUtil.isNotEmpty(status)){wrapper.eq("status",status);} |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if(user.getRoleType()!=1){ |
| | | wrapper.eq("companyId",user.getObjectId()); |
| | | wrapper.eq("companyType",user.getRoleType()); |
| | | } |
| | | wrapper.ne("status",4); |
| | | wrapper.orderBy("id",false); |
| | | return super.packForBT(sysCouponActivityService.selectPage(page,wrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(SysCouponActivity sysCouponActivity,Integer activityId) { |
| | | SysCouponRecord sysCouponRecord = couponRecordService.selectById(activityId); |
| | | sysCouponActivity.setCouponType(sysCouponRecord.getCouponType()); |
| | | sysCouponActivity.setCouponUseType(sysCouponRecord.getCouponUseType()); |
| | | sysCouponActivity.setMoney(sysCouponRecord.getMoney()); |
| | | sysCouponActivity.setFullMoney(sysCouponRecord.getFullMoney()); |
| | | sysCouponActivity.setInsertTime(new Date()); |
| | | sysCouponActivity.setCouponId(activityId); |
| | | sysCouponActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | sysCouponActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | sysCouponActivity.setStatus(sysCouponActivity.getCompanyType()==1?3:1); |
| | | sysCouponActivityService.insert(sysCouponActivity); |
| | | if(sysCouponActivity.getCompanyType()==1){ |
| | | //定时发送优惠券 |
| | | Timer timer = new Timer(); |
| | | timer.schedule(new timerTaskTest(sysCouponActivity.getId()),30*1000);//timer.schedule(执行的方法,延迟多久执行(ms)) |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 跳转到立即处理页面 |
| | | */ |
| | | @RequestMapping("/sysCouponActivity_immediately/{id}") |
| | | public String sysCouponActivityImmediately(@PathVariable Integer id, Model model) { |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "sysCouponActivity_immediately.html"; |
| | | } |
| | | /** |
| | | * 立即处理操作 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) { |
| | | SysCouponActivity sysCouponActivity = sysCouponActivityService.selectById(id); |
| | | if (SinataUtil.isNotEmpty(sysCouponActivity)){ |
| | | sysCouponActivity.setStatus(state); |
| | | sysCouponActivity.setRemark(remark); |
| | | sysCouponActivityService.updateById(sysCouponActivity); |
| | | if(state==3){ |
| | | //定时发送优惠券 |
| | | Timer timer = new Timer(); |
| | | timer.schedule(new timerTaskTest(id),30*1000);//timer.schedule(执行的方法,延迟多久执行(ms)) |
| | | } |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | class timerTaskTest extends TimerTask { |
| | | private Integer id; |
| | | |
| | | public timerTaskTest(Integer id) { |
| | | this.id = id; |
| | | } |
| | | @Override |
| | | public void run() { |
| | | SysCouponActivity sysCouponActivity = sysCouponActivityService.selectById(id); |
| | | UserCouponRecord userCouponRecord = new UserCouponRecord(); |
| | | userCouponRecord.setMoney(sysCouponActivity.getMoney()); |
| | | userCouponRecord.setFullMoney(sysCouponActivity.getFullMoney()); |
| | | Date nowDay = new Date(); |
| | | userCouponRecord.setInsertTime(nowDay); |
| | | userCouponRecord.setExpirationTime(new Date(nowDay.getTime()+sysCouponActivity.getEffective()*24*3600*1000L)); |
| | | userCouponRecord.setCompanyId(sysCouponActivity.getCompanyId()); |
| | | userCouponRecord.setState(1); |
| | | userCouponRecord.setCouponType(sysCouponActivity.getCouponType()); |
| | | userCouponRecord.setCouponUseType(sysCouponActivity.getCouponUseType()); |
| | | userCouponRecord.setCouponActivityId(sysCouponActivity.getId()); |
| | | userCouponRecord.setActivityType(1); |
| | | //判断发送类型1=全部用户,2=选择用户 |
| | | if(sysCouponActivity.getSendType()==1){ |
| | | Wrapper wrapper = new EntityWrapper<TUser>(); |
| | | if(sysCouponActivity.getCompanyType()!=1){ |
| | | wrapper.eq("companyId",sysCouponActivity.getCompanyId()); |
| | | } |
| | | List<TUser> list = userService.selectList(wrapper); |
| | | for(TUser user:list){ |
| | | userCouponRecord.setUserId(user.getId()); |
| | | for (int i=0;i<sysCouponActivity.getNumber();i++){ |
| | | userCouponRecord.insert(); |
| | | } |
| | | } |
| | | sysCouponActivity.setSendUserNum(list.size()); |
| | | sysCouponActivity.updateById(); |
| | | }else{ |
| | | JSONArray userId = JSON.parseArray(sysCouponActivity.getSendUserId()); |
| | | for(int j=0;j<userId.size();j++){ |
| | | userCouponRecord.setUserId(userId.getJSONObject(j).getInteger("userId")); |
| | | for (int i=0;i<sysCouponActivity.getNumber();i++){ |
| | | userCouponRecord.insert(); |
| | | } |
| | | } |
| | | sysCouponActivity.setSendUserNum(userId.size()); |
| | | sysCouponActivity.updateById(); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer sysCouponActivityId) { |
| | | SysCouponActivity sysCouponActivity = new SysCouponActivity(); |
| | | sysCouponActivity.setId(sysCouponActivityId); |
| | | sysCouponActivity.setStatus(4); |
| | | sysCouponActivityService.updateById(sysCouponActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(SysCouponActivity sysCouponActivity,Integer activityId) { |
| | | SysCouponRecord sysCouponRecord = couponRecordService.selectById(activityId); |
| | | sysCouponActivity.setCouponType(sysCouponRecord.getCouponType()); |
| | | sysCouponActivity.setCouponUseType(sysCouponRecord.getCouponUseType()); |
| | | sysCouponActivity.setMoney(sysCouponRecord.getMoney()); |
| | | sysCouponActivity.setFullMoney(sysCouponRecord.getFullMoney()); |
| | | sysCouponActivity.setInsertTime(new Date()); |
| | | sysCouponActivity.setCouponId(activityId); |
| | | sysCouponActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | sysCouponActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | sysCouponActivity.setStatus(sysCouponActivity.getCompanyType()==1?3:1); |
| | | sysCouponActivityService.updateById(sysCouponActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{sysCouponActivityId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("sysCouponActivityId") Integer sysCouponActivityId) { |
| | | return sysCouponActivityService.selectById(sysCouponActivityId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.SysRedPacketRecord; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.SysCouponRecord; |
| | | import com.stylefeng.guns.modular.system.service.ISysCouponRecordService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-15 17:42:16 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/sysCouponRecord") |
| | | public class SysCouponRecordController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/sysCouponRecord/"; |
| | | |
| | | @Autowired |
| | | private ISysCouponRecordService sysCouponRecordService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "sysCouponRecord.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/sysCouponRecord_add") |
| | | public String sysCouponRecordAdd() { |
| | | return PREFIX + "sysCouponRecord_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/sysCouponRecord_update/{sysCouponRecordId}") |
| | | public String sysCouponRecordUpdate(@PathVariable Integer sysCouponRecordId, Model model) { |
| | | SysCouponRecord sysCouponRecord = sysCouponRecordService.selectById(sysCouponRecordId); |
| | | model.addAttribute("item",sysCouponRecord); |
| | | LogObjectHolder.me().set(sysCouponRecord); |
| | | return PREFIX + "sysCouponRecord_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,Integer couponUseType,Integer couponType) { |
| | | |
| | | Date startTimes = null; |
| | | Date endTimes = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | startTimes = DateUtil.getDate_str3(timeArray[0]+" 00:00:00"); |
| | | endTimes = DateUtil.getDate_str3(timeArray[1]+" 23:59:59"); |
| | | } |
| | | Page<SysCouponRecord> page = new PageFactory<SysCouponRecord>().defaultPage(); |
| | | Wrapper wrapper = new EntityWrapper<SysCouponRecord>(); |
| | | if(SinataUtil.isNotEmpty(createTime)){ |
| | | wrapper.between("insertTime",startTimes,endTimes); |
| | | } |
| | | if(SinataUtil.isNotEmpty(couponUseType)){ |
| | | wrapper.eq("couponUseType",couponUseType); |
| | | } |
| | | if(SinataUtil.isNotEmpty(couponType)){ |
| | | wrapper.eq("couponType",couponType); |
| | | } |
| | | wrapper.eq("companyId",ShiroKit.getUser().getObjectId()); |
| | | wrapper.eq("companyType",ShiroKit.getUser().getRoleType()); |
| | | wrapper.orderBy("id",false); |
| | | return super.packForBT(sysCouponRecordService.selectPage(page,wrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(SysCouponRecord sysCouponRecord) { |
| | | sysCouponRecord.setInsertTime(new Date()); |
| | | sysCouponRecord.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | sysCouponRecord.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | sysCouponRecordService.insert(sysCouponRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer sysCouponRecordId) { |
| | | sysCouponRecordService.deleteById(sysCouponRecordId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(SysCouponRecord sysCouponRecord) { |
| | | sysCouponRecordService.updateById(sysCouponRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{sysCouponRecordId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("sysCouponRecordId") Integer sysCouponRecordId) { |
| | | return sysCouponRecordService.selectById(sysCouponRecordId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.SysRedPacketRecord; |
| | | import com.stylefeng.guns.modular.system.service.ISysRedPacketRecordService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-13 10:50:42 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/sysRedPacketRecord") |
| | | public class SysRedPacketRecordController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/sysRedPacketRecord/"; |
| | | |
| | | @Autowired |
| | | private ISysRedPacketRecordService sysRedPacketRecordService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "sysRedPacketRecord.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/sysRedPacketRecord_add") |
| | | public String sysRedPacketRecordAdd() { |
| | | return PREFIX + "sysRedPacketRecord_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/sysRedPacketRecord_update/{sysRedPacketRecordId}") |
| | | public String sysRedPacketRecordUpdate(@PathVariable Integer sysRedPacketRecordId, Model model) { |
| | | SysRedPacketRecord sysRedPacketRecord = sysRedPacketRecordService.selectById(sysRedPacketRecordId); |
| | | model.addAttribute("item",sysRedPacketRecord); |
| | | LogObjectHolder.me().set(sysRedPacketRecord); |
| | | return PREFIX + "sysRedPacketRecord_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime) { |
| | | Date startTimes = null; |
| | | Date endTimes = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | startTimes = DateUtil.getDate_str3(timeArray[0]+" 00:00:00"); |
| | | endTimes = DateUtil.getDate_str3(timeArray[1]+" 23:59:59"); |
| | | } |
| | | Page<SysRedPacketRecord> page = new PageFactory<SysRedPacketRecord>().defaultPage(); |
| | | Wrapper wrapper = new EntityWrapper<SysRedPacketRecord>(); |
| | | if(SinataUtil.isNotEmpty(createTime)){ |
| | | wrapper.between("insertTime",startTimes,endTimes); |
| | | } |
| | | wrapper.eq("companyId",ShiroKit.getUser().getObjectId()); |
| | | wrapper.eq("companyType",ShiroKit.getUser().getRoleType()); |
| | | wrapper.orderBy("id",false); |
| | | return super.packForBT(sysRedPacketRecordService.selectPage(page,wrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(SysRedPacketRecord sysRedPacketRecord) { |
| | | sysRedPacketRecord.setInsertTime(new Date()); |
| | | sysRedPacketRecord.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | sysRedPacketRecord.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | sysRedPacketRecordService.insert(sysRedPacketRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer sysRedPacketRecordId) { |
| | | sysRedPacketRecordService.deleteById(sysRedPacketRecordId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(SysRedPacketRecord sysRedPacketRecord) { |
| | | sysRedPacketRecordService.updateById(sysRedPacketRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{sysRedPacketRecordId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("sysRedPacketRecordId") Integer sysRedPacketRecordId) { |
| | | return sysRedPacketRecordService.selectById(sysRedPacketRecordId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TAdvertisement; |
| | | import com.stylefeng.guns.modular.system.service.ITAdvertisementService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 广告设置控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-02 09:36:03 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tAdvertisement") |
| | | public class TAdvertisementController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tAdvertisement/"; |
| | | |
| | | @Autowired |
| | | private ITAdvertisementService tAdvertisementService; |
| | | |
| | | @Autowired |
| | | private ITRegionService tRegionService; |
| | | |
| | | /** |
| | | * 跳转到广告设置首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tAdvertisement.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加广告设置 |
| | | */ |
| | | @RequestMapping("/tAdvertisement_add") |
| | | public String tAdvertisementAdd(Model model) { |
| | | List<TRegion> list = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("list",list); |
| | | return PREFIX + "tAdvertisement_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改广告设置 |
| | | */ |
| | | @RequestMapping("/tAdvertisement_update/{tAdvertisementId}") |
| | | public String tAdvertisementUpdate(@PathVariable Integer tAdvertisementId, Model model) { |
| | | TAdvertisement tAdvertisement = tAdvertisementService.selectById(tAdvertisementId); |
| | | model.addAttribute("item",tAdvertisement); |
| | | LogObjectHolder.me().set(tAdvertisement); |
| | | |
| | | List<TRegion> list = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("list",list); |
| | | return PREFIX + "tAdvertisement_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取广告设置列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String name, |
| | | Integer type) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tAdvertisementService.getAdvertisementList(page,beginTime,endTime,type,name)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增广告设置 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TAdvertisement tAdvertisement) { |
| | | tAdvertisement.setInsertTime(new Date()); |
| | | tAdvertisement.setInsertUser(ShiroKit.getUser().getId()); |
| | | tAdvertisementService.insert(tAdvertisement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除广告设置 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tAdvertisementId) { |
| | | tAdvertisementService.deleteById(tAdvertisementId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 操作广告设置 |
| | | */ |
| | | @RequestMapping(value = "/opt") |
| | | @ResponseBody |
| | | public Object opt(@RequestParam Integer tAdvertisementId,@RequestParam Integer optType) { |
| | | TAdvertisement tAdvertisement = tAdvertisementService.selectById(tAdvertisementId); |
| | | if (SinataUtil.isNotEmpty(tAdvertisement)){ |
| | | if (1 == optType.intValue()){ //上线 |
| | | tAdvertisement.setState(1); |
| | | }else if (2 == optType.intValue()){ //下线 |
| | | tAdvertisement.setState(2); |
| | | } |
| | | tAdvertisement.setUpdateTime(new Date()); |
| | | tAdvertisement.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tAdvertisementService.updateById(tAdvertisement); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改广告设置 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TAdvertisement tAdvertisement) { |
| | | tAdvertisement.setUpdateTime(new Date()); |
| | | tAdvertisement.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tAdvertisementService.updateById(tAdvertisement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.modular.system.util.AddAdminLogUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TAgreement; |
| | | import com.stylefeng.guns.modular.system.service.ITAgreementService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户端协议管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-01 17:42:20 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tAgreement") |
| | | public class TAgreementController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tAgreement/"; |
| | | |
| | | @Autowired |
| | | private ITAgreementService tAgreementService; |
| | | |
| | | /** |
| | | * 跳转到用户端协议管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | //注册协议 |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType", 1).eq("type", 6)); |
| | | //用户协议 |
| | | TAgreement two = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType", 1).eq("type", 2)); |
| | | //隐私协议 |
| | | TAgreement three = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType", 1).eq("type", 1)); |
| | | model.addAttribute("one",one); |
| | | model.addAttribute("two",two); |
| | | model.addAttribute("three",three); |
| | | return PREFIX + "tAgreement.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到司机端协议管理首页 |
| | | */ |
| | | @RequestMapping("/driver") |
| | | public String driverIndex(Model model) { |
| | | //注册协议 |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType", 2).eq("type", 6)); |
| | | //用户协议 |
| | | TAgreement two = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType", 2).eq("type", 2)); |
| | | //隐私协议 |
| | | TAgreement three = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType", 2).eq("type", 1)); |
| | | model.addAttribute("one",one); |
| | | model.addAttribute("two",two); |
| | | model.addAttribute("three",three); |
| | | return PREFIX + "tAgreementDriver.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到取消订单说明协议管理首页 |
| | | */ |
| | | @RequestMapping("/order") |
| | | public String orderIndex(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 7)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "tAgreementOrder.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到用户指南设置协议管理首页 |
| | | */ |
| | | @RequestMapping("/user") |
| | | public String userIndex(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 3)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "tAgreementUser.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到法律法规设置协议管理首页 |
| | | */ |
| | | @RequestMapping("/law") |
| | | public String lawIndex(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 4)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "tAgreementLaw.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到关于我们设置协议管理首页 |
| | | */ |
| | | @RequestMapping("/me") |
| | | public String meIndex(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 5)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "tAgreementMe.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到充值领券规则设置协议管理首页 |
| | | */ |
| | | @RequestMapping("/recharge") |
| | | public String rechargeIndex(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 8)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "tAgreementRecharge.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到司机注册协议设置管理首页 |
| | | */ |
| | | @RequestMapping("/driverRegister") |
| | | public String driverRegister(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 9)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "driverRegister.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到改派说明设置管理首页 |
| | | */ |
| | | @RequestMapping("/instructions") |
| | | public String instructions(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 10)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "instructions.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到跨城出行乘车须知 |
| | | */ |
| | | @RequestMapping("/corssHtml") |
| | | public String corssHtml(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 11)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "corssHtml.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到常见问题 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showCommonProblem") |
| | | public String showCommonProblem(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 12)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "commonProblem.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到计价规则 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showPricingRules") |
| | | public String showPricingRules(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 13)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "pricingRules.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到包车协议 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showCharterCar") |
| | | public String showCharterCar(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 14)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "tAgreementCharterCar.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到小件物流协议 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showSmallPieceLogistics") |
| | | public String showSmallPieceLogistics(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 15)); |
| | | model.addAttribute("one",one); |
| | | return PREFIX + "tAgreementSmallPieceLogistics.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改协议 |
| | | */ |
| | | @RequestMapping(value = "/updateAppParam") |
| | | @ResponseBody |
| | | public Object updateAppParam(@RequestParam Integer id,@RequestParam String context) { |
| | | TAgreement agreement = tAgreementService.selectById(id); |
| | | agreement.setContent(context); |
| | | agreement.setUpdateTime(new Date()); |
| | | agreement.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tAgreementService.updateById(agreement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加用户端协议管理 |
| | | */ |
| | | @RequestMapping("/tAgreement_add") |
| | | public String tAgreementAdd() { |
| | | return PREFIX + "tAgreement_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改用户端协议管理 |
| | | */ |
| | | @RequestMapping("/tAgreement_update/{tAgreementId}") |
| | | public String tAgreementUpdate(@PathVariable Integer tAgreementId, Model model) { |
| | | TAgreement tAgreement = tAgreementService.selectById(tAgreementId); |
| | | model.addAttribute("item",tAgreement); |
| | | LogObjectHolder.me().set(tAgreement); |
| | | return PREFIX + "tAgreement_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户端协议管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return tAgreementService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户端协议管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TAgreement tAgreement) { |
| | | tAgreementService.insert(tAgreement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除用户端协议管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tAgreementId) { |
| | | tAgreementService.deleteById(tAgreementId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改用户端协议管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TAgreement tAgreement) { |
| | | tAgreementService.updateById(tAgreement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 用户端协议管理详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tAgreementId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tAgreementId") Integer tAgreementId) { |
| | | return tAgreementService.selectById(tAgreementId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.dao.CarInsuranceMapper; |
| | | import com.stylefeng.guns.modular.system.model.TCar; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 车辆审核管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-05 17:25:12 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("/tCarAudit") |
| | | public class TCarAuditController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tCarAudit/"; |
| | | |
| | | @Autowired |
| | | private ITCarService tCarService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService tCompanyService; |
| | | |
| | | @Autowired |
| | | private ITCarServiceService tCarServiceService; |
| | | |
| | | @Autowired |
| | | private ITDriverLineService tDriverLineService; |
| | | |
| | | @Autowired |
| | | private ITCarBrandService tCarBrandService; |
| | | |
| | | @Autowired |
| | | private ITCarModelService tCarModelService; |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | @Autowired |
| | | private ITCarServiceService itCarServiceService; |
| | | |
| | | @Autowired |
| | | private ITServerCarmodelService itServerCarmodelService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Resource |
| | | private CarInsuranceMapper carInsuranceMapper; |
| | | |
| | | /** |
| | | * 跳转到车辆管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tCarAudit.html"; |
| | | } |
| | | /** |
| | | * 获取车辆管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime, |
| | | String id, |
| | | String brandName, |
| | | String modelName, |
| | | String carColor, |
| | | String serverStr, |
| | | String carLicensePlate, |
| | | String driverName, |
| | | String companyName, |
| | | String franchiseeName, |
| | | Integer audit) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tCarService.getCarList1(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(), |
| | | beginTime,endTime,id,brandName,modelName,carColor,serverStr,carLicensePlate,driverName,companyName,franchiseeName,audit)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 车辆审核按钮管理 |
| | | */ |
| | | @RequestMapping(value = "/audit") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCarId,@RequestParam Integer audit) { |
| | | TCar tCar = tCarService.selectById(tCarId); |
| | | tCar.setAudit(audit); |
| | | tCarService.updateById(tCar); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TCarBrand; |
| | | import com.stylefeng.guns.modular.system.service.ITCarBrandService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 车辆品牌管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-05 13:52:25 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tCarBrand") |
| | | public class TCarBrandController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tCarBrand/"; |
| | | |
| | | @Autowired |
| | | private ITCarBrandService tCarBrandService; |
| | | |
| | | /** |
| | | * 跳转到车辆品牌管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tCarBrand.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加车辆品牌管理 |
| | | */ |
| | | @RequestMapping("/tCarBrand_add") |
| | | public String tCarBrandAdd() { |
| | | return PREFIX + "tCarBrand_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改车辆品牌管理 |
| | | */ |
| | | @RequestMapping("/tCarBrand_update/{tCarBrandId}") |
| | | public String tCarBrandUpdate(@PathVariable Integer tCarBrandId, Model model) { |
| | | TCarBrand tCarBrand = tCarBrandService.selectById(tCarBrandId); |
| | | model.addAttribute("item",tCarBrand); |
| | | LogObjectHolder.me().set(tCarBrand); |
| | | return PREFIX + "tCarBrand_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取车辆品牌管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime, |
| | | String name) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tCarBrandService.getCarBrandList(page,beginTime,endTime,name)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增车辆品牌管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TCarBrand tCarBrand) { |
| | | tCarBrand.setInsertTime(new Date()); |
| | | tCarBrand.setState(1); |
| | | tCarBrandService.insert(tCarBrand); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除车辆品牌管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCarBrandId) { |
| | | TCarBrand tCarBrand = tCarBrandService.selectById(tCarBrandId); |
| | | tCarBrand.setState(2); |
| | | tCarBrandService.updateById(tCarBrand); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改车辆品牌管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TCarBrand tCarBrand) { |
| | | tCarBrandService.updateById(tCarBrand); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ExcelExportUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.WoUtil; |
| | | import com.stylefeng.guns.modular.system.dao.CarInsuranceMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 车辆管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-05 17:25:12 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("/tCar") |
| | | public class TCarController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tCar/"; |
| | | |
| | | @Autowired |
| | | private ITCarService tCarService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService tCompanyService; |
| | | |
| | | @Autowired |
| | | private ITCarServiceService tCarServiceService; |
| | | |
| | | @Autowired |
| | | private ITDriverLineService tDriverLineService; |
| | | |
| | | @Autowired |
| | | private ITCarBrandService tCarBrandService; |
| | | |
| | | @Autowired |
| | | private ITCarModelService tCarModelService; |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | @Autowired |
| | | private ITCarServiceService itCarServiceService; |
| | | |
| | | @Autowired |
| | | private ITServerCarmodelService itServerCarmodelService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Resource |
| | | private CarInsuranceMapper carInsuranceMapper; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | /** |
| | | * 跳转到车辆管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tCar.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加车辆管理 |
| | | */ |
| | | @RequestMapping("/tCar_add") |
| | | public String tCarAdd(Model model) { |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else{ |
| | | model.addAttribute("franchiseeList",null); |
| | | } |
| | | //查询当前用户所属分公司/加盟商 |
| | | model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); |
| | | |
| | | //车辆品牌 |
| | | List<TCarBrand> brandList = tCarBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1)); |
| | | model.addAttribute("brandList",brandList); |
| | | //车辆类型 |
| | | /*List<TCarModel> modelList = tCarModelService.selectList(new EntityWrapper<TCarModel>().eq("state", 1)); |
| | | model.addAttribute("modelList",modelList);*/ |
| | | |
| | | List<TServerCarmodel> zcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1)); |
| | | model.addAttribute("zcModelList",zcModelList); |
| | | List<TServerCarmodel> kcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1)); |
| | | model.addAttribute("kcModelList",kcModelList); |
| | | return PREFIX + "tCar_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 查询车辆类型 |
| | | * @param carBrandId |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/brandChange") |
| | | @ResponseBody |
| | | public Object brandChange(@RequestParam Integer carBrandId) { |
| | | List<TCarModel> list = new ArrayList<>(); |
| | | if (SinataUtil.isNotEmpty(carBrandId)){ |
| | | list = tCarModelService.selectList(new EntityWrapper<TCarModel>().eq("state",1).eq("brandId", carBrandId)); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改车辆管理 |
| | | */ |
| | | @RequestMapping("/tCar_update/{tCarId}") |
| | | public String tCarUpdate(@PathVariable Integer tCarId, Model model) { |
| | | TCar tCar = tCarService.selectById(tCarId); |
| | | model.addAttribute("item",tCar); |
| | | LogObjectHolder.me().set(tCar); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); |
| | | |
| | | if (1 == roleType){ |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",tCar.getCompanyId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | } |
| | | |
| | | //查询平台ID |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); |
| | | //判断是平台司机还是加盟司机 |
| | | if ((SinataUtil.isEmpty(tCar.getCompanyId()) || tCar.getCompanyId() == 0 || tCar.getCompanyId() == company.getId()) && (SinataUtil.isEmpty(tCar.getFranchiseeId()) || tCar.getFranchiseeId() == 0)){ |
| | | model.addAttribute("companyType",1); |
| | | }else{ |
| | | model.addAttribute("companyType",2); |
| | | } |
| | | |
| | | //获取经营业务 |
| | | List<TCarService> serviceList = tCarServiceService.selectList(new EntityWrapper<TCarService>().eq("carId", tCar.getId())); |
| | | Integer one = 1; |
| | | Integer two = 1; |
| | | Integer three = 1; |
| | | Integer four = 1; |
| | | Integer five = 1; |
| | | Integer six = 1; |
| | | Integer zcModel = 0; |
| | | Integer kcModel = 0; |
| | | for (TCarService obj : serviceList){ |
| | | if (obj.getType() == 1){ |
| | | one = 2; |
| | | zcModel = obj.getServerCarModelId(); |
| | | } |
| | | if (obj.getType() == 2){ |
| | | two = 2; |
| | | } |
| | | if (obj.getType() == 3){ |
| | | three = 2; |
| | | kcModel = obj.getServerCarModelId(); |
| | | } |
| | | if (obj.getType() == 4){ |
| | | four = 2; |
| | | } |
| | | if (obj.getType() == 5){ |
| | | five = 2; |
| | | } |
| | | if (obj.getType() == 6){ |
| | | six = 2; |
| | | } |
| | | } |
| | | model.addAttribute("one",one); |
| | | model.addAttribute("two",two); |
| | | model.addAttribute("three",three); |
| | | model.addAttribute("four",four); |
| | | model.addAttribute("five",five); |
| | | model.addAttribute("six",six); |
| | | model.addAttribute("zcModel",zcModel); |
| | | model.addAttribute("kcModel",kcModel); |
| | | |
| | | List<TServerCarmodel> zcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1)); |
| | | model.addAttribute("zcModelList",zcModelList); |
| | | List<TServerCarmodel> kcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1)); |
| | | model.addAttribute("kcModelList",kcModelList); |
| | | |
| | | //车辆品牌 |
| | | List<TCarBrand> brandList = tCarBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1)); |
| | | model.addAttribute("brandList",brandList); |
| | | //车辆类型 |
| | | List<TCarModel> modelList = tCarModelService.selectList(new EntityWrapper<TCarModel>().eq("brandId",tCar.getCarBrandId()).eq("state", 1)); |
| | | model.addAttribute("modelList",modelList); |
| | | return PREFIX + "tCar_edit.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到保险列表页 |
| | | * @param carId |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/carInsurance") |
| | | public String carInsurance(Integer carId, Model model){ |
| | | model.addAttribute("carId", carId); |
| | | return PREFIX + "carInsurance.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加页面 |
| | | * @param carId |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showAddCarInsurance") |
| | | public String showAddCarInsurance(Integer carId, Model model){ |
| | | model.addAttribute("carId", carId); |
| | | model.addAttribute("id", ""); |
| | | return PREFIX + "carInsuranceInfo.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到编辑页 |
| | | * @param id |
| | | * @param carId |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showEditCarInsurance") |
| | | public String showEditCarInsurance(Integer id, Integer carId, Model model){ |
| | | model.addAttribute("carId", carId); |
| | | model.addAttribute("id", id); |
| | | return PREFIX + "carInsuranceInfo.html"; |
| | | } |
| | | |
| | | /** |
| | | * 添加保险数据 |
| | | * @param carInsurance |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/saveCarInsurance", method = RequestMethod.POST) |
| | | public ResultUtil saveCarInsurance(CarInsurance carInsurance){ |
| | | if(carInsurance.getId() == null){ |
| | | carInsuranceMapper.insert(carInsurance); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoVehicleInsurance(carInsurance.getId(), 1); |
| | | } |
| | | } |
| | | }).start(); |
| | | }else{ |
| | | carInsuranceMapper.updateById(carInsurance); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoVehicleInsurance(carInsurance.getId(), 2); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取保险详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryCarInsurance", method = RequestMethod.POST) |
| | | public ResultUtil queryCarInsurance(Integer id){ |
| | | CarInsurance carInsurance = carInsuranceMapper.selectById(id); |
| | | return ResultUtil.success(carInsurance); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取保险列表 |
| | | * @param carId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryInsuranceList", method = RequestMethod.POST) |
| | | public Object queryInsuranceList(Integer carId, Integer offset,Integer limit){ |
| | | try { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = carInsuranceMapper.queryInsuranceList(carId, offset, limit); |
| | | int i = carInsuranceMapper.queryInsuranceListCount(carId); |
| | | map.put("rows", list); |
| | | map.put("total", i); |
| | | return map; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除保险 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/delCarInsurance", method = RequestMethod.POST) |
| | | public ResultUtil delCarInsurance(Integer id){ |
| | | carInsuranceMapper.deleteById(id); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoVehicleInsurance(id, 3); |
| | | } |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取车辆管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime, |
| | | String id, |
| | | String brandName, |
| | | String modelName, |
| | | String carColor, |
| | | String serverStr, |
| | | String carLicensePlate, |
| | | String driverName, |
| | | String companyName, |
| | | String franchiseeName) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tCarService.getCarList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,id,brandName,modelName,carColor,serverStr,carLicensePlate,driverName,companyName,franchiseeName)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增车辆管理 |
| | | */ |
| | | @PostMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TCar tCar, String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId) { |
| | | if (1 == roleType){ //平台 |
| | | tCar.setAudit(1); |
| | | if (2 == companyType.intValue()){ |
| | | if (SinataUtil.isNotEmpty(oneId)){ |
| | | tCar.setCompanyId(oneId); |
| | | } |
| | | if (SinataUtil.isNotEmpty(twoId)){ |
| | | tCar.setFranchiseeId(twoId); |
| | | } |
| | | }else if (1 == companyType.intValue()){ |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); |
| | | tCar.setCompanyId(company.getId()); |
| | | tCar.setFranchiseeId(0); |
| | | } |
| | | tCar.setAddType(2); |
| | | tCar.setIsPlatCar(1); |
| | | }else if (2 == roleType){ |
| | | tCar.setAudit(0);//分公司 |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tCar.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(franchiseeId)){ |
| | | tCar.setFranchiseeId(franchiseeId); |
| | | } |
| | | tCar.setIsPlatCar(2); |
| | | tCar.setAddType(3); |
| | | tCar.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | }else if (3 == roleType){ //加盟商 |
| | | tCar.setAudit(0); |
| | | TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | if (SinataUtil.isNotEmpty(tCompany)){ |
| | | tCar.setCompanyId(tCompany.getSuperiorId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tCar.setFranchiseeId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tCar.setIsPlatCar(2); |
| | | tCar.setAddType(4); |
| | | tCar.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tCar.setInsertTime(new Date()); |
| | | tCar.setState(1); |
| | | tCarService.insert(tCar); |
| | | |
| | | //添加经营业务 |
| | | String[] serverArray = serverBox.split(","); |
| | | for (int i=0;i<serverArray.length;i++){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(tCar.getId()); |
| | | service.setType(Integer.valueOf(serverArray[i])); |
| | | tCarServiceService.insert(service); |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除车辆管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCarId) { |
| | | TCar tCar = tCarService.selectById(tCarId); |
| | | tCar.setState(2); |
| | | tCarService.updateById(tCar); |
| | | |
| | | //清除相对应的司机关联车辆ID |
| | | List<TDriver> list = tDriverService.selectList(new EntityWrapper<TDriver>().eq("carId", tCarId)); |
| | | for (TDriver obj : list){ |
| | | obj.setCarId(null); |
| | | tDriverService.updateById(obj); |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改车辆管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TCar tCar,@RequestParam String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId,String zcModel,String kcModel) { |
| | | if (1 == roleType){ //平台 |
| | | tCar.setAudit(1); |
| | | if (2 == companyType.intValue()){ |
| | | if (SinataUtil.isNotEmpty(oneId)){ |
| | | tCar.setCompanyId(oneId); |
| | | } |
| | | if (SinataUtil.isNotEmpty(twoId)){ |
| | | tCar.setFranchiseeId(twoId); |
| | | } |
| | | }else if (1 == companyType.intValue()){ |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); |
| | | tCar.setCompanyId(company.getId()); |
| | | tCar.setFranchiseeId(0); |
| | | } |
| | | }else if (2 == roleType){ //分公司 |
| | | // tCar.setAudit(0); |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tCar.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(franchiseeId)){ |
| | | tCar.setFranchiseeId(franchiseeId); |
| | | } |
| | | }else if (3 == roleType){ //加盟商 |
| | | // tCar.setAudit(0); |
| | | TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | if (SinataUtil.isNotEmpty(tCompany)){ |
| | | tCar.setCompanyId(tCompany.getSuperiorId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tCar.setFranchiseeId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | } |
| | | |
| | | //删除业务 |
| | | tCarServiceService.delete(new EntityWrapper<TCarService>().eq("carId",tCar.getId())); |
| | | |
| | | //添加经营业务 |
| | | String[] serverArray = serverBox.split(","); |
| | | for (int i=0;i<serverArray.length;i++){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(tCar.getId()); |
| | | service.setType(Integer.valueOf(serverArray[i])); |
| | | if (1 == service.getType()){ |
| | | service.setServerCarModelId(Integer.valueOf(zcModel)); |
| | | }else if (3 == service.getType()){ |
| | | service.setServerCarModelId(Integer.valueOf(kcModel)); |
| | | } |
| | | tCarServiceService.insert(service); |
| | | } |
| | | |
| | | tCarService.updateById(tCar); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){ |
| | | pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 车辆管理详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tCarId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tCarId") Integer tCarId) { |
| | | return tCarService.selectById(tCarId); |
| | | } |
| | | |
| | | /** |
| | | * 下载模板 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @RequestMapping(value = "/uploadCarModel") |
| | | public void uploadCarModel(HttpServletRequest request, HttpServletResponse response) { |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<List<String>>(); |
| | | |
| | | // 首行【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("所属机构[平台车辆/加盟车辆]"); |
| | | shellList.add("所属分公司[提示:加盟车辆选填]"); |
| | | shellList.add("所属加盟商[提示:加盟车辆选填]"); |
| | | shellList.add("服务模式:专车[是/否]"); |
| | | shellList.add("服务模式:出租车[是/否]"); |
| | | shellList.add("服务模式:跨城出行[是/否]"); |
| | | shellList.add("服务模式:小件同城物流[是/否]"); |
| | | shellList.add("服务模式:小件跨城物流[是/否]"); |
| | | shellList.add("服务模式:包车[是/否]"); |
| | | shellList.add("车辆品牌"); |
| | | shellList.add("车辆类型"); |
| | | shellList.add("车辆颜色[蓝白色/绿色]"); |
| | | shellList.add("车牌号"); |
| | | dataList.add(shellList); |
| | | |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("平台导入车辆模板"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "平台导入车辆模板", dataList, request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入操作 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value="/exportCar",method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public Object exportCar(HttpServletRequest request){ |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | MultipartFile file = (MultipartFile) multipartRequest.getFile("myfile"); |
| | | try { |
| | | //定时五秒后执行 |
| | | /*Map<String,Object> maps=new HashMap<>(); |
| | | Workbook book = WoUtil.ImportFile(file); |
| | | maps.put("book",book); |
| | | QuartzManager.addJob(AddContract.class, (AddContract.name+new Date().getTime()).toUpperCase(), TimeJobType.ADMIN,DateUtil.getDate_strYMdHms(new Date().getTime() + 1*1000) , maps);*/ |
| | | |
| | | Workbook book = WoUtil.ImportFile(file); |
| | | Sheet sh = book.getSheetAt(0); //获取到第一个表 |
| | | for (int i = 1; i <= sh.getLastRowNum(); i++) { |
| | | Row row = sh.getRow(i); |
| | | |
| | | Cell cell0 = row.getCell(0); //所属机构[平台车辆/加盟车辆] |
| | | String zero = null; |
| | | if (SinataUtil.isNotEmpty(cell0)){ |
| | | zero = String.valueOf(cell0.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell1 = row.getCell(1); //所属分公司[提示:加盟车辆选填] |
| | | String one = null; |
| | | if (SinataUtil.isNotEmpty(cell1)){ |
| | | one = String.valueOf(cell1.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell2 = row.getCell(2); //所属加盟商[提示:加盟车辆选填] |
| | | String two = null; |
| | | if (SinataUtil.isNotEmpty(cell2)){ |
| | | two = String.valueOf(cell2.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell3 = row.getCell(3); //服务模式:专车[是/否] |
| | | String three = null; |
| | | if (SinataUtil.isNotEmpty(cell3)){ |
| | | three = String.valueOf(cell3.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell4 = row.getCell(4); //服务模式:出租车[是/否] |
| | | String four = null; |
| | | if (SinataUtil.isNotEmpty(cell4)){ |
| | | four = String.valueOf(cell4.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell5 = row.getCell(5); //服务模式:跨城出行[是/否] |
| | | String five = null; |
| | | if (SinataUtil.isNotEmpty(cell5)){ |
| | | five = String.valueOf(cell5.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell6 = row.getCell(6); //服务模式:小件跨城物流[是/否] |
| | | String six = null; |
| | | if (SinataUtil.isNotEmpty(cell6)){ |
| | | six = String.valueOf(cell6.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell7 = row.getCell(7); //服务模式:小件跨城物流[是/否] |
| | | String seven = null; |
| | | if (SinataUtil.isNotEmpty(cell7)){ |
| | | seven = String.valueOf(cell7.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell8 = row.getCell(8); //服务模式:包车[是/否] |
| | | String eight = null; |
| | | if (SinataUtil.isNotEmpty(cell8)){ |
| | | eight = String.valueOf(cell8.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell9 = row.getCell(9); //车辆品牌 |
| | | String nine = null; |
| | | if (SinataUtil.isNotEmpty(cell9)){ |
| | | nine = String.valueOf(cell9.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell10 = row.getCell(10); //车辆类型 |
| | | String ten = null; |
| | | if (SinataUtil.isNotEmpty(cell10)){ |
| | | ten = String.valueOf(cell10.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell11 = row.getCell(11); //车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色] |
| | | String eleven = null; |
| | | if (SinataUtil.isNotEmpty(cell11)){ |
| | | eleven = String.valueOf(cell11.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell12 = row.getCell(12); //车牌号 |
| | | String twelve = null; |
| | | if (SinataUtil.isNotEmpty(cell12)){ |
| | | twelve = String.valueOf(cell12.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | // Cell cell13 = row.getCell(13); //行驶证编号 |
| | | // String thirteen = null; |
| | | // if (SinataUtil.isNotEmpty(cell13)){ |
| | | // thirteen = String.valueOf(cell13.getStringCellValue()).trim(); |
| | | // } |
| | | // |
| | | // Cell cell14 = row.getCell(14); //年检到期时间 |
| | | // String fourteen = null; |
| | | // if (SinataUtil.isNotEmpty(cell14)){ |
| | | // fourteen = String.valueOf(cell14.getStringCellValue()).trim(); |
| | | // } |
| | | // |
| | | // Cell cell15 = row.getCell(15); //商业保险到期时间 |
| | | // String fifteen = null; |
| | | // if (SinataUtil.isNotEmpty(cell15)){ |
| | | // fifteen = String.valueOf(cell15.getStringCellValue()).trim(); |
| | | // } |
| | | |
| | | if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(three) || SinataUtil.isEmpty(four) |
| | | || SinataUtil.isEmpty(five) || SinataUtil.isEmpty(six) || SinataUtil.isEmpty(seven) |
| | | || SinataUtil.isEmpty(eight) || SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten) |
| | | || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(twelve) |
| | | ){ |
| | | return new ErrorTip(500, "单元格不能为空"); |
| | | }else{ |
| | | //判断所属机构 |
| | | if (!zero.equals("平台车辆") && !zero.equals("加盟车辆")){ |
| | | return new ErrorTip(500, "所属机构内容不正确"); |
| | | } |
| | | //判断服务模式【专车】 |
| | | if (!three.equals("是") && !three.equals("否")){ |
| | | return new ErrorTip(500, "服务模式【专车】内容不正确"); |
| | | } |
| | | //判断服务模式【出租车】 |
| | | if (!four.equals("是") && !four.equals("否")){ |
| | | return new ErrorTip(500, "服务模式【出租车】内容不正确"); |
| | | } |
| | | //判断服务模式【跨城出行】 |
| | | if (!five.equals("是") && !five.equals("否")){ |
| | | return new ErrorTip(500, "服务模式【跨城出行】内容不正确"); |
| | | } |
| | | //判断服务模式【小件同城物流】 |
| | | if (!six.equals("是") && !six.equals("否")){ |
| | | return new ErrorTip(500, "服务模式【小件同城物流】内容不正确"); |
| | | } |
| | | //判断服务模式【小件跨城物流】 |
| | | if (!seven.equals("是") && !seven.equals("否")){ |
| | | return new ErrorTip(500, "服务模式【小件跨城物流】内容不正确"); |
| | | } |
| | | //判断服务模式【包车】 |
| | | if (!eight.equals("是") && !eight.equals("否")){ |
| | | return new ErrorTip(500, "服务模式【包车】内容不正确"); |
| | | } |
| | | //判断车辆颜色 |
| | | if (!eleven.equals("蓝白色") && !eleven.equals("绿色") ){ |
| | | return new ErrorTip(500, "车辆颜色内容不正确"); |
| | | } |
| | | //判断年检到期时间格式是否正确 |
| | | try { |
| | | // if (!isValidDate(fourteen)) { |
| | | // fourteen = importByExcelForDate(fourteen); |
| | | // } |
| | | }catch (Exception e){ |
| | | return new ErrorTip(500, "年检到期时间格式不正确"); |
| | | } |
| | | //判断商业保险到期时间格式是否正确 |
| | | try { |
| | | // if (!isValidDate(fifteen)) { |
| | | // fifteen = importByExcelForDate(fifteen); |
| | | // } |
| | | }catch (Exception e){ |
| | | return new ErrorTip(500, "商业保险到期时间格式不正确"); |
| | | } |
| | | |
| | | //查找平台公司 |
| | | TCompany platCompany = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).notIn("flag", "3").last(" limit 1")); |
| | | Integer companyId = platCompany.getId(); |
| | | Integer franchiseeId = 0; |
| | | if ("加盟车辆".equals(zero)){ |
| | | //判断所属分公司是否存在 |
| | | if (SinataUtil.isNotEmpty(one)){ |
| | | TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("name", one).eq("type", 2).notIn("flag", "3").last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(company)){ |
| | | companyId = company.getId(); |
| | | //判断加盟商是否存在 |
| | | if (SinataUtil.isNotEmpty(two)){ |
| | | TCompany franchisee = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("superiorId",company.getId()).eq("name", two).eq("type", 3).notIn("flag", "3").last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(franchisee)){ |
| | | franchiseeId = franchisee.getId(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | Integer carBrandId = null; |
| | | Integer carModelId = null; |
| | | //查找品牌 |
| | | if (SinataUtil.isNotEmpty(nine)){ |
| | | TCarBrand carBrand = tCarBrandService.selectOne(new EntityWrapper<TCarBrand>().eq("name", nine).eq("state", 1).last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(carBrand)){ |
| | | carBrandId = carBrand.getId(); |
| | | if (SinataUtil.isNotEmpty(ten)){ |
| | | //查找类型 |
| | | TCarModel carModel = tCarModelService.selectOne(new EntityWrapper<TCarModel>().eq("brandId", carBrand.getId()).eq("name", ten).eq("state", 1).last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(carModel)){ |
| | | carModelId = carModel.getId(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //添加车辆对象 |
| | | TCar car = new TCar(); |
| | | if ("平台车辆".equals(zero)){ |
| | | car.setIsPlatCar(1); |
| | | }else if ("加盟车辆".equals(zero)){ |
| | | car.setIsPlatCar(2); |
| | | } |
| | | car.setCompanyId(companyId); |
| | | car.setFranchiseeId(franchiseeId); |
| | | car.setCarColor(eleven); |
| | | car.setCarBrandId(carBrandId); |
| | | car.setCarModelId(carModelId); |
| | | car.setCarLicensePlate(twelve); |
| | | car.setAudit(1); |
| | | // car.setDrivingLicenseNumber(thirteen); |
| | | // car.setAnnualInspectionTime(DateUtil.parseDate(fourteen)); |
| | | // car.setCommercialInsuranceTime(DateUtil.parseDate(fifteen)); |
| | | car.setInsertTime(new Date()); |
| | | car.setState(1); |
| | | if (ShiroKit.getUser().getRoleType() == 1){ |
| | | car.setAddType(2); |
| | | }else if (ShiroKit.getUser().getRoleType() == 2){ |
| | | car.setAddType(3); |
| | | car.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | }else if (ShiroKit.getUser().getRoleType() == 3){ |
| | | car.setAddType(4); |
| | | car.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tCarService.insert(car); |
| | | |
| | | //添加专车服务模式 |
| | | if ("是".equals(three)){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(car.getId()); |
| | | service.setType(1); |
| | | tCarServiceService.insert(service); |
| | | } |
| | | //添加出租车服务模式 |
| | | if ("是".equals(four)){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(car.getId()); |
| | | service.setType(2); |
| | | tCarServiceService.insert(service); |
| | | } |
| | | //添加跨城出行服务模式 |
| | | if ("是".equals(five)){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(car.getId()); |
| | | service.setType(3); |
| | | tCarServiceService.insert(service); |
| | | } |
| | | //添加小件同城物流服务模式 |
| | | if ("是".equals(six)){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(car.getId()); |
| | | service.setType(4); |
| | | tCarServiceService.insert(service); |
| | | } |
| | | //添加小件跨城物流服务模式 |
| | | if ("是".equals(seven)){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(car.getId()); |
| | | service.setType(5); |
| | | tCarServiceService.insert(service); |
| | | } |
| | | //添加包车服务模式 |
| | | if ("是".equals(eight)){ |
| | | TCarService service = new TCarService(); |
| | | service.setCarId(car.getId()); |
| | | service.setType(6); |
| | | tCarServiceService.insert(service); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 判断日期是否满足yyyy-MM-dd格式 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isValidDate(String str) { |
| | | boolean convertSuccess=true; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | format.setLenient(false); |
| | | format.parse(str); |
| | | } catch (Exception e) { |
| | | convertSuccess=false; |
| | | } |
| | | return convertSuccess; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转换日期 |
| | | * @return |
| | | */ |
| | | public static String importByExcelForDate(String value) {//value就是它的天数 |
| | | String currentCellValue = ""; |
| | | if(value != null && !value.equals("")){ |
| | | Calendar calendar = new GregorianCalendar(1900,0,-1); |
| | | Date d = calendar.getTime(); |
| | | Date dd = DateUtils.addDays(d,Integer.valueOf(value)); |
| | | DateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); |
| | | currentCellValue = formater.format(dd); |
| | | } |
| | | return currentCellValue; |
| | | } |
| | | |
| | | /** |
| | | * 导出车辆信息 |
| | | */ |
| | | @RequestMapping(value = "/outCar") |
| | | public void outCar(HttpServletRequest request, HttpServletResponse response) { |
| | | List<Map<String,Object>> listMap = tCarService.getCarListNoPage(ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId()); |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |
| | | |
| | | //第一行显示【封装】 |
| | | List<String> twoList = new ArrayList<String>(); |
| | | twoList.add("总计:"); |
| | | twoList.add(String.valueOf(listMap.size())+"条"); |
| | | dataList.add(twoList); |
| | | |
| | | // 列【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("添加时间"); |
| | | shellList.add("车辆ID"); |
| | | shellList.add("所属分公司"); |
| | | shellList.add("所属加盟商"); |
| | | shellList.add("车辆品牌"); |
| | | shellList.add("车辆类型"); |
| | | shellList.add("颜色"); |
| | | shellList.add("服务模式"); |
| | | shellList.add("车牌号"); |
| | | shellList.add("行驶证号码"); |
| | | shellList.add("座位数"); |
| | | shellList.add("关联司机"); |
| | | shellList.add("年检到期时间"); |
| | | shellList.add("商业保险到期时间"); |
| | | dataList.add(shellList); |
| | | |
| | | for (Map<String,Object> object : listMap){ |
| | | // 详细数据列【封装】 |
| | | shellList = new ArrayList<String>(); |
| | | if(SinataUtil.isNotEmpty(object.get("insertTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("insertTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | shellList.add(String.valueOf(object.get("id"))); |
| | | if(SinataUtil.isNotEmpty(object.get("companyName"))){ |
| | | shellList.add(object.get("companyName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("franchiseeName"))){ |
| | | shellList.add(object.get("franchiseeName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("brandName"))){ |
| | | shellList.add(object.get("brandName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("modelName"))){ |
| | | shellList.add(object.get("modelName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("carColor"))){ |
| | | shellList.add(object.get("carColor").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("serverStr"))){ |
| | | shellList.add(object.get("serverStr").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("carLicensePlate"))){ |
| | | shellList.add(object.get("carLicensePlate").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("drivingLicenseNumber"))){ |
| | | shellList.add(object.get("drivingLicenseNumber").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("seat"))){ |
| | | shellList.add(object.get("seat").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("driverName"))){ |
| | | shellList.add(object.get("driverName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("annualInspectionTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("annualInspectionTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("commercialInsuranceTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("commercialInsuranceTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | dataList.add(shellList); |
| | | } |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("车辆信息导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "车辆信息导出记录", dataList,request, response); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TCarBrand; |
| | | import com.stylefeng.guns.modular.system.service.ITCarBrandService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TCarModel; |
| | | import com.stylefeng.guns.modular.system.service.ITCarModelService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 车辆类型管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-05 14:31:28 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tCarModel") |
| | | public class TCarModelController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tCarModel/"; |
| | | |
| | | @Autowired |
| | | private ITCarModelService tCarModelService; |
| | | |
| | | @Autowired |
| | | private ITCarBrandService tCarBrandService; |
| | | |
| | | /** |
| | | * 跳转到车辆类型管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tCarModel.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加车辆类型管理 |
| | | */ |
| | | @RequestMapping("/tCarModel_add") |
| | | public String tCarModelAdd(Model model) { |
| | | List<TCarBrand> brandList = tCarBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1).orderBy("insertTime", false)); |
| | | model.addAttribute("brandList",brandList); |
| | | return PREFIX + "tCarModel_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改车辆类型管理 |
| | | */ |
| | | @RequestMapping("/tCarModel_update/{tCarModelId}") |
| | | public String tCarModelUpdate(@PathVariable Integer tCarModelId, Model model) { |
| | | TCarModel tCarModel = tCarModelService.selectById(tCarModelId); |
| | | model.addAttribute("item",tCarModel); |
| | | LogObjectHolder.me().set(tCarModel); |
| | | |
| | | List<TCarBrand> brandList = tCarBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1).orderBy("insertTime", false)); |
| | | model.addAttribute("brandList",brandList); |
| | | return PREFIX + "tCarModel_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取车辆类型管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime, |
| | | String name) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tCarModelService.getCarModelList(page,beginTime,endTime,name)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增车辆类型管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TCarModel tCarModel) { |
| | | tCarModel.setInsertTime(new Date()); |
| | | tCarModel.setState(1); |
| | | tCarModelService.insert(tCarModel); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除车辆类型管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCarModelId) { |
| | | TCarModel tCarModel = tCarModelService.selectById(tCarModelId); |
| | | tCarModel.setState(2); |
| | | tCarModelService.updateById(tCarModel); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改车辆类型管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TCarModel tCarModel) { |
| | | tCarModelService.updateById(tCarModel); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyCityService; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 分公司管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-06 09:15:48 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tCompany") |
| | | public class TCompanyController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tCompany/"; |
| | | |
| | | @Autowired |
| | | private ITCompanyService tCompanyService; |
| | | |
| | | @Autowired |
| | | private ITRegionService tRegionService; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private ITCompanyCityService tCompanyCityService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | /** |
| | | * 跳转到修改平台信息 |
| | | */ |
| | | @RequestMapping("/admin_update") |
| | | public String tCompanyUpdate(Model model) { |
| | | TCompany tCompany = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type",1).notIn("flag",3)); |
| | | model.addAttribute("item",tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | //省 |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 1).eq("objectId", tCompany.getId())); |
| | | model.addAttribute("user",user); |
| | | |
| | | //经营区域 |
| | | List<Map<String, Object>> scopeList = tCompanyService.getCompanyScopeById(tCompany.getId()); |
| | | model.addAttribute("scopeList",scopeList); |
| | | return PREFIX + "platformEdit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到分公司管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tCompany.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到加盟商管理首页 |
| | | */ |
| | | @RequestMapping("/franchisee") |
| | | public String franchisee() { |
| | | return PREFIX + "franchisee.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加分公司管理 |
| | | */ |
| | | @RequestMapping("/tCompany_add") |
| | | public String tCompanyAdd(Model model) { |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | return PREFIX + "tCompany_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加加盟商司管理 |
| | | */ |
| | | @RequestMapping("/tCompany_addFranchisee") |
| | | public String tCompany_addFranchisee(Model model) { |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | if (1 == roleType){ |
| | | //查询分公司 |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | }else if (2 == roleType){ |
| | | TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | model.addAttribute("company",tCompany); |
| | | } |
| | | model.addAttribute("roleType",roleType); |
| | | return PREFIX + "tCompany_addFranchisee.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看分公司详情 |
| | | */ |
| | | @RequestMapping("/tCompany_detail/{tCompanyId}") |
| | | public String tCompany_detail(@PathVariable Integer tCompanyId, Model model) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item",tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | //省 |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 2).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user",user); |
| | | |
| | | //经营区域 |
| | | List<Map<String, Object>> scopeList = tCompanyService.getCompanyScopeById(tCompanyId); |
| | | model.addAttribute("scopeList",scopeList); |
| | | |
| | | return PREFIX + "tCompany_detail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改分公司管理 |
| | | */ |
| | | @RequestMapping("/tCompany_update/{tCompanyId}") |
| | | public String tCompanyUpdate(@PathVariable Integer tCompanyId, Model model) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item",tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | //省 |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 2).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user",user); |
| | | |
| | | //经营区域 |
| | | List<Map<String, Object>> scopeList = tCompanyService.getCompanyScopeById(tCompanyId); |
| | | model.addAttribute("scopeList",scopeList); |
| | | return PREFIX + "tCompany_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看加盟商 |
| | | */ |
| | | @RequestMapping("/tCompany_detailFranchisee/{tCompanyId}") |
| | | public String tCompany_detailFranchisee(@PathVariable Integer tCompanyId, Model model) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item",tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | |
| | | TCompany obj = tCompanyService.selectById(tCompany.getSuperiorId()); |
| | | if (SinataUtil.isNotEmpty(obj)){ |
| | | model.addAttribute("companyName",obj.getName()); |
| | | }else { |
| | | model.addAttribute("companyName","平台"); |
| | | } |
| | | |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user",user); |
| | | return PREFIX + "tCompany_detailFranchisee.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改分公司管理 |
| | | */ |
| | | @RequestMapping("/tCompany_updateFranchisee/{tCompanyId}") |
| | | public String tCompany_updateFranchisee(@PathVariable Integer tCompanyId, Model model) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item",tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | if (1 == roleType){ |
| | | //查询分公司 |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | }else if (2 == roleType){ |
| | | TCompany obj = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | model.addAttribute("company",obj); |
| | | } |
| | | model.addAttribute("roleType",roleType); |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user",user); |
| | | |
| | | return PREFIX + "tCompany_updateFranchisee.html"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/change") |
| | | @ResponseBody |
| | | public Object change(@RequestParam Integer code) { |
| | | List<TRegion> list = new ArrayList<>(); |
| | | if (SinataUtil.isNotEmpty(code)){ |
| | | TRegion region = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", code)); |
| | | list = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", region.getId())); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取分公司管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String name, |
| | | String principalName, |
| | | String principalPhone, |
| | | String adminName, |
| | | String adminPhone, |
| | | String serviceStr, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tCompanyService.getCompanyList(page,beginTime,endTime,name,principalName,principalPhone,adminName,adminPhone,serviceStr,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取分公司管理列表 |
| | | */ |
| | | @RequestMapping(value = "/listFranchisee") |
| | | @ResponseBody |
| | | public Object listFranchisee(String insertTime, |
| | | String name, |
| | | String account, |
| | | String principalName, |
| | | String principalPhone, |
| | | String serviceStr, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() == 3){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tCompanyService.getFranchiseeList(page,beginTime,endTime,name,account,principalName,principalPhone,serviceStr,state,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId())); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增分公司管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TCompany tCompany,@RequestParam String subArr,String account,String password) { |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account) |
| | | .eq("status",1)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | tCompany.setType(2); //2:分公司 |
| | | tCompany.setState(0); //0:正常 |
| | | tCompany.setInsertTime(new Date()); |
| | | tCompanyService.insert(tCompany); |
| | | |
| | | //添加User对象 |
| | | User user = new User(); |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setRoleid("7"); |
| | | user.setDeptid(25); |
| | | user.setStatus(1); |
| | | user.setCreatetime(new Date()); |
| | | user.setRoleType(2); |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | //添加经营区域 |
| | | addSocpe(subArr,tCompany.getId()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | //添加经营区域 |
| | | public void addSocpe(String subArr,Integer id){ |
| | | JSONArray jsonArray = JSON.parseArray(subArr); |
| | | tCompanyCityService.delete(new EntityWrapper<TCompanyCity>().eq("companyId", id)); |
| | | int size = jsonArray.size(); |
| | | for (int i = 0; i < size; i++){ |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TCompanyCity tCompanyCity = tCompanyCityService.selectOne(new EntityWrapper<TCompanyCity>().eq("id", jsonObject.getInteger("recordId")).eq("companyId", id)); |
| | | if (SinataUtil.isEmpty(tCompanyCity)){ |
| | | tCompanyCity = new TCompanyCity(); |
| | | tCompanyCity.setProvinceCode(jsonObject.getInteger("provinceCode")); |
| | | tCompanyCity.setCityCode(jsonObject.getInteger("cityCode")); |
| | | tCompanyCity.setAreaCode(jsonObject.getInteger("areaCode")); |
| | | tCompanyCity.setCompanyId(id); |
| | | tCompanyCity.setState(1); |
| | | tCompanyCityService.insert(tCompanyCity); |
| | | }else{ |
| | | tCompanyCity.setProvinceCode(jsonObject.getInteger("provinceCode")); |
| | | tCompanyCity.setCityCode(jsonObject.getInteger("cityCode")); |
| | | tCompanyCity.setAreaCode(jsonObject.getInteger("areaCode")); |
| | | tCompanyCityService.updateById(tCompanyCity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增加盟商管理 |
| | | */ |
| | | @RequestMapping(value = "/addFranchisee") |
| | | @ResponseBody |
| | | public Object addFranchisee(TCompany tCompany,String account,String password) { |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount( |
| | | new EntityWrapper<User>().eq("account", account) |
| | | .ne("status",3)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | tCompany.setType(3); //2:分公司 |
| | | if (ShiroKit.getUser().getRoleType() == 2){ |
| | | tCompany.setSuperiorId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tCompany.setState(0); //0:正常 |
| | | tCompany.setInsertTime(new Date()); |
| | | tCompanyService.insert(tCompany); |
| | | |
| | | //添加User对象 |
| | | User user = new User(); |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setRoleid("3"); |
| | | user.setDeptid(26); |
| | | user.setStatus(1); |
| | | user.setCreatetime(new Date()); |
| | | user.setRoleType(3); |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除分公司管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCompanyId) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | tCompany.setFlag("3"); |
| | | tCompanyService.updateById(tCompany); |
| | | User user = userService.selectOne(new EntityWrapper<User>() |
| | | .eq("roleid", 7) |
| | | .eq("status", 1) |
| | | .eq("roleType", 2) |
| | | .eq("objectId", tCompany.getId())); |
| | | user.setStatus(3); |
| | | userService.updateById(user); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改分公司管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TCompany tCompany,@RequestParam String subArr,String account,String password,Integer userId) { |
| | | //判断账号 |
| | | User user = userService.selectById(userId); |
| | | if (SinataUtil.isNotEmpty(account) && SinataUtil.isNotEmpty(password)){ |
| | | if (!user.getAccount().equals(account)){ |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | } |
| | | //修改账号密码 |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | } |
| | | tCompanyService.updateById(tCompany); |
| | | user.setName(tCompany.getName()); |
| | | userService.updateById(user); |
| | | |
| | | //添加经营区域 |
| | | addSocpe(subArr,tCompany.getId()); |
| | | |
| | | TCompany tCompany1 = tCompanyService.selectById(tCompany.getId()); |
| | | if(tCompany1.getType() == 1){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传平台数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyPay();//上传网约车平台公司支付信息 |
| | | pushMinistryOfTransportUtil.baseInfoCompany(tCompany.getId()); |
| | | pushMinistryOfTransportUtil.baseInfoCompanyService(); |
| | | pushMinistryOfTransportUtil.baseInfoCompanyPermit(tCompany.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改加盟商管理 |
| | | */ |
| | | @RequestMapping(value = "/updateFranchisee") |
| | | @ResponseBody |
| | | public Object updateFranchisee(TCompany tCompany,String account,String password,Integer userId) { |
| | | //判断账号 |
| | | User user = userService.selectById(userId); |
| | | if (!user.getAccount().equals(account)){ |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | } |
| | | tCompanyService.updateById(tCompany); |
| | | |
| | | //修改账号密码 |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setName(tCompany.getName()); |
| | | userService.updateById(user); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TProblem; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TComplaint; |
| | | import com.stylefeng.guns.modular.system.service.ITComplaintService; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 投诉列表控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 17:31:24 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tComplaint") |
| | | public class TComplaintController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tComplaint/"; |
| | | |
| | | @Autowired |
| | | private ITComplaintService tComplaintService; |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService tSystemNoticeService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到投诉列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tComplaint.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TComplaint tComplaint = tComplaintService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tComplaint.getReason(); |
| | | }else if (2 == type){ |
| | | str = tComplaint.getDescription(); |
| | | }else if (3 == type){ |
| | | str = tComplaint.getHandleResult(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到立即处理页面 |
| | | */ |
| | | @RequestMapping("/tComplaint_immediately/{tComplaintId}") |
| | | public String tComplaintUpdate(@PathVariable Integer tComplaintId, Model model) { |
| | | model.addAttribute("tComplaintId",tComplaintId); |
| | | return PREFIX + "tComplaint_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{str}") |
| | | public String lookDetail(@PathVariable String str, Model model) { |
| | | System.out.println(str); |
| | | model.addAttribute("str",str); |
| | | return PREFIX + "lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取投诉列表列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String userName, |
| | | String userPhone, |
| | | String driverPhone, |
| | | Integer isHandle) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tComplaintService.getComplaintList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,userName,userPhone,driverPhone,isHandle)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 删除投诉列表 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam String handleResult) { |
| | | TComplaint tComplaint = tComplaintService.selectById(id); |
| | | if(SinataUtil.isNotEmpty(tComplaint)){ |
| | | tComplaint.setHandleResult(handleResult); |
| | | tComplaint.setHandleUserId(ShiroKit.getUser().getId()); |
| | | tComplaint.setIsHandle(1); |
| | | tComplaint.setHandleTime(new Date()); |
| | | tComplaintService.updateById(tComplaint); |
| | | |
| | | //增加系统消息 |
| | | TSystemNotice notice = new TSystemNotice(); |
| | | notice.setType(2); |
| | | notice.setUserType(1); |
| | | notice.setContent("投诉处理结果:【"+handleResult+"】。"); |
| | | notice.setUserId(tComplaint.getUserId()); |
| | | notice.setInsertTime(new Date()); |
| | | notice.setRead(1); |
| | | tSystemNoticeService.insert(notice); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.ratedPassengerComplaint(tComplaint.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除投诉 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(Integer tComplaintId) { |
| | | tComplaintService.deleteById(tComplaintId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改投诉列表 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TComplaint tComplaint) { |
| | | tComplaintService.updateById(tComplaint); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 投诉列表详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tComplaintId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tComplaintId") Integer tComplaintId) { |
| | | return tComplaintService.selectById(tComplaintId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TComplaint; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.service.ITComplaintService; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 司机投诉用户列表控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 17:31:24 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tComplaintDriver") |
| | | public class TComplaintDriverController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tComplaintDriver/"; |
| | | |
| | | @Autowired |
| | | private ITComplaintService tComplaintService; |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService tSystemNoticeService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到投诉列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tComplaint.html"; |
| | | } |
| | | /** |
| | | * 跳转到黑名单列表页 |
| | | */ |
| | | @RequestMapping("/blackList1") |
| | | public String blackList() { |
| | | return PREFIX + "tComplaint_BlackList.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TComplaint tComplaint = tComplaintService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tComplaint.getReason(); |
| | | }else if (2 == type){ |
| | | str = tComplaint.getDescription(); |
| | | }else if (3 == type){ |
| | | str = tComplaint.getHandleResult(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到立即处理页面 |
| | | */ |
| | | @RequestMapping("/tComplaint_immediately/{tComplaintId}") |
| | | public String tComplaintUpdate(@PathVariable Integer tComplaintId, Model model) { |
| | | model.addAttribute("tComplaintId",tComplaintId); |
| | | return PREFIX + "tComplaint_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{str}") |
| | | public String lookDetail(@PathVariable String str, Model model) { |
| | | System.out.println(str); |
| | | model.addAttribute("str",str); |
| | | return PREFIX + "lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取投诉列表列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String userName, |
| | | String driverName, |
| | | String userPhone, |
| | | Integer isHandle) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tComplaintService.getComplaintDriverList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,userName,userPhone,driverName,isHandle)); |
| | | return super.packForBT(page); |
| | | } |
| | | /** |
| | | * 查看黑名单列表 |
| | | */ |
| | | @RequestMapping(value = "/blackList") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String phone, |
| | | String userName) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String, Object>> blackList = tComplaintService.getBlackList(page, ShiroKit.getUser().getRoleType() |
| | | , ShiroKit.getUser().getObjectId(), beginTime, endTime, userName, phone); |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | List<String> strings = new ArrayList<>(); |
| | | for (Map<String, Object> stringObjectMap : blackList) { |
| | | if (strings.isEmpty()){ |
| | | strings.add(String.valueOf(stringObjectMap.get("id"))); |
| | | maps.add(stringObjectMap); |
| | | }else if (!strings.contains(String.valueOf(stringObjectMap.get("id")))){ |
| | | strings.add(String.valueOf(stringObjectMap.get("id"))); |
| | | maps.add(stringObjectMap); |
| | | } |
| | | } |
| | | page.setRecords(maps); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 删除投诉列表 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam String handleResult,@RequestParam Integer handleType) { |
| | | TComplaint tComplaint = tComplaintService.selectById(id); |
| | | Integer userId = tComplaint.getUserId(); |
| | | TUser tUser = userService.selectById(userId); |
| | | |
| | | switch (handleType){ |
| | | case 1: |
| | | tComplaint.setIsBlack(1); |
| | | tComplaint.setIsHandle(1); |
| | | tComplaint.setBlackTime(new Date()); |
| | | if (tUser!=null){ |
| | | tUser.setIsBlack(1); |
| | | tUser.setBlackTime(new Date()); |
| | | userService.updateById(tUser); |
| | | } |
| | | break; |
| | | case 2: |
| | | tComplaint.setHandleType(2); |
| | | break; |
| | | } |
| | | if(SinataUtil.isNotEmpty(tComplaint)){ |
| | | tComplaint.setHandleResult(handleResult); |
| | | tComplaint.setHandleUserId(ShiroKit.getUser().getId()); |
| | | tComplaint.setIsHandle(1); |
| | | tComplaint.setHandleTime(new Date()); |
| | | tComplaintService.updateById(tComplaint); |
| | | |
| | | //增加系统消息 |
| | | TSystemNotice notice = new TSystemNotice(); |
| | | notice.setType(2); |
| | | notice.setUserType(1); |
| | | notice.setContent("投诉处理结果:【"+handleResult+"】。"); |
| | | notice.setUserId(tComplaint.getUserId()); |
| | | notice.setInsertTime(new Date()); |
| | | notice.setRead(1); |
| | | tSystemNoticeService.insert(notice); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.ratedPassengerComplaint(tComplaint.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除投诉 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(Integer tComplaintId) { |
| | | tComplaintService.deleteById(tComplaintId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 将用户移除黑名单 |
| | | */ |
| | | @RequestMapping(value = "/removeBlack") |
| | | @ResponseBody |
| | | public Object removeBlack(Integer id) { |
| | | TUser user = userService.selectById(id); |
| | | user.setIsBlack(0); |
| | | user.setBlackTime(null); |
| | | userService.updateById(user); |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 修改投诉列表 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TComplaint tComplaint) { |
| | | tComplaintService.updateById(tComplaint); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 投诉列表详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tComplaintId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tComplaintId") Integer tComplaintId) { |
| | | return tComplaintService.selectById(tComplaintId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.*; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.dao.DriverPunishMapper; |
| | | import com.stylefeng.guns.modular.system.dao.DriverTrainMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import net.bytebuddy.asm.Advice; |
| | | import net.sf.ehcache.management.sampled.CacheSampler; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.apache.poi.hdf.extractor.TC; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 司机审核列表控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-04 17:35:28 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tDriver") |
| | | public class TDriverController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tDriver/"; |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService tCompanyService; |
| | | |
| | | @Autowired |
| | | private ITDriverServiceService tDriverServiceService; |
| | | |
| | | @Autowired |
| | | private ITDriverLineService tDriverLineService; |
| | | |
| | | @Autowired |
| | | private ITLineService itLineService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Resource |
| | | private DriverTrainMapper driverTrainMapper; |
| | | |
| | | @Resource |
| | | private DriverPunishMapper driverPunishMapper; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到司机审核列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tDriver.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到审核通过司机首页 |
| | | */ |
| | | @RequestMapping("/yesDriver") |
| | | public String yesDriver() { |
| | | return PREFIX + "yesDriver.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加司机 |
| | | */ |
| | | @RequestMapping("/tDriver_add") |
| | | public String tDriverAdd(Model model) { |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>() |
| | | .eq("type", 3) |
| | | .eq("superiorId",ShiroKit.getUser().getObjectId()) |
| | | .notIn("state",1) |
| | | .notIn("flag",3)); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else{ |
| | | model.addAttribute("franchiseeList",null); |
| | | } |
| | | //查询当前用户所属分公司/加盟商 |
| | | model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); |
| | | |
| | | //查询线路列表 |
| | | List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().eq("state", 1)); |
| | | model.addAttribute("lineList",lineList); |
| | | return PREFIX + "tDriver_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改审核司机 |
| | | */ |
| | | @RequestMapping("/tDriver_immediately/{tDriverId}") |
| | | public String tDriver_immediately(@PathVariable Integer tDriverId, Model model) { |
| | | Map<String, Object> tDriver = tDriverService.getDriverById(tDriverId); |
| | | model.addAttribute("item",tDriver); |
| | | LogObjectHolder.me().set(tDriver); |
| | | return PREFIX + "tDriver_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到选择车辆页面 |
| | | */ |
| | | @RequestMapping("/tDriver_changeCar/{tDriverId}") |
| | | public String tDriver_changeCar(@PathVariable Integer tDriverId, Model model) { |
| | | model.addAttribute("tDriverId",tDriverId); |
| | | return PREFIX + "tDriver_changeCar.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到冻结/解冻司机页面 |
| | | */ |
| | | @RequestMapping("/tDriver_optDriver/{tDriverId}/{optType}") |
| | | public String tDriver_optDriver(@PathVariable Integer tDriverId,@PathVariable Integer optType, Model model) { |
| | | model.addAttribute("tDriverId",tDriverId); |
| | | model.addAttribute("optType",optType); |
| | | return PREFIX + "tDriver_optDriver.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看司机详情 |
| | | */ |
| | | @RequestMapping("/tDriver_look/{tDriverId}") |
| | | public String tDriver_look(@PathVariable Integer tDriverId, Model model) { |
| | | Map<String, Object> tDriver = tDriverService.getDriverById(tDriverId); |
| | | model.addAttribute("item",tDriver); |
| | | LogObjectHolder.me().set(tDriver); |
| | | return PREFIX + "tDriver_look.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改司机 |
| | | */ |
| | | @RequestMapping("/tDriver_update/{tDriverId}") |
| | | public String tDriverUpdate(@PathVariable Integer tDriverId, Model model) { |
| | | TDriver tDriver = tDriverService.selectById(tDriverId); |
| | | model.addAttribute("item",tDriver); |
| | | LogObjectHolder.me().set(tDriver); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); |
| | | |
| | | if (1 == roleType){ |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",tDriver.getCompanyId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | } |
| | | |
| | | //查询平台ID |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); |
| | | //判断是平台司机还是加盟司机 |
| | | if ((SinataUtil.isEmpty(tDriver.getCompanyId()) || tDriver.getCompanyId() == 0 || tDriver.getCompanyId() == company.getId()) && (SinataUtil.isEmpty(tDriver.getFranchiseeId()) || tDriver.getFranchiseeId() == 0)){ |
| | | model.addAttribute("companyType",1); |
| | | }else{ |
| | | model.addAttribute("companyType",2); |
| | | } |
| | | |
| | | //获取经营业务 |
| | | List<TDriverService> serviceList = tDriverServiceService.selectList(new EntityWrapper<TDriverService>().eq("driverId", tDriverId)); |
| | | Integer one = 1; |
| | | Integer two = 1; |
| | | Integer three = 1; |
| | | Integer four = 1; |
| | | Integer five = 1; |
| | | Integer six = 1; |
| | | for (TDriverService obj : serviceList){ |
| | | if (obj.getType() == 1){ |
| | | one = 2; |
| | | } |
| | | if (obj.getType() == 2){ |
| | | two = 2; |
| | | } |
| | | if (obj.getType() == 3){ |
| | | three = 2; |
| | | } |
| | | if (obj.getType() == 4){ |
| | | four = 2; |
| | | } |
| | | if (obj.getType() == 5){ |
| | | five = 2; |
| | | } |
| | | if (obj.getType() == 6){ |
| | | six = 2; |
| | | } |
| | | } |
| | | model.addAttribute("one",one); |
| | | model.addAttribute("two",two); |
| | | model.addAttribute("three",three); |
| | | model.addAttribute("four",four); |
| | | model.addAttribute("five",five); |
| | | model.addAttribute("six",six); |
| | | |
| | | //查询线路列表 |
| | | List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().eq("state", 1)); |
| | | model.addAttribute("lineList",lineList); |
| | | //查询驾驶员已添加的线路列表 |
| | | List<Map<String, Object>> driverLineList = tDriverLineService.getDriverLineListByDriverId(tDriverId); |
| | | model.addAttribute("driverLineList",driverLineList); |
| | | return PREFIX + "tDriver_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加培训页 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showTraining") |
| | | public String showTraining(Integer id, Model model){ |
| | | model.addAttribute("id", id); |
| | | return PREFIX + "training.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存培训数据 |
| | | * @param train |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/saveTrain", method = RequestMethod.POST) |
| | | public ResultUtil saveTrain(String train, Integer driverId){ |
| | | if(ToolUtil.isEmpty(train)){ |
| | | return ResultUtil.error("请添加有效的培训记录"); |
| | | } |
| | | String[] split = train.split(","); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | List<DriverTrain> update = new ArrayList<>(); |
| | | List<DriverTrain> add = new ArrayList<>(); |
| | | for(String s : split){ |
| | | String[] s1 = s.split("_"); |
| | | if(ToolUtil.isNotEmpty(s1[0])){//修改 |
| | | DriverTrain driverTrain = driverTrainMapper.selectById(s1[0]); |
| | | driverTrain.setDriverId(driverId); |
| | | driverTrain.setCourseName(s1[1]); |
| | | driverTrain.setCourseDate(sdf.parse(s1[2])); |
| | | driverTrain.setStartTime(s1[3]); |
| | | driverTrain.setStopTime(s1[4]); |
| | | driverTrain.setDuration(Integer.valueOf(s1[5])); |
| | | update.add(driverTrain); |
| | | }else{//添加 |
| | | DriverTrain driverTrain = new DriverTrain(); |
| | | driverTrain.setDriverId(driverId); |
| | | driverTrain.setCourseName(s1[1]); |
| | | driverTrain.setCourseDate(sdf.parse(s1[2])); |
| | | driverTrain.setStartTime(s1[3]); |
| | | driverTrain.setStopTime(s1[4]); |
| | | driverTrain.setDuration(Integer.valueOf(s1[5])); |
| | | add.add(driverTrain); |
| | | } |
| | | } |
| | | List<DriverTrain> driverTrains = driverTrainMapper.queryAllTrain(driverId); |
| | | for(DriverTrain driverTrain : driverTrains){ |
| | | boolean b = true; |
| | | for(String s : split){ |
| | | String[] s1 = s.split("_"); |
| | | if(ToolUtil.isNotEmpty(s1[0]) && driverTrain.getId() == Integer.valueOf(s1[0])){ |
| | | b = false; |
| | | break; |
| | | } |
| | | } |
| | | if(b){ |
| | | driverTrainMapper.deleteById(driverTrain.getId()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 3); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | if(update.size() > 0){ |
| | | for(DriverTrain driverTrain : update){ |
| | | driverTrainMapper.updateById(driverTrain); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 2); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | if(add.size() > 0){ |
| | | for(DriverTrain driverTrain : add){ |
| | | driverTrainMapper.insert(driverTrain); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 1); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取司机的所有培训数据 |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryAllTrain", method = RequestMethod.POST) |
| | | public ResultUtil queryAllTrain(Integer driverId){ |
| | | List<DriverTrain> driverTrains = driverTrainMapper.queryAllTrain(driverId); |
| | | return ResultUtil.success(driverTrains); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到处罚页 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @RequestMapping("/showPunish") |
| | | public String showPunish(Integer id, Model model){ |
| | | model.addAttribute("id", id); |
| | | return PREFIX + "punish.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存处罚数据 |
| | | * @param punish |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/savePunish", method = RequestMethod.POST) |
| | | public ResultUtil savePunish(String punish, Integer driverId){ |
| | | if(ToolUtil.isEmpty(punish)){ |
| | | return ResultUtil.error("请添加有效的培训记录"); |
| | | } |
| | | String[] split = punish.split(","); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | List<DriverPunish> update = new ArrayList<>(); |
| | | List<DriverPunish> add = new ArrayList<>(); |
| | | for(String s : split){ |
| | | String[] s1 = s.split("_"); |
| | | if(ToolUtil.isNotEmpty(s1[0])){//修改 |
| | | DriverPunish driverPunish = driverPunishMapper.selectById(s1[0]); |
| | | driverPunish.setDriverId(driverId); |
| | | driverPunish.setPunishTime(sdf.parse(s1[1])); |
| | | driverPunish.setPunishReason(s1[2]); |
| | | driverPunish.setPunishReault(s1[3]); |
| | | update.add(driverPunish); |
| | | }else{//添加 |
| | | DriverPunish driverPunish = new DriverPunish(); |
| | | driverPunish.setDriverId(driverId); |
| | | driverPunish.setPunishTime(sdf.parse(s1[1])); |
| | | driverPunish.setPunishReason(s1[2]); |
| | | driverPunish.setPunishReault(s1[3]); |
| | | add.add(driverPunish); |
| | | } |
| | | } |
| | | List<DriverPunish> driverPunishes = driverPunishMapper.queryAllPunish(driverId); |
| | | for(DriverPunish driverTrain : driverPunishes){ |
| | | boolean b = true; |
| | | for(String s : split){ |
| | | String[] s1 = s.split("_"); |
| | | if(ToolUtil.isNotEmpty(s1[0]) && driverTrain.getId() == Integer.valueOf(s1[0])){ |
| | | b = false; |
| | | break; |
| | | } |
| | | } |
| | | if(b){ |
| | | driverTrainMapper.deleteById(driverTrain.getId()); |
| | | } |
| | | } |
| | | if(update.size() > 0){ |
| | | for(DriverPunish driverTrain : update){ |
| | | driverPunishMapper.updateById(driverTrain); |
| | | } |
| | | } |
| | | if(add.size() > 0){ |
| | | for(DriverPunish driverTrain : add){ |
| | | driverPunishMapper.insert(driverTrain); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.ratedDriverPunish(driverTrain.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取所有处罚数据 |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryAllPunish", method = RequestMethod.POST) |
| | | public ResultUtil queryAllPunish(Integer driverId){ |
| | | List<DriverPunish> driverPunishes = driverPunishMapper.queryAllPunish(driverId); |
| | | return ResultUtil.success(driverPunishes); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据分公司ID获取加盟商 |
| | | * @param oneId |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/oneChange") |
| | | @ResponseBody |
| | | public Object oneChange(@RequestParam Integer oneId) { |
| | | List<TCompany> list = new ArrayList<>(); |
| | | if (SinataUtil.isNotEmpty(oneId)){ |
| | | list = tCompanyService.selectList(new EntityWrapper<TCompany>() |
| | | .eq("type", 3) |
| | | .eq("superiorId", oneId) |
| | | .notIn("flag",3) |
| | | .notIn("state",1)); |
| | | } |
| | | return list; |
| | | } |
| | | @Autowired |
| | | private ITPubTransactionDetailsService pubTransactionDetailsService; |
| | | /** |
| | | * 司机余额修改 |
| | | */ |
| | | @RequestMapping(value = "/changeMoney") |
| | | @ResponseBody |
| | | public Object oneChange(Integer id ,Integer type,String mount) { |
| | | TDriver tDriver = tDriverService.selectById(id); |
| | | TPubTransactionDetails tPubTransactionDetails = new TPubTransactionDetails(); |
| | | tPubTransactionDetails.setUserId(tDriver.getId()); |
| | | tPubTransactionDetails.setInsertTime(new Date()); |
| | | tPubTransactionDetails.setRemark("平台修改余额"); |
| | | tPubTransactionDetails.setMoney(new BigDecimal(mount)); |
| | | tPubTransactionDetails.setState(type); |
| | | tPubTransactionDetails.setType(1); |
| | | tPubTransactionDetails.setUserType(2); |
| | | tPubTransactionDetails.setOrderType(7); |
| | | pubTransactionDetailsService.insert(tPubTransactionDetails); |
| | | // type=1增加 type=2减少 |
| | | switch (type){ |
| | | case 1: |
| | | BigDecimal bigDecimal = new BigDecimal(mount); |
| | | |
| | | BigDecimal add = tDriver.getBalance().add(bigDecimal); |
| | | tDriver.setBalance(add); |
| | | break; |
| | | case 2: |
| | | BigDecimal bigDecimal1 = new BigDecimal(mount); |
| | | BigDecimal subtract = tDriver.getBalance().subtract(bigDecimal1); |
| | | int comparisonResult = subtract.compareTo(BigDecimal.ZERO); |
| | | // 小于0 设置为0 不要为负数 |
| | | if (comparisonResult<0){ |
| | | // tDriver.setBalance(BigDecimal.ZERO); |
| | | |
| | | return 502; |
| | | }else{ |
| | | tDriver.setBalance(subtract); |
| | | } |
| | | break; |
| | | } |
| | | tDriverService.updateById(tDriver); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 获取司机审核列表列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String companyName, |
| | | String phone, |
| | | String account, |
| | | Integer addType, |
| | | Integer authState) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tDriverService.getAuthDriverList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,companyName,phone,account,addType,authState)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @Autowired |
| | | private ITOrderEvaluateService itOrderEvaluateService; |
| | | /** |
| | | * 获取审核通过的司机列表 |
| | | */ |
| | | @RequestMapping(value = "/listYesDriver") |
| | | @ResponseBody |
| | | public Object listYesDriver(String insertTime, |
| | | String companyName, |
| | | String phone, |
| | | String name, |
| | | Integer addType, |
| | | Integer authState) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String, Object>> driverList = tDriverService.getDriverList(page, ShiroKit.getUser().getRoleType(), ShiroKit.getUser().getObjectId(), |
| | | beginTime, endTime, companyName, phone, name, addType, authState); |
| | | for (Map<String, Object> stringObjectMap : driverList) { |
| | | // 司机id |
| | | Integer id = Integer.valueOf(stringObjectMap.get("id").toString()); |
| | | List<TOrderEvaluate> driverId = itOrderEvaluateService.selectList(new EntityWrapper<TOrderEvaluate>() |
| | | .eq("driverId", id)); |
| | | Double temp =0.00; |
| | | for (TOrderEvaluate tOrderEvaluate : driverId) { |
| | | temp +=tOrderEvaluate.getFraction(); |
| | | } |
| | | double v = temp / driverId.size(); |
| | | if (temp==0.00 || driverId.size()==0){ |
| | | stringObjectMap.put("fraction","暂无评分"); |
| | | }else{ |
| | | // 使用 DecimalFormat 格式化为两位小数 |
| | | DecimalFormat df = new DecimalFormat("#.##"); |
| | | String formattedV = df.format(v); |
| | | stringObjectMap.put("fraction",formattedV); |
| | | } |
| | | } |
| | | page.setRecords(driverList); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取可被选择的车辆列表 |
| | | */ |
| | | @RequestMapping(value = "/selectCarList/{tDriverId}") |
| | | @ResponseBody |
| | | public Object selectCarList(@PathVariable Integer tDriverId, |
| | | String carLicensePlate, |
| | | String brandName, |
| | | String modelName, |
| | | String color, |
| | | String serverStr) { |
| | | TDriver driver = tDriverService.selectById(tDriverId); |
| | | /*String useCarIdStr = null; |
| | | //查询已被使用的车辆ID |
| | | if (SinataUtil.isNotEmpty(driver.getCarId())){ |
| | | useCarIdStr = tDriverService.getUseCarIdStr(driver.getCarId()); |
| | | }else{ |
| | | useCarIdStr = tDriverService.getUseCarIdStr(null); |
| | | }*/ |
| | | //2020-08-21:新需求,已被绑定的车辆可以被继续绑定 |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tDriverService.getCanSelectCarList(page, |
| | | ShiroKit.getUser().getRoleType(), |
| | | ShiroKit.getUser().getObjectId(), |
| | | null, |
| | | carLicensePlate, |
| | | brandName, |
| | | modelName, |
| | | color, |
| | | serverStr)); |
| | | return super.packForBT(page); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 审核操作 1=通过 2=不通过 |
| | | */ |
| | | @RequestMapping(value = "/authOpt") |
| | | @ResponseBody |
| | | public Object authOpt(Integer id,Integer authState) { |
| | | if (SinataUtil.isNotEmpty(id) && SinataUtil.isNotEmpty(authState)){ |
| | | TDriver tDriver = tDriverService.selectById(id); |
| | | Integer type = 0; |
| | | if (1 == authState){ |
| | | type = 5; |
| | | tDriver.setAuthState(2); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoDriver(id); |
| | | pushMinistryOfTransportUtil.baseInfoDriverApp(id); |
| | | } |
| | | } |
| | | }).start(); |
| | | }else{ |
| | | type = 6; |
| | | tDriver.setAuthState(4); |
| | | } |
| | | |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("uid", String.valueOf(tDriver.getId())); |
| | | map.put("type", String.valueOf(type)); |
| | | String result = HttpRequestUtil.postRequest(PushURL.driver_auth_url, map); |
| | | System.out.println("司机注册审核发送短信 :【driverId="+tDriver.getId().toString()+"】,调用接口:"+result); |
| | | |
| | | tDriverService.updateById(tDriver); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 更换车辆操作 |
| | | */ |
| | | @RequestMapping(value = "/selectCarOpt") |
| | | @ResponseBody |
| | | public Object selectCarOpt(Integer tDriverId,Integer carId) { |
| | | if (SinataUtil.isNotEmpty(tDriverId) && SinataUtil.isNotEmpty(carId)){ |
| | | TDriver tDriver = tDriverService.selectById(tDriverId); |
| | | tDriver.setCarId(carId); |
| | | tDriverService.updateById(tDriver); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 新增司机审核列表 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TDriver tDriver,@RequestParam String serverBox,@RequestParam String lineStr,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId) { |
| | | //判断登录账户是否重复 |
| | | int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", tDriver.getPhone()).in("authState", "1,2,3").ne("flag", 3)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | if (1 == roleType){ //平台 |
| | | if (2 == companyType.intValue()){ |
| | | if (SinataUtil.isNotEmpty(oneId)){ |
| | | tDriver.setCompanyId(oneId); |
| | | } |
| | | if (SinataUtil.isNotEmpty(twoId)){ |
| | | tDriver.setFranchiseeId(twoId); |
| | | } |
| | | }else if (1 == companyType.intValue()){ |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); |
| | | tDriver.setCompanyId(company.getId()); |
| | | tDriver.setFranchiseeId(franchiseeId); |
| | | } |
| | | tDriver.setAddType(2); |
| | | tDriver.setIsPlatCar(1); |
| | | tDriver.setAuthState(2); |
| | | }else if (2 == roleType){ //分公司 |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tDriver.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(franchiseeId)){ |
| | | tDriver.setFranchiseeId(franchiseeId); |
| | | } |
| | | tDriver.setAddType(3); |
| | | tDriver.setIsPlatCar(2); |
| | | tDriver.setAuthState(1); |
| | | tDriver.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | }else if (3 == roleType){ //加盟商 |
| | | TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | if (SinataUtil.isNotEmpty(tCompany)){ |
| | | tDriver.setCompanyId(tCompany.getSuperiorId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tDriver.setFranchiseeId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tDriver.setAddType(4); |
| | | tDriver.setIsPlatCar(2); |
| | | tDriver.setAuthState(1); |
| | | tDriver.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tDriver.setInsertTime(new Date()); |
| | | tDriver.setInsertUser(ShiroKit.getUser().getId()); |
| | | // tDriver.setPassword(MD5Util.encrypt(tDriver.getPassword())); |
| | | |
| | | tDriver.setPassword(ShiroKit.md5(tDriver.getPassword(), "SA;d5#")); |
| | | |
| | | tDriverService.insert(tDriver); |
| | | |
| | | //添加经营业务 |
| | | String[] serverArray = serverBox.split(","); |
| | | for (int i=0;i<serverArray.length;i++){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(tDriver.getId()); |
| | | service.setType(Integer.valueOf(serverArray[i])); |
| | | tDriverServiceService.insert(service); |
| | | |
| | | if (3 == Integer.valueOf(serverArray[i])){ |
| | | //添加线路 |
| | | if (SinataUtil.isNotEmpty(lineStr)){ |
| | | addLine(lineStr,tDriver.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 添加线路 |
| | | * @param subArr |
| | | * @param id |
| | | */ |
| | | public void addLine(String subArr,Integer id){ |
| | | JSONArray jsonArray = JSON.parseArray(subArr); |
| | | int size = jsonArray.size(); |
| | | for (int i = 0; i < size; i++){ |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TDriverLine line = new TDriverLine(); |
| | | line.setCreateTime(new Date()); |
| | | line.setAddTime(jsonObject.getString("time")); |
| | | line.setLineId(jsonObject.getInteger("lineId")); |
| | | line.setDriverId(id); |
| | | tDriverLineService.insert(line); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除司机审核列表 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tDriverId) { |
| | | TDriver driver = tDriverService.selectById(tDriverId); |
| | | driver.setFlag("3"); |
| | | tDriverService.updateById(driver); |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 操作司机状态 |
| | | */ |
| | | @RequestMapping(value = "/optDriver") |
| | | @ResponseBody |
| | | public Object optDriver(@RequestParam Integer driverId,@RequestParam String remark,@RequestParam Integer optType) { |
| | | if (SinataUtil.isNotEmpty(driverId) && SinataUtil.isNotEmpty(optType)){ |
| | | TDriver tDriver = tDriverService.selectById(driverId); |
| | | if (1 == optType){ //解冻 |
| | | tDriver.setAuthState(2); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoDriver(driverId); |
| | | } |
| | | } |
| | | }).start(); |
| | | }else if (2 == optType){ //冻结 |
| | | tDriver.setAuthState(3); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoDriver(driverId); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | tDriver.setRemark(remark); |
| | | tDriverService.updateById(tDriver); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改司机审核列表 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TDriver tDriver,@RequestParam String serverBox,@RequestParam String lineStr,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId) { |
| | | TDriver obj = tDriverService.selectById(tDriver.getId()); |
| | | if (!obj.getPhone().equals(tDriver.getPhone())){ |
| | | //判断登录账户是否重复 |
| | | int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", tDriver.getPhone()).in("authState", "1,2,3")); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | } |
| | | if (1 == roleType){ //平台 |
| | | if (2 == companyType.intValue()){ |
| | | if (SinataUtil.isNotEmpty(oneId)){ |
| | | tDriver.setCompanyId(oneId); |
| | | } |
| | | if (SinataUtil.isNotEmpty(twoId)){ |
| | | tDriver.setFranchiseeId(twoId); |
| | | } |
| | | }else if (1 == companyType.intValue()){ |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1)); |
| | | tDriver.setCompanyId(company.getId()); |
| | | tDriver.setFranchiseeId(franchiseeId); |
| | | } |
| | | }else if (2 == roleType){ //分公司 |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tDriver.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(franchiseeId)){ |
| | | tDriver.setFranchiseeId(franchiseeId); |
| | | } |
| | | }else if (3 == roleType){ //加盟商 |
| | | TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | if (SinataUtil.isNotEmpty(tCompany)){ |
| | | tDriver.setCompanyId(tCompany.getSuperiorId()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){ |
| | | tDriver.setFranchiseeId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | } |
| | | tDriver.setUpdateTime(new Date()); |
| | | tDriver.setUpdateUser(ShiroKit.getUser().getId()); |
| | | // tDriver.setPassword(MD5Util.encrypt(tDriver.getPassword())); |
| | | tDriver.setPassword(ShiroKit.md5(tDriver.getPassword(), "SA;d5#")); |
| | | tDriverService.updateById(tDriver); |
| | | |
| | | //删除业务 |
| | | tDriverServiceService.delete(new EntityWrapper<TDriverService>().eq("driverId",tDriver.getId())); |
| | | |
| | | //删除线路 |
| | | tDriverLineService.delete(new EntityWrapper<TDriverLine>().eq("driverId",tDriver.getId())); |
| | | |
| | | //添加经营业务 |
| | | String[] serverArray = serverBox.split(","); |
| | | for (int i=0;i<serverArray.length;i++){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(tDriver.getId()); |
| | | service.setType(Integer.valueOf(serverArray[i])); |
| | | tDriverServiceService.insert(service); |
| | | |
| | | if (3 == Integer.valueOf(serverArray[i])){ |
| | | //添加线路 |
| | | if (SinataUtil.isNotEmpty(lineStr)){ |
| | | addLine(lineStr,tDriver.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriver(tDriver.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 下载模板 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @RequestMapping(value = "/uploadDriverModel") |
| | | public void uploadDriverModel(HttpServletRequest request, HttpServletResponse response) { |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<List<String>>(); |
| | | |
| | | String title = ""; |
| | | |
| | | // 首行【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | if (ShiroKit.getUser().getRoleType() == 1){ |
| | | title = "平台导入司机模板"; |
| | | |
| | | shellList.add("司机名称"); |
| | | shellList.add("所属机构[平台司机/加盟司机]"); |
| | | shellList.add("所属分公司[提示:加盟司机选填]"); |
| | | shellList.add("所属加盟商[提示:加盟司机选填]"); |
| | | shellList.add("性别[男/女]"); |
| | | shellList.add("身份证号"); |
| | | shellList.add("出租车资格证号"); |
| | | shellList.add("工号[选填]"); |
| | | shellList.add("经营业务:专车[是/否]"); |
| | | shellList.add("经营业务:出租车[是/否]"); |
| | | shellList.add("经营业务:跨城出行[是/否]"); |
| | | shellList.add("经营业务:小件同城物流[是/否]"); |
| | | shellList.add("经营业务:小件跨城物流[是/否]"); |
| | | shellList.add("经营业务:包车[是/否]"); |
| | | shellList.add("登录账号[手机号]"); |
| | | shellList.add("登录密码[密码长度为6-18]"); |
| | | }else if (ShiroKit.getUser().getRoleType() == 2){ |
| | | title = "分公司导入司机模板"; |
| | | |
| | | shellList.add("司机名称"); |
| | | shellList.add("所属加盟商[选填]"); |
| | | shellList.add("性别[男/女]"); |
| | | shellList.add("身份证号"); |
| | | shellList.add("出租车资格证号"); |
| | | shellList.add("工号[选填]"); |
| | | shellList.add("经营业务:专车[是/否]"); |
| | | shellList.add("经营业务:出租车[是/否]"); |
| | | shellList.add("经营业务:跨城出行[是/否]"); |
| | | shellList.add("经营业务:小件同城物流[是/否]"); |
| | | shellList.add("经营业务:小件跨城物流[是/否]"); |
| | | shellList.add("经营业务:包车[是/否]"); |
| | | shellList.add("登录账号[手机号]"); |
| | | shellList.add("登录密码[密码长度为6-18]"); |
| | | }else if (ShiroKit.getUser().getRoleType() == 3){ |
| | | title = "加盟商导入司机模板"; |
| | | |
| | | shellList.add("司机名称"); |
| | | shellList.add("性别[男/女]"); |
| | | shellList.add("身份证号"); |
| | | shellList.add("出租车资格证号"); |
| | | shellList.add("工号[选填]"); |
| | | shellList.add("经营业务:专车[是/否]"); |
| | | shellList.add("经营业务:出租车[是/否]"); |
| | | shellList.add("经营业务:跨城出行[是/否]"); |
| | | shellList.add("经营业务:小件同城物流[是/否]"); |
| | | shellList.add("经营业务:小件跨城物流[是/否]"); |
| | | shellList.add("经营业务:包车[是/否]"); |
| | | shellList.add("登录账号[手机号]"); |
| | | shellList.add("登录密码[密码长度为6-18]"); |
| | | } |
| | | dataList.add(shellList); |
| | | |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet(title+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), title, dataList, request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导入操作 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value="/exportDriver",method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public Object exportDriver(HttpServletRequest request){ |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | MultipartFile file = (MultipartFile) multipartRequest.getFile("myfile"); |
| | | try { |
| | | if (ShiroKit.getUser().getRoleType() == 1){ |
| | | Workbook book = WoUtil.ImportFile(file); |
| | | Sheet sh = book.getSheetAt(0); //获取到第一个表 |
| | | for (int i = 1; i <= sh.getLastRowNum(); i++) { |
| | | Row row = sh.getRow(i); |
| | | |
| | | Cell cell0 = row.getCell(0); //司机名称 |
| | | String zero = null; |
| | | if (SinataUtil.isNotEmpty(cell0)){ |
| | | zero = String.valueOf(cell0.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell1 = row.getCell(1); //所属机构[平台司机/加盟司机] |
| | | String one = null; |
| | | if (SinataUtil.isNotEmpty(cell1)){ |
| | | one = String.valueOf(cell1.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell2 = row.getCell(2); //所属分公司[提示:加盟司机选填] |
| | | String two = null; |
| | | if (SinataUtil.isNotEmpty(cell2)){ |
| | | two = String.valueOf(cell2.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell3 = row.getCell(3); //所属加盟商[提示:加盟司机选填] |
| | | String three = null; |
| | | if (SinataUtil.isNotEmpty(cell3)){ |
| | | three = String.valueOf(cell3.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell4 = row.getCell(4); //性别[男/女] |
| | | String four = null; |
| | | if (SinataUtil.isNotEmpty(cell4)){ |
| | | four = String.valueOf(cell4.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | // Cell cell5 = row.getCell(5); //驾驶证号码 |
| | | // String five = null; |
| | | // if (SinataUtil.isNotEmpty(cell5)){ |
| | | // five = String.valueOf(cell5.getStringCellValue()).trim(); |
| | | // } |
| | | // |
| | | // Cell cell6 = row.getCell(6); //驾龄 |
| | | // String six = null; |
| | | // if (SinataUtil.isNotEmpty(cell6)){ |
| | | // six = String.valueOf(cell6.getStringCellValue()).trim(); |
| | | // } |
| | | |
| | | Cell cell7 = row.getCell(5); //身份证号 |
| | | String seven = null; |
| | | if (SinataUtil.isNotEmpty(cell7)){ |
| | | seven = String.valueOf(cell7.getStringCellValue()).trim(); |
| | | } |
| | | // |
| | | // Cell cell8 = row.getCell(8); //居住地址 |
| | | // String eight = null; |
| | | // if (SinataUtil.isNotEmpty(cell8)){ |
| | | // eight = String.valueOf(cell8.getStringCellValue()).trim(); |
| | | // } |
| | | |
| | | Cell cell9 = row.getCell(6); //出租车资格证号 |
| | | String nine = null; |
| | | if (SinataUtil.isNotEmpty(cell9)){ |
| | | cell9.setCellType(Cell.CELL_TYPE_STRING); |
| | | nine = String.valueOf(cell9.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell10 = row.getCell(7); //工号[选填] |
| | | String ten = null; |
| | | if (SinataUtil.isNotEmpty(cell10)){ |
| | | DataFormatter formatter = new DataFormatter(); |
| | | ten = formatter.formatCellValue(cell10); |
| | | } |
| | | |
| | | Cell cell11 = row.getCell(8); //经营业务:专车[是/否] |
| | | String eleven = null; |
| | | if (SinataUtil.isNotEmpty(cell11)){ |
| | | eleven = String.valueOf(cell11.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell12 = row.getCell(9); //经营业务:专车[是/否] |
| | | String twelve = null; |
| | | if (SinataUtil.isNotEmpty(cell12)){ |
| | | twelve = String.valueOf(cell12.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell13 = row.getCell(10); //经营业务:跨城出行[是/否] |
| | | String thirteen = null; |
| | | if (SinataUtil.isNotEmpty(cell13)){ |
| | | thirteen = String.valueOf(cell13.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell14 = row.getCell(11); //经营业务:小件同城物流[是/否] |
| | | String fourteen = null; |
| | | if (SinataUtil.isNotEmpty(cell14)){ |
| | | fourteen = String.valueOf(cell14.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell15 = row.getCell(12); //经营业务:小件跨城物流[是/否] |
| | | String fifteen = null; |
| | | if (SinataUtil.isNotEmpty(cell15)){ |
| | | fifteen = String.valueOf(cell15.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell16 = row.getCell(13); //经营业务:包车[是/否] |
| | | String sixteen = null; |
| | | if (SinataUtil.isNotEmpty(cell16)){ |
| | | sixteen = String.valueOf(cell16.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell17 = row.getCell(14); //登录账号[手机号] |
| | | String seventeen = null; |
| | | if (SinataUtil.isNotEmpty(cell17)){ |
| | | cell17.setCellType(Cell.CELL_TYPE_STRING); |
| | | seventeen = String.valueOf(cell17.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell18 = row.getCell(15); //登录密码[密码长度为6-18] |
| | | String eighteen = null; |
| | | if (SinataUtil.isNotEmpty(cell18)){ |
| | | cell18.setCellType(Cell.CELL_TYPE_STRING); |
| | | eighteen = String.valueOf(cell18.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(one) || SinataUtil.isEmpty(four) |
| | | || SinataUtil.isEmpty(nine) |
| | | || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(twelve) || SinataUtil.isEmpty(thirteen) |
| | | || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen) || SinataUtil.isEmpty(sixteen) |
| | | || SinataUtil.isEmpty(seventeen)|| SinataUtil.isEmpty(eighteen)){ |
| | | return new ErrorTip(500, "单元格不能为空"); |
| | | }else{ |
| | | //判断账号是否存在 |
| | | int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", seventeen).in("authState", "1,2,3").ne("flag", 3)); |
| | | if (count > 0){ |
| | | continue; |
| | | } |
| | | |
| | | //判断所属机构 |
| | | if (!one.equals("平台司机") && !one.equals("加盟司机")){ |
| | | return new ErrorTip(500, "所属机构内容不正确"); |
| | | } |
| | | //判断性别 |
| | | if (!four.equals("男") && !four.equals("女")){ |
| | | return new ErrorTip(500, "性别内容不正确"); |
| | | } |
| | | //判断经营业务【专车】 |
| | | if (!eleven.equals("是") && !eleven.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【专车】内容不正确"); |
| | | } |
| | | //判断经营业务【出租车】 |
| | | if (!twelve.equals("是") && !twelve.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【出租车】内容不正确"); |
| | | } |
| | | //判断经营业务【跨城出行】 |
| | | if (!thirteen.equals("是") && !thirteen.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【跨城出行】内容不正确"); |
| | | } |
| | | //判断经营业务【小件同城物流】 |
| | | if (!fourteen.equals("是") && !fourteen.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【小件同城物流】内容不正确"); |
| | | } |
| | | //判断经营业务【小件跨城物流】 |
| | | if (!fifteen.equals("是") && !fifteen.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【小件跨城物流】内容不正确"); |
| | | } |
| | | //判断经营业务【包车】 |
| | | if (!sixteen.equals("是") && !sixteen.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【包车】内容不正确"); |
| | | } |
| | | //判断驾龄 |
| | | // if (!isInteger(six)){ |
| | | // return new ErrorTip(500, "驾龄格式不正确"); |
| | | // } |
| | | //判断手机号 |
| | | if (!isPhone(seventeen)){ |
| | | return new ErrorTip(500, "登录账号[手机号]格式不正确"); |
| | | } |
| | | //判断登录密码 |
| | | if (!isPassword(eighteen)){ |
| | | return new ErrorTip(500, "登录密码格式不正确"); |
| | | } |
| | | |
| | | //查找平台公司 |
| | | TCompany platCompany = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).notIn("flag", "3").last(" limit 1")); |
| | | Integer companyId = platCompany.getId(); |
| | | Integer franchiseeId = 0; |
| | | if ("加盟司机".equals(one)){ |
| | | //判断所属分公司是否存在 |
| | | if (SinataUtil.isNotEmpty(two)){ |
| | | TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("name", two).eq("type", 2).notIn("flag", "3").last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(company)){ |
| | | companyId = company.getId(); |
| | | //判断加盟商是否存在 |
| | | if (SinataUtil.isNotEmpty(three)){ |
| | | TCompany franchisee = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("superiorId",company.getId()).eq("name", three).eq("type", 3).notIn("flag", "3").last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(franchisee)){ |
| | | franchiseeId = franchisee.getId(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | TDriver driver = new TDriver(); |
| | | driver.setAccount(seventeen); |
| | | driver.setJobNumber(ten); |
| | | driver.setPhone(seventeen); |
| | | driver.setPassword(ShiroKit.md5(eighteen, "SA;d5#")); |
| | | driver.setName(zero); |
| | | if ("男".equals(four)){ |
| | | driver.setSex(1); |
| | | }else if ("女".equals(four)){ |
| | | driver.setSex(2); |
| | | } |
| | | driver.setIdCard(seven); |
| | | // driver.setDriverAge(Integer.valueOf(six)); |
| | | // driver.setDriveCard(five); |
| | | driver.setTaxiAptitudeCard(nine); |
| | | if ("平台司机".equals(one)){ |
| | | driver.setIsPlatCar(1); |
| | | }else if ("加盟司机".equals(one)){ |
| | | driver.setIsPlatCar(2); |
| | | } |
| | | driver.setCompanyId(companyId); |
| | | driver.setFranchiseeId(franchiseeId); |
| | | driver.setState(2); |
| | | driver.setAuthState(2); |
| | | driver.setFlag("1"); |
| | | driver.setInsertUser(ShiroKit.getUser().getId()); |
| | | driver.setInsertTime(new Date()); |
| | | driver.setAddType(2); |
| | | driver.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | // if(SinataUtil.isNotEmpty(eight)){ |
| | | // driver.setDriverAddress(eight); |
| | | // } |
| | | tDriverService.insert(driver); |
| | | |
| | | |
| | | //添加专车服务模式 |
| | | if ("是".equals(eleven)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(1); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加出租车服务模式 |
| | | if ("是".equals(twelve)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(2); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加跨城出行服务模式 |
| | | if ("是".equals(thirteen)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(3); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加小件同城物流服务模式 |
| | | if ("是".equals(fourteen)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(4); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加小件跨城物流服务模式 |
| | | if ("是".equals(fifteen)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(5); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加包车服务模式 |
| | | if ("是".equals(sixteen)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(6); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | } |
| | | } |
| | | }else if (ShiroKit.getUser().getRoleType() == 2){ |
| | | Workbook book = WoUtil.ImportFile(file); |
| | | Sheet sh = book.getSheetAt(0); //获取到第一个表 |
| | | for (int i = 1; i <= sh.getLastRowNum(); i++) { |
| | | Row row = sh.getRow(i); |
| | | |
| | | Cell cell0 = row.getCell(0); //司机名称 |
| | | String zero = null; |
| | | if (SinataUtil.isNotEmpty(cell0)){ |
| | | zero = String.valueOf(cell0.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell1 = row.getCell(3); //所属加盟商[选填] |
| | | String one = null; |
| | | if (SinataUtil.isNotEmpty(cell1)){ |
| | | one = String.valueOf(cell1.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell2 = row.getCell(4); //性别[男/女] |
| | | String two = null; |
| | | if (SinataUtil.isNotEmpty(cell2)){ |
| | | two = String.valueOf(cell2.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell5 = row.getCell(5); //身份证号 |
| | | String five = null; |
| | | if (SinataUtil.isNotEmpty(cell5)){ |
| | | five = String.valueOf(cell5.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell7 = row.getCell(6); //出租车资格证号 |
| | | String seven = null; |
| | | if (SinataUtil.isNotEmpty(cell7)){ |
| | | cell7.setCellType(Cell.CELL_TYPE_STRING); |
| | | seven = String.valueOf(cell7.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell8 = row.getCell(7); //工号[选填] |
| | | String eight = null; |
| | | if (SinataUtil.isNotEmpty(cell8)){ |
| | | cell8.setCellType(Cell.CELL_TYPE_STRING); |
| | | eight = String.valueOf(cell8.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell9 = row.getCell(8); //经营业务:专车[是/否] |
| | | String nine = null; |
| | | if (SinataUtil.isNotEmpty(cell9)){ |
| | | nine = String.valueOf(cell9.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell10 = row.getCell(9); //经营业务:出租车[是/否] |
| | | String ten = null; |
| | | if (SinataUtil.isNotEmpty(cell10)){ |
| | | ten = String.valueOf(cell10.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell11 = row.getCell(10); //经营业务:跨城出行[是/否] |
| | | String eleven = null; |
| | | if (SinataUtil.isNotEmpty(cell11)){ |
| | | eleven = String.valueOf(cell11.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell12 = row.getCell(11); //经营业务:小件同城物流[是/否] |
| | | String twelve = null; |
| | | if (SinataUtil.isNotEmpty(cell12)){ |
| | | twelve = String.valueOf(cell12.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell13 = row.getCell(12); //经营业务:小件跨城物流[是/否] |
| | | String thirteen = null; |
| | | if (SinataUtil.isNotEmpty(cell13)){ |
| | | thirteen = String.valueOf(cell13.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell14 = row.getCell(13); //经营业务:包车[是/否] |
| | | String fourteen = null; |
| | | if (SinataUtil.isNotEmpty(cell14)){ |
| | | fourteen = String.valueOf(cell14.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell15 = row.getCell(14); //登录账号[手机号] |
| | | String fifteen = null; |
| | | if (SinataUtil.isNotEmpty(cell15)){ |
| | | cell15.setCellType(Cell.CELL_TYPE_STRING); |
| | | fifteen = String.valueOf(cell15.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell16 = row.getCell(15); //登录密码[密码长度为6-18] |
| | | String sixteen = null; |
| | | if (SinataUtil.isNotEmpty(cell16)){ |
| | | cell16.setCellType(Cell.CELL_TYPE_STRING); |
| | | sixteen = String.valueOf(cell16.getStringCellValue()).trim(); |
| | | } |
| | | if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(two) |
| | | || SinataUtil.isEmpty(five) || SinataUtil.isEmpty(seven) |
| | | || SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten) |
| | | || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(twelve) || SinataUtil.isEmpty(thirteen) |
| | | || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen) || SinataUtil.isEmpty(sixteen)){ |
| | | return new ErrorTip(500, "单元格不能为空"); |
| | | }else{ |
| | | //判断账号是否存在 |
| | | int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", fifteen).in("authState", "1,2,3").ne("flag", 3)); |
| | | if (count > 0){ |
| | | continue; |
| | | } |
| | | //判断性别 |
| | | if (!two.equals("男") && !two.equals("女")){ |
| | | return new ErrorTip(500, "性别内容不正确"); |
| | | } |
| | | //判断经营业务【专车】 |
| | | if (!nine.equals("是") && !nine.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【专车】内容不正确"); |
| | | } |
| | | //判断经营业务【出租车】 |
| | | if (!ten.equals("是") && !ten.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【出租车】内容不正确"); |
| | | } |
| | | //判断经营业务【跨城出行】 |
| | | if (!eleven.equals("是") && !eleven.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【跨城出行】内容不正确"); |
| | | } |
| | | //判断经营业务【小件同城物流】 |
| | | if (!twelve.equals("是") && !twelve.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【小件同城物流】内容不正确"); |
| | | } |
| | | //判断经营业务【小件跨城物流】 |
| | | if (!thirteen.equals("是") && !thirteen.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【小件跨城物流】内容不正确"); |
| | | } |
| | | //判断经营业务【包车】 |
| | | if (!fourteen.equals("是") && !fourteen.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【包车】内容不正确"); |
| | | } |
| | | |
| | | //判断手机号 |
| | | if (!isPhone(fifteen)){ |
| | | return new ErrorTip(500, "登录账号[手机号]格式不正确"); |
| | | } |
| | | //判断登录密码 |
| | | if (!isPassword(sixteen)){ |
| | | return new ErrorTip(500, "登录密码格式不正确"); |
| | | } |
| | | //查找平台公司 |
| | | Integer companyId = ShiroKit.getUser().getObjectId(); |
| | | Integer franchiseeId = 0; |
| | | //判断所属分公司是否存在 |
| | | if (SinataUtil.isNotEmpty(one)){ |
| | | TCompany franchisee = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("superiorId",companyId).eq("name", one).eq("type", 3).notIn("flag", "3").last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(franchisee)){ |
| | | franchiseeId = franchisee.getId(); |
| | | } |
| | | } |
| | | |
| | | TDriver driver = new TDriver(); |
| | | driver.setAccount(fifteen); |
| | | driver.setJobNumber(eight); |
| | | driver.setPhone(fifteen); |
| | | driver.setPassword(ShiroKit.md5(sixteen, "SA;d5#")); |
| | | driver.setName(zero); |
| | | if ("男".equals(two)){ |
| | | driver.setSex(1); |
| | | }else if ("女".equals(two)){ |
| | | driver.setSex(2); |
| | | } |
| | | driver.setIdCard(five); |
| | | driver.setTaxiAptitudeCard(seven); |
| | | driver.setIsPlatCar(2); |
| | | driver.setCompanyId(companyId); |
| | | driver.setFranchiseeId(franchiseeId); |
| | | driver.setState(2); |
| | | driver.setAuthState(2); |
| | | driver.setFlag("1"); |
| | | driver.setInsertUser(ShiroKit.getUser().getId()); |
| | | driver.setInsertTime(new Date()); |
| | | driver.setAddType(3); |
| | | driver.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | |
| | | tDriverService.insert(driver); |
| | | |
| | | //添加专车服务模式 |
| | | if ("是".equals(nine)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(1); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加出租车服务模式 |
| | | if ("是".equals(ten)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(2); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加跨城出行服务模式 |
| | | if ("是".equals(eleven)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(3); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加小件同城物流服务模式 |
| | | if ("是".equals(twelve)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(4); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加小件跨城物流服务模式 |
| | | if ("是".equals(thirteen)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(5); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加包车服务模式 |
| | | if ("是".equals(fourteen)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(6); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | |
| | | } |
| | | } |
| | | }else if (ShiroKit.getUser().getRoleType() == 3){ |
| | | Workbook book = WoUtil.ImportFile(file); |
| | | Sheet sh = book.getSheetAt(0); //获取到第一个表 |
| | | for (int i = 1; i <= sh.getLastRowNum(); i++) { |
| | | Row row = sh.getRow(i); |
| | | |
| | | Cell cell0 = row.getCell(0); //司机名称 |
| | | String zero = null; |
| | | if (SinataUtil.isNotEmpty(cell0)){ |
| | | zero = String.valueOf(cell0.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell2 = row.getCell(4); //性别[男/女] |
| | | String one = null; |
| | | if (SinataUtil.isNotEmpty(cell2)){ |
| | | one = String.valueOf(cell2.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | |
| | | |
| | | Cell cell5 = row.getCell(5); //身份证号 |
| | | String four = null; |
| | | if (SinataUtil.isNotEmpty(cell5)){ |
| | | four = String.valueOf(cell5.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | |
| | | |
| | | Cell cell7 = row.getCell(6); //出租车资格证号 |
| | | String six = null; |
| | | if (SinataUtil.isNotEmpty(cell7)){ |
| | | cell7.setCellType(Cell.CELL_TYPE_STRING); |
| | | six = String.valueOf(cell7.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell8 = row.getCell(7); //工号[选填] |
| | | String seven = null; |
| | | if (SinataUtil.isNotEmpty(cell8)){ |
| | | cell8.setCellType(Cell.CELL_TYPE_STRING); |
| | | seven = String.valueOf(cell8.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell9 = row.getCell(8); //经营业务:专车[是/否] |
| | | String eight = null; |
| | | if (SinataUtil.isNotEmpty(cell9)){ |
| | | eight = String.valueOf(cell9.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell10 = row.getCell(9); //经营业务:出租车[是/否] |
| | | String nine = null; |
| | | if (SinataUtil.isNotEmpty(cell10)){ |
| | | nine = String.valueOf(cell10.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell11 = row.getCell(10); //经营业务:跨城出行[是/否] |
| | | String ten = null; |
| | | if (SinataUtil.isNotEmpty(cell11)){ |
| | | ten = String.valueOf(cell11.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell12 = row.getCell(11); //经营业务:小件同城物流[是/否] |
| | | String eleven = null; |
| | | if (SinataUtil.isNotEmpty(cell12)){ |
| | | eleven = String.valueOf(cell12.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell13 = row.getCell(12); //经营业务:小件跨城物流[是/否] |
| | | String twelve = null; |
| | | if (SinataUtil.isNotEmpty(cell13)){ |
| | | twelve = String.valueOf(cell13.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell14 = row.getCell(13); //经营业务:包车[是/否] |
| | | String thirteen = null; |
| | | if (SinataUtil.isNotEmpty(cell14)){ |
| | | thirteen = String.valueOf(cell14.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell15 = row.getCell(14); //登录账号[手机号] |
| | | String fourteen = null; |
| | | if (SinataUtil.isNotEmpty(cell15)){ |
| | | cell15.setCellType(Cell.CELL_TYPE_STRING); |
| | | fourteen = String.valueOf(cell15.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell16 = row.getCell(15); //登录密码[密码长度为6-18] |
| | | String fifteen = null; |
| | | if (SinataUtil.isNotEmpty(cell16)){ |
| | | cell16.setCellType(Cell.CELL_TYPE_STRING); |
| | | fifteen = String.valueOf(cell16.getStringCellValue()).trim(); |
| | | } |
| | | if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(one) |
| | | || SinataUtil.isEmpty(four) |
| | | || SinataUtil.isEmpty(six) || SinataUtil.isEmpty(eight) |
| | | || SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten) |
| | | || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(twelve) || SinataUtil.isEmpty(thirteen) |
| | | || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen) ){ |
| | | return new ErrorTip(500, "单元格不能为空"); |
| | | }else{ |
| | | //判断账号是否存在 |
| | | int count = tDriverService.selectCount(new EntityWrapper<TDriver>().eq("phone", fourteen).in("authState", "1,2,3").ne("flag", 3)); |
| | | if (count > 0){ |
| | | continue; |
| | | } |
| | | //判断性别 |
| | | if (!one.equals("男") && !one.equals("女")){ |
| | | return new ErrorTip(500, "性别内容不正确"); |
| | | } |
| | | //判断经营业务【专车】 |
| | | if (!eight.equals("是") && !eight.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【专车】内容不正确"); |
| | | } |
| | | //判断经营业务【出租车】 |
| | | if (!nine.equals("是") && !nine.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【出租车】内容不正确"); |
| | | } |
| | | //判断经营业务【跨城出行】 |
| | | if (!ten.equals("是") && !ten.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【跨城出行】内容不正确"); |
| | | } |
| | | //判断经营业务【小件同城物流】 |
| | | if (!eleven.equals("是") && !eleven.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【小件同城物流】内容不正确"); |
| | | } |
| | | //判断经营业务【小件跨城物流】 |
| | | if (!twelve.equals("是") && !twelve.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【小件跨城物流】内容不正确"); |
| | | } |
| | | //判断经营业务【包车】 |
| | | if (!thirteen.equals("是") && !thirteen.equals("否")){ |
| | | return new ErrorTip(500, "经营业务【包车】内容不正确"); |
| | | } |
| | | |
| | | //判断手机号 |
| | | if (!isPhone(fourteen)){ |
| | | return new ErrorTip(500, "登录账号[手机号]格式不正确"); |
| | | } |
| | | //判断登录密码 |
| | | if (!isPassword(fifteen)){ |
| | | return new ErrorTip(500, "登录密码格式不正确"); |
| | | } |
| | | //查找平台公司 |
| | | Integer companyId = 0; |
| | | Integer franchiseeId = 0; |
| | | TCompany franchisee = itCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | if (SinataUtil.isNotEmpty(franchisee)){ |
| | | companyId = franchisee.getSuperiorId(); |
| | | franchiseeId = franchisee.getId(); |
| | | } |
| | | if (companyId == 0 && franchiseeId == 0){ |
| | | return new ErrorTip(500, "当前登录账户上级分公司不能为空"); |
| | | } |
| | | |
| | | TDriver driver = new TDriver(); |
| | | driver.setAccount(fourteen); |
| | | driver.setJobNumber(seven); |
| | | driver.setPhone(fourteen); |
| | | driver.setPassword(ShiroKit.md5(fifteen, "SA;d5#")); |
| | | driver.setName(zero); |
| | | if ("男".equals(one)){ |
| | | driver.setSex(1); |
| | | }else if ("女".equals(one)){ |
| | | driver.setSex(2); |
| | | } |
| | | driver.setIdCard(four); |
| | | driver.setTaxiAptitudeCard(six); |
| | | driver.setIsPlatCar(2); |
| | | driver.setCompanyId(companyId); |
| | | driver.setFranchiseeId(franchiseeId); |
| | | driver.setState(2); |
| | | driver.setAuthState(2); |
| | | driver.setFlag("1"); |
| | | driver.setInsertUser(ShiroKit.getUser().getId()); |
| | | driver.setInsertTime(new Date()); |
| | | driver.setAddType(4); |
| | | driver.setAddObjectId(ShiroKit.getUser().getObjectId()); |
| | | |
| | | tDriverService.insert(driver); |
| | | |
| | | //添加专车服务模式 |
| | | if ("是".equals(eight)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(1); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加出租车服务模式 |
| | | if ("是".equals(nine)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(2); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加跨城出行服务模式 |
| | | if ("是".equals(ten)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(3); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加小件同城物流服务模式 |
| | | if ("是".equals(eleven)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(4); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加小件跨城物流服务模式 |
| | | if ("是".equals(twelve)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(5); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | //添加包车服务模式 |
| | | if ("是".equals(thirteen)){ |
| | | TDriverService service = new TDriverService(); |
| | | service.setDriverId(driver.getId()); |
| | | service.setType(6); |
| | | itDriverServiceService.insert(service); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | @Autowired |
| | | private ITDriverServiceService itDriverServiceService; |
| | | |
| | | /** |
| | | * 验证是否可以字符转为整数 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isInteger(String str) { |
| | | try{ |
| | | String reg = "^[0-9]\\d*$"; |
| | | boolean flag = str.matches(reg); |
| | | return flag; |
| | | }catch(NumberFormatException e) { |
| | | System.out.println("异常:\"" + str + "\"..."); |
| | | return false; |
| | | } |
| | | } |
| | | /** |
| | | * 验证手机号格式是否正确 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isPhone(String str) { |
| | | try{ |
| | | String reg = "^1\\d{10}$"; |
| | | boolean flag = str.matches(reg); |
| | | return flag; |
| | | }catch(NumberFormatException e) { |
| | | System.out.println("异常:\"" + str + "\"..."); |
| | | return false; |
| | | } |
| | | } |
| | | /** |
| | | * 验证密码长度是否正确 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isPassword(String str) { |
| | | try{ |
| | | String reg = "^.{6,18}$"; |
| | | boolean flag = str.matches(reg); |
| | | return flag; |
| | | }catch(NumberFormatException e) { |
| | | System.out.println("异常:\"" + str + "\"..."); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出司机信息 |
| | | */ |
| | | @RequestMapping(value = "/outDriver") |
| | | public void outDriver(HttpServletRequest request, HttpServletResponse response) { |
| | | List<Map<String,Object>> listMap = tDriverService.getDriverListNoPage(ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId()); |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |
| | | |
| | | //第一行显示【封装】 |
| | | List<String> twoList = new ArrayList<String>(); |
| | | twoList.add("总计:"); |
| | | twoList.add(String.valueOf(listMap.size())+"条"); |
| | | dataList.add(twoList); |
| | | |
| | | // 列【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("添加时间"); |
| | | shellList.add("姓名"); |
| | | shellList.add("登录账号【手机号】"); |
| | | shellList.add("性别"); |
| | | shellList.add("司机来源"); |
| | | shellList.add("所属分公司"); |
| | | shellList.add("所属加盟商"); |
| | | shellList.add("当前车辆"); |
| | | shellList.add("服务模式"); |
| | | shellList.add("关联线路"); |
| | | shellList.add("评分"); |
| | | shellList.add("历史接单数"); |
| | | shellList.add("历史订单总金额"); |
| | | shellList.add("当前钱包余额"); |
| | | shellList.add("钱包活动余额"); |
| | | shellList.add("钱包收入余额"); |
| | | shellList.add("状态"); |
| | | dataList.add(shellList); |
| | | |
| | | for (Map<String,Object> object : listMap){ |
| | | // 详细数据列【封装】 |
| | | shellList = new ArrayList<String>(); |
| | | if(SinataUtil.isNotEmpty(object.get("insertTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("insertTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("name"))){ |
| | | shellList.add(object.get("name").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("phone"))){ |
| | | shellList.add(object.get("phone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("sex"))){ |
| | | shellList.add(object.get("sex").toString() == "1"?"男":"女"); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("addType"))){ |
| | | |
| | | shellList.add(object.get("addType").toString().equals("1")?"司机注册":(object.get("addType").toString().equals("2")?"平台添加":(object.get("addType").toString().equals("3")?"分公司添加":(object.get("addType").toString().equals("4")?"加盟商添加":"")))); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("companyName"))){ |
| | | shellList.add(object.get("companyName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("franchiseeName"))){ |
| | | shellList.add(object.get("franchiseeName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("carLicensePlate"))){ |
| | | shellList.add(object.get("carLicensePlate").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("serverStr"))){ |
| | | shellList.add(object.get("serverStr").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("lineStr"))){ |
| | | shellList.add(object.get("lineStr").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("evaluateNum"))){ |
| | | shellList.add(object.get("evaluateNum").toString()); |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("historyNum"))){ |
| | | shellList.add(object.get("historyNum").toString()); |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("historyMoney"))){ |
| | | shellList.add(object.get("historyMoney").toString()); |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("balance"))){ |
| | | shellList.add(object.get("balance").toString()); |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("laveActivityMoney"))){ |
| | | shellList.add(object.get("laveActivityMoney").toString()); |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("laveBusinessMoney"))){ |
| | | shellList.add(object.get("laveBusinessMoney").toString()); |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("authState"))){ |
| | | shellList.add(object.get("authState").toString().equals("1")?"待审核":(object.get("authState").toString().equals("2")?"正常":(object.get("authState").toString().equals("3")?"冻结":(object.get("authState").toString().equals("4")?"已拒绝":"")))); |
| | | |
| | | shellList.add(object.get("authState").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | dataList.add(shellList); |
| | | } |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("司机信息导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "司机信息导出记录", dataList,request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TFeedback; |
| | | import com.stylefeng.guns.modular.system.service.ITFeedbackService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 反馈管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-10 10:24:59 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tFeedback") |
| | | public class TFeedbackController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tFeedback/"; |
| | | |
| | | @Autowired |
| | | private ITFeedbackService tFeedbackService; |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService tSystemNoticeService; |
| | | |
| | | /** |
| | | * 跳转到司机反馈管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tFeedback.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到用户反馈管理首页 |
| | | */ |
| | | @RequestMapping("/userFeedback") |
| | | public String userFeedback() { |
| | | return PREFIX + "userFeedback.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加反馈管理 |
| | | */ |
| | | @RequestMapping("/tFeedback_add") |
| | | public String tFeedbackAdd() { |
| | | return PREFIX + "tFeedback_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改反馈管理 |
| | | */ |
| | | @RequestMapping("/tFeedback_immediately/{tFeedbackId}/{type}") |
| | | public String tFeedbackUpdate(@PathVariable Integer tFeedbackId, @PathVariable Integer type, Model model) { |
| | | model.addAttribute("tFeedbackId",tFeedbackId); |
| | | model.addAttribute("type",type); |
| | | return PREFIX + "tFeedback_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TFeedback tFeedback = tFeedbackService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tFeedback.getContent(); |
| | | }else if (2 == type){ |
| | | str = tFeedback.getRemark(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取司机反馈管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String driverName, |
| | | String driverPhone, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tFeedbackService.getFeedbackList(page,beginTime,endTime,2,driverName,driverPhone,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户反馈管理列表 |
| | | */ |
| | | @RequestMapping(value = "/listUser") |
| | | @ResponseBody |
| | | public Object listUser(String insertTime, |
| | | String userName, |
| | | String userPhone, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tFeedbackService.getFeedbackList(page,beginTime,endTime,1,userName,userPhone,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 立即处理操作 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam String remark) { |
| | | TFeedback tFeedback = tFeedbackService.selectById(id); |
| | | if (SinataUtil.isNotEmpty(tFeedback)){ |
| | | tFeedback.setCldate(new Date()); |
| | | tFeedback.setRemark(remark); |
| | | tFeedback.setHandleUserId(ShiroKit.getUser().getId()); |
| | | tFeedback.setState(2); |
| | | tFeedbackService.updateById(tFeedback); |
| | | |
| | | //增加系统消息 |
| | | TSystemNotice notice = new TSystemNotice(); |
| | | notice.setType(2); |
| | | notice.setUserType(tFeedback.getType()); |
| | | notice.setContent("反馈处理结果:【"+remark+"】。"); |
| | | notice.setUserId(tFeedback.getUserId()); |
| | | notice.setInsertTime(new Date()); |
| | | notice.setRead(1); |
| | | tSystemNoticeService.insert(notice); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TComplaint; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TInvoice; |
| | | import com.stylefeng.guns.modular.system.service.ITInvoiceService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 开发票列表控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 10:55:26 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tInvoice") |
| | | public class TInvoiceController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tInvoice/"; |
| | | |
| | | @Autowired |
| | | private ITInvoiceService tInvoiceService; |
| | | |
| | | /** |
| | | * 跳转到开发票列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tInvoice.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TInvoice tInvoice = tInvoiceService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tInvoice.getContent(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加开发票列表 |
| | | */ |
| | | @RequestMapping("/tInvoice_add") |
| | | public String tInvoiceAdd() { |
| | | return PREFIX + "tInvoice_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改开发票列表 |
| | | */ |
| | | @RequestMapping("/tInvoice_update/{tInvoiceId}") |
| | | public String tInvoiceUpdate(@PathVariable Integer tInvoiceId, Model model) { |
| | | TInvoice tInvoice = tInvoiceService.selectById(tInvoiceId); |
| | | model.addAttribute("item",tInvoice); |
| | | LogObjectHolder.me().set(tInvoice); |
| | | return PREFIX + "tInvoice_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取开发票列表列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String email, |
| | | String name, |
| | | Integer type, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tInvoiceService.getInvoiceList(page,beginTime,endTime,email,name,type,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 重新开发票 |
| | | */ |
| | | @RequestMapping(value = "/again") |
| | | @ResponseBody |
| | | public Object again(@RequestParam Integer tInvoiceId) { |
| | | TInvoice tInvoice = tInvoiceService.selectById(tInvoiceId); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除开发票列表 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tInvoiceId) { |
| | | tInvoiceService.deleteById(tInvoiceId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.util.task.base.QuartzManager; |
| | | import com.stylefeng.guns.modular.system.util.task.base.TimeJobType; |
| | | import com.stylefeng.guns.modular.system.util.task.jobs.AddNotice; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TNotices; |
| | | import com.stylefeng.guns.modular.system.service.ITNoticesService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 滚动消息设置控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-10 15:21:25 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tNotices") |
| | | public class TNoticesController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tNotices/"; |
| | | |
| | | @Autowired |
| | | private ITNoticesService tNoticesService; |
| | | |
| | | /** |
| | | * 跳转到滚动消息设置首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tNotices.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到系统公告设置首页 |
| | | */ |
| | | @RequestMapping("/system") |
| | | public String system() { |
| | | return PREFIX + "system.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加滚动消息设置 |
| | | */ |
| | | @RequestMapping("/tNotices_add") |
| | | public String tNoticesAdd() { |
| | | return PREFIX + "tNotices_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加系统公告 |
| | | */ |
| | | @RequestMapping("/system_add") |
| | | public String system_add() { |
| | | return PREFIX + "system_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改滚动消息设置 |
| | | */ |
| | | @RequestMapping("/tNotices_update/{tNoticesId}") |
| | | public String tNoticesUpdate(@PathVariable Integer tNoticesId, Model model) { |
| | | TNotices tNotices = tNoticesService.selectById(tNoticesId); |
| | | model.addAttribute("item",tNotices); |
| | | LogObjectHolder.me().set(tNotices); |
| | | return PREFIX + "tNotices_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改系统公告 |
| | | */ |
| | | @RequestMapping("/system_update/{tNoticesId}") |
| | | public String system_update(@PathVariable Integer tNoticesId, Model model) { |
| | | TNotices tNotices = tNoticesService.selectById(tNoticesId); |
| | | model.addAttribute("item",tNotices); |
| | | LogObjectHolder.me().set(tNotices); |
| | | return PREFIX + "system_update.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取滚动消息设置列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String content) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tNoticesService.getRollingNoticeList(page,beginTime,endTime,1,content)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取系统公告设置列表 |
| | | */ |
| | | @RequestMapping(value = "/listSystem") |
| | | @ResponseBody |
| | | public Object listSystem(String insertTime,String content) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tNoticesService.getRollingNoticeList(page,beginTime,endTime,2,content)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增滚动消息设置 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TNotices tNotices) { |
| | | tNotices.setIsDelete(1); |
| | | tNotices.setInsertTime(new Date()); |
| | | tNotices.setInsertUser(ShiroKit.getUser().getId()); |
| | | tNotices.setType(1); |
| | | tNoticesService.insert(tNotices); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 新增系统公告 |
| | | */ |
| | | @RequestMapping(value = "/addSystem") |
| | | @ResponseBody |
| | | public Object addSystem(TNotices tNotices,@RequestParam Integer isAlert, |
| | | @RequestParam Integer isUser, |
| | | @RequestParam Integer isDriver) { |
| | | tNotices.setIsDelete(1); |
| | | tNotices.setInsertTime(new Date()); |
| | | tNotices.setInsertUser(ShiroKit.getUser().getId()); |
| | | tNotices.setType(2); |
| | | tNotices.setIsAlert(isAlert); |
| | | tNotices.setIsUser(isUser); |
| | | tNotices.setIsDriver(isDriver); |
| | | tNoticesService.insert(tNotices); |
| | | if (tNotices.getIsShow() == 1){ //发布 |
| | | //定时1秒后执行 |
| | | Map<String,Object> maps=new HashMap<>(); |
| | | maps.put("noticeId",tNotices.getId()); |
| | | QuartzManager.addJob(AddNotice.class, ( |
| | | AddNotice.name+tNotices.getId()).toUpperCase(), |
| | | TimeJobType.UNLOCK, |
| | | DateUtil.getDate_strYMdHms(new Date().getTime() + 1*1000) , |
| | | maps); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 发布系统公告 |
| | | */ |
| | | @RequestMapping(value = "/sendSystem") |
| | | @ResponseBody |
| | | public Object sendSystem(@RequestParam Integer tNoticesId) { |
| | | TNotices tNotices = tNoticesService.selectById(tNoticesId); |
| | | if (tNotices.getIsShow() == 2){ |
| | | //定时1秒后执行 |
| | | Map<String,Object> maps=new HashMap<>(); |
| | | maps.put("noticeId",tNotices.getId()); |
| | | QuartzManager.addJob(AddNotice.class, (AddNotice.name+tNotices.getId()).toUpperCase(), TimeJobType.UNLOCK,DateUtil.getDate_strYMdHms(new Date().getTime() + 1*1000) , maps); |
| | | } |
| | | tNotices.setIsShow(1); |
| | | tNotices.setUpdateTime(new Date()); |
| | | tNotices.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tNoticesService.updateById(tNotices); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tNoticesId) { |
| | | TNotices tNotices = tNoticesService.selectById(tNoticesId); |
| | | tNotices.setIsDelete(2); |
| | | tNotices.setFlag("3"); |
| | | tNotices.setUpdateTime(new Date()); |
| | | tNotices.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tNoticesService.updateById(tNotices); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改滚动消息设置 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TNotices tNotices) { |
| | | tNotices.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tNotices.setUpdateTime(new Date()); |
| | | tNoticesService.updateById(tNotices); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改系统公告 |
| | | */ |
| | | @RequestMapping(value = "/updateSystem") |
| | | @ResponseBody |
| | | public Object updateSystem(TNotices tNotices,@RequestParam Integer isAlert,@RequestParam Integer isUser, |
| | | @RequestParam Integer isDriver) { |
| | | tNotices.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tNotices.setUpdateTime(new Date()); |
| | | tNotices.setIsAlert(isAlert); |
| | | tNotices.setIsUser(isUser); |
| | | tNotices.setIsDriver(isDriver); |
| | | tNoticesService.updateById(tNotices); |
| | | if (tNotices.getIsShow() == 1){ //发布 |
| | | //定时1秒后执行 |
| | | Map<String,Object> maps=new HashMap<>(); |
| | | maps.put("noticeId",tNotices.getId()); |
| | | QuartzManager.addJob(AddNotice.class, |
| | | (AddNotice.name+tNotices.getId()).toUpperCase(), |
| | | TimeJobType.UNLOCK, |
| | | DateUtil.getDate_strYMdHms(new Date().getTime() + 1*1000) , |
| | | maps); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TOpenCityBusiness; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.service.ITOpenCityBusinessService; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import com.stylefeng.guns.modular.system.util.GaoDeMapUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TOpenCity; |
| | | import com.stylefeng.guns.modular.system.service.ITOpenCityService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 城市管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-02 11:40:31 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOpenCity") |
| | | public class TOpenCityController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tOpenCity/"; |
| | | |
| | | @Autowired |
| | | private ITOpenCityService tOpenCityService; |
| | | |
| | | @Autowired |
| | | private ITRegionService tRegionService; |
| | | |
| | | @Autowired |
| | | private ITOpenCityBusinessService tOpenCityBusinessService; |
| | | |
| | | /** |
| | | * 跳转到城市管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tOpenCity.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加城市管理 |
| | | */ |
| | | @RequestMapping("/tOpenCity_add") |
| | | public String tOpenCityAdd(Model model) { |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | return PREFIX + "tOpenCity_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改城市管理 |
| | | */ |
| | | @RequestMapping("/tOpenCity_update/{tOpenCityId}") |
| | | public String tOpenCityUpdate(@PathVariable Integer tOpenCityId, Model model) { |
| | | TOpenCity tOpenCity = tOpenCityService.selectById(tOpenCityId); |
| | | model.addAttribute("item",tOpenCity); |
| | | LogObjectHolder.me().set(tOpenCity); |
| | | |
| | | //省 |
| | | List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",provinceList); |
| | | //市 |
| | | List<TRegion> cityList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", tOpenCity.getAreaId())); |
| | | model.addAttribute("cityList",cityList); |
| | | //区 |
| | | List<TRegion> areaList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", tOpenCity.getCityId())); |
| | | model.addAttribute("areaList",areaList); |
| | | //经营业务 |
| | | List<Map<String,Object>> businessList = tOpenCityService.getBusinessByCityId(tOpenCityId); |
| | | model.addAttribute("businessList",businessList); |
| | | return PREFIX + "tOpenCity_edit.html"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/change") |
| | | @ResponseBody |
| | | public Object change(@RequestParam Integer id) { |
| | | List<TRegion> list = new ArrayList<>(); |
| | | if (SinataUtil.isNotEmpty(id)){ |
| | | list = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", id)); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取城市管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String condition) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOpenCityService.getOpenCityList(page,beginTime,endTime,condition)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增城市管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TOpenCity tOpenCity,@RequestParam String businessTypeStr,Integer areaId,Integer cityId,Integer provinceId) { |
| | | //获取code |
| | | if (SinataUtil.isNotEmpty(areaId)){ |
| | | TRegion area = tRegionService.selectById(areaId); |
| | | tOpenCity.setCode(area.getCode()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(cityId)){ |
| | | TRegion city = tRegionService.selectById(cityId); |
| | | tOpenCity.setCode(city.getCode()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(provinceId)){ |
| | | TRegion province = tRegionService.selectById(provinceId); |
| | | tOpenCity.setCode(province.getCode()); |
| | | } |
| | | tOpenCity.setAreaId(areaId); |
| | | tOpenCity.setCityId(cityId); |
| | | tOpenCity.setProvinceId(provinceId); |
| | | //获取经纬度 |
| | | String address = tOpenCity.getAreaName(); |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getCityName())){ |
| | | address+=tOpenCity.getCityName(); |
| | | } |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())){ |
| | | address+=tOpenCity.getProvinceName(); |
| | | } |
| | | JSONObject positionObj = GaoDeMapUtil.getLngAndLat(address); |
| | | String longitude = positionObj.getString("longitude"); |
| | | String latitude = positionObj.getString("latitude"); |
| | | tOpenCity.setLon(Double.valueOf(longitude)); |
| | | tOpenCity.setLat(Double.valueOf(latitude)); |
| | | tOpenCity.setInsertTime(new Date()); |
| | | tOpenCity.setInsertUser(ShiroKit.getUser().getId()); |
| | | tOpenCityService.insert(tOpenCity); |
| | | |
| | | //添加经营业务 |
| | | testJSONStrToJSONArray(businessTypeStr,tOpenCity.getId()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | public void testJSONStrToJSONArray(String subArr,Integer tOpenCityId){ |
| | | JSONArray jsonArray = JSON.parseArray(subArr); |
| | | int size = jsonArray.size(); |
| | | for (int i = 0; i < size; i++){ |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TOpenCityBusiness business = new TOpenCityBusiness(); |
| | | if (SinataUtil.isNotEmpty(jsonObject.getInteger("busId")) && jsonObject.getInteger("busId") != 0){ |
| | | business = tOpenCityBusinessService.selectById(jsonObject.getInteger("busId")); |
| | | business.setUpdateTime(new Date()); |
| | | business.setUpdateUser(ShiroKit.getUser().getId()); |
| | | business.setFlag("2"); |
| | | }else{ |
| | | business.setInsertTime(DateUtil.parse(jsonObject.getString("time")+" 00:00:00","yyyy-MM-dd HH:mm:ss")); |
| | | business.setInsertUser(ShiroKit.getUser().getId()); |
| | | } |
| | | business.setOpenCityId(tOpenCityId); |
| | | String type = jsonObject.getString("type"); |
| | | Integer businessType = 0; |
| | | if ("专车".equals(type)){ |
| | | businessType = 1; |
| | | }else if ("出租车".equals(type)){ |
| | | businessType = 2; |
| | | }else if ("跨城出行".equals(type)){ |
| | | businessType = 3; |
| | | }else if ("跨城小件物流".equals(type)){ |
| | | businessType = 4; |
| | | }else if ("同城小件物流".equals(type)){ |
| | | businessType = 5; |
| | | }else if ("包车".equals(type)){ |
| | | businessType = 6; |
| | | } |
| | | business.setBusinessType(businessType); |
| | | business.setSort(jsonObject.getInteger("sort")); |
| | | if (SinataUtil.isNotEmpty(jsonObject.getInteger("busId")) && jsonObject.getInteger("busId") != 0){ |
| | | tOpenCityBusinessService.updateById(business); |
| | | }else{ |
| | | tOpenCityBusinessService.insert(business); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除城市管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tOpenCityId) { |
| | | TOpenCity tOpenCity = tOpenCityService.selectById(tOpenCityId); |
| | | tOpenCity.setFlag("3"); |
| | | tOpenCityService.updateById(tOpenCity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改城市管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TOpenCity tOpenCity,@RequestParam String businessTypeStr,Integer areaId,Integer cityId,Integer provinceId) { |
| | | if (SinataUtil.isNotEmpty(areaId)){ |
| | | TRegion area = tRegionService.selectById(areaId); |
| | | tOpenCity.setCode(area.getCode()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(cityId)){ |
| | | TRegion city = tRegionService.selectById(cityId); |
| | | tOpenCity.setCode(city.getCode()); |
| | | } |
| | | if (SinataUtil.isNotEmpty(provinceId)){ |
| | | TRegion province = tRegionService.selectById(provinceId); |
| | | tOpenCity.setCode(province.getCode()); |
| | | } |
| | | if (SinataUtil.isEmpty(areaId)){ |
| | | tOpenCity.setAreaId(0); |
| | | tOpenCity.setAreaName(""); |
| | | }else{ |
| | | tOpenCity.setAreaId(areaId); |
| | | } |
| | | if (SinataUtil.isEmpty(cityId)){ |
| | | tOpenCity.setCityId(0); |
| | | tOpenCity.setCityName(""); |
| | | }else{ |
| | | tOpenCity.setCityId(cityId); |
| | | } |
| | | if (SinataUtil.isEmpty(provinceId)){ |
| | | tOpenCity.setProvinceId(0); |
| | | tOpenCity.setProvinceName(""); |
| | | }else{ |
| | | tOpenCity.setProvinceId(provinceId); |
| | | } |
| | | |
| | | //获取经纬度 |
| | | String address = tOpenCity.getAreaName(); |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getCityName())){ |
| | | address+=tOpenCity.getCityName(); |
| | | } |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())){ |
| | | address+=tOpenCity.getProvinceName(); |
| | | } |
| | | JSONObject positionObj = GaoDeMapUtil.getLngAndLat(address); |
| | | String longitude = positionObj.getString("longitude"); |
| | | String latitude = positionObj.getString("latitude"); |
| | | tOpenCity.setLon(Double.valueOf(longitude)); |
| | | tOpenCity.setLat(Double.valueOf(latitude)); |
| | | tOpenCity.setUpdateTime(new Date()); |
| | | tOpenCity.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tOpenCityService.updateById(tOpenCity); |
| | | |
| | | //删除经营业务 |
| | | TOpenCityBusiness business = new TOpenCityBusiness(); |
| | | business.setFlag("3"); |
| | | tOpenCityBusinessService.update(business,new EntityWrapper<TOpenCityBusiness>().eq("openCityId",tOpenCity.getId())); |
| | | //添加经营业务 |
| | | testJSONStrToJSONArray(businessTypeStr,tOpenCity.getId()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 城市管理详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tOpenCityId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tOpenCityId") Integer tOpenCityId) { |
| | | return tOpenCityService.selectById(tOpenCityId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TComplaint; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TOrderEvaluate; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderEvaluateService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 评价列表控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 11:44:36 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOrderEvaluate") |
| | | public class TOrderEvaluateController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tOrderEvaluate/"; |
| | | |
| | | @Autowired |
| | | private ITOrderEvaluateService tOrderEvaluateService; |
| | | |
| | | /** |
| | | * 跳转到评价列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tOrderEvaluate.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TOrderEvaluate tOrderEvaluate = tOrderEvaluateService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tOrderEvaluate.getContent(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加评价列表 |
| | | */ |
| | | @RequestMapping("/tOrderEvaluate_add") |
| | | public String tOrderEvaluateAdd() { |
| | | return PREFIX + "tOrderEvaluate_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改评价列表 |
| | | */ |
| | | @RequestMapping("/tOrderEvaluate_update/{tOrderEvaluateId}") |
| | | public String tOrderEvaluateUpdate(@PathVariable Integer tOrderEvaluateId, Model model) { |
| | | TOrderEvaluate tOrderEvaluate = tOrderEvaluateService.selectById(tOrderEvaluateId); |
| | | model.addAttribute("item",tOrderEvaluate); |
| | | LogObjectHolder.me().set(tOrderEvaluate); |
| | | return PREFIX + "tOrderEvaluate_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取评价列表列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String userName, |
| | | String userPhone, |
| | | String driverName, |
| | | String driverPhone, |
| | | String fraction, |
| | | Integer orderType) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderEvaluateService.getOrderEvaluateList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,userName,userPhone,driverName,driverPhone,fraction,orderType)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增评价列表 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TOrderEvaluate tOrderEvaluate) { |
| | | tOrderEvaluateService.insert(tOrderEvaluate); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除评价列表 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tOrderEvaluateId) { |
| | | tOrderEvaluateService.deleteById(tOrderEvaluateId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改评价列表 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TOrderEvaluate tOrderEvaluate) { |
| | | tOrderEvaluateService.updateById(tOrderEvaluate); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 评价列表详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tOrderEvaluateId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tOrderEvaluateId") Integer tOrderEvaluateId) { |
| | | return tOrderEvaluateService.selectById(tOrderEvaluateId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TFeedback; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TProblem; |
| | | import com.stylefeng.guns.modular.system.service.ITProblemService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 用户留言管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-24 11:20:23 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tProblem") |
| | | public class TProblemController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tProblem/"; |
| | | |
| | | @Autowired |
| | | private ITProblemService tProblemService; |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService itSystemNoticeService; |
| | | |
| | | /** |
| | | * 跳转到用户留言管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tProblem.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TProblem tProblem = tProblemService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tProblem.getContent(); |
| | | }else if (2 == type){ |
| | | str = tProblem.getAnswer(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到立即处理页面 |
| | | */ |
| | | @RequestMapping("/tProblem_immediately/{tProblemId}") |
| | | public String tProblemUpdate(@PathVariable Integer tProblemId, Model model) { |
| | | model.addAttribute("tProblemId",tProblemId); |
| | | return PREFIX + "tProblem_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户留言管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String userName, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tProblemService.getProblemList(page,beginTime,endTime,userName,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 立即处理 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer tProblemId,@RequestParam String answer) { |
| | | TProblem tProblem = tProblemService.selectById(tProblemId); |
| | | if (SinataUtil.isNotEmpty(tProblem)){ |
| | | tProblem.setAnswer(answer); |
| | | tProblem.setHandleTime(new Date()); |
| | | tProblem.setHandleUserId(ShiroKit.getUser().getId()); |
| | | tProblem.setState(2); |
| | | tProblemService.updateById(tProblem); |
| | | |
| | | //增加系统消息 |
| | | TSystemNotice notice = new TSystemNotice(); |
| | | notice.setType(2); |
| | | notice.setUserType(1); |
| | | notice.setContent("您的留言被回复啦:【"+answer+"】"); |
| | | notice.setUserId(tProblem.getUserId()); |
| | | notice.setInsertTime(new Date()); |
| | | notice.setRead(1); |
| | | itSystemNoticeService.insert(notice); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TComplaint; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TPubWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.ITPubWithdrawalService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 提现列表控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 09:30:59 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tPubWithdrawal") |
| | | public class TPubWithdrawalController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tPubWithdrawal/"; |
| | | |
| | | @Autowired |
| | | private ITPubWithdrawalService tPubWithdrawalService; |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService tSystemNoticeService; |
| | | |
| | | /** |
| | | * 跳转到提现列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tPubWithdrawal.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TPubWithdrawal tPubWithdrawal = tPubWithdrawalService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tPubWithdrawal.getRemark(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到立即处理页面 |
| | | */ |
| | | @RequestMapping("/tPubWithdrawal_immediately/{tPubWithdrawalId}") |
| | | public String tPubWithdrawalUpdate(@PathVariable Integer tPubWithdrawalId, Model model) { |
| | | model.addAttribute("tPubWithdrawalId",tPubWithdrawalId); |
| | | return PREFIX + "tPubWithdrawal_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取提现列表列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String name, |
| | | Integer withdrawalType) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tPubWithdrawalService.getWithdrawalList(page,beginTime,endTime,name,withdrawalType)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增提现列表 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TPubWithdrawal tPubWithdrawal) { |
| | | tPubWithdrawalService.insert(tPubWithdrawal); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 立即处理操作 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) { |
| | | TPubWithdrawal tPubWithdrawal = tPubWithdrawalService.selectById(id); |
| | | if (SinataUtil.isNotEmpty(tPubWithdrawal)){ |
| | | // tPubWithdrawal.setState(state); //调用接口修改状态 |
| | | tPubWithdrawal.setRemark(remark); |
| | | tPubWithdrawal.setHandleTime(new Date()); |
| | | |
| | | Integer stateObj = 1; |
| | | if (2 == state){ //同意提现 |
| | | stateObj = 1; |
| | | }else if (3 == state){ //拒绝提现 |
| | | stateObj = 2; |
| | | } |
| | | tPubWithdrawalService.updateById(tPubWithdrawal); |
| | | |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", String.valueOf(tPubWithdrawal.getId())); |
| | | map.put("state", String.valueOf(stateObj)); |
| | | String result = HttpRequestUtil.postRequest(PushURL.withdraw_auth_url, map); |
| | | System.out.println("提现审核接口 :【recordId="+tPubWithdrawal.getId().toString()+"】,调用接口:"+result); |
| | | |
| | | //增加系统消息 |
| | | TSystemNotice notice = new TSystemNotice(); |
| | | notice.setType(2); |
| | | notice.setUserType(tPubWithdrawal.getUserType()); |
| | | notice.setContent("提现处理结果:【"+remark+"】。"); |
| | | notice.setUserId(tPubWithdrawal.getUserId()); |
| | | notice.setInsertTime(new Date()); |
| | | notice.setRead(1); |
| | | tSystemNoticeService.insert(notice); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改提现列表 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TPubWithdrawal tPubWithdrawal) { |
| | | tPubWithdrawalService.updateById(tPubWithdrawal); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 提现列表详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tPubWithdrawalId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tPubWithdrawalId") Integer tPubWithdrawalId) { |
| | | return tPubWithdrawalService.selectById(tPubWithdrawalId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TComplaint; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TSmsrecord; |
| | | import com.stylefeng.guns.modular.system.service.ITSmsrecordService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 短信记录控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-10 19:43:13 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tSmsrecord") |
| | | public class TSmsrecordController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tSmsrecord/"; |
| | | |
| | | @Autowired |
| | | private ITSmsrecordService tSmsrecordService; |
| | | |
| | | /** |
| | | * 跳转到短信记录首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tSmsrecord.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TSmsrecord tSmsrecord = tSmsrecordService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tSmsrecord.getContent(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取短信记录列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String phone) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tSmsrecordService.getSmsCodeList(page,beginTime,endTime,phone)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 系统设置控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 13:43:44 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tSysReformist") |
| | | public class TSysReformistController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tSysReformist/"; |
| | | |
| | | @Autowired |
| | | private ITSysReformistService tSysReformistService; |
| | | |
| | | @Autowired |
| | | private ITSysIntegralService tSysIntegralService; |
| | | |
| | | @Autowired |
| | | private ITSysFaceDistinguishService tSysFaceDistinguishService; |
| | | |
| | | @Autowired |
| | | private ITSysPushOrderService tSysPushOrderService; |
| | | |
| | | @Autowired |
| | | private ITSysCancleOrderService tSysCancleOrderService; |
| | | |
| | | @Autowired |
| | | private ITPhoneService tPhoneService; |
| | | @Autowired |
| | | private ITUseMoneyService useMoneyService; |
| | | @Autowired |
| | | private ITRechargeMoneyService rechargeMoneyService; |
| | | |
| | | |
| | | /** |
| | | * 跳转到系统设置首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | //改派设置 |
| | | /*TSysReformist reformist = tSysReformistService.selectOne(new EntityWrapper<TSysReformist>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("reformist",reformist); |
| | | //积分设置 |
| | | TSysIntegral integral = tSysIntegralService.selectOne(new EntityWrapper<TSysIntegral>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("integral",integral);*/ |
| | | //人脸识别 |
| | | TSysFaceDistinguish faceDistinguish = tSysFaceDistinguishService.selectOne(new EntityWrapper<TSysFaceDistinguish>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("faceDistinguish",faceDistinguish); |
| | | |
| | | //专车推单(第一轮) |
| | | /*TSysPushOrder zcOne = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 1).eq("type", 1)); |
| | | model.addAttribute("zcOne",zcOne); |
| | | //专车推单(第二轮) |
| | | TSysPushOrder zcTwo = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 1).eq("type", 2)); |
| | | model.addAttribute("zcTwo",zcTwo); |
| | | //专车推单(第三轮) |
| | | TSysPushOrder zcThree = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 1).eq("type", 3)); |
| | | model.addAttribute("zcThree",zcThree);*/ |
| | | |
| | | //出租车推单(第一轮) |
| | | TSysPushOrder czcOne = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 2).eq("type", 1)); |
| | | model.addAttribute("czcOne",czcOne); |
| | | //出租车推单(第二轮) |
| | | TSysPushOrder czcTwo = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 2).eq("type", 2)); |
| | | model.addAttribute("czcTwo",czcTwo); |
| | | //出租车推单(第三轮) |
| | | TSysPushOrder czcThree = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 2).eq("type", 3)); |
| | | model.addAttribute("czcThree",czcThree); |
| | | |
| | | //普通取消设置(专车) |
| | | /* TSysCancleOrder ptCancel1 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 1)); |
| | | model.addAttribute("ptCancel1",ptCancel1); |
| | | //普通取消设置(出租车) |
| | | TSysCancleOrder ptCancel2 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 2)); |
| | | model.addAttribute("ptCancel2",ptCancel2); |
| | | //普通取消设置(跨城出行) |
| | | TSysCancleOrder ptCancel3 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1).eq("orderType", 3)); |
| | | model.addAttribute("ptCancel3",ptCancel3); |
| | | |
| | | //预约取消设置(专车) |
| | | TSysCancleOrder yyCancel1 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 1)); |
| | | model.addAttribute("yyCancel1",yyCancel1); |
| | | //预约取消设置(出租车) |
| | | TSysCancleOrder yyCancel2 = tSysCancleOrderService.selectOne(new EntityWrapper<TSysCancleOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2).eq("orderType", 2)); |
| | | model.addAttribute("yyCancel2",yyCancel2);*/ |
| | | |
| | | //报警电话 |
| | | TPhone phone1 = tPhoneService.selectOne(new EntityWrapper<TPhone>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1)); |
| | | model.addAttribute("phone1",phone1); |
| | | //客服电话 |
| | | TPhone phone2 = tPhoneService.selectOne(new EntityWrapper<TPhone>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2)); |
| | | model.addAttribute("phone2",phone2); |
| | | //客服电话 |
| | | TPhone phone3 = tPhoneService.selectOne(new EntityWrapper<TPhone>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 3)); |
| | | model.addAttribute("phone3",phone3); |
| | | |
| | | TUseMoney tUseMoney = useMoneyService.selectList(new EntityWrapper<TUseMoney>()).get(0); |
| | | model.addAttribute("money1",tUseMoney); |
| | | TRechargeMoney tRechargeMoney = rechargeMoneyService.selectList |
| | | (new EntityWrapper<TRechargeMoney>()).get(0); |
| | | model.addAttribute("recharge",tRechargeMoney.getContent()); |
| | | return PREFIX + "tSysReformist.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除系统设置 |
| | | */ |
| | | @RequestMapping(value = "/setUp") |
| | | @ResponseBody |
| | | public Object setUp( |
| | | @RequestParam Double czc1,@RequestParam Integer czc2,@RequestParam Double czc3, |
| | | @RequestParam Double czc4,@RequestParam Integer czc5,@RequestParam Double czc6, |
| | | @RequestParam Double czc7,@RequestParam Integer czc8,@RequestParam Double czc9, |
| | | @RequestParam String phone1,@RequestParam String phone2,@RequestParam String phone3 |
| | | ,@RequestParam String res,@RequestParam String money |
| | | ) { |
| | | |
| | | //人脸识别 |
| | | TSysFaceDistinguish faceDistinguish = tSysFaceDistinguishService.selectOne(new EntityWrapper<TSysFaceDistinguish>().eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | if (SinataUtil.isNotEmpty(faceDistinguish)){ |
| | | tSysFaceDistinguishService.updateById(faceDistinguish); |
| | | }else{ |
| | | faceDistinguish = new TSysFaceDistinguish(); |
| | | faceDistinguish.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | tSysFaceDistinguishService.insert(faceDistinguish); |
| | | } |
| | | // 充值金额 |
| | | String recharge = res.substring(0, res.length() - 1); |
| | | String[] numbersAsString = recharge.split(","); |
| | | int[] numbers = new int[numbersAsString.length]; |
| | | for (int i = 0; i < numbersAsString.length; i++) { |
| | | numbers[i] = Integer.parseInt(numbersAsString[i]); |
| | | } |
| | | Arrays.sort(numbers); |
| | | StringBuilder sortedString = new StringBuilder(); |
| | | for (int i = 0; i < numbers.length; i++) { |
| | | sortedString.append(numbers[i]); |
| | | if (i < numbers.length - 1) { |
| | | sortedString.append(","); |
| | | } |
| | | } |
| | | TRechargeMoney tRechargeMoney = rechargeMoneyService.selectList |
| | | (new EntityWrapper<TRechargeMoney>()).get(0); |
| | | tRechargeMoney.setContent(sortedString.toString()); |
| | | rechargeMoneyService.updateById(tRechargeMoney); |
| | | // 软件使用费 |
| | | TUseMoney tUseMoney = useMoneyService.selectList(new EntityWrapper<TUseMoney>()).get(0); |
| | | tUseMoney.setMoney(Double.valueOf(money)); |
| | | useMoneyService.updateById(tUseMoney); |
| | | //出租车推单(第一轮) |
| | | TSysPushOrder czcOne = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 2).eq("type", 1)); |
| | | if (SinataUtil.isNotEmpty(czcOne)){ |
| | | czcOne.setPushDistance(czc1); |
| | | czcOne.setPushTime(czc2); |
| | | czcOne.setDriverProportion(czc3); |
| | | tSysPushOrderService.updateById(czcOne); |
| | | }else{ |
| | | czcOne = new TSysPushOrder(); |
| | | czcOne.setPushDistance(czc1); |
| | | czcOne.setPushTime(czc2); |
| | | czcOne.setDriverProportion(czc3); |
| | | czcOne.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | czcOne.setPushType(2); |
| | | czcOne.setType(1); |
| | | tSysPushOrderService.insert(czcOne); |
| | | } |
| | | //出租车推单(第二轮) |
| | | TSysPushOrder czcTwo = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 2).eq("type", 2)); |
| | | if (SinataUtil.isNotEmpty(czcTwo)){ |
| | | czcTwo.setPushDistance(czc4); |
| | | czcTwo.setPushTime(czc5); |
| | | czcTwo.setDriverProportion(czc6); |
| | | tSysPushOrderService.updateById(czcTwo); |
| | | }else{ |
| | | czcTwo = new TSysPushOrder(); |
| | | czcTwo.setPushDistance(czc4); |
| | | czcTwo.setPushTime(czc5); |
| | | czcTwo.setDriverProportion(czc6); |
| | | czcTwo.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | czcTwo.setPushType(2); |
| | | czcTwo.setType(2); |
| | | tSysPushOrderService.insert(czcTwo); |
| | | } |
| | | //出租车推单(第三轮) |
| | | TSysPushOrder czcThree = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("pushType", 2).eq("type", 3)); |
| | | if (SinataUtil.isNotEmpty(czcThree)){ |
| | | czcThree.setPushDistance(czc7); |
| | | czcThree.setPushTime(czc8); |
| | | czcThree.setDriverProportion(czc9); |
| | | tSysPushOrderService.updateById(czcThree); |
| | | }else{ |
| | | czcThree = new TSysPushOrder(); |
| | | czcThree.setPushDistance(czc7); |
| | | czcThree.setPushTime(czc8); |
| | | czcThree.setDriverProportion(czc9); |
| | | czcThree.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | czcThree.setPushType(2); |
| | | czcThree.setType(3); |
| | | tSysPushOrderService.insert(czcThree); |
| | | } |
| | | |
| | | |
| | | |
| | | //报警电话 |
| | | TPhone phoneOne = tPhoneService.selectOne(new EntityWrapper<TPhone>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 1)); |
| | | if (SinataUtil.isNotEmpty(phoneOne)){ |
| | | phoneOne.setPhone(phone1); |
| | | tPhoneService.updateById(phoneOne); |
| | | }else{ |
| | | phoneOne = new TPhone(); |
| | | phoneOne.setPhone(phone1); |
| | | phoneOne.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | phoneOne.setType(1); |
| | | if (ShiroKit.getUser().getRoleType() == 1){ |
| | | phoneOne.setPlatform(1); |
| | | }else{ |
| | | phoneOne.setPlatform(2); |
| | | } |
| | | tPhoneService.insert(phoneOne); |
| | | } |
| | | //客服电话 |
| | | TPhone phoneTwo = tPhoneService.selectOne(new EntityWrapper<TPhone>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 2)); |
| | | if (SinataUtil.isNotEmpty(phoneTwo)){ |
| | | phoneTwo.setPhone(phone2); |
| | | tPhoneService.updateById(phoneTwo); |
| | | }else{ |
| | | phoneTwo = new TPhone(); |
| | | phoneTwo.setPhone(phone2); |
| | | phoneTwo.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | phoneTwo.setType(2); |
| | | if (ShiroKit.getUser().getRoleType() == 1){ |
| | | phoneTwo.setPlatform(1); |
| | | }else{ |
| | | phoneTwo.setPlatform(2); |
| | | } |
| | | tPhoneService.insert(phoneTwo); |
| | | } |
| | | |
| | | // 电召电话 |
| | | TPhone phone = tPhoneService.selectOne(new EntityWrapper<TPhone>().eq("companyId", ShiroKit.getUser().getObjectId()).eq("type", 3)); |
| | | if (SinataUtil.isNotEmpty(phone)){ |
| | | phone.setPhone(phone3); |
| | | tPhoneService.updateById(phone); |
| | | }else{ |
| | | phone = new TPhone(); |
| | | phone.setPhone(phone3); |
| | | phone.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | phone.setType(3); |
| | | if (ShiroKit.getUser().getRoleType() == 1){ |
| | | phone.setPlatform(1); |
| | | }else{ |
| | | phone.setPlatform(2); |
| | | } |
| | | tPhoneService.insert(phone); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TSysSensitiveWords; |
| | | import com.stylefeng.guns.modular.system.service.ITSysSensitiveWordsService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 敏感词管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 19:45:29 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tSysSensitiveWords") |
| | | public class TSysSensitiveWordsController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tSysSensitiveWords/"; |
| | | |
| | | @Autowired |
| | | private ITSysSensitiveWordsService tSysSensitiveWordsService; |
| | | |
| | | /** |
| | | * 跳转到敏感词管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tSysSensitiveWords.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加敏感词管理 |
| | | */ |
| | | @RequestMapping("/tSysSensitiveWords_add") |
| | | public String tSysSensitiveWordsAdd() { |
| | | return PREFIX + "tSysSensitiveWords_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取敏感词管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime, |
| | | String content) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tSysSensitiveWordsService.getSensitiveWordList(page,beginTime,endTime,content)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增敏感词管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TSysSensitiveWords tSysSensitiveWords) { |
| | | tSysSensitiveWords.setCreateTime(new Date()); |
| | | tSysSensitiveWordsService.insert(tSysSensitiveWords); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除敏感词管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tSysSensitiveWordsId) { |
| | | tSysSensitiveWordsService.deleteById(tSysSensitiveWordsId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.*; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 用户管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-01 15:47:58 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tUser") |
| | | public class TUserController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tUser/"; |
| | | |
| | | @Autowired |
| | | private ITUserService tUserService; |
| | | |
| | | /** |
| | | * 跳转到用户管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tUser.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改用户管理 |
| | | */ |
| | | @RequestMapping("/tUser_userDetail/{tUserId}") |
| | | public String tUser_userDetail(@PathVariable Integer tUserId, Model model) { |
| | | Map<String,Object> tUser = tUserService.getUserDetailById(tUserId); |
| | | model.addAttribute("item",tUser); |
| | | return PREFIX + "tUser_userDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改用户余额页面 |
| | | */ |
| | | @RequestMapping("/tUser_updateBalance/{tUserId}") |
| | | public String tUser_updateBalance(@PathVariable Integer tUserId, Model model) { |
| | | model.addAttribute("tUserId",tUserId); |
| | | return PREFIX + "tUser_updateBalance.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改用户密码页面 |
| | | */ |
| | | @RequestMapping("/tUser_updatePassword/{tUserId}") |
| | | public String tUser_updatePassword(@PathVariable Integer tUserId, Model model) { |
| | | model.addAttribute("tUserId",tUserId); |
| | | return PREFIX + "tUser_updatePassword.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改用户状态页面 |
| | | */ |
| | | @RequestMapping("/tUser_optUser/{tUserId}/{optType}") |
| | | public String tUser_optUser(@PathVariable Integer tUserId,@PathVariable Integer optType, Model model) { |
| | | model.addAttribute("tUserId",tUserId); |
| | | model.addAttribute("optType",optType); |
| | | return PREFIX + "tUser_optUser.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String id, |
| | | String nickName, |
| | | String phone, |
| | | Integer isAuth, |
| | | Integer state,String companyName) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tUserService.getUserList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),isAuth,state,id,nickName,phone,companyName)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 修改余额操作 |
| | | */ |
| | | @RequestMapping(value = "/updateBalance") |
| | | @ResponseBody |
| | | public Object updateBalance(@RequestParam Integer tUserId, |
| | | @RequestParam Integer updateType, |
| | | @RequestParam BigDecimal money) { |
| | | TUser tUser = tUserService.selectById(tUserId); |
| | | if (SinataUtil.isNotEmpty(tUser)){ |
| | | if (1 == updateType.intValue()){ //增加 |
| | | tUser.setBalance(tUser.getBalance().add(money)); |
| | | }else if (2 == updateType.intValue()){ //减少 |
| | | if((tUser.getBalance().subtract(money)).compareTo(new BigDecimal(0)) == -1){ |
| | | tUser.setBalance(new BigDecimal(0)); |
| | | }else{ |
| | | tUser.setBalance(tUser.getBalance().subtract(money)); |
| | | } |
| | | } |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改密码操作 |
| | | */ |
| | | @RequestMapping(value = "/updatePassword") |
| | | @ResponseBody |
| | | public Object updatePassword(@RequestParam Integer tUserId, |
| | | @RequestParam String password) { |
| | | TUser tUser = tUserService.selectById(tUserId); |
| | | if (SinataUtil.isNotEmpty(tUser)){ |
| | | // tUser.setPassWord(MD5Util.encrypt(password)); |
| | | tUser.setPassWord(ShiroKit.md5(password, "&a.s")); |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 操作用户 |
| | | */ |
| | | @RequestMapping(value = "/optUser") |
| | | @ResponseBody |
| | | public Object optUser(@RequestParam Integer tUserId,@RequestParam Integer optType,@RequestParam String remark) { |
| | | TUser tUser = tUserService.selectById(tUserId); |
| | | if (SinataUtil.isNotEmpty(tUser)){ |
| | | if (1 == optType.intValue()){ //冻结 |
| | | tUser.setState(2); |
| | | tUser.setRemark(remark); |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("uid", tUser.getId().toString()); |
| | | String result = HttpRequestUtil.postRequest(PushURL.freeze_user_url, map); |
| | | System.out.println("冻结用户:【userId="+tUser.getId().toString()+"】,调用接口:"+result); |
| | | |
| | | }else if (2 == optType.intValue()){ //解冻 |
| | | tUser.setState(1); |
| | | tUser.setRemark(remark); |
| | | } |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 下载模板 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @RequestMapping(value = "/uploadUserModel") |
| | | public void uploadUserModel(HttpServletRequest request, HttpServletResponse response) { |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<List<String>>(); |
| | | |
| | | // 首行【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("昵称"); |
| | | shellList.add("手机号"); |
| | | shellList.add("生日[例如:1995-09-09]"); |
| | | shellList.add("性别[男/女]"); |
| | | shellList.add("紧急联系人[选填]"); |
| | | shellList.add("紧急联系电话[选填]"); |
| | | shellList.add("是否实名认证[是/否]"); |
| | | shellList.add("真实姓名"); |
| | | shellList.add("身份证号"); |
| | | shellList.add("余额"); |
| | | shellList.add("密码[6-18个长度]"); |
| | | dataList.add(shellList); |
| | | |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("平台导入用户模板"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "平台导入用户模板", dataList, request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导入操作 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value="/exportUser",method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public Object exportUser(HttpServletRequest request){ |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | MultipartFile file = (MultipartFile) multipartRequest.getFile("myfile"); |
| | | try { |
| | | //定时五秒后执行 |
| | | /*Map<String,Object> maps=new HashMap<>(); |
| | | Workbook book = WoUtil.ImportFile(file); |
| | | maps.put("book",book); |
| | | QuartzManager.addJob(AddContract.class, (AddContract.name+new Date().getTime()).toUpperCase(), TimeJobType.ADMIN,DateUtil.getDate_strYMdHms(new Date().getTime() + 1*1000) , maps);*/ |
| | | |
| | | Workbook book = WoUtil.ImportFile(file); |
| | | Sheet sh = book.getSheetAt(0); //获取到第一个表 |
| | | for (int i = 1; i <= sh.getLastRowNum(); i++) { |
| | | Row row = sh.getRow(i); |
| | | |
| | | Cell cell0 = row.getCell(0); //昵称 |
| | | String nickName = null; |
| | | if (SinataUtil.isNotEmpty(cell0)){ |
| | | nickName = String.valueOf(cell0.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell1 = row.getCell(1); //手机号 |
| | | String phone = null; |
| | | if (SinataUtil.isNotEmpty(cell1)){ |
| | | DataFormatter formatter = new DataFormatter(); |
| | | phone = formatter.formatCellValue(cell1); |
| | | } |
| | | |
| | | Cell cell2 = row.getCell(2); //生日[例如:1995-09-09] |
| | | String birthday = null; |
| | | if (SinataUtil.isNotEmpty(cell2)){ |
| | | DataFormatter formatter = new DataFormatter(); |
| | | birthday = formatter.formatCellValue(cell2); |
| | | } |
| | | |
| | | Cell cell3 = row.getCell(3); //性别[男/女] |
| | | String sex = null; |
| | | if (SinataUtil.isNotEmpty(cell3)){ |
| | | sex = String.valueOf(cell3.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell4 = row.getCell(4); //紧急联系人[选填] |
| | | String emergencyContact = null; |
| | | if (SinataUtil.isNotEmpty(cell4)){ |
| | | emergencyContact = String.valueOf(cell4.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell5 = row.getCell(5); //紧急联系电话[选填] |
| | | String emergencyContactNumber = null; |
| | | if (SinataUtil.isNotEmpty(cell5)){ |
| | | emergencyContactNumber = String.valueOf(cell5.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell6 = row.getCell(6); //是否实名认证[是/否] |
| | | String isAuth = null; |
| | | if (SinataUtil.isNotEmpty(cell6)){ |
| | | isAuth = String.valueOf(cell6.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell7 = row.getCell(7); //真实姓名 |
| | | String name = null; |
| | | if (SinataUtil.isNotEmpty(cell7)){ |
| | | name = String.valueOf(cell7.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell8 = row.getCell(8); //身份证号 |
| | | String idCard = null; |
| | | if (SinataUtil.isNotEmpty(cell8)){ |
| | | idCard = String.valueOf(cell8.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell9 = row.getCell(9); //余额 |
| | | String balance = null; |
| | | if (SinataUtil.isNotEmpty(cell9)){ |
| | | DataFormatter formatter = new DataFormatter(); |
| | | balance = formatter.formatCellValue(cell9); |
| | | } |
| | | |
| | | Cell cell10 = row.getCell(10); //密码 |
| | | String passWord = null; |
| | | if (SinataUtil.isNotEmpty(cell10)){ |
| | | DataFormatter formatter = new DataFormatter(); |
| | | passWord = formatter.formatCellValue(cell10); |
| | | } |
| | | |
| | | if (SinataUtil.isEmpty(nickName) || SinataUtil.isEmpty(phone) || SinataUtil.isEmpty(birthday) |
| | | || SinataUtil.isEmpty(sex) || SinataUtil.isEmpty(isAuth) || SinataUtil.isEmpty(balance) |
| | | || SinataUtil.isEmpty(passWord) ){ |
| | | return new ErrorTip(500, "单元格不能为空"); |
| | | }else{ |
| | | int count = tUserService.selectCount(new EntityWrapper<TUser>().eq("phone", phone).notIn("flag", 3)); |
| | | if (count > 0){ |
| | | return new ErrorTip(500, "手机号已存在,请重新填写"); |
| | | } |
| | | //判断性别 |
| | | if (!sex.equals("男") && !sex.equals("女")){ |
| | | return new ErrorTip(500, "性别内容不正确"); |
| | | } |
| | | //判断是否实名认证 |
| | | if (!isAuth.equals("是") && !isAuth.equals("否")){ |
| | | return new ErrorTip(500, "是否实名认证内容不正确"); |
| | | } |
| | | if ("是".equals(isAuth)){ |
| | | //判断紧急联系电话 |
| | | if (SinataUtil.isNotEmpty(emergencyContactNumber)){ |
| | | if (!isPhone(emergencyContactNumber)){ |
| | | return new ErrorTip(500, "紧急联系电话格式不正确"); |
| | | } |
| | | } |
| | | } |
| | | //判断生日格式 |
| | | try { |
| | | if (!isValidDate(birthday)) { |
| | | birthday = importByExcelForDate(birthday); |
| | | } |
| | | }catch (Exception e){ |
| | | return new ErrorTip(500, "年检到期时间格式不正确"); |
| | | } |
| | | //判断手机号 |
| | | if (!isPhone(phone)){ |
| | | return new ErrorTip(500, "手机号格式不正确"); |
| | | } |
| | | //判断余额 |
| | | if (!isDouble(balance)){ |
| | | return new ErrorTip(500, "余额格式不正确"); |
| | | } |
| | | //判断登录密码 |
| | | if (!isPassword(passWord)){ |
| | | return new ErrorTip(500, "登录密码格式不正确"); |
| | | } |
| | | TUser user = new TUser(); |
| | | TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).notIn("flag", 3).last(" limit 1")); |
| | | user.setCompanyId(company.getId()); |
| | | user.setPhone(phone); |
| | | user.setNickName(nickName); |
| | | user.setBirthday(DateUtil.parseDate(birthday)); |
| | | if (sex.equals("男")){ |
| | | user.setSex(1); |
| | | }else if (sex.equals("女")){ |
| | | user.setSex(2); |
| | | } |
| | | user.setEmergencyContact(emergencyContact); |
| | | user.setEmergencyContactNumber(emergencyContactNumber); |
| | | if ("是".equals(isAuth)){ |
| | | user.setIsAuth(2); |
| | | }else if ("否".equals(isAuth)){ |
| | | user.setIsAuth(1); |
| | | } |
| | | user.setName(name); |
| | | user.setIdCard(idCard); |
| | | user.setBalance(new BigDecimal(balance)); |
| | | user.setPassWord(ShiroKit.md5(passWord, "&a.s")); |
| | | user.setState(1); |
| | | user.setFlag("1"); |
| | | user.setInsertTime(new Date()); |
| | | user.setInsertUser(ShiroKit.getUser().getId()); |
| | | tUserService.insert(user); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | /** |
| | | * 判断日期是否满足yyyy-MM-dd格式 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isValidDate(String str) { |
| | | boolean convertSuccess=true; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | format.setLenient(false); |
| | | format.parse(str); |
| | | } catch (Exception e) { |
| | | convertSuccess=false; |
| | | } |
| | | return convertSuccess; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转换日期 |
| | | * @return |
| | | */ |
| | | public static String importByExcelForDate(String value) {//value就是它的天数 |
| | | String currentCellValue = ""; |
| | | if(value != null && !value.equals("")){ |
| | | Calendar calendar = new GregorianCalendar(1900,0,-1); |
| | | Date d = calendar.getTime(); |
| | | Date dd = DateUtils.addDays(d,Integer.valueOf(value)); |
| | | DateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); |
| | | currentCellValue = formater.format(dd); |
| | | } |
| | | return currentCellValue; |
| | | } |
| | | |
| | | /** |
| | | * 验证手机号格式是否正确 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isPhone(String str) { |
| | | try{ |
| | | String reg = "^1\\d{10}$"; |
| | | boolean flag = str.matches(reg); |
| | | return flag; |
| | | }catch(NumberFormatException e) { |
| | | System.out.println("异常:\"" + str + "\"..."); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证密码长度是否正确 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isPassword(String str) { |
| | | try{ |
| | | String reg = "^.{6,18}$"; |
| | | boolean flag = str.matches(reg); |
| | | return flag; |
| | | }catch(NumberFormatException e) { |
| | | System.out.println("异常:\"" + str + "\"..."); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证是否可以字符转为金额值 |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static boolean isDouble(String str) { |
| | | try{ |
| | | Double.parseDouble(str); |
| | | return true; |
| | | }catch(NumberFormatException e) { |
| | | System.out.println("异常:\"" + str + "\"不是数字/整数/小数..."); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出用户信息 |
| | | */ |
| | | @RequestMapping(value = "/outUser") |
| | | public void outUser(HttpServletRequest request, HttpServletResponse response) { |
| | | List<Map<String,Object>> listMap = tUserService.getUserListNoPage(ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId()); |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |
| | | |
| | | //第一行显示【封装】 |
| | | List<String> twoList = new ArrayList<String>(); |
| | | twoList.add("总计:"); |
| | | twoList.add(String.valueOf(listMap.size())+"条"); |
| | | dataList.add(twoList); |
| | | |
| | | // 列【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("注册时间"); |
| | | shellList.add("用户ID"); |
| | | shellList.add("注册地所属分公司"); |
| | | shellList.add("昵称"); |
| | | shellList.add("手机号"); |
| | | shellList.add("紧急联系人姓名"); |
| | | shellList.add("紧急联系人电话"); |
| | | shellList.add("是否实名认证"); |
| | | shellList.add("历史出行次数"); |
| | | shellList.add("历史消费"); |
| | | shellList.add("积分"); |
| | | shellList.add("备注"); |
| | | shellList.add("状态"); |
| | | dataList.add(shellList); |
| | | |
| | | for (Map<String,Object> object : listMap){ |
| | | // 详细数据列【封装】 |
| | | shellList = new ArrayList<String>(); |
| | | if(SinataUtil.isNotEmpty(object.get("insertTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("insertTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | shellList.add(String.valueOf(object.get("id"))); |
| | | if(SinataUtil.isNotEmpty(object.get("companyName"))){ |
| | | shellList.add(object.get("companyName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("nickName"))){ |
| | | shellList.add(object.get("nickName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("phone"))){ |
| | | shellList.add(object.get("phone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("emergencyContact"))){ |
| | | shellList.add(object.get("emergencyContact").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("emergencyContactNumber"))){ |
| | | shellList.add(object.get("emergencyContactNumber").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("isAuth"))){ |
| | | shellList.add(object.get("isAuth").toString().equals("是")?"是":"否"); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("historyNum"))){ |
| | | shellList.add(object.get("historyNum").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("consumptionNum"))){ |
| | | shellList.add(object.get("consumptionNum").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("integral"))){ |
| | | shellList.add(object.get("integral").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("remark"))){ |
| | | shellList.add(object.get("remark").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("state"))){ |
| | | shellList.add(Integer.valueOf(object.get("state").toString()) == 1?"正常":"冻结"); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | dataList.add(shellList); |
| | | } |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("用户信息导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "用户信息导出记录", dataList,request, response); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TUserRedPacketRecord; |
| | | import com.stylefeng.guns.modular.system.service.ITUserRedPacketRecordService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-07-10 15:33:49 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tUserRedPacketRecord") |
| | | public class TUserRedPacketRecordController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tUserRedPacketRecord/"; |
| | | |
| | | @Autowired |
| | | private ITUserRedPacketRecordService tUserRedPacketRecordService; |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model,Integer couponActivityId) { |
| | | model.addAttribute("couponActivityId",couponActivityId); |
| | | return PREFIX + "tUserRedPacketRecord.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/tUserRedPacketRecord_add") |
| | | public String tUserRedPacketRecordAdd() { |
| | | return PREFIX + "tUserRedPacketRecord_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tUserRedPacketRecord_update/{tUserRedPacketRecordId}") |
| | | public String tUserRedPacketRecordUpdate(@PathVariable Integer tUserRedPacketRecordId, Model model) { |
| | | TUserRedPacketRecord tUserRedPacketRecord = tUserRedPacketRecordService.selectById(tUserRedPacketRecordId); |
| | | model.addAttribute("item",tUserRedPacketRecord); |
| | | LogObjectHolder.me().set(tUserRedPacketRecord); |
| | | return PREFIX + "tUserRedPacketRecord_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,String userName,String userPhone,Integer couponActivityId,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(userCouponRecordService.getRedList(page,beginTime,endTime,userName,userPhone,couponActivityId,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TUserRedPacketRecord tUserRedPacketRecord) { |
| | | tUserRedPacketRecordService.insert(tUserRedPacketRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tUserRedPacketRecordId) { |
| | | tUserRedPacketRecordService.deleteById(tUserRedPacketRecordId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TUserRedPacketRecord tUserRedPacketRecord) { |
| | | tUserRedPacketRecordService.updateById(tUserRedPacketRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tUserRedPacketRecordId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tUserRedPacketRecordId") Integer tUserRedPacketRecordId) { |
| | | return tUserRedPacketRecordService.selectById(tUserRedPacketRecordId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TVerified; |
| | | import com.stylefeng.guns.modular.system.service.ITVerifiedService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 实名认证列表控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-09 08:46:44 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tVerified") |
| | | public class TVerifiedController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tVerified/"; |
| | | |
| | | @Autowired |
| | | private ITVerifiedService tVerifiedService; |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService tSystemNoticeService; |
| | | |
| | | @Autowired |
| | | private ITUserService tUserService; |
| | | |
| | | /** |
| | | * 跳转到实名认证列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tVerified.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加实名认证列表 |
| | | */ |
| | | @RequestMapping("/tVerified_add") |
| | | public String tVerifiedAdd() { |
| | | return PREFIX + "tVerified_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改实名认证列表 |
| | | */ |
| | | @RequestMapping("/tVerified_immediately/{tVerifiedId}") |
| | | public String tVerifiedUpdate(@PathVariable Integer tVerifiedId, Model model) { |
| | | model.addAttribute("tVerifiedId",tVerifiedId); |
| | | return PREFIX + "tVerified_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取实名认证列表列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String userName, |
| | | String userPhone, |
| | | String name, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tVerifiedService.getVerifiedList(page,beginTime,endTime,userName,userPhone,name,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 立即审核操作 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam Integer state) { |
| | | if (SinataUtil.isNotEmpty(id) && SinataUtil.isNotEmpty(state)){ |
| | | TVerified tVerified = tVerifiedService.selectById(id); |
| | | tVerified.setState(state); |
| | | tVerifiedService.updateById(tVerified); |
| | | |
| | | //增加系统消息 |
| | | /*TSystemNotice notice = new TSystemNotice(); |
| | | notice.setType(2); |
| | | notice.setUserType(2); //todo |
| | | if (2 == state){ |
| | | notice.setContent("实名认证处理结果:【您的实名认证申请已通过审核】。"); |
| | | }else if (3 == state){ |
| | | notice.setContent("实名认证处理结果:【您的实名认证申请未通过审核】。"); |
| | | } |
| | | notice.setUserId(tVerified.getUserId()); |
| | | notice.setInsertTime(new Date()); |
| | | notice.setRead(1); |
| | | tSystemNoticeService.insert(notice);*/ |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除实名认证列表 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tVerifiedId) { |
| | | tVerifiedService.deleteById(tVerifiedId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.TPubWithdrawal; |
| | | import com.stylefeng.guns.modular.system.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.modular.system.model.TVersionManagement; |
| | | import com.stylefeng.guns.modular.system.service.ITVersionManagementService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 版本管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-10 18:43:26 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tVersionManagement") |
| | | public class TVersionManagementController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tVersionManagement/"; |
| | | |
| | | @Autowired |
| | | private ITVersionManagementService tVersionManagementService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | /** |
| | | * 跳转到版本管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tVersionManagement.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}/{type}") |
| | | public String lookDetail(@PathVariable Integer id, @PathVariable Integer type, Model model) { |
| | | TVersionManagement tVersionManagement = tVersionManagementService.selectById(id); |
| | | String str = ""; |
| | | if (1 == type){ |
| | | str = tVersionManagement.getContent(); |
| | | } |
| | | model.addAttribute("str",str); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加版本管理 |
| | | */ |
| | | @RequestMapping("/tVersionManagement_add") |
| | | public String tVersionManagementAdd() { |
| | | return PREFIX + "tVersionManagement_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改版本管理 |
| | | */ |
| | | @RequestMapping("/tVersionManagement_update/{tVersionManagementId}") |
| | | public String tVersionManagementUpdate(@PathVariable Integer tVersionManagementId, Model model) { |
| | | TVersionManagement tVersionManagement = tVersionManagementService.selectById(tVersionManagementId); |
| | | model.addAttribute("item",tVersionManagement); |
| | | LogObjectHolder.me().set(tVersionManagement); |
| | | return PREFIX + "tVersionManagement_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取版本管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String version) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tVersionManagementService.getVersionList(page,beginTime,endTime,version)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | /** |
| | | * 异步上传包 |
| | | * @param myfile |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/saveApk") |
| | | public Map<String, Object> saveApk(@RequestPart("myfile") MultipartFile myfile, HttpServletRequest request){ |
| | | Map<String, Object> m = new HashMap<>(); |
| | | /*try { |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(file.getOriginalFilename()); |
| | | try { |
| | | String fileSavePath = gunsProperties.getFileUploadPath()+"apk\\"; |
| | | file.transferTo(new File(fileSavePath + pictureName)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | m.put("imgUrl", gunsProperties.getPictureServerAddress()+"apk/"+pictureName); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }*/ |
| | | try { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | MultipartFile file = (MultipartFile) myfile; |
| | | |
| | | String pictureName = OssUploadUtil.ossUpload(request, file); |
| | | m.put("imgUrl", pictureName); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return m; |
| | | } |
| | | |
| | | /** |
| | | * 新增版本管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TVersionManagement tVersionManagement) { |
| | | //判断版本号是否相同 |
| | | int count = tVersionManagementService.selectCount( |
| | | new EntityWrapper<TVersionManagement>() |
| | | .eq("version", tVersionManagement.getVersion()) |
| | | .eq("type", tVersionManagement.getType())); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | |
| | | tVersionManagement.setInsertTime(new Date()); |
| | | tVersionManagementService.insert(tVersionManagement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除版本管理 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tVersionManagementId) { |
| | | tVersionManagementService.deleteById(tVersionManagementId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改版本管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TVersionManagement tVersionManagement) { |
| | | int count = tVersionManagementService.selectCount( |
| | | new EntityWrapper<TVersionManagement>() |
| | | .eq("version", tVersionManagement.getVersion()) |
| | | .eq("type", tVersionManagement.getType())); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | tVersionManagementService.updateById(tVersionManagement); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 版本管理详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tVersionManagementId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tVersionManagementId") Integer tVersionManagementId) { |
| | | return tVersionManagementService.selectById(tVersionManagementId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.UserActivityBalance; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityBalanceService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-19 14:32:36 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userActivityBalance") |
| | | public class UserActivityBalanceController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userActivityBalance/"; |
| | | |
| | | @Autowired |
| | | private IUserActivityBalanceService userActivityBalanceService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "userActivityBalance.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userActivityBalance_add") |
| | | public String userActivityBalanceAdd() { |
| | | return PREFIX + "userActivityBalance_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userActivityBalance_update/{userActivityBalanceId}") |
| | | public String userActivityBalanceUpdate(@PathVariable Integer userActivityBalanceId, Model model) { |
| | | UserActivityBalance userActivityBalance = userActivityBalanceService.selectById(userActivityBalanceId); |
| | | model.addAttribute("item",userActivityBalance); |
| | | LogObjectHolder.me().set(userActivityBalance); |
| | | return PREFIX + "userActivityBalance_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return userActivityBalanceService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(UserActivityBalance userActivityBalance) { |
| | | userActivityBalanceService.insert(userActivityBalance); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userActivityBalanceId) { |
| | | userActivityBalanceService.deleteById(userActivityBalanceId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(UserActivityBalance userActivityBalance) { |
| | | userActivityBalanceService.updateById(userActivityBalance); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{userActivityBalanceId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("userActivityBalanceId") Integer userActivityBalanceId) { |
| | | return userActivityBalanceService.selectById(userActivityBalanceId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.page.PageInfoBT; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-19 14:32:29 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userActivity") |
| | | public class UserActivityController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userActivity/"; |
| | | |
| | | @Autowired |
| | | private IUserActivityService userActivityService; |
| | | |
| | | @Autowired |
| | | private IUserActivityBalanceService userActivityBalanceService; |
| | | |
| | | @Autowired |
| | | private IUserActivityDiscount1Service userActivityDiscount1Service; |
| | | |
| | | @Autowired |
| | | private IUserActivityInviteService userActivityInviteService; |
| | | |
| | | @Autowired |
| | | private IUserActivityRedenvelopeService userActivityRedenvelopeService; |
| | | |
| | | @Autowired |
| | | private IUserActivityRegisteredService userActivityRegisteredService; |
| | | |
| | | @Autowired |
| | | private ISysCouponRecordService sysCouponRecordService; |
| | | |
| | | @Autowired |
| | | private ISysRedPacketRecordService sysRedPacketRecordService; |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | @Autowired |
| | | private ITUserRedPacketRecordService redPacketRecordService; |
| | | |
| | | /** |
| | | * 跳转领取统计 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/receiveRecord") |
| | | public String receiveRecord(Model model,Integer activityId){ |
| | | model.addAttribute("activityId",activityId); |
| | | UserActivity userActivity = userActivityService.selectById(activityId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("startTime", sdf.format(userActivity.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(userActivity.getEndTime())); |
| | | UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectOne(new EntityWrapper<UserActivityRegistered>().eq("userActivityId",activityId)); |
| | | UserActivityInvite userActivityInvite = userActivityInviteService.selectOne(new EntityWrapper<UserActivityInvite>().eq("userActivityId",activityId)); |
| | | UserActivityDiscount1 userActivityDiscount1 = userActivityDiscount1Service.selectOne(new EntityWrapper<UserActivityDiscount1>().eq("userActivityId",activityId)); |
| | | UserActivityRedenvelope userActivityRedenvelope = userActivityRedenvelopeService.selectOne(new EntityWrapper<UserActivityRedenvelope>().eq("userActivityId",activityId)); |
| | | if(SinataUtil.isNotEmpty(userActivityRegistered)){ |
| | | model.addAttribute("userActivityRegisteredId",userActivityRegistered.getId()); |
| | | }else{ |
| | | model.addAttribute("userActivityRegisteredId",0); |
| | | } |
| | | if(SinataUtil.isNotEmpty(userActivityInvite)){ |
| | | model.addAttribute("userActivityInviteId",userActivityInvite.getId()); |
| | | }else{ |
| | | model.addAttribute("userActivityInviteId",0); |
| | | } |
| | | if(SinataUtil.isNotEmpty(userActivityDiscount1)){ |
| | | model.addAttribute("userActivityDiscount1Id",userActivityDiscount1.getId()); |
| | | }else{ |
| | | model.addAttribute("userActivityDiscount1Id",0); |
| | | } |
| | | if(SinataUtil.isNotEmpty(userActivityRedenvelope)){ |
| | | model.addAttribute("userActivityRedenvelopeId",userActivityRedenvelope.getId()); |
| | | }else{ |
| | | model.addAttribute("userActivityRedenvelopeId",0); |
| | | } |
| | | return PREFIX + "receiveRecord.html"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/receiveRecordDetail") |
| | | @ResponseBody |
| | | public Object receiveRecordDetail(String createTime,Integer activityId) { |
| | | String startTimes = null; |
| | | String endTimes = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | startTimes = timeArray[0]; |
| | | endTimes = timeArray[1]; |
| | | }else{ |
| | | UserActivity userActivity = userActivityService.selectById(activityId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | startTimes=sdf.format(userActivity.getStartTime()); |
| | | endTimes=sdf.format(userActivity.getEndTime()); |
| | | } |
| | | Map<String,Object> map = new HashMap<>(); |
| | | Double totalMOney=0d; |
| | | UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectOne(new EntityWrapper<UserActivityRegistered>().eq("userActivityId",activityId)); |
| | | UserActivityInvite userActivityInvite = userActivityInviteService.selectOne(new EntityWrapper<UserActivityInvite>().eq("userActivityId",activityId)); |
| | | UserActivityDiscount1 userActivityDiscount1 = userActivityDiscount1Service.selectOne(new EntityWrapper<UserActivityDiscount1>().eq("userActivityId",activityId)); |
| | | UserActivityRedenvelope userActivityRedenvelope = userActivityRedenvelopeService.selectOne(new EntityWrapper<UserActivityRedenvelope>().eq("userActivityId",activityId)); |
| | | if(SinataUtil.isNotEmpty(userActivityRegistered)){ |
| | | Map<String,Object> resultMap = userCouponRecordService.getCouponStatic(startTimes,endTimes,userActivityRegistered.getId(),2); |
| | | totalMOney+=Double.parseDouble(resultMap.get("money").toString()); |
| | | map.put("userActivityRegisteredMoney",resultMap.get("money")); |
| | | map.put("userActivityRegisteredNumber",resultMap.get("number")); |
| | | map.put("userActivityRegisteredUseMoney",resultMap.get("useMoney")); |
| | | }else{ |
| | | map.put("userActivityRegisteredMoney",0); |
| | | map.put("userActivityRegisteredNumber",0); |
| | | map.put("userActivityRegisteredUseMoney",0); |
| | | } |
| | | if(SinataUtil.isNotEmpty(userActivityInvite)){ |
| | | Map<String,Object> resultMap = userCouponRecordService.getCouponStatic(startTimes,endTimes,userActivityInvite.getId(),3); |
| | | totalMOney+=Double.parseDouble(resultMap.get("money").toString()); |
| | | map.put("userActivityInviteMoney",resultMap.get("money")); |
| | | map.put("userActivityInviteNumber",resultMap.get("number")); |
| | | map.put("userActivityInviteUseMoney",resultMap.get("useMoney")); |
| | | }else{ |
| | | map.put("userActivityInviteMoney",0); |
| | | map.put("userActivityInviteNumber",0); |
| | | map.put("userActivityInviteUseMoney",0); |
| | | } |
| | | if(SinataUtil.isNotEmpty(userActivityDiscount1)){ |
| | | Map<String,Object> resultMap = userCouponRecordService.getDiscountStatic(startTimes,endTimes,userActivityDiscount1.getId()); |
| | | map.put("userActivityDiscount1Money",resultMap.get("money")); |
| | | map.put("userActivityDiscount1Number",resultMap.get("number")); |
| | | }else{ |
| | | map.put("userActivityDiscount1Money",0); |
| | | map.put("userActivityDiscount1Number",0); |
| | | } |
| | | if(SinataUtil.isNotEmpty(userActivityRedenvelope)){ |
| | | Map<String,Object> resultMap = userCouponRecordService.getRedStatic(startTimes,endTimes,userActivityRedenvelope.getId()); |
| | | totalMOney+=Double.parseDouble(resultMap.get("money").toString()); |
| | | map.put("userActivityRedenvelopeMoney",resultMap.get("money")); |
| | | map.put("userActivityRedenvelopeNumber",resultMap.get("number")); |
| | | map.put("userActivityRedenvelopeUseMoney",resultMap.get("useMoney")); |
| | | }else{ |
| | | map.put("userActivityRedenvelopeMoney",0); |
| | | map.put("userActivityRedenvelopeNumber",0); |
| | | map.put("userActivityRedenvelopeUseMoney",0); |
| | | } |
| | | Map<String,Object> resultMap = userCouponRecordService.getRegStatic(startTimes,endTimes,activityId); |
| | | |
| | | totalMOney+=Double.parseDouble(resultMap.get("money").toString()); |
| | | map.put("totalMOney",totalMOney); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "userActivity.html"; |
| | | } |
| | | /** |
| | | * 跳转添加注册送优惠券页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("addRegist") |
| | | public String addRegist() { |
| | | return PREFIX + "addRegist.html"; |
| | | } |
| | | /** |
| | | * 跳转红包选择页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/sysRedPacketRecord") |
| | | public String sysRedPacketRecord() { |
| | | return PREFIX + "sysRedPacketRecord.html"; |
| | | } |
| | | /** |
| | | * 跳转到选择优惠券页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/sysCouponRecord") |
| | | public String sysCouponRecord() { |
| | | return PREFIX + "sysCouponRecord.html"; |
| | | } |
| | | |
| | | @RequestMapping("/sysCouponRecord1") |
| | | public String sysCouponRecord1() { |
| | | return PREFIX + "sysCouponRecord1.html"; |
| | | } |
| | | @RequestMapping("/sysCouponRecord2") |
| | | public String sysCouponRecord2(Model model,Integer type) { |
| | | model.addAttribute("type",type); |
| | | return PREFIX + "sysCouponRecord2.html"; |
| | | } |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userActivity_add") |
| | | public String userActivityAdd() { |
| | | return PREFIX + "userActivity_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userActivity_update/{userActivityId}") |
| | | public String userActivityUpdate(@PathVariable Integer userActivityId, Model model) { |
| | | UserActivity userActivity = userActivityService.selectById(userActivityId); |
| | | model.addAttribute("item",userActivity); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | model.addAttribute("startTime", sdf.format(userActivity.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(userActivity.getEndTime())); |
| | | UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectOne(new EntityWrapper<UserActivityRegistered>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("item1",userActivityRegistered); |
| | | if(userActivityRegistered!=null){ |
| | | model.addAttribute("item1Coupon",sysCouponRecordService.selectById(userActivityRegistered.getCouponId())); |
| | | } |
| | | UserActivityInvite userActivityInvite = userActivityInviteService.selectOne(new EntityWrapper<UserActivityInvite>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("item2",userActivityInvite); |
| | | if(userActivityInvite!=null){ |
| | | model.addAttribute("item2Coupon",sysCouponRecordService.selectById(userActivityInvite.getCouponId())); |
| | | } |
| | | List<UserActivityBalance> balanceInfoList = userActivityBalanceService.selectList(new EntityWrapper<UserActivityBalance>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("balanceInfoList",balanceInfoList); |
| | | model.addAttribute("item4",userActivityDiscount1Service.selectOne(new EntityWrapper<UserActivityDiscount1>().eq("userActivityId",userActivity.getId()))); |
| | | UserActivityRedenvelope userActivityRedenvelope = userActivityRedenvelopeService.selectOne(new EntityWrapper<UserActivityRedenvelope>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("item5",userActivityRedenvelope); |
| | | if(userActivityRedenvelope!=null){ |
| | | model.addAttribute("item5Red",sysRedPacketRecordService.selectById(userActivityRedenvelope.getRedEnvelopeId())); |
| | | } |
| | | LogObjectHolder.me().set(userActivity); |
| | | return PREFIX + "userActivity_edit.html"; |
| | | } |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/blanceList") |
| | | @ResponseBody |
| | | public Object blanceList(String createTime,Integer activityId) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(userCouponRecordService.getBlanceList(page,beginTime,endTime,activityId)); |
| | | return super.packForBT(page); |
| | | } |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,String name,Integer status, Integer offset, Integer limit) { |
| | | Date startTimes = null; |
| | | Date endTimes = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | startTimes = DateUtil.getDate_str3(timeArray[0]+" 00:00:00"); |
| | | endTimes = DateUtil.getDate_str3(timeArray[1]+" 23:59:59"); |
| | | } |
| | | Integer uid = ShiroKit.getUser().getId(); |
| | | return userActivityService.queryUserActivityList(uid, startTimes, endTimes, name, status, offset, limit); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param name 活动时间 |
| | | * @param startTime 时间区间 |
| | | * @param registCouponId 注册活动-优惠券id |
| | | * @param registEnable 注册活动-是否启动(1=不启动,2=启动) |
| | | * @param registNumber 注册活动-优惠券数量 |
| | | * @param registEffective 注册活动-优惠券有效期 |
| | | * @param inviteCouponId 邀请活动-优惠券id |
| | | * @param inviteEnable 邀请活动-是否启动(1=不启动,2=启动) |
| | | * @param inviteNumber 邀请活动-优惠券数量 |
| | | * @param inviteEffective 邀请活动-优惠券有效期 |
| | | * @param balanceEnable 充值活动-是否启动(1=不启动,2=启动) |
| | | * @param balanceInfo 充值活动-详情 |
| | | * @param discountEnable 折扣活动-是否启动(1=不启动,2=启动) |
| | | * @param discountSpecial 折扣活动-专车 |
| | | * @param discountTaxi 折扣活动-出租车 |
| | | * @param discountLogistics 折扣活动-小件物流 |
| | | * @param redenvelopeId -红包活动-红包id |
| | | * @param redenvelopeEnable 红包活动-是否启动(1=不启动,2=启动) |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(String name,String startTime,Integer registCouponId, |
| | | Integer registEnable,Integer registNumber,Integer registEffective, |
| | | Integer inviteCouponId,Integer inviteEnable,Integer inviteNumber,Integer inviteEffective, |
| | | Integer balanceEnable,String balanceInfo, |
| | | Integer discountEnable,Double discountSpecial,Double discountTaxi,Double discountLogistics, |
| | | Integer redenvelopeId,Integer redenvelopeEnable, Double registerPrice, Double invitationPrice, Double redPrice) { |
| | | userActivityService.insertOrUpdate(null,name,startTime, registCouponId, |
| | | registEnable, registNumber, registEffective, |
| | | inviteCouponId, inviteEnable, inviteNumber, inviteEffective, |
| | | balanceEnable, balanceInfo, |
| | | discountEnable, discountSpecial, discountTaxi, discountLogistics, |
| | | redenvelopeId, redenvelopeEnable, registerPrice, invitationPrice, redPrice); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userActivityId) { |
| | | userActivityService.deleteById(userActivityId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param name 活动时间 |
| | | * @param startTime 时间区间 |
| | | * @param registCouponId 注册活动-优惠券id |
| | | * @param registEnable 注册活动-是否启动(1=不启动,2=启动) |
| | | * @param registNumber 注册活动-优惠券数量 |
| | | * @param registEffective 注册活动-优惠券有效期 |
| | | * @param inviteCouponId 邀请活动-优惠券id |
| | | * @param inviteEnable 邀请活动-是否启动(1=不启动,2=启动) |
| | | * @param inviteNumber 邀请活动-优惠券数量 |
| | | * @param inviteEffective 邀请活动-优惠券有效期 |
| | | * @param balanceEnable 充值活动-是否启动(1=不启动,2=启动) |
| | | * @param balanceInfo 充值活动-详情 |
| | | * @param discountEnable 折扣活动-是否启动(1=不启动,2=启动) |
| | | * @param discountSpecial 折扣活动-专车 |
| | | * @param discountTaxi 折扣活动-出租车 |
| | | * @param discountLogistics 折扣活动-小件物流 |
| | | * @param redenvelopeId -红包活动-红包id |
| | | * @param redenvelopeEnable 红包活动-是否启动(1=不启动,2=启动) |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(Integer id,String name,String startTime,Integer registCouponId, |
| | | Integer registEnable,Integer registNumber,Integer registEffective, |
| | | Integer inviteCouponId,Integer inviteEnable,Integer inviteNumber,Integer inviteEffective, |
| | | Integer balanceEnable,String balanceInfo, |
| | | Integer discountEnable,Double discountSpecial,Double discountTaxi,Double discountLogistics, |
| | | Integer redenvelopeId,Integer redenvelopeEnable, Double registerPrice, Double invitationPrice, Double redPrice) { |
| | | userActivityService.insertOrUpdate(id,name,startTime, registCouponId, |
| | | registEnable, registNumber, registEffective, |
| | | inviteCouponId, inviteEnable, inviteNumber, inviteEffective, |
| | | balanceEnable, balanceInfo, |
| | | discountEnable, discountSpecial, discountTaxi, discountLogistics, |
| | | redenvelopeId, redenvelopeEnable, registerPrice, invitationPrice, redPrice); |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 修改状态 |
| | | * @param driverActivity |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/updateStatus") |
| | | @ResponseBody |
| | | public Object updateStatus(UserActivity driverActivity) { |
| | | userActivityService.updateById(driverActivity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/userActivity_detail/{userActivityId}") |
| | | public Object detail(@PathVariable("userActivityId") Integer userActivityId,Model model) { |
| | | UserActivity userActivity = userActivityService.selectById(userActivityId); |
| | | model.addAttribute("item",userActivity); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | model.addAttribute("startTime", sdf.format(userActivity.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(userActivity.getEndTime())); |
| | | UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectOne(new EntityWrapper<UserActivityRegistered>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("item1",userActivityRegistered); |
| | | if(userActivityRegistered!=null){ |
| | | model.addAttribute("item1Coupon",sysCouponRecordService.selectById(userActivityRegistered.getCouponId())); |
| | | } |
| | | UserActivityInvite userActivityInvite = userActivityInviteService.selectOne(new EntityWrapper<UserActivityInvite>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("item2",userActivityInvite); |
| | | if(userActivityInvite!=null){ |
| | | model.addAttribute("item2Coupon",sysCouponRecordService.selectById(userActivityInvite.getCouponId())); |
| | | } |
| | | List<UserActivityBalance> balanceInfoList = userActivityBalanceService.selectList(new EntityWrapper<UserActivityBalance>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("balanceInfoList",balanceInfoList); |
| | | model.addAttribute("item4",userActivityDiscount1Service.selectOne(new EntityWrapper<UserActivityDiscount1>().eq("userActivityId",userActivity.getId()))); |
| | | UserActivityRedenvelope userActivityRedenvelope = userActivityRedenvelopeService.selectOne(new EntityWrapper<UserActivityRedenvelope>().eq("userActivityId",userActivity.getId())); |
| | | model.addAttribute("item5",userActivityRedenvelope); |
| | | if(userActivityRedenvelope!=null){ |
| | | model.addAttribute("item5Red",sysRedPacketRecordService.selectById(userActivityRedenvelope.getRedEnvelopeId())); |
| | | } |
| | | return PREFIX + "userActivity_detail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到立即处理页面 |
| | | */ |
| | | @RequestMapping("/userActivity_immediately/{id}") |
| | | public String userActivityImmediately(@PathVariable Integer id, Model model) { |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "userActivity_immediately.html"; |
| | | } |
| | | /** |
| | | * 立即处理操作 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) { |
| | | UserActivity userActivity = userActivityService.selectById(id); |
| | | if (SinataUtil.isNotEmpty(userActivity)){ |
| | | userActivity.setStatus(state); |
| | | userActivity.setRemark(remark); |
| | | userActivityService.updateById(userActivity); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.UserActivityDiscount1; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityDiscount1Service; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-19 14:32:41 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userActivityDiscount1") |
| | | public class UserActivityDiscount1Controller extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userActivityDiscount1/"; |
| | | |
| | | @Autowired |
| | | private IUserActivityDiscount1Service userActivityDiscount1Service; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "userActivityDiscount1.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userActivityDiscount1_add") |
| | | public String userActivityDiscount1Add() { |
| | | return PREFIX + "userActivityDiscount1_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userActivityDiscount1_update/{userActivityDiscount1Id}") |
| | | public String userActivityDiscount1Update(@PathVariable Integer userActivityDiscount1Id, Model model) { |
| | | UserActivityDiscount1 userActivityDiscount1 = userActivityDiscount1Service.selectById(userActivityDiscount1Id); |
| | | model.addAttribute("item",userActivityDiscount1); |
| | | LogObjectHolder.me().set(userActivityDiscount1); |
| | | return PREFIX + "userActivityDiscount1_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return userActivityDiscount1Service.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(UserActivityDiscount1 userActivityDiscount1) { |
| | | userActivityDiscount1Service.insert(userActivityDiscount1); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userActivityDiscount1Id) { |
| | | userActivityDiscount1Service.deleteById(userActivityDiscount1Id); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(UserActivityDiscount1 userActivityDiscount1) { |
| | | userActivityDiscount1Service.updateById(userActivityDiscount1); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{userActivityDiscount1Id}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("userActivityDiscount1Id") Integer userActivityDiscount1Id) { |
| | | return userActivityDiscount1Service.selectById(userActivityDiscount1Id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.UserActivityDiscount2; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityDiscount2Service; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-19 14:32:46 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userActivityDiscount2") |
| | | public class UserActivityDiscount2Controller extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userActivityDiscount2/"; |
| | | |
| | | @Autowired |
| | | private IUserActivityDiscount2Service userActivityDiscount2Service; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "userActivityDiscount2.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userActivityDiscount2_add") |
| | | public String userActivityDiscount2Add() { |
| | | return PREFIX + "userActivityDiscount2_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userActivityDiscount2_update/{userActivityDiscount2Id}") |
| | | public String userActivityDiscount2Update(@PathVariable Integer userActivityDiscount2Id, Model model) { |
| | | UserActivityDiscount2 userActivityDiscount2 = userActivityDiscount2Service.selectById(userActivityDiscount2Id); |
| | | model.addAttribute("item",userActivityDiscount2); |
| | | LogObjectHolder.me().set(userActivityDiscount2); |
| | | return PREFIX + "userActivityDiscount2_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return userActivityDiscount2Service.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(UserActivityDiscount2 userActivityDiscount2) { |
| | | userActivityDiscount2Service.insert(userActivityDiscount2); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userActivityDiscount2Id) { |
| | | userActivityDiscount2Service.deleteById(userActivityDiscount2Id); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(UserActivityDiscount2 userActivityDiscount2) { |
| | | userActivityDiscount2Service.updateById(userActivityDiscount2); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{userActivityDiscount2Id}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("userActivityDiscount2Id") Integer userActivityDiscount2Id) { |
| | | return userActivityDiscount2Service.selectById(userActivityDiscount2Id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.UserActivityInvite; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityInviteService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-19 14:32:57 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userActivityInvite") |
| | | public class UserActivityInviteController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userActivityInvite/"; |
| | | |
| | | @Autowired |
| | | private IUserActivityInviteService userActivityInviteService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "userActivityInvite.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userActivityInvite_add") |
| | | public String userActivityInviteAdd() { |
| | | return PREFIX + "userActivityInvite_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userActivityInvite_update/{userActivityInviteId}") |
| | | public String userActivityInviteUpdate(@PathVariable Integer userActivityInviteId, Model model) { |
| | | UserActivityInvite userActivityInvite = userActivityInviteService.selectById(userActivityInviteId); |
| | | model.addAttribute("item",userActivityInvite); |
| | | LogObjectHolder.me().set(userActivityInvite); |
| | | return PREFIX + "userActivityInvite_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return userActivityInviteService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(UserActivityInvite userActivityInvite) { |
| | | userActivityInviteService.insert(userActivityInvite); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userActivityInviteId) { |
| | | userActivityInviteService.deleteById(userActivityInviteId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(UserActivityInvite userActivityInvite) { |
| | | userActivityInviteService.updateById(userActivityInvite); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{userActivityInviteId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("userActivityInviteId") Integer userActivityInviteId) { |
| | | return userActivityInviteService.selectById(userActivityInviteId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.UserActivityRedenvelope; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityRedenvelopeService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-19 14:33:03 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userActivityRedenvelope") |
| | | public class UserActivityRedenvelopeController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userActivityRedenvelope/"; |
| | | |
| | | @Autowired |
| | | private IUserActivityRedenvelopeService userActivityRedenvelopeService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "userActivityRedenvelope.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userActivityRedenvelope_add") |
| | | public String userActivityRedenvelopeAdd() { |
| | | return PREFIX + "userActivityRedenvelope_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userActivityRedenvelope_update/{userActivityRedenvelopeId}") |
| | | public String userActivityRedenvelopeUpdate(@PathVariable Integer userActivityRedenvelopeId, Model model) { |
| | | UserActivityRedenvelope userActivityRedenvelope = userActivityRedenvelopeService.selectById(userActivityRedenvelopeId); |
| | | model.addAttribute("item",userActivityRedenvelope); |
| | | LogObjectHolder.me().set(userActivityRedenvelope); |
| | | return PREFIX + "userActivityRedenvelope_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return userActivityRedenvelopeService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(UserActivityRedenvelope userActivityRedenvelope) { |
| | | userActivityRedenvelopeService.insert(userActivityRedenvelope); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userActivityRedenvelopeId) { |
| | | userActivityRedenvelopeService.deleteById(userActivityRedenvelopeId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(UserActivityRedenvelope userActivityRedenvelope) { |
| | | userActivityRedenvelopeService.updateById(userActivityRedenvelope); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{userActivityRedenvelopeId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("userActivityRedenvelopeId") Integer userActivityRedenvelopeId) { |
| | | return userActivityRedenvelopeService.selectById(userActivityRedenvelopeId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.UserActivityRegistered; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityRegisteredService; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-19 14:33:09 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userActivityRegistered") |
| | | public class UserActivityRegisteredController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userActivityRegistered/"; |
| | | |
| | | @Autowired |
| | | private IUserActivityRegisteredService userActivityRegisteredService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "userActivityRegistered.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userActivityRegistered_add") |
| | | public String userActivityRegisteredAdd() { |
| | | return PREFIX + "userActivityRegistered_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userActivityRegistered_update/{userActivityRegisteredId}") |
| | | public String userActivityRegisteredUpdate(@PathVariable Integer userActivityRegisteredId, Model model) { |
| | | UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectById(userActivityRegisteredId); |
| | | model.addAttribute("item",userActivityRegistered); |
| | | LogObjectHolder.me().set(userActivityRegistered); |
| | | return PREFIX + "userActivityRegistered_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | return userActivityRegisteredService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(UserActivityRegistered userActivityRegistered) { |
| | | userActivityRegisteredService.insert(userActivityRegistered); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userActivityRegisteredId) { |
| | | userActivityRegisteredService.deleteById(userActivityRegisteredId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(UserActivityRegistered userActivityRegistered) { |
| | | userActivityRegisteredService.updateById(userActivityRegistered); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{userActivityRegisteredId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("userActivityRegisteredId") Integer userActivityRegisteredId) { |
| | | return userActivityRegisteredService.selectById(userActivityRegisteredId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.UserCouponRecord; |
| | | import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-06-17 09:15:18 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/userCouponRecord") |
| | | public class UserCouponRecordController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/userCouponRecord/"; |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index( Model model,Integer couponActivityId,Integer activityType) { |
| | | model.addAttribute("activityType",activityType); |
| | | model.addAttribute("couponActivityId",couponActivityId); |
| | | return PREFIX + "userCouponRecord.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/userCouponRecord_add") |
| | | public String userCouponRecordAdd() { |
| | | return PREFIX + "userCouponRecord_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/userCouponRecord_update/{userCouponRecordId}") |
| | | public String userCouponRecordUpdate(@PathVariable Integer userCouponRecordId, Model model) { |
| | | UserCouponRecord userCouponRecord = userCouponRecordService.selectById(userCouponRecordId); |
| | | model.addAttribute("item",userCouponRecord); |
| | | LogObjectHolder.me().set(userCouponRecord); |
| | | return PREFIX + "userCouponRecord_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,String userName,String userPhone,Integer couponActivityId,Integer activityType,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | | String[] timeArray = createTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(userCouponRecordService.getList(page,beginTime,endTime,userName,userPhone,couponActivityId,activityType,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(UserCouponRecord userCouponRecord) { |
| | | userCouponRecordService.insert(userCouponRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer userCouponRecordId) { |
| | | userCouponRecordService.deleteById(userCouponRecordId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(UserCouponRecord userCouponRecord) { |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{userCouponRecordId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("userCouponRecordId") Integer userCouponRecordId) { |
| | | return userCouponRecordService.selectById(userCouponRecordId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TDispatch; |
| | | import com.stylefeng.guns.modular.system.service.ITDispatchService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 调度管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-01 16:00:16 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tDispatch") |
| | | public class TDispatchController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tDispatch/"; |
| | | |
| | | @Autowired |
| | | private ITDispatchService tDispatchService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService tCompanyService; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | /** |
| | | * 跳转到调度管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tDispatch.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加调度管理 |
| | | */ |
| | | @RequestMapping("/tDispatch_add") |
| | | public String tDispatchAdd(Model model) { |
| | | model.addAttribute("roleType",ShiroKit.getUser().getRoleType()); |
| | | |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2) |
| | | .eq("isCross", 1) |
| | | .last(" and state != 1 and FIND_IN_SET(flag,'1,2')")); |
| | | model.addAttribute("companyList",companyList); |
| | | |
| | | if (2 == ShiroKit.getUser().getRoleType()){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3) |
| | | .eq("superiorId",ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else{ |
| | | model.addAttribute("franchiseeList",null); |
| | | } |
| | | return PREFIX + "tDispatch_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 根据分公司ID获取加盟商 |
| | | * @param oneId |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/companyChange") |
| | | @ResponseBody |
| | | public Object companyChange(@RequestParam Integer oneId) { |
| | | List<TCompany> list = new ArrayList<>(); |
| | | if (SinataUtil.isNotEmpty(oneId)){ |
| | | list = tCompanyService.selectList(new EntityWrapper<TCompany>() |
| | | .eq("type", 3) |
| | | .eq("isCross", 1) |
| | | .eq("superiorId", oneId) |
| | | .last(" and state != 1 and FIND_IN_SET(flag,'1,2')")); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改调度管理 |
| | | */ |
| | | @RequestMapping("/tDispatch_update/{tDispatchId}") |
| | | public String tDispatchUpdate(@PathVariable Integer tDispatchId, Model model) { |
| | | TDispatch tDispatch = tDispatchService.selectById(tDispatchId); |
| | | model.addAttribute("item",tDispatch); |
| | | LogObjectHolder.me().set(tDispatch); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | if (1 == roleType){ |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2) |
| | | .eq("isCross", 1) |
| | | .last(" and state != 1 and FIND_IN_SET(flag,'1,2')")); |
| | | model.addAttribute("companyList",companyList); |
| | | |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3) |
| | | .eq("superiorId",tDispatch.getCompanyId()) |
| | | .eq("isCross", 1) |
| | | .last(" and state != 1 and FIND_IN_SET(flag,'1,2')")); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3) |
| | | .eq("superiorId",ShiroKit.getUser().getObjectId()) |
| | | .eq("isCross", 1) |
| | | .last(" and state != 1 and FIND_IN_SET(flag,'1,2')")); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | } |
| | | return PREFIX + "tDispatch_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取调度管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String name,String companyName,String franchiseeName,String account,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tDispatchService.getDispatchList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,name,companyName,franchiseeName,account,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增调度管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TDispatch tDispatch) { |
| | | //判断账号是否存在 |
| | | int count = tDispatchService.selectCount(new EntityWrapper<TDispatch>().eq("account",tDispatch.getAccount()).last(" and FIND_IN_SET(state,'1,2')")); |
| | | if (count > 0){ |
| | | return new ErrorTip(500,"账号已存在,请重新输入"); |
| | | } |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | if (2 == roleType){ |
| | | tDispatch.setCompanyId(objectId); |
| | | }else if (3 == roleType){ |
| | | TCompany company = tCompanyService.selectById(objectId); |
| | | tDispatch.setCompanyId(company.getSuperiorId()); |
| | | tDispatch.setFranchiseeId(objectId); |
| | | } |
| | | tDispatch.setInsertTime(new Date()); |
| | | tDispatch.setInsertUserId(ShiroKit.getUser().getId()); |
| | | tDispatch.setInsertUserRole(roleType); |
| | | tDispatch.setState(1); |
| | | if(tDispatch.getCompanyId() == null){ |
| | | Integer objectId1 = userService.selectById(ShiroKit.getUser().getId()).getObjectId(); |
| | | tDispatch.setCompanyId(objectId1); |
| | | } |
| | | tDispatch.setPassword(ShiroKit.md5(tDispatch.getPassword(), "WL:x9#")); |
| | | tDispatchService.insert(tDispatch); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除调度管理 |
| | | * @param tDispatchId |
| | | * @param optType 1=删除 2=冻结 3=解冻 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/opt") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tDispatchId,@RequestParam Integer optType) { |
| | | TDispatch dispatch = tDispatchService.selectById(tDispatchId); |
| | | if (1 == optType){ |
| | | dispatch.setState(3); |
| | | }else if (2 == optType){ |
| | | dispatch.setState(2); |
| | | }else if (3 == optType){ |
| | | dispatch.setState(1); |
| | | } |
| | | tDispatchService.updateById(dispatch); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改调度管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TDispatch tDispatch) { |
| | | TDispatch obj = tDispatchService.selectById(tDispatch.getId()); |
| | | if (!obj.getAccount().equals(tDispatch.getAccount())){ |
| | | //判断账号是否存在 |
| | | int count = tDispatchService.selectCount(new EntityWrapper<TDispatch>().eq("account",tDispatch.getAccount()).last(" and FIND_IN_SET(state,'1,2')")); |
| | | if (count > 0){ |
| | | return new ErrorTip(500,"账号已存在,请重新输入"); |
| | | } |
| | | } |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | if (2 == roleType){ |
| | | tDispatch.setCompanyId(objectId); |
| | | }else if (3 == roleType){ |
| | | TCompany company = tCompanyService.selectById(objectId); |
| | | tDispatch.setCompanyId(company.getSuperiorId()); |
| | | tDispatch.setFranchiseeId(objectId); |
| | | } |
| | | if (SinataUtil.isNotEmpty(tDispatch.getPassword())){ |
| | | tDispatch.setPassword(ShiroKit.md5(tDispatch.getPassword(), "WL:x9#")); |
| | | } |
| | | tDispatchService.updateById(tDispatch); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TIntegralGoods; |
| | | import com.stylefeng.guns.modular.system.service.ITIntegralGoodsService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 商品管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-02 11:28:36 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tIntegralGoods") |
| | | public class TIntegralGoodsController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tIntegralGoods/"; |
| | | |
| | | @Autowired |
| | | private ITIntegralGoodsService tIntegralGoodsService; |
| | | |
| | | /** |
| | | * 跳转到商品管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tIntegralGoods.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加商品管理 |
| | | */ |
| | | @RequestMapping("/tIntegralGoods_add") |
| | | public String tIntegralGoodsAdd() { |
| | | return PREFIX + "tIntegralGoods_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改商品管理 |
| | | */ |
| | | @RequestMapping("/tIntegralGoods_update/{tIntegralGoodsId}") |
| | | public String tIntegralGoodsUpdate(@PathVariable Integer tIntegralGoodsId, Model model) { |
| | | TIntegralGoods tIntegralGoods = tIntegralGoodsService.selectById(tIntegralGoodsId); |
| | | model.addAttribute("item",tIntegralGoods); |
| | | LogObjectHolder.me().set(tIntegralGoods); |
| | | return PREFIX + "tIntegralGoods_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取商品管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String name,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tIntegralGoodsService.getIntegralGoodsList(page,beginTime,endTime,name,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增商品管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TIntegralGoods tIntegralGoods) { |
| | | tIntegralGoods.setInsertTime(new Date()); |
| | | tIntegralGoods.setInsertUserId(ShiroKit.getUser().getId()); |
| | | tIntegralGoods.setInsertUserRole(ShiroKit.getUser().getRoleType()); |
| | | tIntegralGoods.setState(1); |
| | | tIntegralGoodsService.insert(tIntegralGoods); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * c操作商品 |
| | | * @param tIntegralGoodsId |
| | | * @param optType 1=上架 2=下架 3=删除 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/opt") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tIntegralGoodsId,@RequestParam Integer optType) { |
| | | TIntegralGoods tIntegralGoods = tIntegralGoodsService.selectById(tIntegralGoodsId); |
| | | if (1 == optType){ |
| | | tIntegralGoods.setState(1); |
| | | }else if (2 == optType){ |
| | | tIntegralGoods.setState(2); |
| | | }else if (3 == optType){ |
| | | tIntegralGoods.setState(3); |
| | | } |
| | | tIntegralGoodsService.updateById(tIntegralGoods); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改商品管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TIntegralGoods tIntegralGoods) { |
| | | tIntegralGoodsService.updateById(tIntegralGoods); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TOrderCharter; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TIntegralOrder; |
| | | import com.stylefeng.guns.modular.system.service.ITIntegralOrderService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 积分兑换订单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-02 15:22:24 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tIntegralOrder") |
| | | public class TIntegralOrderController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tIntegralOrder/"; |
| | | |
| | | @Autowired |
| | | private ITIntegralOrderService tIntegralOrderService; |
| | | |
| | | /** |
| | | * 跳转到积分兑换订单首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tIntegralOrder.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}") |
| | | public String lookDetail(@PathVariable Integer id, Model model) { |
| | | TIntegralOrder tIntegralOrder = tIntegralOrderService.selectById(id); |
| | | model.addAttribute("str",tIntegralOrder.getRemark()); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转至立即处理页面 |
| | | */ |
| | | @RequestMapping("/tIntegralOrder_immediately/{tIntegralOrderId}") |
| | | public String tIntegralOrder_immediately(@PathVariable Integer tIntegralOrderId, Model model) { |
| | | model.addAttribute("id",tIntegralOrderId); |
| | | return PREFIX + "tIntegralOrder_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取积分兑换订单列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String userName,String goodsName,String consigneeName,String consigneePhone,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tIntegralOrderService.getIntegralOrderList(page,beginTime,endTime,userName,goodsName,consigneeName,consigneePhone,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 立即处理 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(TIntegralOrder tIntegralOrder) { |
| | | tIntegralOrder.setState(2); |
| | | tIntegralOrderService.updateById(tIntegralOrder); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除积分兑换订单 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tIntegralOrderId) { |
| | | TIntegralOrder tIntegralOrder = tIntegralOrderService.selectById(tIntegralOrderId); |
| | | tIntegralOrder.setState(3); |
| | | tIntegralOrderService.updateById(tIntegralOrder); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 跨城线路管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-15 16:17:29 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tLine") |
| | | public class TLineController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tLine/"; |
| | | |
| | | @Autowired |
| | | private ITLineService tLineService; |
| | | |
| | | @Autowired |
| | | private ITSiteService itSiteService; |
| | | |
| | | @Autowired |
| | | private ITServerCarmodelService itServerCarmodelService; |
| | | |
| | | @Autowired |
| | | private ITLineSiteService itLineSiteService; |
| | | |
| | | @Autowired |
| | | private ITLinePriceService itLinePriceService; |
| | | |
| | | @Autowired |
| | | private ITLineShiftService itLineShiftService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | @Autowired |
| | | private ITLineCompanyService itLineCompanyService; |
| | | |
| | | /** |
| | | * 跳转到跨城站点管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tLine.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加跨城站点管理 |
| | | */ |
| | | @RequestMapping("/tLine_add") |
| | | public String tLineAdd(Model model) { |
| | | //站点 |
| | | List<TSite> siteList = itSiteService.selectList(new EntityWrapper<TSite>().eq("state", 1)); |
| | | model.addAttribute("siteList",siteList); |
| | | //跨城车型 |
| | | List<TServerCarmodel> carmodelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1)); |
| | | model.addAttribute("carmodelList",carmodelList); |
| | | return PREFIX + "tLine_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 分配企业页面 |
| | | */ |
| | | @RequestMapping("/tLine_addCompany/{tLineId}") |
| | | public String tLine_addCompany(@PathVariable Integer tLineId,Model model) { |
| | | TLine tLine = tLineService.selectById(tLineId); |
| | | model.addAttribute("tLine",tLine); |
| | | //查询所有企业 |
| | | List<TCompany> companyList = itCompanyService.selectList(new EntityWrapper<TCompany>().last(" where not FIND_IN_SET(state,'1') and not FIND_IN_SET(flag,'3')")); |
| | | model.addAttribute("companyList",companyList); |
| | | //查询已分配企业 |
| | | List<Map<String, Object>> lineCompanyList = tLineService.getLineCompanyList(tLineId); |
| | | model.addAttribute("lineCompanyList",lineCompanyList); |
| | | return PREFIX + "tLine_addCompany.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改跨城站点管理 |
| | | */ |
| | | @RequestMapping("/tLine_update/{tLineId}") |
| | | public String tLineUpdate(@PathVariable Integer tLineId, Model model) { |
| | | TLine tLine = tLineService.selectById(tLineId); |
| | | model.addAttribute("item",tLine); |
| | | LogObjectHolder.me().set(tLine); |
| | | |
| | | //查找站点起点+终点 |
| | | TLineSite start = itLineSiteService.selectOne(new EntityWrapper<TLineSite>().eq("lineId", tLineId).eq("type", 1)); |
| | | model.addAttribute("start",start); |
| | | TLineSite end = itLineSiteService.selectOne(new EntityWrapper<TLineSite>().eq("lineId", tLineId).eq("type", 2)); |
| | | model.addAttribute("end",end); |
| | | //站点 |
| | | List<TSite> siteList = itSiteService.selectList(new EntityWrapper<TSite>().eq("state", 1)); |
| | | model.addAttribute("siteList",siteList); |
| | | //跨城车型 |
| | | List<TServerCarmodel> carmodelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1)); |
| | | model.addAttribute("carmodelList",carmodelList); |
| | | //查询所有站点 |
| | | List<Map<String, Object>> linePriceList = tLineService.getLinePriceList(tLineId); |
| | | model.addAttribute("linePriceList",linePriceList); |
| | | //查询所有班次 |
| | | List<TLineShift> lineShiftList = itLineShiftService.selectList(new EntityWrapper<TLineShift>().eq("lineId", tLineId).last(" and not FIND_IN_SET(state,'3')")); |
| | | model.addAttribute("lineShiftList",lineShiftList); |
| | | return PREFIX + "tLine_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取跨城站点管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String name,String insertUser,String modelStr,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tLineService.getLineList(page,beginTime,endTime,name,insertUser,modelStr,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增跨城站点管理 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public ResultUtil add(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr,@RequestParam String shuArr) { |
| | | String name = tLine.getName(); |
| | | name = name.replaceAll("& lt;", "<"); |
| | | name = name.replaceAll("& gt;", ">"); |
| | | name = name.replaceAll("& #40;", "("); |
| | | name = name.replaceAll("& #41;", ")"); |
| | | tLine.setName(name); |
| | | tLine.setState(1); |
| | | tLine.setInsertTime(new Date()); |
| | | tLine.setInsertUserId(ShiroKit.getUser().getId()); |
| | | tLineService.insert(tLine); |
| | | |
| | | //添加线路站点起点+终点 |
| | | TLineSite start = new TLineSite(); |
| | | start.setLineId(tLine.getId()); |
| | | start.setSiteId(startSiteId); |
| | | start.setType(1); |
| | | itLineSiteService.insert(start); |
| | | TLineSite end = new TLineSite(); |
| | | end.setLineId(tLine.getId()); |
| | | end.setSiteId(endSiteId); |
| | | end.setType(2); |
| | | itLineSiteService.insert(end); |
| | | |
| | | //添加价格设置 |
| | | addPrice(tLine.getId(), subArr); |
| | | |
| | | //添加班次设置 |
| | | return addShift(tLine.getId(), shuArr); |
| | | } |
| | | |
| | | /** |
| | | * 添加线路班次 |
| | | * @param lineId |
| | | * @param shuArr |
| | | */ |
| | | private ResultUtil addShift(Integer lineId, @RequestParam String shuArr) { |
| | | try { |
| | | JSONArray jsonArray1 = JSON.parseArray(shuArr); |
| | | int size1 = jsonArray1.size(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<String> list = new ArrayList<>(); |
| | | for (int i = 0; i < size1; i++) { |
| | | List<TLineShift> tLineShifts = itLineShiftService.selectList(new EntityWrapper<TLineShift>().eq("lineId", lineId).ne("state", 3).orderBy("startTime")); |
| | | JSONObject jsonObject = jsonArray1.getJSONObject(i); |
| | | TLineShift shift = new TLineShift(); |
| | | shift.setLineId(lineId); |
| | | String shiftTime = jsonObject.getString("shiftTime"); |
| | | String startTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(shiftTime)){ |
| | | String[] timeArray = shiftTime.split(" - "); |
| | | startTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Date s1 = sdf.parse("2020-11-11 " + startTime + ":00"); |
| | | Date e1 = sdf.parse("2020-11-11 " + endTime + ":00"); |
| | | boolean b = false; |
| | | for(TLineShift lineShift : tLineShifts){ |
| | | Date s2 = sdf.parse("2020-11-11 " + lineShift.getStartTime() + ":00"); |
| | | Date e2 = sdf.parse("2020-11-11 " + lineShift.getEndTime() + ":00"); |
| | | if(s2.getTime() <= s1.getTime() && e1.getTime() <= e2.getTime()){ |
| | | list.add(startTime + " - " + endTime); |
| | | b = true; |
| | | break; |
| | | } |
| | | if(s1.getTime() <= s2.getTime() && s1.getTime() <= e2.getTime() && e1.getTime() >= s2.getTime()){ |
| | | list.add(startTime + " - " + endTime); |
| | | b = true; |
| | | break; |
| | | } |
| | | if(s1.getTime() >= s2.getTime() && s1.getTime() <= e2.getTime() && e1.getTime() >= e2.getTime()){ |
| | | list.add(startTime + " - " + endTime); |
| | | b = true; |
| | | break; |
| | | } |
| | | } |
| | | if(b){ |
| | | continue; |
| | | } |
| | | shift.setStartTime(startTime); |
| | | shift.setEndTime(endTime); |
| | | shift.setCarNum(jsonObject.getInteger("carNum")); |
| | | shift.setInsertTime(new Date()); |
| | | shift.setAddTime(jsonObject.getString("time2")); |
| | | shift.setState(1); |
| | | itLineShiftService.insert(shift); |
| | | } |
| | | if(list.size() > 0){ |
| | | return ResultUtil.error("【" + JSON.toJSONString(list) + "】时间段与现存时间段重合,添加失败!"); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加线路价格 |
| | | * @param lineId |
| | | * @param subArr |
| | | */ |
| | | private void addPrice(Integer lineId, @RequestParam String subArr) { |
| | | JSONArray jsonArray = JSON.parseArray(subArr); |
| | | int size = jsonArray.size(); |
| | | for (int i = 0; i < size; i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TLinePrice price = new TLinePrice(); |
| | | price.setLineId(lineId); |
| | | price.setServerCarModelId(jsonObject.getInteger("serverModelId")); |
| | | price.setType(jsonObject.getInteger("type")); |
| | | price.setContent(jsonObject.getString("content")); |
| | | price.setContentStr(jsonObject.getString("contentStr")); |
| | | price.setState(1); |
| | | price.setInsertTime(new Date()); |
| | | price.setAddTime(jsonObject.getString("time")); |
| | | itLinePriceService.insert(price); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 操作跨城站点管理 |
| | | * optType 1=删除 2=冻结 3=解冻 |
| | | */ |
| | | @RequestMapping(value = "/opt") |
| | | @ResponseBody |
| | | public Object opt(@RequestParam Integer tLineId,@RequestParam Integer optType) { |
| | | TLine tLine = tLineService.selectById(tLineId); |
| | | if (1 == optType){ |
| | | tLine.setState(3); |
| | | }else if (2 == optType){ |
| | | tLine.setState(2); |
| | | }else if (3 == optType){ |
| | | tLine.setState(1); |
| | | } |
| | | tLineService.updateById(tLine); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 分配企业操作 |
| | | */ |
| | | @RequestMapping(value = "/addCompany") |
| | | @ResponseBody |
| | | public Object addCompany(Integer lineId,@RequestParam String comArr) { |
| | | //删除分配企业 |
| | | itLineCompanyService.delete(new EntityWrapper<TLineCompany>().eq("lineId",lineId)); |
| | | //添加企业 |
| | | if (SinataUtil.isNotEmpty(comArr)){ |
| | | JSONArray jsonArray = JSON.parseArray(comArr); |
| | | int size = jsonArray.size(); |
| | | for (int i = 0; i < size; i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TLineCompany lineCompany = new TLineCompany(); |
| | | lineCompany.setLineId(lineId); |
| | | lineCompany.setCompanyId(jsonObject.getInteger("companyId")); |
| | | lineCompany.setInsertTime(new Date()); |
| | | lineCompany.setInsertUserId(ShiroKit.getUser().getId()); |
| | | itLineCompanyService.insert(lineCompany); |
| | | } |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 修改跨城站点管理 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public ResultUtil update(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr,@RequestParam String shuArr) { |
| | | String name = tLine.getName(); |
| | | name = name.replaceAll("& lt;", "<"); |
| | | name = name.replaceAll("& gt;", ">"); |
| | | name = name.replaceAll("& #40;", "("); |
| | | name = name.replaceAll("& #41;", ")"); |
| | | tLine.setName(name); |
| | | tLineService.updateById(tLine); |
| | | |
| | | //修改站点起点 |
| | | TLineSite start = itLineSiteService.selectOne(new EntityWrapper<TLineSite>().eq("lineId", tLine.getId()).eq("type", 1)); |
| | | if (SinataUtil.isNotEmpty(start)){ |
| | | if (start.getSiteId().intValue() != startSiteId.intValue()){ |
| | | start.setSiteId(startSiteId); |
| | | itLineSiteService.updateById(start); |
| | | } |
| | | }else{ |
| | | start = new TLineSite(); |
| | | start.setLineId(tLine.getId()); |
| | | start.setSiteId(startSiteId); |
| | | start.setType(1); |
| | | itLineSiteService.insert(start); |
| | | } |
| | | //修改站点终点 |
| | | TLineSite end = itLineSiteService.selectOne(new EntityWrapper<TLineSite>().eq("lineId", tLine.getId()).eq("type", 2)); |
| | | if (SinataUtil.isNotEmpty(end)){ |
| | | if (end.getSiteId().intValue() != endSiteId.intValue()){ |
| | | end.setSiteId(endSiteId); |
| | | itLineSiteService.updateById(end); |
| | | } |
| | | }else{ |
| | | end = new TLineSite(); |
| | | end.setLineId(tLine.getId()); |
| | | end.setSiteId(endSiteId); |
| | | end.setType(2); |
| | | itLineSiteService.insert(end); |
| | | } |
| | | |
| | | //删除线路价格 |
| | | itLinePriceService.delete(new EntityWrapper<TLinePrice>().eq("lineId",tLine.getId())); |
| | | //添加价格设置 |
| | | addPrice(tLine.getId(), subArr); |
| | | //删除线路班次 |
| | | itLineShiftService.delete(new EntityWrapper<TLineShift>().eq("lineId",tLine.getId())); |
| | | //添加班次设置 |
| | | return addShift(tLine.getId(), shuArr); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TOrderEvaluate; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TOrderCharter; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderCharterService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 旅游包车订单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-02 10:39:00 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOrderCharter") |
| | | public class TOrderCharterController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tOrderCharter/"; |
| | | |
| | | @Autowired |
| | | private ITOrderCharterService tOrderCharterService; |
| | | |
| | | /** |
| | | * 跳转到旅游包车订单首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tOrderCharter.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看详情 |
| | | */ |
| | | @RequestMapping("/lookDetail/{id}") |
| | | public String lookDetail(@PathVariable Integer id, Model model) { |
| | | TOrderCharter tOrderCharter = tOrderCharterService.selectById(id); |
| | | model.addAttribute("str",tOrderCharter.getRemark()); |
| | | return "/system/tComplaint/lookDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改旅游包车订单 |
| | | */ |
| | | @RequestMapping("/tOrderCharter_immediately/{tOrderCharterId}") |
| | | public String tOrderCharterUpdate(@PathVariable Integer tOrderCharterId, Model model) { |
| | | model.addAttribute("id",tOrderCharterId); |
| | | return PREFIX + "tOrderCharter_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取旅游包车订单列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String userName,String contactName,String contactPhone,String useDemand,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tOrderCharterService.getCharterOrderList(page,beginTime,endTime,userName,contactName,contactPhone,useDemand,state)); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 立即处理 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(TOrderCharter tOrderCharter) { |
| | | tOrderCharter.setState(2); |
| | | tOrderCharterService.updateById(tOrderCharter); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除旅游包车订单 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tOrderCharterId) { |
| | | TOrderCharter tOrderCharter = tOrderCharterService.selectById(tOrderCharterId); |
| | | tOrderCharter.setState(3); |
| | | tOrderCharterService.updateById(tOrderCharter); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TOrderCharter; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TOrderCharteredCar; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderCharteredCarService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 旅游包车订单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-24 11:08:23 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOrderCharteredCar") |
| | | public class TOrderCharteredCarController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tOrderCharteredCar/"; |
| | | |
| | | @Autowired |
| | | private ITOrderCharteredCarService tOrderCharteredCarService; |
| | | |
| | | /** |
| | | * 跳转到旅游包车订单首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tOrderCharteredCar.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改旅游包车订单 |
| | | */ |
| | | @RequestMapping("/tOrderCharteredCar_immediately/{tOrderCharteredCarId}") |
| | | public String tOrderCharteredCarUpdate(@PathVariable Integer tOrderCharteredCarId, Model model) { |
| | | model.addAttribute("id",tOrderCharteredCarId); |
| | | return PREFIX + "tOrderCharteredCar_immediately.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取旅游包车订单列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime,String userName,String contactPerson,String contactPhone,String modelUse,Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | List<Map<String, Object>> charterCarOrderList = tOrderCharteredCarService.getCharterCarOrderList(page, beginTime, endTime, userName, contactPerson, contactPhone, modelUse, state, ShiroKit.getUser().getRoleType(), ShiroKit.getUser().getObjectId()); |
| | | for(Map<String, Object> map : charterCarOrderList){ |
| | | String[] prices = map.get("price").toString().split("-"); |
| | | String p = Double.valueOf(prices[0]) * Integer.valueOf(map.get("peopleNumber").toString()) + "-" + Double.valueOf(prices[1]) * Integer.valueOf(map.get("peopleNumber").toString()); |
| | | map.put("price", p); |
| | | |
| | | } |
| | | page.setRecords(charterCarOrderList); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 立即处理 |
| | | */ |
| | | @RequestMapping(value = "/immediately") |
| | | @ResponseBody |
| | | public Object immediately(Integer id, String remark) { |
| | | TOrderCharteredCar tOrderCharteredCar = tOrderCharteredCarService.selectById(id); |
| | | tOrderCharteredCar.setState(2); |
| | | tOrderCharteredCar.setRemark(remark); |
| | | tOrderCharteredCarService.updateById(tOrderCharteredCar); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除旅游包车订单 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tOrderCharterId) { |
| | | TOrderCharteredCar tOrderCharter = tOrderCharteredCarService.selectById(tOrderCharterId); |
| | | tOrderCharter.setIsDelete(2); |
| | | tOrderCharteredCarService.updateById(tOrderCharter); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 跨城出行订单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-16 14:56:46 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOrderCrossCity") |
| | | public class TOrderCrossCityController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tOrderCrossCity/"; |
| | | |
| | | @Autowired |
| | | private ITOrderCrossCityService tOrderCrossCityService; |
| | | |
| | | @Autowired |
| | | private ITServerCarmodelService tServerCarmodelService; |
| | | |
| | | @Autowired |
| | | private ITLineService itLineService; |
| | | |
| | | @Autowired |
| | | private ITOrderPositionService tOrderPositionService; |
| | | |
| | | private ResultUtil resultUtil; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | /** |
| | | * 跳转到跨城出行订单首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | //服务专车车型 |
| | | List<TServerCarmodel> carmodelList = tServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1)); |
| | | model.addAttribute("carmodelList",carmodelList); |
| | | //线路 |
| | | List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().last(" where not FIND_IN_SET(state,'3')")); |
| | | model.addAttribute("lineList",lineList); |
| | | return PREFIX + "tOrderCrossCity.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看跨城出行订单详情页面 |
| | | */ |
| | | @RequestMapping("/tOrderCrossCity_detail/{tOrderCrossCityId}") |
| | | public String tOrderCrossCityUpdate(@PathVariable Integer tOrderCrossCityId, Model model) { |
| | | Map<String, Object> item = tOrderCrossCityService.getCrossCityOrderDetailById(tOrderCrossCityId); |
| | | model.addAttribute("item",item); |
| | | return PREFIX + "tOrderCrossCity_detail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到跨城出行订单轨迹页面 |
| | | */ |
| | | @RequestMapping("/tOrderCrossCity_track/{tOrderCrossCityId}") |
| | | public String tOrderCrossCity_track(@PathVariable Integer tOrderCrossCityId, Model model) { |
| | | model.addAttribute("tOrderCrossCityId",tOrderCrossCityId); |
| | | return PREFIX + "tOrderCrossCity_track.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取订单轨迹 |
| | | * @param orderDetailId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getOrderTrack", method = RequestMethod.POST) |
| | | public ResultUtil getOrderTrack(String orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | try { |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + "_3.txt"); |
| | | if(!file.exists()){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class); |
| | | // List<TOrderPosition> list = tOrderPositionService.selectList(new EntityWrapper<TOrderPosition>().eq("orderType", 3).eq("orderId", orderDetailId).orderBy("insertTime")); |
| | | /*if(list.size() == 0){ |
| | | return ResultUtil.error("该订单没有运行轨迹"); |
| | | }*/ |
| | | resultUtil = ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | resultUtil = ResultUtil.runErr(); |
| | | } |
| | | }else { |
| | | resultUtil = ResultUtil.paranErr(); |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | /** |
| | | * 获取跨城出行订单列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String orderNum, |
| | | Integer orderSource, |
| | | String userName, |
| | | String userPhone, |
| | | String passengers, |
| | | String passengersPhone, |
| | | Integer serverCarModelId, |
| | | String driver, |
| | | Integer lineId, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderCrossCityService.getCrossCityOrderList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),orderNum,orderSource,userName,userPhone,passengers,passengersPhone,serverCarModelId,driver,lineId,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | @Resource |
| | | private LineShiftDriverMapper lineShiftDriverMapper; |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private OrderCancelMapper orderCancelMapper; |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消跨城出行订单 |
| | | */ |
| | | @RequestMapping(value = "/cancel") |
| | | @ResponseBody |
| | | public Object cancel(@RequestParam Integer tOrderCrossCityId) throws Exception { |
| | | TOrderCrossCity tOrderCrossCity = tOrderCrossCityService.selectById(tOrderCrossCityId); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | |
| | | TOrderCrossCity orderCrossCity = tOrderCrossCityService.selectById(tOrderCrossCityId); |
| | | if(orderCrossCity.getState() > 5 && orderCrossCity.getState() != 11 && orderCrossCity.getState() != 7){ |
| | | return ResultUtil.error("订单状态不在可取消范围内"); |
| | | } |
| | | orderCrossCity.setState(10); |
| | | tOrderCrossCityService.updateById(orderCrossCity); |
| | | |
| | | if(orderCrossCity.getDriverId() != null){ |
| | | //修改司机信息 |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCity.getLineShiftDriverId()); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber() > lineShiftDriver.getTotalSeat() ? |
| | | lineShiftDriver.getTotalSeat() : lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber()); |
| | | String seat = ""; |
| | | String[] split = orderCrossCity.getSeatNumber().split(","); |
| | | for(String s : split){ |
| | | seat += s + ","; |
| | | } |
| | | seat = lineShiftDriver.getLaveSeatNumber() + "," + seat.substring(0, seat.length() - 1); |
| | | |
| | | //总和大于总座位数的情况 |
| | | if(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber() > lineShiftDriver.getTotalSeat()){ |
| | | seat = ""; |
| | | for(int i = 1; i <= lineShiftDriver.getTotalSeat(); i++){ |
| | | seat += i + ","; |
| | | } |
| | | seat = seat.substring(0, seat.length() - 1); |
| | | } |
| | | lineShiftDriver.setLaveSeatNumber(seat); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | if(lineShiftDriver.getLaveSeat() >= lineShiftDriver.getTotalSeat()){ |
| | | TDriver driver = tDriverService.selectById(orderCrossCity.getDriverId()); |
| | | driver.setState(2); |
| | | tDriverService.updateById(driver); |
| | | } |
| | | } |
| | | |
| | | |
| | | //已支付的情况下进行退款操作 |
| | | if(null != orderCrossCity.getPayType() && null != orderCrossCity.getPayMoney()) { |
| | | if (orderCrossCity.getPayType() == 3) {//余额支付 |
| | | TUser tUser = userService.selectById(orderCrossCity.getUserId()); |
| | | tUser.setBalance(tUser.getBalance().add(orderCrossCity.getPayMoney())); |
| | | userService.updateById(tUser); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", orderCrossCity.getPayMoney().doubleValue(), 1, 1, 1, 3, tOrderCrossCityId); |
| | | } else { |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, tOrderCrossCityId, 3, null, 2).get(0); |
| | | if (null == query) { |
| | | return ResultUtil.error("订单还未进行支付"); |
| | | } |
| | | |
| | | } |
| | | |
| | | //添加负的收入明细 |
| | | List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("type", 2).eq("incomeId", tOrderCrossCityId).eq("orderType", 3)); |
| | | for(Income income : incomes){ |
| | | if(income.getUserType() == 2){//处理司机的收入 |
| | | TDriver driver = tDriverService.selectById(income.getObjectId()); |
| | | driver.setBalance(driver.getBalance().subtract(new BigDecimal(income.getMoney()))); |
| | | driver.setLaveBusinessMoney(new BigDecimal(driver.getLaveBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue()); |
| | | driver.setBusinessMoney(new BigDecimal(driver.getBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue()); |
| | | tDriverService.updateById(driver); |
| | | } |
| | | Income income1 = new Income(); |
| | | BeanUtils.copyProperties(income, income1); |
| | | income1.setMoney(income.getMoney() * -1); |
| | | income1.setId(null); |
| | | income1.setInsertTime(new Date()); |
| | | incomeService.insert(income1); |
| | | } |
| | | } |
| | | //添加取消记录 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(tOrderCrossCityId); |
| | | orderCancel.setOrderType(3); |
| | | orderCancel.setReason("调度端取消订单"); |
| | | orderCancel.setRemark("调度“" + user.getName() + "-" + user.getId() + "”执行取消操作"); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(3); |
| | | orderCancel.setUserId(user.getId()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | |
| | | //增加推送 |
| | | Map<String,String> map1 = new HashMap<>(); |
| | | map1.put("id", tOrderCrossCity.getId().toString()); |
| | | map1.put("orderType", "3"); |
| | | String result1 = HttpRequestUtil.postRequest(PushURL.cancel_order_url, map1); |
| | | System.out.println("跨城出行取消:【orderId="+tOrderCrossCity.getId().toString()+"】,调用接口:"+result1); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除跨城出行订单 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tOrderCrossCityId) { |
| | | TOrderCrossCity tOrderCrossCity = tOrderCrossCityService.selectById(tOrderCrossCityId); |
| | | tOrderCrossCity.setIsDelete(2); |
| | | tOrderCrossCityService.updateById(tOrderCrossCity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 小件物流订单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-24 14:20:41 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOrderLogistics") |
| | | public class TOrderLogisticsController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tOrderLogistics/"; |
| | | |
| | | @Autowired |
| | | private ITOrderLogisticsService tOrderLogisticsService; |
| | | |
| | | @Resource |
| | | private OrderCancelMapper orderCancelMapper; |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到小件物流订单首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tOrderLogistics.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加小件物流订单 |
| | | */ |
| | | @RequestMapping("/tOrderLogistics_add") |
| | | public String tOrderLogisticsAdd() { |
| | | return PREFIX + "tOrderLogistics_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看小件物流订单 |
| | | */ |
| | | @RequestMapping("/tOrderLogistics_detail/{tOrderLogisticsId}") |
| | | public String tOrderLogistics_detail(@PathVariable Integer tOrderLogisticsId, Model model) { |
| | | Map<String,Object> tOrderLogistics = tOrderLogisticsService.getLogisticsOrderDetailById(tOrderLogisticsId); |
| | | model.addAttribute("item",tOrderLogistics); |
| | | return PREFIX + "tOrderLogistics_detail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取小件物流订单列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String orderNum, |
| | | Integer type, |
| | | Integer orderSource, |
| | | String userName, |
| | | String userPhone, |
| | | String recipient, |
| | | String recipientPhone, |
| | | String driver, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderLogisticsService.getLogisticsOrderList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(), |
| | | orderNum,orderSource,type,userName,userPhone,recipient,recipientPhone,driver,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @Autowired |
| | | private ITDriverService itDriverService; |
| | | |
| | | /** |
| | | * 取消小件物流订单 |
| | | */ |
| | | @RequestMapping(value = "/cancel") |
| | | @ResponseBody |
| | | public Object cancel(@RequestParam Integer tOrderLogisticsId) { |
| | | try{ |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | TOrderLogistics tOrderLogistics = tOrderLogisticsService.selectById(tOrderLogisticsId); |
| | | tOrderLogistics.setState(10); |
| | | |
| | | //已支付的情况下进行退款操作 |
| | | if(null != tOrderLogistics.getPayType() && null != tOrderLogistics.getPayMoney()) { |
| | | if (tOrderLogistics.getPayType() == 3) {//余额支付 |
| | | TUser tUser = userService.selectById(tOrderLogistics.getUserId()); |
| | | tUser.setBalance(tUser.getBalance().add(tOrderLogistics.getPayMoney())); |
| | | userService.updateById(tUser); |
| | | } else { |
| | | List<PaymentRecord> paymentRecords = paymentRecordService.query(1, null, null, tOrderLogisticsId, tOrderLogistics.getType(), null, 2); |
| | | if (paymentRecords.size() == 0) { |
| | | return ResultUtil.error("订单还未进行支付"); |
| | | } |
| | | boolean b = false; |
| | | for(PaymentRecord query : paymentRecords){ |
| | | |
| | | } |
| | | if(b){ |
| | | //添加交易明细 |
| | | |
| | | } |
| | | } |
| | | |
| | | transactionDetailsService.saveData(tOrderLogistics.getUserId(), "小件订单取消退款", tOrderLogistics.getPayMoney().doubleValue(), 1, 1, 1, 4, tOrderLogistics.getId()); |
| | | |
| | | //添加负的收入明细 |
| | | List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("type", 2).eq("incomeId", tOrderLogistics.getId()).eq("orderType", tOrderLogistics.getType())); |
| | | for(Income income : incomes){ |
| | | if(income.getUserType() == 2){//处理司机的收入 |
| | | TDriver driver = tDriverService.selectById(income.getObjectId()); |
| | | driver.setBalance(driver.getBalance().subtract(new BigDecimal(income.getMoney()))); |
| | | driver.setLaveBusinessMoney(new BigDecimal(driver.getLaveBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue()); |
| | | driver.setBusinessMoney(new BigDecimal(driver.getBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue()); |
| | | tDriverService.updateById(driver); |
| | | } |
| | | Income income1 = new Income(); |
| | | BeanUtils.copyProperties(income, income1); |
| | | income1.setMoney(income.getMoney() * -1); |
| | | income1.setId(null); |
| | | income1.setInsertTime(new Date()); |
| | | incomeService.insert(income1); |
| | | } |
| | | } |
| | | tOrderLogisticsService.updateById(tOrderLogistics); |
| | | |
| | | //添加取消记录 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(tOrderLogistics.getId()); |
| | | orderCancel.setOrderType(tOrderLogistics.getType()); |
| | | orderCancel.setReason("调度端取消订单"); |
| | | orderCancel.setRemark("调度“" + user.getName() + "-" + user.getId() + "”执行取消操作"); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(3); |
| | | orderCancel.setUserId(user.getId()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderLogistics.getId().toString()); |
| | | map.put("orderType", tOrderLogistics.getType().toString()); |
| | | String result = HttpRequestUtil.postRequest(PushURL.cancel_order_url, map); |
| | | System.out.println("小件物流取消:【orderId="+tOrderLogistics.getId().toString()+"】,调用接口:"+result); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除小件物流订单 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tOrderLogisticsId) { |
| | | TOrderLogistics tOrderLogistics = tOrderLogisticsService.selectById(tOrderLogisticsId); |
| | | tOrderLogistics.setIsDelete(2); |
| | | tOrderLogisticsService.updateById(tOrderLogistics); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 专车订单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-02 17:28:59 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOrderPrivateCar") |
| | | public class TOrderPrivateCarController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tOrderPrivateCar/"; |
| | | |
| | | @Autowired |
| | | private ITOrderPrivateCarService tOrderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private ITServerCarmodelService tServerCarmodelService; |
| | | |
| | | @Autowired |
| | | private ITOrderPositionService tOrderPositionService; |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Resource |
| | | private OrderCancelMapper orderCancelMapper; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到专车订单首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | //服务专车车型 |
| | | List<TServerCarmodel> carmodelList = tServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1)); |
| | | model.addAttribute("carmodelList",carmodelList); |
| | | return PREFIX + "tOrderPrivateCar.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改专车订单 |
| | | */ |
| | | @RequestMapping("/tOrderPrivateCar_orderDetail/{tOrderPrivateCarId}") |
| | | public String tOrderPrivateCarUpdate(@PathVariable Integer tOrderPrivateCarId, Model model) { |
| | | Map<String, Object> item = tOrderPrivateCarService.getPrivateCarOrderDetailById(tOrderPrivateCarId); |
| | | model.addAttribute("item",item); |
| | | return PREFIX + "tOrderPrivateCar_orderDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到出租车订单轨迹页面 |
| | | */ |
| | | @RequestMapping("/tOrderPrivateCar_trajectory/{tOrderPrivateCarId}") |
| | | public String tOrderTaxi_trajectory(@PathVariable Integer tOrderPrivateCarId, Model model) { |
| | | model.addAttribute("tOrderPrivateCarId",tOrderPrivateCarId); |
| | | return PREFIX + "tOrderPrivateCar_trajectory.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取专车订单列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String orderNum, |
| | | Integer orderSource, |
| | | String userName, |
| | | String userPhone, |
| | | String passengers, |
| | | String passengersPhone, |
| | | Integer serverCarModelId, |
| | | String driver, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderPrivateCarService.getPrivateCarOrderList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),orderNum,orderSource,userName,userPhone,passengers,passengersPhone,serverCarModelId,driver,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | private ResultUtil resultUtil; |
| | | |
| | | /** |
| | | * 获取订单轨迹 |
| | | * @param orderDetailId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getOrderTrack", method = RequestMethod.POST) |
| | | public ResultUtil getOrderTrack(String orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | try { |
| | | // List<TOrderPosition> list = tOrderPositionService.selectList(new EntityWrapper<TOrderPosition>().eq("orderType", 1).eq("orderId", orderDetailId).orderBy("insertTime")); |
| | | /*if(list.size() == 0){ |
| | | return ResultUtil.error("该订单没有运行轨迹"); |
| | | }*/ |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + "_1.txt"); |
| | | if(!file.exists()){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class); |
| | | resultUtil = ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | resultUtil = ResultUtil.runErr(); |
| | | } |
| | | }else { |
| | | resultUtil = ResultUtil.paranErr(); |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | /** |
| | | * 取消专车订单 |
| | | */ |
| | | @RequestMapping(value = "/cancel") |
| | | @ResponseBody |
| | | public Object cancel(@RequestParam Integer tOrderPrivateCarId) { |
| | | TOrderPrivateCar tOrderPrivateCar = tOrderPrivateCarService.selectById(tOrderPrivateCarId); |
| | | |
| | | //修改之前司机状态 -- 空闲 |
| | | if(null != tOrderPrivateCar.getDriverId()){ |
| | | TDriver driver = tDriverService.selectById(tOrderPrivateCar.getDriverId()); |
| | | driver.setState(2); |
| | | tDriverService.updateById(driver); |
| | | } |
| | | |
| | | tOrderPrivateCar.setState(10); |
| | | tOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(tOrderPrivateCarId); |
| | | orderCancel.setOrderType(1); |
| | | orderCancel.setReason("平台取消订单"); |
| | | orderCancel.setRemark("平台取消订单"); |
| | | orderCancel.setUserType(2); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderPrivateCar.getId().toString()); |
| | | map.put("orderType", "1"); |
| | | String result = HttpRequestUtil.postRequest(PushURL.cancel_order_url, map); |
| | | System.out.println("专车取消:【orderId="+tOrderPrivateCar.getId().toString()+"】,调用接口:"+result); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.orderCancel(tOrderPrivateCarId); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除专车订单 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tOrderPrivateCarId) { |
| | | TOrderPrivateCar tOrderPrivateCar = tOrderPrivateCarService.selectById(tOrderPrivateCarId); |
| | | tOrderPrivateCar.setIsDelete(2); |
| | | tOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 专车改派管理控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-03 14:20:27 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tReassign") |
| | | public class TReassignController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tReassign/"; |
| | | |
| | | @Autowired |
| | | private ITReassignService tReassignService; |
| | | |
| | | @Autowired |
| | | private ITOrderPrivateCarService itOrderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private ITOrderCrossCityService itOrderCrossCityService; |
| | | |
| | | @Autowired |
| | | private ITDriverService itDriverService; |
| | | |
| | | @Resource |
| | | private LineShiftDriverMapper lineShiftDriverMapper; |
| | | |
| | | @Autowired |
| | | private ITDispatchService dispatchService; |
| | | |
| | | @Resource |
| | | private OrderCancelMapper orderCancelMapper; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | @Autowired |
| | | private ITOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | /** |
| | | * 跳转到出租车改派管理首页 |
| | | */ |
| | | @RequestMapping("/taxiPieceLogistics") |
| | | public String taxiPieceLogistics() { |
| | | return PREFIX + "taxi.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到专车改派管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tReassign.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到跨城出行改派管理首页 |
| | | */ |
| | | @RequestMapping("/cross") |
| | | public String corse() { |
| | | return PREFIX + "cross.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到小件物流改派管理首页 |
| | | */ |
| | | @RequestMapping("/smallPieceLogistics") |
| | | public String smallPieceLogistics() { |
| | | return PREFIX + "smallPieceLogistics.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到添加专车改派管理 |
| | | */ |
| | | @RequestMapping("/tReassign_add") |
| | | public String tReassignAdd() { |
| | | return PREFIX + "tReassign_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改专车改派管理 |
| | | */ |
| | | @RequestMapping("/tReassign_update/{tReassignId}") |
| | | public String tReassignUpdate(@PathVariable Integer tReassignId, Model model) { |
| | | TReassign tReassign = tReassignService.selectById(tReassignId); |
| | | model.addAttribute("item",tReassign); |
| | | LogObjectHolder.me().set(tReassign); |
| | | return PREFIX + "tReassign_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改专车改派管理 |
| | | */ |
| | | @RequestMapping("/tReassign_reassignment/{tReassignId}") |
| | | public String tReassign_reassignment(@PathVariable Integer tReassignId, Model model) { |
| | | model.addAttribute("tReassignId",tReassignId); |
| | | return PREFIX + "tReassign_reassignment.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改跨城改派管理 |
| | | */ |
| | | @RequestMapping("/tReassign_reassignmentCross/{tReassignId}") |
| | | public String tReassign_reassignmentCross(@PathVariable Integer tReassignId, Model model) { |
| | | model.addAttribute("tReassignId",tReassignId); |
| | | return PREFIX + "tReassign_reassignmentCross.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改跨城改派管理 |
| | | */ |
| | | @RequestMapping("/tReassign_reassignmentSmall/{tReassignId}") |
| | | public String tReassign_reassignmentSmall(@PathVariable Integer tReassignId, Model model) { |
| | | model.addAttribute("tReassignId",tReassignId); |
| | | return PREFIX + "tReassign_reassignmentSmall.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取专车改派管理列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String insertTime, |
| | | String originalDriverName, |
| | | String originalDriverPhone, |
| | | String orderNum, |
| | | String nowDriverName, |
| | | String nowDriverPhone, |
| | | Integer orderState, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tReassignService.getPrivateCarReassignOrderList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,originalDriverName,originalDriverPhone,orderNum,nowDriverName,nowDriverPhone,orderState,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取跨城改派管理列表 |
| | | */ |
| | | @RequestMapping(value = "/listCross") |
| | | @ResponseBody |
| | | public Object listCross(String insertTime, |
| | | String originalDriverName, |
| | | String originalDriverPhone, |
| | | String orderNum, |
| | | String nowDriverName, |
| | | String nowDriverPhone, |
| | | Integer orderState, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tReassignService.getCrossReassignOrderList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,originalDriverName,originalDriverPhone,orderNum,nowDriverName,nowDriverPhone,orderState,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取跨城改派管理列表 |
| | | */ |
| | | @RequestMapping(value = "/listSmallPieceLogistics") |
| | | @ResponseBody |
| | | public Object listSmallPieceLogistics(String insertTime, |
| | | String originalDriverName, |
| | | String originalDriverPhone, |
| | | String orderNum, |
| | | String nowDriverName, |
| | | String nowDriverPhone, |
| | | Integer orderState, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tReassignService.getSmallPieceLogisticsList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,originalDriverName,originalDriverPhone,orderNum,nowDriverName,nowDriverPhone,orderState,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 选择司机列表 |
| | | */ |
| | | @RequestMapping(value = "/selectDriver/{orderId}") |
| | | @ResponseBody |
| | | public Object selectDriver(@PathVariable Integer orderId, |
| | | String name, |
| | | String phone) { |
| | | TReassign reassign = tReassignService.selectById(orderId); |
| | | TOrderPrivateCar privateCar = itOrderPrivateCarService.selectById(reassign.getOrderId()); |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tReassignService.getCanSelectPrivateCarDriverList(page,privateCar.getCompanyId(),name,phone)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 选择司机列表 |
| | | */ |
| | | @RequestMapping(value = "/selectCrossDriver/{orderId}") |
| | | @ResponseBody |
| | | public Object selectCrossDriver(@PathVariable Integer orderId, |
| | | String name, |
| | | String phone) { |
| | | TReassign reassign = tReassignService.selectById(orderId); |
| | | TOrderCrossCity tOrderCrossCity = itOrderCrossCityService.selectById(reassign.getOrderId()); |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(tOrderCrossCity.getLineShiftDriverId()); |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tReassignService.getCanSelectCrossDriverList(page, tOrderCrossCity.getCompanyId(), tOrderCrossCity.getServerCarModelId(), |
| | | tOrderCrossCity.getLineId(), lineShiftDriver.getLineShiftId(), tOrderCrossCity.getTravelTime(), tOrderCrossCity.getPeopleNumber(), name, phone, tOrderCrossCity.getDriverId())); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 选择司机列表 |
| | | */ |
| | | @RequestMapping(value = "/selectSmallDriver/{orderId}") |
| | | @ResponseBody |
| | | public Object selectSmallDriver(@PathVariable Integer orderId, |
| | | String name, |
| | | String phone) { |
| | | TReassign reassign = tReassignService.selectById(orderId); |
| | | TOrderLogistics tOrderLogistics = orderLogisticsService.selectById(reassign.getOrderId()); |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tReassignService.getCanSelectSmallDriverList(page,tOrderLogistics.getCompanyId(), tOrderLogistics.getType(),name,phone)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 操作专车改派管理 |
| | | * optType 1=拒绝 2=取消 |
| | | */ |
| | | @RequestMapping(value = "/opt") |
| | | @ResponseBody |
| | | public Object opt(@RequestParam Integer tReassignId,@RequestParam Integer optType) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | TReassign tReassign = tReassignService.selectById(tReassignId); |
| | | if (1 == optType){ |
| | | tReassign.setState(5); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //还原订单状态 |
| | | TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId()); |
| | | tOrderPrivateCar.setState(tOrderPrivateCar.getOldState()); |
| | | itOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | }else if (2 == optType){ |
| | | tReassign.setState(4); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //修改订单状态"已取消" |
| | | TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId()); |
| | | tOrderPrivateCar.setState(10); |
| | | itOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | |
| | | //修改司机状态"空闲" |
| | | TDriver driver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | driver.setState(2); |
| | | itDriverService.updateById(driver); |
| | | |
| | | //添加取消记录 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(tReassign.getOrderId()); |
| | | orderCancel.setOrderType(tReassign.getOrderType()); |
| | | orderCancel.setReason("调度端取消订单"); |
| | | orderCancel.setRemark("调度“" + user.getName() + "-" + user.getId() + "”执行取消操作"); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(3); |
| | | orderCancel.setUserId(user.getId()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | //调用推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderPrivateCar.getId().toString()); |
| | | map.put("orderType", "1"); |
| | | String result = HttpRequestUtil.postRequest(PushURL.cancel_order_url, map); |
| | | System.out.println("专车取消:【orderId="+tOrderPrivateCar.getId().toString()+"】,调用接口:"+result); |
| | | } |
| | | |
| | | //返回驾驶员处罚金 |
| | | TDriver originalDriver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | |
| | | //增加交易明细 |
| | | TPubTransactionDetails details = new TPubTransactionDetails(); |
| | | details.setUserId(originalDriver.getId()); |
| | | details.setInsertTime(new Date()); |
| | | details.setRemark("【专车改派】:改派失败或订单取消"); |
| | | details.setMoney(new BigDecimal(tReassign.getMoney())); |
| | | details.setState(1); |
| | | details.setType(1); |
| | | details.setUserType(2); |
| | | details.setOrderType(3); |
| | | details.setOrderId(tReassign.getOrderId()); |
| | | itPubTransactionDetailsService.insert(details); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @Autowired |
| | | private ITPubTransactionDetailsService itPubTransactionDetailsService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 操作专车改派管理 |
| | | * optType 1=拒绝 2=取消 |
| | | */ |
| | | @RequestMapping(value = "/optSmall") |
| | | @ResponseBody |
| | | public Object optSmall(@RequestParam Integer tReassignId,@RequestParam Integer optType) { |
| | | try { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | TReassign tReassign = tReassignService.selectById(tReassignId); |
| | | if (1 == optType){ |
| | | tReassign.setState(5); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //还原订单状态 |
| | | TOrderLogistics tOrderLogistics = orderLogisticsService.selectById(tReassign.getOrderId()); |
| | | tOrderLogistics.setState(tOrderLogistics.getOldState()); |
| | | orderLogisticsService.updateById(tOrderLogistics); |
| | | }else if (2 == optType){ |
| | | tReassign.setState(4); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //修改订单状态"已取消" |
| | | TOrderLogistics tOrderLogistics = orderLogisticsService.selectById(tReassign.getOrderId()); |
| | | tOrderLogistics.setState(10); |
| | | orderLogisticsService.updateById(tOrderLogistics); |
| | | |
| | | //添加取消记录 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(tReassign.getOrderId()); |
| | | orderCancel.setOrderType(tReassign.getOrderType()); |
| | | orderCancel.setReason("调度端取消订单"); |
| | | orderCancel.setRemark("调度“" + user.getName() + "-" + user.getId() + "”执行取消操作"); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(3); |
| | | orderCancel.setUserId(user.getId()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | //调用推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderLogistics.getId().toString()); |
| | | map.put("orderType", tOrderLogistics.getType().toString()); |
| | | String result = HttpRequestUtil.postRequest(PushURL.cancel_order_url, map); |
| | | System.out.println("小件物流取消:【orderId="+tOrderLogistics.getId().toString()+"】,调用接口:"+result); |
| | | |
| | | //已支付的情况下进行退款操作 |
| | | if(null != tOrderLogistics.getPayType() && null != tOrderLogistics.getPayMoney()) { |
| | | if (tOrderLogistics.getPayType() == 3) {//余额支付 |
| | | TUser tUser = userService.selectById(tOrderLogistics.getUserId()); |
| | | tUser.setBalance(tUser.getBalance().add(tOrderLogistics.getPayMoney())); |
| | | userService.updateById(tUser); |
| | | } else { |
| | | List<PaymentRecord> paymentRecords = paymentRecordService.query(1, null, null, tOrderLogistics.getId(), tOrderLogistics.getType(), null, 2); |
| | | if (paymentRecords.size() == 0) { |
| | | return ResultUtil.error("订单还未进行支付"); |
| | | } |
| | | boolean b = false; |
| | | for(PaymentRecord query : paymentRecords){ |
| | | |
| | | } |
| | | if(b){ |
| | | //添加交易明细 |
| | | |
| | | } |
| | | } |
| | | |
| | | transactionDetailsService.saveData(tOrderLogistics.getUserId(), "小件订单取消退款", tOrderLogistics.getPayMoney().doubleValue(), 1, 1, 1, 4, tOrderLogistics.getId()); |
| | | |
| | | //添加负的收入明细 |
| | | List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("type", 2).eq("incomeId", tOrderLogistics.getId()).eq("orderType", tOrderLogistics.getType())); |
| | | for(Income income : incomes){ |
| | | if(income.getUserType() == 2){//处理司机的收入 |
| | | TDriver driver = itDriverService.selectById(income.getObjectId()); |
| | | driver.setBalance(driver.getBalance().subtract(new BigDecimal(income.getMoney()))); |
| | | driver.setLaveBusinessMoney(new BigDecimal(driver.getLaveBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue()); |
| | | driver.setBusinessMoney(new BigDecimal(driver.getBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue()); |
| | | itDriverService.updateById(driver); |
| | | } |
| | | Income income1 = new Income(); |
| | | BeanUtils.copyProperties(income, income1); |
| | | income1.setMoney(income.getMoney() * -1); |
| | | income1.setId(null); |
| | | income1.setInsertTime(new Date()); |
| | | incomeService.insert(income1); |
| | | } |
| | | } |
| | | } |
| | | //返回驾驶员处罚金 |
| | | TDriver originalDriver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | |
| | | //增加交易明细 |
| | | TPubTransactionDetails details = new TPubTransactionDetails(); |
| | | details.setUserId(originalDriver.getId()); |
| | | details.setInsertTime(new Date()); |
| | | details.setRemark("【小件物流】:改派失败或订单取消"); |
| | | details.setMoney(new BigDecimal(tReassign.getMoney())); |
| | | details.setState(1); |
| | | details.setType(1); |
| | | details.setUserType(2); |
| | | details.setOrderType(tReassign.getOrderType()); |
| | | details.setOrderId(tReassign.getOrderId()); |
| | | itPubTransactionDetailsService.insert(details); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 专车订单改派司机 |
| | | */ |
| | | @RequestMapping(value = "/selectDriver") |
| | | @ResponseBody |
| | | public Object selectDriver(@RequestParam Integer orderId,@RequestParam Integer driverId) { |
| | | //修改订单 |
| | | TReassign tReassign = tReassignService.selectById(orderId); |
| | | TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId()); |
| | | |
| | | //修改之前司机状态 -- 空闲 |
| | | TDriver oldDriver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | oldDriver.setState(2); |
| | | itDriverService.updateById(oldDriver); |
| | | |
| | | //查找司机对象 |
| | | TDriver nowDriver = itDriverService.selectById(driverId); |
| | | nowDriver.setState(3); |
| | | itDriverService.updateById(nowDriver); |
| | | |
| | | //修改专车订单 |
| | | tOrderPrivateCar.setState(tOrderPrivateCar.getOldState()); |
| | | tOrderPrivateCar.setDriverId(driverId); |
| | | tOrderPrivateCar.setCarId(nowDriver.getCarId()); |
| | | itOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | |
| | | //修改专车改派订单 |
| | | tReassign.setNowDriverId(driverId); |
| | | tReassign.setNowCarId(nowDriver.getCarId()); |
| | | tReassign.setState(3); |
| | | tReassign.setCompleteTime(new Date()); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("orderId", tOrderPrivateCar.getId().toString()); |
| | | map.put("orderType", "1"); |
| | | String result = HttpRequestUtil.postRequest(PushURL.order_push_url, map); |
| | | System.out.println("专车改派:【orderId="+tOrderPrivateCar.getId().toString()+"】,调用接口:"+result); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 跨城出行订单改派司机 |
| | | */ |
| | | @RequestMapping(value = "/selectCrossDriver") |
| | | @ResponseBody |
| | | public Object selectCrossDriver(@RequestParam Integer orderId,@RequestParam Integer driverId) { |
| | | //修改原司机信息 |
| | | //修改订单 |
| | | TReassign tReassign = tReassignService.selectById(orderId); |
| | | TOrderCrossCity tOrderCrossCity = itOrderCrossCityService.selectById(tReassign.getOrderId()); |
| | | TDriver oldDriver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(tOrderCrossCity.getLineShiftDriverId()); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + tOrderCrossCity.getPeopleNumber() > lineShiftDriver.getTotalSeat() ? |
| | | lineShiftDriver.getTotalSeat() : lineShiftDriver.getLaveSeat() + tOrderCrossCity.getPeopleNumber()); |
| | | String seat = ""; |
| | | String[] split = tOrderCrossCity.getSeatNumber().split(","); |
| | | for(String s : split){ |
| | | seat += s + ","; |
| | | } |
| | | seat = lineShiftDriver.getLaveSeatNumber() + "," + seat.substring(0, seat.length() - 1); |
| | | |
| | | //总和大于总座位数的情况 |
| | | if(lineShiftDriver.getLaveSeat() + tOrderCrossCity.getPeopleNumber() > lineShiftDriver.getTotalSeat()){ |
| | | seat = ""; |
| | | for(int i = 1; i <= lineShiftDriver.getTotalSeat(); i++){ |
| | | seat += i + ","; |
| | | } |
| | | seat = seat.substring(0, seat.length() - 1); |
| | | } |
| | | lineShiftDriver.setLaveSeatNumber(seat); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | if(lineShiftDriver.getLaveSeat() >= lineShiftDriver.getTotalSeat()){ |
| | | oldDriver.setState(2); |
| | | itDriverService.updateById(oldDriver); |
| | | } |
| | | |
| | | //修改新司机数据 |
| | | List<LineShiftDriver> query = lineShiftDriverMapper.query(lineShiftDriver.getLineShiftId(), driverId, tOrderCrossCity.getTravelTime()); |
| | | if(query.size() == 0){ |
| | | return ResultUtil.error("司机没有预约班次"); |
| | | } |
| | | LineShiftDriver lineShiftDriver1 = query.get(0); |
| | | if(lineShiftDriver1.getLaveSeat() < tOrderCrossCity.getPeopleNumber()){ |
| | | return ResultUtil.runErr("司机车辆剩余座位数不足"); |
| | | } |
| | | lineShiftDriver1.setLaveSeat(lineShiftDriver1.getLaveSeat() - tOrderCrossCity.getPeopleNumber()); |
| | | String[] split1 = lineShiftDriver1.getLaveSeatNumber().split(","); |
| | | String seat1 = "";//使用 |
| | | String seat2 = "";//未使用 |
| | | for(int i = 0; i < tOrderCrossCity.getPeopleNumber(); i++){ |
| | | seat1 += split1[i] + ","; |
| | | } |
| | | for(int i = tOrderCrossCity.getPeopleNumber(); i < split.length; i++){ |
| | | seat2 += split1[i] + ","; |
| | | } |
| | | lineShiftDriver1.setLaveSeatNumber(seat2); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver1); |
| | | TDriver driver = itDriverService.selectById(driverId); |
| | | if(driver.getState() == 1){ |
| | | return ResultUtil.error("司机还未上班呢"); |
| | | } |
| | | if(driver.getState() == 2){ |
| | | driver.setState(3); |
| | | } |
| | | |
| | | //修改订单数据 |
| | | tOrderCrossCity.setDriverId(driverId); |
| | | tOrderCrossCity.setCarId(driver.getCarId()); |
| | | tOrderCrossCity.setSeatNumber(seat1); |
| | | tOrderCrossCity.setState(tOrderCrossCity.getOldState()); |
| | | tOrderCrossCity.setLineShiftDriverId(lineShiftDriver1.getId()); |
| | | tOrderCrossCity.setOldState(null); |
| | | tOrderCrossCity.setIsReassign(2); |
| | | try { |
| | | tOrderCrossCity.setOrderNum(itOrderCrossCityService.getOrderNum(driverId, tOrderCrossCity.getLineShiftDriverId())); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | itOrderCrossCityService.updateAllColumnById(tOrderCrossCity); |
| | | |
| | | //修改专车改派订单 |
| | | tReassign.setNowDriverId(driverId); |
| | | tReassign.setNowCarId(driver.getCarId()); |
| | | tReassign.setState(3); |
| | | tReassign.setCompleteTime(new Date()); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //修改收入明细,转给新司机(因为是先支付金额) |
| | | List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", oldDriver.getId()).eq("type", 2).eq("incomeId", tReassign.getOrderId()).eq("orderType", 3)); |
| | | if(incomes.size() > 0){ |
| | | Income income = incomes.get(0); |
| | | income.setObjectId(driverId); |
| | | incomeService.updateById(income); |
| | | |
| | | oldDriver.setBusinessMoney(oldDriver.getBusinessMoney() - income.getMoney()); |
| | | oldDriver.setLaveBusinessMoney(oldDriver.getLaveBusinessMoney() - income.getMoney()); |
| | | oldDriver.setBalance(oldDriver.getBalance().subtract(new BigDecimal(income.getMoney()))); |
| | | |
| | | driver.setBusinessMoney(driver.getBusinessMoney() + income.getMoney()); |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() + income.getMoney()); |
| | | driver.setBalance(driver.getBalance().add(new BigDecimal(income.getMoney()))); |
| | | |
| | | } |
| | | itDriverService.updateById(oldDriver); |
| | | itDriverService.updateById(driver); |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("orderId", tOrderCrossCity.getId().toString()); |
| | | map.put("orderType", "3"); |
| | | String result = HttpRequestUtil.postRequest(PushURL.order_push_url, map); |
| | | System.out.println("跨城出行改派:【orderId="+tOrderCrossCity.getId().toString()+"】,调用接口:"+result); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 专车订单改派司机 |
| | | */ |
| | | @RequestMapping(value = "/selectSmallDriver") |
| | | @ResponseBody |
| | | public Object selectSmallDriver(@RequestParam Integer orderId,@RequestParam Integer driverId) { |
| | | //修改订单 |
| | | TReassign tReassign = tReassignService.selectById(orderId); |
| | | TOrderLogistics tOrderLogistics = orderLogisticsService.selectById(tReassign.getOrderId()); |
| | | |
| | | TDriver nowDriver = itDriverService.selectById(driverId); |
| | | //修改专车订单 |
| | | tOrderLogistics.setState(tOrderLogistics.getOldState()); |
| | | tOrderLogistics.setDriverId(driverId); |
| | | tOrderLogistics.setCarId(nowDriver.getCarId()); |
| | | orderLogisticsService.updateById(tOrderLogistics); |
| | | |
| | | tReassign.setNowDriverId(driverId); |
| | | tReassign.setNowCarId(nowDriver.getCarId()); |
| | | tReassign.setState(3); |
| | | tReassign.setCompleteTime(new Date()); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("userType", 2).eq("type", 2).eq("incomeId", tOrderLogistics.getId()).eq("orderType", tOrderLogistics.getType())); |
| | | for(Income income : incomes){ |
| | | income.setObjectId(driverId); |
| | | incomeService.updateById(income); |
| | | |
| | | TDriver driver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | driver.setBalance(driver.getBalance().subtract(new BigDecimal(income.getMoney()))); |
| | | driver.setBusinessMoney(driver.getBusinessMoney() - income.getMoney()); |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - income.getMoney()); |
| | | itDriverService.updateById(driver); |
| | | |
| | | driver = itDriverService.selectById(driverId); |
| | | driver.setBalance(driver.getBalance().add(new BigDecimal(income.getMoney()))); |
| | | driver.setBusinessMoney(driver.getBusinessMoney() + income.getMoney()); |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() + income.getMoney()); |
| | | itDriverService.updateById(driver); |
| | | } |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("orderId", tOrderLogistics.getId().toString()); |
| | | map.put("orderType", tOrderLogistics.getType().toString()); |
| | | String result = HttpRequestUtil.postRequest(PushURL.order_push_url, map); |
| | | System.out.println("小件物流改派:【orderId="+tOrderLogistics.getId().toString()+"】,调用接口:"+result); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取出租车改派管理列表 |
| | | */ |
| | | @RequestMapping(value = "/listTaxi") |
| | | @ResponseBody |
| | | public Object listTaxi(String insertTime, |
| | | String originalDriverName, |
| | | String originalDriverPhone, |
| | | String orderNum, |
| | | String nowDriverName, |
| | | String nowDriverPhone, |
| | | Integer orderState, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | //page.setRecords(tReassignService.getTaxiReassignOrderList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,originalDriverName,originalDriverPhone,orderNum,nowDriverName,nowDriverPhone,orderState,state)); |
| | | List<Map<String,Object>> list = tReassignService.getTaxiReassignOrderList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,originalDriverName,originalDriverPhone,orderNum,nowDriverName,nowDriverPhone,orderState,state); |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @Autowired |
| | | private ITOrderTaxiService orderTaxiService; |
| | | /** |
| | | * 选择司机列表 |
| | | */ |
| | | @RequestMapping(value = "/selectTaxiDriver/{orderId}") |
| | | @ResponseBody |
| | | public Object selectTaxiDriver(@PathVariable Integer orderId, |
| | | String name, |
| | | String phone) { |
| | | TReassign reassign = tReassignService.selectById(orderId); |
| | | TOrderTaxi tOrderTaxi = orderTaxiService.selectById(reassign.getOrderId()); |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tReassignService.getCanSelectTaxiCarDriverList(page,tOrderTaxi.getCompanyId(),name,phone,tOrderTaxi.getDriverId())); |
| | | return super.packForBT(page); |
| | | } |
| | | /** |
| | | * 操作出租车改派管理 |
| | | * optType 1=拒绝 2=取消 |
| | | */ |
| | | @RequestMapping(value = "/optTaxi") |
| | | @ResponseBody |
| | | public Object optTaxi(@RequestParam Integer tReassignId,@RequestParam Integer optType) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | TReassign tReassign = tReassignService.selectById(tReassignId); |
| | | if (1 == optType){ |
| | | tReassign.setState(5); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //还原订单状态 |
| | | TOrderTaxi tOrderTaxi = orderTaxiService.selectById(tReassign.getOrderId()); |
| | | tOrderTaxi.setState(tOrderTaxi.getOldState()); |
| | | orderTaxiService.updateById(tOrderTaxi); |
| | | }else if (2 == optType){ |
| | | tReassign.setState(4); |
| | | tReassignService.updateById(tReassign); |
| | | |
| | | //修改订单状态"已取消" |
| | | TOrderTaxi tOrderTaxi = orderTaxiService.selectById(tReassign.getOrderId()); |
| | | tOrderTaxi.setState(10); |
| | | orderTaxiService.updateById(tOrderTaxi); |
| | | |
| | | //修改司机状态"空闲" |
| | | TDriver driver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | driver.setState(2); |
| | | itDriverService.updateById(driver); |
| | | |
| | | //添加取消记录 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(tReassign.getOrderId()); |
| | | orderCancel.setOrderType(tReassign.getOrderType()); |
| | | orderCancel.setReason("调度端取消订单"); |
| | | orderCancel.setRemark("调度“" + user.getName() + "-" + user.getId() + "”执行取消操作"); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(3); |
| | | orderCancel.setUserId(user.getId()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | //调用推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderTaxi.getId().toString()); |
| | | map.put("orderType", "2"); |
| | | String result = HttpRequestUtil.postRequest(PushURL.cancel_order_url, map); |
| | | System.out.println("出租车取消:【orderId="+tOrderTaxi.getId().toString()+"】,调用接口:"+result); |
| | | } |
| | | |
| | | //返回驾驶员处罚金 |
| | | TDriver originalDriver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | | |
| | | //增加交易明细 |
| | | TPubTransactionDetails details = new TPubTransactionDetails(); |
| | | details.setUserId(originalDriver.getId()); |
| | | details.setInsertTime(new Date()); |
| | | details.setRemark("【出租车改派】:改派失败或订单取消"); |
| | | details.setMoney(new BigDecimal(tReassign.getMoney())); |
| | | details.setState(1); |
| | | details.setType(1); |
| | | details.setUserType(2); |
| | | details.setOrderType(2); |
| | | details.setOrderId(tReassign.getOrderId()); |
| | | itPubTransactionDetailsService.insert(details); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TServerCarmodelController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TSiteController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TSystemPriceController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/BlackboardController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/DeptController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/DictController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/KaptchaController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/LogController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/LoginController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/LoginLogController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/MenuController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/RoleController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/UediterController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/UserMgrController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/taxi/TOrderTaxiController.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/MD5.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/SendSms.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/SignUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/UploadUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/VenueLatVo.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/WoUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/WrapperUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/factory/UserFactory.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/CarInsurance.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Dept.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Dict.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverActivity.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverActivityHistory.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverActivityOnline.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverActivityOrder.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverActivityRegistered.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverOnline.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverPunish.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverTrain.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/GDInterface.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Income.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/LineShiftDriver.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/LoginLog.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Menu.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Notice.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OperationLog.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OrderCancel.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/PaymentRecord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Region.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Relation.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Role.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SysCouponActivity.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SysCouponRecord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SysRedPacketRecord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TAdvertisement.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TAgreement.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TCar.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TCarBrand.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TCarModel.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TCarService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TCompany.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TCompanyCity.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TComplaint.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TDispatch.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TDriver.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TDriverLine.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TDriverService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TFeedback.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TIntegralGoods.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TIntegralOrder.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TInvoice.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TLine.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TLineCompany.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TLinePrice.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TLineShift.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TLineSite.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TLocation.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TNotices.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOpenCity.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOpenCityBusiness.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderCharter.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderCharteredCar.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderCrossCity.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderEvaluate.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderLogistics.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderPosition.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderPrivateCar.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOrderTaxi.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TPhone.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TProblem.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TPubTransactionDetails.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TPubWithdrawal.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TReassign.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TRechargeMoney.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TRegion.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TServerCarmodel.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSite.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSmsrecord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSysCancleOrder.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSysFaceDistinguish.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSysIntegral.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSysPushOrder.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSysReformist.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSysSensitiveWords.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSystemNotice.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TSystemPrice.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TUseMoney.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TUser.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TUserRedPacketRecord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TVerified.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TVersionManagement.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TransactionDetails.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/User.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivity.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityBalance.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityDiscount1.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityDiscount2.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityInvite.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityRedenvelope.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityRegistered.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserCouponRecord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserRedPacketRecord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDeptService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDictService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverActivityHistoryService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverActivityOnlineService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverActivityOrderService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverActivityRegisteredService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverActivityService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverOnlineService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IGDInterfaceService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IIncomeService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ILoginLogService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IMenuService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/INoticeService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOperationLogService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IPaymentRecordService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IRelationService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IRoleService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ISysCouponActivityService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ISysCouponRecordService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ISysRedPacketRecordService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITAdvertisementService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITAgreementService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITCarBrandService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITCarModelService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITCarService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITCarServiceService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITCompanyCityService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITCompanyService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITComplaintService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITDispatchService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITDriverLineService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITDriverService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITDriverServiceService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITFeedbackService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITIntegralGoodsService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITIntegralOrderService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITInvoiceService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITLineCompanyService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITLinePriceService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITLineService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITLineShiftService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITLineSiteService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITLocationService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITNoticesService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOpenCityBusinessService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOpenCityService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderCharterService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderCharteredCarService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderCrossCityService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderEvaluateService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderLogisticsService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderPositionService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderPrivateCarService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderTaxiService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITPhoneService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITProblemService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITPubTransactionDetailsService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITPubWithdrawalService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITReassignService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITRechargeMoneyService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITRegionService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITServerCarmodelService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSiteService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSmsrecordService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSysCancleOrderService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSysFaceDistinguishService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSysIntegralService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSysPushOrderService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSysReformistService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSysSensitiveWordsService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSystemNoticeService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSystemPriceService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITUseMoneyService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITUserRedPacketRecordService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITUserService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITVerifiedService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITVersionManagementService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITransactionDetailsService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityBalanceService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityDiscount1Service.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityDiscount2Service.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityInviteService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityRedenvelopeService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityRegisteredService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserCouponRecordService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserRedPacketRecordService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserService.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DeptServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DictServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverActivityHistoryServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverActivityOnlineServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverActivityOrderServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverActivityRegisteredServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverActivityServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/GDInterfaceServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/IncomeServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/LoginLogServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/MenuServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/NoticeServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OperationLogServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PaymentRecordServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RelationServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SysCouponActivityServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SysCouponRecordServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SysRedPacketRecordServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAdvertisementServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgreementServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TCarBrandServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TCarModelServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TCarServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TCarServiceServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TCompanyCityServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TCompanyServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TComplaintServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDispatchServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverLineServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverServiceServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TFeedbackServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TIntegralGoodsServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TIntegralOrderServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TInvoiceServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TLineCompanyServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TLinePriceServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TLineServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TLineShiftServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TLineSiteServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TLocationServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TNoticesServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOpenCityBusinessServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOpenCityServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderCharterServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderCharteredCarServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderCrossCityServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderEvaluateServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderLogisticsServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderPositionServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderPrivateCarServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderTaxiServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TPhoneServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TProblemServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TPubTransactionDetailsServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TPubWithdrawalServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TReassignServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TRechargeMoneyServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TRegionServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TServerCarmodelServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSiteServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSmsrecordServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSysCancleOrderServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSysFaceDistinguishServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSysIntegralServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSysPushOrderServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSysReformistServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSysSensitiveWordsServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSystemNoticeServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSystemPriceServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TUseMoneyServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TUserRedPacketRecordServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TUserServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TVerifiedServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TVersionManagementServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TransactionDetailsServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityBalanceServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityDiscount1ServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityDiscount2ServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityInviteServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityRedenvelopeServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityRegisteredServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserCouponRecordServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserRedPacketRecordServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserServiceImpl.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/ManagerUser.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/ReqAddManager.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/ReqEditManager.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/UserDto.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/AddAdminLogUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ConstellationUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/DateUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapElectricFenceUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GaoDeMapUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GeodesyUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/HttpRequestUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/HuaWeiSMSUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/JpushUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OrderUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushURL.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RedisUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ResultUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RongCloudUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SpringContextsUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WoUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/QuartzTest.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/TestJob.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/ThreadTes.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/base/AbstractJob.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/base/QuartzManager.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/base/TimeJobType.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/exceptions/TimeException.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddMachine.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddNotice.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddSensitiveWord.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/SendSms.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/start/TimerServerStartJob.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/three/Base64Coder.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/three/HMACSHA1Util.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/three/PlatformUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/three/TokenUtil.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/CustomWarpper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/DeptWarpper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/DictWarpper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/MenuWarpper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/NoticeWrapper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/RoleWarpper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/TFeedbackWarpper.java
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/UserWarpper.java
ManagementOKTravel/guns-admin/src/test/sql/test.sql |