Commit 44ab1569 authored by Sun's avatar Sun
Browse files

no commit message

parent f0b37245
使用dubbo功能时,才进行配置。
1.开启dubbo provider和consumer注解
服务层
开启注解:@com.alibaba.dubbo.config.annotation.Service(interfaceClass = IXXXXService.class,version = "1.0.0", timeout = 60000)
控制层
开启注解:@Reference(version = "1.0.0")
2.启动zookeeper
3.启动dubbo provider(JeeSpring-webDubboProvider)
4.启动dubbo consumer(JeeSpring-web)
5.使用com.jeespring.modules.server模块测试。
正式使用时,建议增加dubbo-Api模块,包含服务接口和实体类,供provider和consumer调用。
<?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>
<groupId>com.jeespring</groupId>
<artifactId>jeespring-webDubboProvider</artifactId>
<name>jeespring-webDubboProvider</name>
<description>jeespring-webDubboProvider</description>
<version>3.0.0</version>
<packaging>war</packaging>
<parent>
<groupId>com.jeespring</groupId>
<artifactId>jeespring</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>com.jeespring</groupId>
<artifactId>jeespring-cms</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.jeespring</groupId>
<artifactId>jeespring-company</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.jeespring</groupId>
<artifactId>jeespring-framework</artifactId>
<version>1.0.0</version>
</dependency>
<!--dependency>
<groupId>com.jeespring</groupId>
<artifactId>jeespring-mq</artifactId>
<version>1.0.0</version>
</dependency-->
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>apache-ant-zip</artifactId>
<version>2.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/apache-ant-zip-2.3.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>ckfinder</artifactId>
<version>2.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ckfinder-2.3.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>ckfinderplugin-fileeditor</artifactId>
<version>2.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ckfinderplugin-fileeditor-2.3.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>ckfinderplugin-imageresize</artifactId>
<version>2.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ckfinderplugin-imageresize-2.3.jar</systemPath>
</dependency>
<dependency>
<groupId>com.swetake</groupId>
<artifactId>qrcode</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/QRCode-1.5.jar</systemPath>
</dependency>
<dependency>
<groupId>bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.13</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/UserAgentUtils-1.13.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<!--plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes></packagingExcludes>
<warSourceExcludes></warSourceExcludes>
<webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludeArtifactIds>
slf4j-log4j12
</excludeArtifactIds>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved.
*/
package com;
import com.jeespring.common.websocket.WebSockertFilter;
import com.jeespring.modules.sys.service.SystemService;
import org.apache.catalina.connector.Connector;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* jeespring
* springboot的启动类
* * * @author 黄炳桂 516821420@qq.com
* Created on 2017/1/8 16:20
*
* @EnableAutoConfiguration(exclude = {
* org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,
* org.activiti.spring.boot.SecurityAutoConfiguration.class,
* })
* 使用lazyInit缩短Spring Boot启动时间//, lazyInit = true
*/
@EnableCaching
@SpringBootApplication
@ServletComponentScan(basePackages = {"com.jeespring", "com.company","cn.xxx"})
@ComponentScan(basePackages = {"com.jeespring", "com.company","cn.xxx"})
@MapperScan(basePackages={"com.jeespring.modules.**.dao","com.company.project.modules.*.dao","cn.xxx.xxx.modules.*.dao"})
@EnableScheduling
@ComponentScan
@EnableAutoConfiguration
@Configuration
//部署开发异常处理在线文档:https://gitee.com/JeeHuangBingGui/jeeSpringCloud/wikis
//开发文档:https://gitee.com/JeeHuangBingGui/jeeSpringCloud/attach_files (JeeSpringCloud中级培训文档.docx)
public class JeeSpringDriver {
@Value("${http.port}")
private Integer port;
public static void main(String[] args) {
//Spring boot run
new SpringApplicationBuilder(JeeSpringDriver.class).web(true).run(args);
SystemService.printKeyLoadMessage();
//IM WebSocker
WebSockertFilter w = new WebSockertFilter();
w.startWebsocketChatServer();
JeeSpringRunPrint.runPrint();
}
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
// 添加http
tomcat.addAdditionalTomcatConnectors(createStandardConnector());
return tomcat;
}
/**
* 配置http
* @return Connector
*/
private Connector createStandardConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setPort(port);
return connector;
}
}
package com;
public class JeeSpringRunPrint {
public static void runPrint(){
printGods();
printAnimalsGods();
printLadyGods();
printPoetries();
}
private static void printGods() {
System.out.println(
"--------------- 佛祖保佑 神兽护体 女神助攻 流量冲天 ---------------\n" +
" _ooOoo_ \n" +
" o8888888o \n" +
" 88\" . \"88 \n" +
" (| ^_^ |) \n" +
" O\\ = /O \n" +
" ____/`---'\\____ \n" +
" .' \\\\| |// `. \n" +
" / \\||| : |||// \\ \n" +
" / _||||| -:- |||||- \\ \n" +
" | | \\\\\\ - /// | | \n" +
" | \\_| ''\\---/'' | | \n" +
" \\ .-\\__ `-` ___/-. / \n" +
" ___`. .' /--.--\\ `. . ___ \n" +
" .\"\" '< `.___\\_<|>_/___.' >'\"\". \n" +
" | | : `- \\`.;`\\ _ /`;.`/ - ` : | | \n" +
" \\ \\ `-. \\_ __\\ /__ _/ .-` / / \n" +
" ========`-.____`-.___\\_____/___.-`____.-'======== \n" +
" `=---=' \n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n" +
" 佛祖保佑 永不宕机 永无BUG 流量冲天 \n" +
"");
}
private static void printAnimalsGods(){
System.out.println(
"\n" +
"        ┏┓ ┏┓+ + \n" +
"       ┏┛┻━━━━━━━┛┻┓ + + \n" +
"       ┃       ┃ \n" +
"       ┃   ━    ┃ ++ + + + \n" +
"       █████━█████ ┃+ \n" +
"       ┃       ┃ + \n" +
"       ┃   ┻    ┃ \n" +
"       ┃       ┃ + + \n" +
"       ┗━━┓  ┏━━━━┛ \n" +
" ┃   ┃ \n" +
"          ┃   ┃ + + + + \n" +
"          ┃   ┃  \n" +
"          ┃   ┃ +     神兽护体,流量冲天 \n" +
"          ┃   ┃ 永不宕机,代码无bug \n" +
"          ┃   ┃  + \n" +
"          ┃    ┗━━━━━┓ + + \n" +
"          ┃       ┣┓ \n" +
"          ┃       ┏┛ \n" +
"          ┗┓┓┏━━━┳┓┏┛ + + + + \n" +
"           ┃┫┫  ┃┫┫ \n" +
"           ┗┻┛  ┗┻┛+ + + + \n" +
"");
System.out.println(
"\n" +
"       ┏┓ ┏┓ \n" +
" ┏┛┻━━━━━━┛┻┓ \n" +
" ┃       ┃ \n" +
" ┃   ━    ┃ \n" +
" ┃ ┳┛  ┗┳  ┃ \n" +
" ┃       ┃ \n" +
" ┃   ┻    ┃ \n" +
" ┃       ┃ \n" +
" ┗━┓   ┏━━━┛ \n" +
" ┃   ┃ 神兽护体 流量冲天 \n" +
" ┃   ┃ 永不宕机 代码无BUG! \n" +
" ┃   ┗━━━━━━━━━┓ \n" +
" ┃        ┣┓ \n" +
" ┃     ┏┛ \n" +
" ┗━┓ ┓ ┏━━━┳ ┓ ┏━┛ \n" +
" ┃ ┫ ┫ ┃ ┫ ┫ \n" +
" ┗━┻━┛ ┗━┻━┛ \n" +
"");
}
private static void printLadyGods(){
System.out.println(
"\n" +
" .::::. \n" +
" .::::::::. \n" +
" ::::::::::: \n" +
" ..:::::::::::' \n" +
" '::::::::::::' \n" +
" .:::::::::: \n" +
" '::::::::::::::.. 女神助攻,流量冲天 \n" +
" ..::::::::::::. 永不宕机,代码无bug \n" +
" ``:::::::::::::::: \n" +
" ::::``:::::::::' .:::. \n" +
" ::::' ':::::' .::::::::. \n" +
" .::::' :::: .:::::::'::::. \n" +
" .:::' ::::: .:::::::::' ':::::. \n" +
" .::' :::::.:::::::::' ':::::. \n" +
" .::' ::::::::::::::' ``::::. \n" +
" ...::: ::::::::::::' ``::. \n" +
" ```` ':. ':::::::::' ::::.. \n" +
" '.:::::' ':'````.. \n" +
"");
}
private static void printPoetries() {
System.out.println(
"\n" +
" 唐伯虎:\n" +
" 桃花庵歌 \n" +
" 桃花坞里桃花庵,桃花庵下桃花仙; \n" +
" 桃花仙人种桃树,又摘桃花卖酒钱。 \n" +
" 酒醒只在花前坐,酒醉还来花下眠; \n" +
" 半醒半醉日复日,花落花开年复年。 \n" +
" 但愿老死花酒间,不愿鞠躬车马前; \n" +
" 车尘马足富者趣,酒盏花枝贫者缘。 \n" +
" 若将富贵比贫贱,一在平地一在天; \n" +
" 若将贫贱比车马,他得驱驰我得闲。 \n" +
" 别人笑我太疯癫,我笑他人看不穿; \n" +
" 不见五陵豪杰墓,无花无酒锄作田。 \n" +
"");
System.out.println(
"\n" +
" 曹操:\n" +
" 短歌行 \n" +
" 对酒当歌,人生几何?譬如朝露,去日苦多。 \n" +
" 概当以慷,忧思难忘。何以解忧?唯有杜康。 \n" +
" 青青子衿,悠悠我心。但为君故,沈吟至今。 \n" +
" 呦呦鹿鸣,食野之苹。我有嘉宾,鼓瑟吹笙。 \n" +
" 明明如月,何时可掇?忧从中来,不可断绝。 \n" +
" 越陌度阡,枉用相存。契阔谈咽,心念旧恩。 \n" +
" 月明星稀,乌鹊南飞。绕树三匝,何枝可依。 \n" +
" 山不厌高,海不厌深,周公吐哺,天下归心。 \n" +
"");
System.out.println(
"\n" +
" 关羽: \n" +
" 咏关公 \n" +
" 桃园结义薄云天,偃月青龙刀刃寒。 \n" +
" 一骑绝尘走千里,五关斩将震坤乾。 \n" +
" 忠心报国为梁栋,肝胆护兄铸铁肩。 \n" +
" 一去麦城无复返,英魂庙里化青烟。 \n" +
"");
System.out.println(
"\n" +
" 程序员: \n" +
" 程序开发行 \n" +
" 写字楼里写字间,写字间里程序员; \n" +
" 程序人员做开发,又拿程序换活钱。 \n" +
" 上班只在网上坐,下班还来网下眠; \n" +
" 奔驰宝马贵者趣,公交自行程序员。 \n" +
" 不见满街漂亮妹,哪个归得程序员; \n" +
" 别人笑我忒疯癫,我笑他人看不穿。 \n" +
" 年复一年代码圈,精益求精产品圈; \n" +
" 至情之人同成长,缔造和谐至情间。 \n" +
" 千锤百炼飞冲天,辉煌有为戏人间; \n" +
" 谈笑风生社会圈,享天福天下归心。 \n" +
" JeeSpring官方QQ群:328910546 \n" +
" JeeSpring官方QQ群(VIP):558699173 \n" +
" JeeSpring官方架构群:464865153 \n" +
" JeeSpring是官方分布式微服务集群开源框架,使用前端HTML或后端模板引擎+mvvm+spring mvc+spring boot+spring cloud、mybatis、alibaba dubbo 分布式、\n" +
" 微服务、集群、工作流、代码生成(前端界面、底层代码、dubbo、微服务的生成)等核心技术。\n" +
" 开源中国 https://gitee.com/JeeHuangBingGui/jeeSpringCloud\n" +
"");
}
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved.
*/
package com;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
/**
* Web程序启动类
*
* @author 黄炳桂 516821420@qq.com
* @date 2017-05-21 9:43
*/
public class JeeSpringServlet extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(JeeSpringDriver.class);
}
}
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.dao;
import com.jeespring.common.persistence.InterfaceBaseDao;
import org.apache.ibatis.annotations.Mapper;
import com.company.project.modules.ylttrip.entity.TfTicket;
/**
* 订单DAO接口
* @author JeeSpring
* @version 2018-11-07
*/
@Mapper
public interface TfTicketDao extends InterfaceBaseDao<TfTicket> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.entity;
import org.hibernate.validator.constraints.Length;
import com.jeespring.modules.sys.entity.User;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeespring.common.persistence.AbstractBaseEntity;
import com.jeespring.common.utils.excel.annotation.ExcelField;
import com.jeespring.modules.sys.utils.DictUtils;
/**
* 订单Entity
* @author JeeSpring
* @version 2018-11-07
*/
public class TfTicket extends AbstractBaseEntity<TfTicket> {
private static final long serialVersionUID = 1L;
private String ticketNo; // 订单编号
private String goodsNo; // 商品编号
private String goodsItemId; // 种类编号
private String goodsItemName; // 种类名称
private Long goodsNum; // 商品数量
private Double sumGoodsNum; // sum商品数量
private Double price; // 商品单价
private Double sumPrice; // sum商品单价
private Double salePrice; // 订单金额
private Double sumSalePrice; // sum订单金额
private com.jeespring.modules.sys.entity.User user; // 下单人
private java.util.Date orderDate; // 下单时间
private String state; // 订单状态
private String stateLabel; // 订单状态Label
private String statePicture; // 订单状态Picture
private java.util.Date stateDate; // 状态时间
private String custName; // 客户姓名
private String linkPhone; // 联系电话
private String address; // 收货地址
private Long payType; // 付款方式
private String payTypeLabel; // 付款方式Label
private String payTypePicture; // 付款方式Picture
private String logistId; // 物流编号
private String logistComp; // 物流公司
private String checkinCode; // 入园号
private String reserveId; // 票务系统订单号
private String remark; // 订单备注
private java.util.Date beginOrderDate; // 开始 下单时间
private java.util.Date endOrderDate; // 结束 下单时间
private java.util.Date beginStateDate; // 开始 状态时间
private java.util.Date endStateDate; // 结束 状态时间
public TfTicket() {
super();
}
public TfTicket(String id){
super(id);
}
@Length(min=1, max=25, message="订单编号长度必须介于 1 和 25 之间")
@ExcelField(title="订单编号", align=2, sort=1)
public String getTicketNo() {
return ticketNo;
}
public void setTicketNo(String ticketNo) {
this.ticketNo = ticketNo;
}
@Length(min=0, max=25, message="商品编号长度必须介于 0 和 25 之间")
@ExcelField(title="商品编号", align=2, sort=2)
public String getGoodsNo() {
return goodsNo;
}
public void setGoodsNo(String goodsNo) {
this.goodsNo = goodsNo;
}
@Length(min=0, max=255, message="种类编号长度必须介于 0 和 255 之间")
@ExcelField(title="种类编号", align=2, sort=3)
public String getGoodsItemId() {
return goodsItemId;
}
public void setGoodsItemId(String goodsItemId) {
this.goodsItemId = goodsItemId;
}
@Length(min=0, max=255, message="种类名称长度必须介于 0 和 255 之间")
@ExcelField(title="种类名称", align=2, sort=4)
public String getGoodsItemName() {
return goodsItemName;
}
public void setGoodsItemName(String goodsItemName) {
this.goodsItemName = goodsItemName;
}
@ExcelField(title="商品数量", align=2, sort=5)
public Long getGoodsNum() {
return goodsNum;
}
public void setGoodsNum(Long goodsNum) {
this.goodsNum = goodsNum;
}
public Double getSumGoodsNum() {
return sumGoodsNum;
}
public void setSumGoodsNum(Double goodsNum) {
this.sumGoodsNum = goodsNum;
}
@ExcelField(title="商品单价", align=2, sort=6)
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Double getSumPrice() {
return sumPrice;
}
public void setSumPrice(Double price) {
this.sumPrice = price;
}
@ExcelField(title="订单金额", align=2, sort=7)
public Double getSalePrice() {
return salePrice;
}
public void setSalePrice(Double salePrice) {
this.salePrice = salePrice;
}
public Double getSumSalePrice() {
return sumSalePrice;
}
public void setSumSalePrice(Double salePrice) {
this.sumSalePrice = salePrice;
}
@ExcelField(title="下单人", fieldType=User.class, value="user.name", align=2, sort=8)
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelField(title="下单时间", align=2, sort=9)
public Date getOrderDate() {
return orderDate;
}
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
@Length(min=0, max=2, message="订单状态长度必须介于 0 和 2 之间")
@ExcelField(title="订单状态", dictType="STATE", align=2, sort=10)
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getStateLabel() {
return DictUtils.getDictLabel(state,"STATE","");
}
public String getStatePicture() {
return DictUtils.getDictPicture(state,"STATE","");
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelField(title="状态时间", align=2, sort=11)
public Date getStateDate() {
return stateDate;
}
public void setStateDate(Date stateDate) {
this.stateDate = stateDate;
}
@Length(min=0, max=50, message="客户姓名长度必须介于 0 和 50 之间")
@ExcelField(title="客户姓名", align=2, sort=12)
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
@Length(min=0, max=50, message="联系电话长度必须介于 0 和 50 之间")
@ExcelField(title="联系电话", align=2, sort=13)
public String getLinkPhone() {
return linkPhone;
}
public void setLinkPhone(String linkPhone) {
this.linkPhone = linkPhone;
}
@Length(min=0, max=500, message="收货地址长度必须介于 0 和 500 之间")
@ExcelField(title="收货地址", align=2, sort=14)
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@ExcelField(title="付款方式", dictType="PAY_TYPE", align=2, sort=15)
public Long getPayType() {
return payType;
}
public void setPayType(Long payType) {
this.payType = payType;
}
public String getPayTypeLabel() {
return DictUtils.getDictLabel(payType,"PAY_TYPE","");
}
public String getPayTypePicture() {
return DictUtils.getDictPicture(payType,"PAY_TYPE","");
}
@Length(min=0, max=25, message="物流编号长度必须介于 0 和 25 之间")
@ExcelField(title="物流编号", align=2, sort=16)
public String getLogistId() {
return logistId;
}
public void setLogistId(String logistId) {
this.logistId = logistId;
}
@Length(min=0, max=200, message="物流公司长度必须介于 0 和 200 之间")
@ExcelField(title="物流公司", align=2, sort=17)
public String getLogistComp() {
return logistComp;
}
public void setLogistComp(String logistComp) {
this.logistComp = logistComp;
}
@Length(min=0, max=255, message="入园号长度必须介于 0 和 255 之间")
@ExcelField(title="入园号", align=2, sort=18)
public String getCheckinCode() {
return checkinCode;
}
public void setCheckinCode(String checkinCode) {
this.checkinCode = checkinCode;
}
@Length(min=0, max=30, message="票务系统订单号长度必须介于 0 和 30 之间")
@ExcelField(title="票务系统订单号", align=2, sort=20)
public String getReserveId() {
return reserveId;
}
public void setReserveId(String reserveId) {
this.reserveId = reserveId;
}
@Length(min=0, max=500, message="订单备注长度必须介于 0 和 500 之间")
@ExcelField(title="订单备注", align=2, sort=21)
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getBeginOrderDate() {
return beginOrderDate;
}
public void setBeginOrderDate(Date beginOrderDate) {
this.beginOrderDate = beginOrderDate;
}
public Date getEndOrderDate() {
return endOrderDate;
}
public void setEndOrderDate(Date endOrderDate) {
this.endOrderDate = endOrderDate;
}
public Date getBeginStateDate() {
return beginStateDate;
}
public void setBeginStateDate(Date beginStateDate) {
this.beginStateDate = beginStateDate;
}
public Date getEndStateDate() {
return endStateDate;
}
public void setEndStateDate(Date endStateDate) {
this.endStateDate = endStateDate;
}
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.rest;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
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.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.jeespring.common.utils.DateUtils;
import com.jeespring.common.config.Global;
import com.jeespring.common.persistence.Page;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.common.utils.StringUtils;
import com.jeespring.common.utils.excel.ExportExcel;
import com.jeespring.common.utils.excel.ImportExcel;
import com.company.project.modules.ylttrip.entity.TfTicket;
import com.company.project.modules.ylttrip.service.ITfTicketService;
import org.springframework.web.bind.annotation.RestController;
import com.jeespring.common.web.Result;
import com.jeespring.common.web.ResultFactory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
/**
* 订单Controller
* @author JeeSpring
* @version 2018-11-07
*/
@RestController
@RequestMapping(value = "/rest/ylttrip/tfTicket")
@Api(value="订单接口", description="订单接口")
public class TfTicketRestController extends AbstractBaseController {
//调用dubbo服务器是,要去Reference注解,注解Autowired
//@Reference(version = "1.0.0")
@Autowired
private ITfTicketService tfTicketService;
/**
* 订单信息
*/
@RequestMapping(value = {"get"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="订单信息(Content-Type为text/html)", notes="订单信息(Content-Type为text/html)")
@ApiImplicitParam(name = "id", value = "订单id", required = false, dataType = "String",paramType="query")
public Result getRequestParam(@RequestParam(required=false) String id) {
return get(id);
}
@RequestMapping(value = {"get/json"},method ={RequestMethod.POST})
@ApiOperation(value="订单信息(Content-Type为application/json)", notes="订单信息(Content-Type为application/json)")
@ApiImplicitParam(name = "id", value = "订单id", required = false, dataType = "String",paramType="body")
public Result getRequestBody(@RequestBody(required=false) String id) {
return get(id);
}
private Result get(String id) {
TfTicket entity = null;
if (StringUtils.isNotBlank(id)){
entity = tfTicketService.getCache(id);
//entity = tfTicketService.get(id);
}
if (entity == null){
entity = new TfTicket();
}
Result result = ResultFactory.getSuccessResult();
result.setResultObject(entity);
return result;
}
/**
* 订单列表(不包含页信息)
*/
//RequiresPermissions("ylttrip:tfTicket:findList")
@RequestMapping(value = {"findList"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="订单列表(不包含页信息)(Content-Type为text/html)", notes="订单列表(不包含页信息)(Content-Type为text/html)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="query")
public Result findListRequestParam(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
return findList( tfTicket,model);
}
@RequestMapping(value = {"findList/json"},method ={RequestMethod.POST})
@ApiOperation(value="订单列表(不包含页信息)(Content-Type为application/json)", notes="订单列表(不包含页信息)(Content-Type为application/json)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="body")
public Result findListRequestBody(@RequestBody TfTicket tfTicket, Model model) {
return findList( tfTicket,model);
}
private Result findList(TfTicket tfTicket, Model model) {
List<TfTicket> list = tfTicketService.findListCache(tfTicket);
//List<TfTicket> list = tfTicketService.findList(tfTicket);
Result result = ResultFactory.getSuccessResult();
result.setResultObject(list);
return result;
}
/**
* 订单列表(包含页信息)
*/
//RequiresPermissions("ylttrip:tfTicket:list")
@RequestMapping(value = {"list"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="订单列表(包含页信息)(Content-Type为text/html)", notes="订单列表(包含页信息)(Content-Type为text/html)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="query")
public Result listRequestParam(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
return list(tfTicket,model);
}
@RequestMapping(value = {"list/json"},method ={RequestMethod.POST})
@ApiOperation(value="订单列表(包含页信息)(Content-Type为application/json)", notes="订单列表(包含页信息)(Content-Type为application/json)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="body")
public Result listRequestBody(@RequestBody TfTicket tfTicket, Model model) {
return list(tfTicket,model);
}
private Result list(TfTicket tfTicket, Model model) {
Page<TfTicket> page = tfTicketService.findPageCache(new Page<TfTicket>(tfTicket.getPageNo(),tfTicket.getPageSize(),tfTicket.getOrderBy()), tfTicket);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(tfTicket.getPageNo(),tfTicket.getPageSize(),tfTicket.getOrderBy()), tfTicket);
Result result = ResultFactory.getSuccessResult();
result.setResultObject(page);
return result;
}
/**
* 订单获取列表第一条记录
*/
//RequiresPermissions("ylttrip:tfTicket:listFrist")
@RequestMapping(value = {"listFrist"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="订单获取列表第一条记录(Content-Type为text/html)", notes="订单获取列表第一条记录(Content-Type为text/html)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="query")
public Result listFristRequestParam(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
return listFrist(tfTicket,model);
}
@RequestMapping(value = {"listFrist/json"},method ={RequestMethod.POST})
@ApiOperation(value="订单获取列表第一条记录(Content-Type为application/json)", notes="订单获取列表第一条记录(Content-Type为application/json)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="body")
public Result listFristRequestBody(@RequestBody TfTicket tfTicket, Model model) {
return listFrist(tfTicket,model);
}
private Result listFrist(TfTicket tfTicket, Model model) {
Page<TfTicket> page = tfTicketService.findPageCache(new Page<TfTicket>(tfTicket.getPageNo(),tfTicket.getPageSize(),tfTicket.getOrderBy()), tfTicket);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(tfTicket.getPageNo(),tfTicket.getPageSize(),tfTicket.getOrderBy()), tfTicket);
Result result = ResultFactory.getSuccessResult();
if(page.getList().size()>0){
result.setResultObject(page.getList().get(0));
}else{
result=ResultFactory.getErrorResult("没有记录!");
}
return result;
}
/**
* 保存订单
*/
//RequiresPermissions(value={"ylttrip:tfTicket:add","ylttrip:tfTicket:edit"},logical=Logical.OR)
@RequestMapping(value = "save",method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="保存订单(Content-Type为text/html)", notes="保存订单(Content-Type为text/html)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="query")
public Result saveRequestParam(TfTicket tfTicket, Model model, RedirectAttributes redirectAttributes) {
return save(tfTicket,model,redirectAttributes);
}
@RequestMapping(value = "save/json",method ={RequestMethod.POST})
@ApiOperation(value="保存订单(Content-Type为application/json)", notes="保存订单(Content-Type为application/json)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="body")
public Result saveRequestBody(@RequestBody TfTicket tfTicket, Model model, RedirectAttributes redirectAttributes) {
return save(tfTicket,model,redirectAttributes);
}
private Result save(TfTicket tfTicket, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, tfTicket)){
Result result = ResultFactory.getErrorResult("数据验证失败");
}
tfTicketService.save(tfTicket);
Result result = ResultFactory.getSuccessResult("保存订单成功");
return result;
}
/**
* 删除订单
*/
//RequiresPermissions("ylttrip:tfTicket:del")
@RequestMapping(value = "delete",method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="删除订单(Content-Type为text/html)", notes="删除订单(Content-Type为text/html)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="query")
public Result deleteRequestParam(TfTicket tfTicket, RedirectAttributes redirectAttributes) {
return delete(tfTicket,redirectAttributes);
}
@RequestMapping(value = "delete/json",method ={RequestMethod.POST})
@ApiOperation(value="删除订单(Content-Type为application/json)", notes="删除订单(Content-Type为application/json)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="body")
public Result deleteRequestBody(@RequestBody TfTicket tfTicket, RedirectAttributes redirectAttributes) {
return delete(tfTicket,redirectAttributes);
}
private Result delete(TfTicket tfTicket, RedirectAttributes redirectAttributes) {
tfTicketService.delete(tfTicket);
Result result = ResultFactory.getSuccessResult("删除订单成功");
return result;
}
/**
* 删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping(value = "deleteByLogic",method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="逻辑删除订单(Content-Type为text/html)", notes="逻辑删除订单(Content-Type为text/html)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="query")
public Result deleteByLogicRequestParam(TfTicket tfTicket, RedirectAttributes redirectAttributes) {
return deleteByLogic(tfTicket,redirectAttributes);
}
/**
* 删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping(value = "deleteByLogic/json",method ={RequestMethod.POST})
@ApiOperation(value="逻辑删除订单(Content-Type为application/json)", notes="逻辑删除订单(Content-Type为application/json)")
@ApiImplicitParam(name = "tfTicket", value = "订单", dataType = "TfTicket",paramType="body")
public Result deleteByLogicRequestBody(@RequestBody TfTicket tfTicket, RedirectAttributes redirectAttributes) {
return deleteByLogic(tfTicket,redirectAttributes);
}
private Result deleteByLogic(TfTicket tfTicket, RedirectAttributes redirectAttributes) {
tfTicketService.deleteByLogic(tfTicket);
Result result = ResultFactory.getSuccessResult("删除订单成功");
return result;
}
/**
* 批量删除订单
*/
//RequiresPermissions("ylttrip:tfTicket:del")
@RequestMapping(value = "deleteAll",method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="批量删除订单(Content-Type为text/html)", notes="批量删除订单(Content-Type为text/html)")
@ApiImplicitParam(name = "ids", value = "订单ids,用,隔开", required = false, dataType = "String",paramType="query")
public Result deleteAllRequestParam(String ids, RedirectAttributes redirectAttributes) {
return deleteAll(ids,redirectAttributes);
}
@RequestMapping(value = "deleteAll/json",method ={RequestMethod.POST})
@ApiOperation(value="批量删除订单(Content-Type为application/json)", notes="批量删除订单(Content-Type为application/json)")
@ApiImplicitParam(name = "ids", value = "订单ids,用,隔开", required = false, dataType = "String",paramType="body")
public Result deleteAllRequestBody(@RequestBody String ids, RedirectAttributes redirectAttributes) {
return deleteAll(ids,redirectAttributes);
}
private Result deleteAll(String ids, RedirectAttributes redirectAttributes) {
String idArray[] =ids.split(",");
for(String id : idArray){
tfTicketService.delete(tfTicketService.get(id));
}
Result result = ResultFactory.getSuccessResult("删除订单成功");
return result;
}
/**
* 批量删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping(value = "deleteAllByLogic",method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="逻辑批量删除订单(Content-Type为text/html)", notes="逻辑批量删除订单(Content-Type为text/html)")
@ApiImplicitParam(name = "ids", value = "订单ids,用,隔开", required = false, dataType = "String",paramType="query")
public Result deleteAllByLogicRequestParam(String ids, RedirectAttributes redirectAttributes) {
return deleteAllByLogic(ids,redirectAttributes);
}
/**
* 批量删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping(value = "deleteAllByLogic/json",method ={RequestMethod.POST})
@ApiOperation(value="逻辑批量删除订单(Content-Type为application/json)", notes="逻辑批量删除订单(Content-Type为application/json)")
@ApiImplicitParam(name = "ids", value = "订单ids,用,隔开", required = false, dataType = "String",paramType="body")
public Result deleteAllByLogicRequestBody(@RequestBody String ids, RedirectAttributes redirectAttributes) {
return deleteAllByLogic(ids,redirectAttributes);
}
private Result deleteAllByLogic(String ids, RedirectAttributes redirectAttributes) {
String idArray[] =ids.split(",");
for(String id : idArray){
tfTicketService.deleteByLogic(tfTicketService.get(id));
}
Result result = ResultFactory.getSuccessResult("删除订单成功");
return result;
}
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.service;
import com.jeespring.common.persistence.InterfaceBaseService;
import com.jeespring.modules.server.entity.SysServer;
import com.company.project.modules.ylttrip.entity.TfTicket;
/**
* I订单Service
* @author JeeSpring
* @version 2018-11-07
*/
public interface ITfTicketService extends InterfaceBaseService<TfTicket> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.service;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.jeespring.common.persistence.Page;
import com.jeespring.common.service.AbstractBaseService;
import com.company.project.modules.ylttrip.entity.TfTicket;
import com.company.project.modules.ylttrip.dao.TfTicketDao;
import com.company.project.modules.ylttrip.service.ITfTicketService;
import com.alibaba.fastjson.JSON;
import com.jeespring.common.redis.RedisUtils;
import com.jeespring.common.security.MD5Tools;
//import com.alibaba.dubbo.config.annotation.Service;
import com.jeespring.common.config.Global;
/**
* 订单Service
* @author JeeSpring
* @version 2018-11-07
*/
//启用dubbo服务器时,要去掉下面注解
//com.alibaba.dubbo.config.annotation.Service(interfaceClass = ISysServerService.class,version = "1.0.0", timeout = 60000)
@org.springframework.stereotype.Service
@Transactional(readOnly = true)
public class TfTicketService extends AbstractBaseService<TfTicketDao, TfTicket> implements ITfTicketService{
/**
* redis caches
*/
@Autowired
private RedisUtils redisUtils;
public TfTicket get(String id) {
//获取数据库数据
TfTicket tfTicket=super.get(id);
return tfTicket;
}
public TfTicket getCache(String id) {
//获取缓存数据
TfTicket tfTicket=(TfTicket)redisUtils.get(RedisUtils.getIdKey(TfTicketService.class.getName(),id));
if( tfTicket!=null) return tfTicket;
//获取数据库数据
tfTicket=super.get(id);
//设置缓存数据
redisUtils.set(RedisUtils.getIdKey(TfTicketService.class.getName(),id),tfTicket);
return tfTicket;
}
public List<TfTicket> total(TfTicket tfTicket) {
//获取数据库数据
List<TfTicket> tfTicketList=super.total(tfTicket);
return tfTicketList;
}
public List<TfTicket> totalCache(TfTicket tfTicket) {
//获取缓存数据
String totalKey = RedisUtils.getTotalKey(TfTicketService.class.getName(),JSON.toJSONString(tfTicket));
List<TfTicket> tfTicketList=(List<TfTicket>)redisUtils.get(totalKey);
if(tfTicketList!=null) return tfTicketList;
//获取数据库数据
tfTicketList=super.total(tfTicket);
//设置缓存数据
redisUtils.set(totalKey,tfTicketList);
return tfTicketList;
}
public List<TfTicket> findList(TfTicket tfTicket) {
//获取数据库数据
List<TfTicket> tfTicketList=super.findList(tfTicket);
//设置缓存数据
return tfTicketList;
}
public List<TfTicket> findListCache(TfTicket tfTicket) {
//获取缓存数据
String findListKey = RedisUtils.getFindListKey(TfTicketService.class.getName(),JSON.toJSONString(tfTicket));
List<TfTicket> tfTicketList=(List<TfTicket>)redisUtils.get(findListKey);
if(tfTicketList!=null) return tfTicketList;
//获取数据库数据
tfTicketList=super.findList(tfTicket);
//设置缓存数据
redisUtils.set(findListKey,tfTicketList);
return tfTicketList;
}
public TfTicket findListFirst(TfTicket tfTicket) {;
//获取数据库数据
List<TfTicket> tfTicketList=super.findList(tfTicket);
if(tfTicketList.size()>0) tfTicket=tfTicketList.get(0);
return tfTicket;
}
public TfTicket findListFirstCache(TfTicket tfTicket) {
//获取缓存数据
String findListFirstKey = RedisUtils.getFindListFirstKey(TfTicketService.class.getName(),JSON.toJSONString(tfTicket));
TfTicket tfTicketRedis=(TfTicket)redisUtils.get(findListFirstKey);
if(tfTicketRedis!=null) return tfTicketRedis;
//获取数据库数据
List<TfTicket> tfTicketList=super.findList(tfTicket);
if(tfTicketList.size()>0) tfTicket=tfTicketList.get(0);
else tfTicket=new TfTicket();
//设置缓存数据
redisUtils.set(findListFirstKey,tfTicket);
return tfTicket;
}
public Page<TfTicket> findPage(Page<TfTicket> page, TfTicket tfTicket) {
//获取数据库数据
Page<TfTicket> pageReuslt=super.findPage(page, tfTicket);
return pageReuslt;
}
public Page<TfTicket> findPageCache(Page<TfTicket> page, TfTicket tfTicket) {
//获取缓存数据
String findPageKey = RedisUtils.getFindPageKey(TfTicketService.class.getName(),JSON.toJSONString(page)+JSON.toJSONString(tfTicket));
Page<TfTicket> pageReuslt=(Page<TfTicket>)redisUtils.get(findPageKey);
if(pageReuslt!=null) return pageReuslt;
//获取数据库数据
pageReuslt=super.findPage(page, tfTicket);
//设置缓存数据
redisUtils.set(findPageKey,pageReuslt);
return pageReuslt;
}
@Transactional(readOnly = false)
public void save(TfTicket tfTicket) {
//保存数据库记录
super.save(tfTicket);
//设置清除缓存数据
redisUtils.remove(RedisUtils.getIdKey(TfTicketService.class.getName(),tfTicket.getId()));
//清除列表和页面缓存数据
redisUtils.removePattern(RedisUtils.getFindListKeyPattern(TfTicketService.class.getName()));
redisUtils.removePattern(RedisUtils.getFinPageKeyPattern(TfTicketService.class.getName()));
}
@Transactional(readOnly = false)
public void delete(TfTicket tfTicket) {
//清除记录缓存数据
redisUtils.remove(RedisUtils.getIdKey(TfTicketService.class.getName(),tfTicket.getId()));
//删除数据库记录
super.delete(tfTicket);
//清除列表和页面缓存数据
redisUtils.removePattern(RedisUtils.getFindListKeyPattern(TfTicketService.class.getName()));
redisUtils.removePattern(RedisUtils.getFinPageKeyPattern(TfTicketService.class.getName()));
}
@Transactional(readOnly = false)
public void deleteByLogic(TfTicket tfTicket) {
//清除记录缓存数据
redisUtils.remove(RedisUtils.getIdKey(TfTicketService.class.getName(),tfTicket.getId()));
//逻辑删除数据库记录
super.deleteByLogic(tfTicket);
//清除列表和页面缓存数据
redisUtils.removePattern(RedisUtils.getFindListKeyPattern(TfTicketService.class.getName()));
redisUtils.removePattern(RedisUtils.getFinPageKeyPattern(TfTicketService.class.getName()));
}
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
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.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.jeespring.common.utils.DateUtils;
import com.jeespring.common.config.Global;
import com.jeespring.common.persistence.Page;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.common.utils.StringUtils;
import com.jeespring.common.utils.excel.ExportExcel;
import com.jeespring.common.utils.excel.ImportExcel;
import com.company.project.modules.ylttrip.entity.TfTicket;
import com.company.project.modules.ylttrip.service.TfTicketService;
import com.company.project.modules.ylttrip.service.ITfTicketService;
import com.alibaba.dubbo.config.annotation.Reference;
/**
* 订单Controller
* @author JeeSpring
* @version 2018-11-07
*/
@Controller
@RequestMapping(value = "${adminPath}/ylttrip/tfTicket")
public class TfTicketController extends AbstractBaseController {
//调用dubbo服务器是,要去Reference注解,注解Autowired
//@Reference(version = "1.0.0")
@Autowired
private ITfTicketService tfTicketService;
@ModelAttribute
public TfTicket get(@RequestParam(required=false) String id) {
TfTicket entity = null;
if (StringUtils.isNotBlank(id)){
entity = tfTicketService.getCache(id);
//entity = tfTicketService.get(id);
}
if (entity == null){
entity = new TfTicket();
}
return entity;
}
/**
* 订单统计页面
*/
@RequiresPermissions("ylttrip:tfTicket:total")
@RequestMapping(value = {"total"})
public String totalView(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
total(tfTicket,request,response,model);
return "modules/ylttrip/tfTicketTotal";
}
private void total(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
if(StringUtils.isEmpty(tfTicket.getTotalType())){
tfTicket.setTotalType("%Y-%m-%d");
}
//X轴的数据
List<String> xAxisData= new ArrayList<String>();
//Y轴的数据
Map<String,List<Double>> yAxisData = new HashMap<String,List<Double>>();
List<Double> countList = new ArrayList<Double>();
List<Double> sumList = new ArrayList<Double>();
List<Double> sumGoodsNumList = new ArrayList<Double>();
List<Double> sumPriceList = new ArrayList<Double>();
List<Double> sumSalePriceList = new ArrayList<Double>();
if(tfTicket.getOrderBy()==""){
tfTicket.setOrderBy("totalDate");
}
List<TfTicket> list = tfTicketService.totalCache(tfTicket);
//List<TfTicket> list = tfTicketService.total(tfTicket);
model.addAttribute("list", list);
for(TfTicket tfTicketItem:list){
//x轴数据
xAxisData.add( tfTicketItem.getTotalDate());
countList.add(Double.valueOf(tfTicketItem.getTotalCount()));
if(tfTicketItem.getSumGoodsNum()!=null)
sumGoodsNumList.add(Double.valueOf(tfTicketItem.getSumGoodsNum()));
else
tfTicketItem.setSumGoodsNum(0D);
if(tfTicketItem.getSumPrice()!=null)
sumPriceList.add(Double.valueOf(tfTicketItem.getSumPrice()));
else
tfTicketItem.setSumPrice(0D);
if(tfTicketItem.getSumSalePrice()!=null)
sumSalePriceList.add(Double.valueOf(tfTicketItem.getSumSalePrice()));
else
tfTicketItem.setSumSalePrice(0D);
}
yAxisData.put("数量", countList);
yAxisData.put("商品数量", sumGoodsNumList);
yAxisData.put("商品单价", sumPriceList);
yAxisData.put("订单金额", sumSalePriceList);
request.setAttribute("xAxisData", xAxisData);
request.setAttribute("yAxisData", yAxisData);
model.addAttribute("sumTotalCount", list.stream().mapToInt(TfTicket::getTotalCount).sum());
model.addAttribute("sumGoodsNum", list.stream().mapToDouble(TfTicket::getSumGoodsNum).sum());
model.addAttribute("sumPrice", list.stream().mapToDouble(TfTicket::getSumPrice).sum());
model.addAttribute("sumSalePrice", list.stream().mapToDouble(TfTicket::getSumSalePrice).sum());
//饼图数据
Map<String,Object> orientData= new HashMap<String,Object>();
Map<String,Object> orientDataSumGoodsNum= new HashMap<String,Object>();
Map<String,Object> orientDataSumPrice= new HashMap<String,Object>();
Map<String,Object> orientDataSumSalePrice= new HashMap<String,Object>();
for(TfTicket tfTicketItem:list){
orientData.put(tfTicketItem.getTotalDate(), tfTicketItem.getTotalCount());
orientDataSumGoodsNum.put(tfTicketItem.getTotalDate(), Double.valueOf(tfTicketItem.getSumGoodsNum()));
orientDataSumPrice.put(tfTicketItem.getTotalDate(), Double.valueOf(tfTicketItem.getSumPrice()));
orientDataSumSalePrice.put(tfTicketItem.getTotalDate(), Double.valueOf(tfTicketItem.getSumSalePrice()));
}
model.addAttribute("orientData", orientData);
model.addAttribute("orientDataSumGoodsNum", orientDataSumGoodsNum);
model.addAttribute("orientDataSumPrice", orientDataSumPrice);
model.addAttribute("orientDataSumSalePrice", orientDataSumSalePrice);
}
@RequiresPermissions("ylttrip:tfTicket:total")
@RequestMapping(value = {"totalMap"})
public String totalMap(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
if(StringUtils.isEmpty(tfTicket.getTotalType())){
tfTicket.setTotalType("%Y-%m-%d");
}
List<TfTicket> list = tfTicketService.totalCache(tfTicket);
//List<TfTicket> list = tfTicketService.total(tfTicket);
model.addAttribute("sumTotalCount", list.stream().mapToInt(TfTicket::getTotalCount).sum());
model.addAttribute("sumGoodsNum", list.stream().mapToDouble(TfTicket::getSumGoodsNum).sum());
model.addAttribute("sumPrice", list.stream().mapToDouble(TfTicket::getSumPrice).sum());
model.addAttribute("sumSalePrice", list.stream().mapToDouble(TfTicket::getSumSalePrice).sum());
model.addAttribute("list", list);
return "modules/ylttrip/tfTicketTotalMap";
}
/**
* 订单列表页面
*/
@RequiresPermissions("ylttrip:tfTicket:list")
@RequestMapping(value = {"list", ""})
public String list(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<TfTicket> page = tfTicketService.findPageCache(new Page<TfTicket>(request, response), tfTicket);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(request, response), tfTicket);
model.addAttribute("page", page);
tfTicket.setOrderBy("totalDate");
total(tfTicket,request,response,model);
return "modules/ylttrip/tfTicketList";
}
/**
* 订单列表页面
*/
@RequiresPermissions("ylttrip:tfTicket:list")
@RequestMapping(value = {"listVue"})
public String listVue(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<TfTicket> page = tfTicketService.findPageCache(new Page<TfTicket>(request, response), tfTicket);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(request, response), tfTicket);
model.addAttribute("page", page);
return "modules/ylttrip/tfTicketListVue";
}
/**
* 订单列表页面
*/
//RequiresPermissions("ylttrip:tfTicket:select")
@RequestMapping(value = {"select"})
public String select(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<TfTicket> page = tfTicketService.findPageCache(new Page<TfTicket>(request, response), tfTicket);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(request, response), tfTicket);
model.addAttribute("page", page);
return "modules/ylttrip/tfTicketSelect";
}
/**
* 查看,增加,编辑订单表单页面
*/
@RequiresPermissions(value={"ylttrip:tfTicket:view","ylttrip:tfTicket:add","ylttrip:tfTicket:edit"},logical=Logical.OR)
@RequestMapping(value = "form")
public String form(TfTicket tfTicket, Model model, HttpServletRequest request, HttpServletResponse response) {
model.addAttribute("action", request.getParameter("action"));
model.addAttribute("tfTicket", tfTicket);
if(request.getParameter("ViewFormType")!=null && request.getParameter("ViewFormType").equals("FormTwo"))
return "modules/ylttrip/tfTicketFormTwo";
return "modules/ylttrip/tfTicketForm";
}
/**
* 保存订单
*/
@RequiresPermissions(value={"ylttrip:tfTicket:add","ylttrip:tfTicket:edit"},logical=Logical.OR)
@RequestMapping(value = "save")
public String save(TfTicket tfTicket, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response) {
if (!beanValidator(model, tfTicket)){
return form(tfTicket, model,request,response);
}
tfTicketService.save(tfTicket);
addMessage(redirectAttributes, "保存订单成功");
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
/**
* 删除订单
*/
@RequiresPermissions("ylttrip:tfTicket:del")
@RequestMapping(value = "delete")
public String delete(TfTicket tfTicket, RedirectAttributes redirectAttributes) {
tfTicketService.delete(tfTicket);
addMessage(redirectAttributes, "删除订单成功");
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
/**
* 删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequiresPermissions(value={"ylttrip:tfTicket:del","ylttrip:tfTicket:delByLogic"},logical=Logical.OR)
@RequestMapping(value = "deleteByLogic")
public String deleteByLogic(TfTicket tfTicket, RedirectAttributes redirectAttributes) {
tfTicketService.deleteByLogic(tfTicket);
addMessage(redirectAttributes, "逻辑删除订单成功");
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
/**
* 批量删除订单
*/
@RequiresPermissions("ylttrip:tfTicket:del")
@RequestMapping(value = "deleteAll")
public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
String idArray[] =ids.split(",");
for(String id : idArray){
tfTicketService.delete(tfTicketService.get(id));
}
addMessage(redirectAttributes, "删除订单成功");
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
/**
* 批量删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequiresPermissions(value={"ylttrip:tfTicket:del","ylttrip:tfTicket:delByLogic"},logical=Logical.OR)
@RequestMapping(value = "deleteAllByLogic")
public String deleteAllByLogic(String ids, RedirectAttributes redirectAttributes) {
String idArray[] =ids.split(",");
for(String id : idArray){
tfTicketService.deleteByLogic(tfTicketService.get(id));
}
addMessage(redirectAttributes, "删除订单成功");
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
/**
* 导出excel文件
*/
@RequiresPermissions("ylttrip:tfTicket:export")
@RequestMapping(value = "export", method=RequestMethod.POST)
public String exportFile(TfTicket tfTicket, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
String fileName = "订单"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(request, response, -1), tfTicket);
new ExportExcel("订单", TfTicket.class).setDataList(page.getList()).write(response, fileName).dispose();
return null;
} catch (Exception e) {
addMessage(redirectAttributes, "导出订单记录失败!失败信息:"+e.getMessage());
}
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
/**
* 导入Excel数据
*/
@RequiresPermissions("ylttrip:tfTicket:import")
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
try {
int successNum = 0;
ImportExcel ei = new ImportExcel(file, 1, 0);
List<TfTicket> list = ei.getDataList(TfTicket.class);
for (TfTicket tfTicket : list){
tfTicketService.save(tfTicket);
}
successNum=list.size();
addMessage(redirectAttributes, "已成功导入 "+successNum+" 条订单记录");
} catch (Exception e) {
addMessage(redirectAttributes, "导入订单失败!失败信息:"+e.getMessage());
}
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
/**
* 下载导入订单数据模板
*/
@RequiresPermissions("ylttrip:tfTicket:import")
@RequestMapping(value = "import/template")
public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
String fileName = "订单数据导入模板.xlsx";
List<TfTicket> list = Lists.newArrayList();
new ExportExcel("订单数据", TfTicket.class, 1).setDataList(list).write(response, fileName).dispose();
return null;
} catch (Exception e) {
addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
}
return "redirect:"+Global.getAdminPath()+"/ylttrip/tfTicket/?repage";
}
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.dao.one;
import com.jeespring.common.persistence.InterfaceBaseDao;
import org.apache.ibatis.annotations.Mapper;
import com.jeespring.modules.test.entity.one.FormLeave;
/**
* 请假DAO接口
* @author JeeSpring
* @version 2018-10-12
*/
@Mapper
public interface FormLeaveDao extends InterfaceBaseDao<FormLeave> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.dao.onetomany;
import com.jeespring.common.persistence.InterfaceBaseDao;
import org.apache.ibatis.annotations.Mapper;
import com.jeespring.modules.test.entity.onetomany.TestDataChild2;
/**
* 订票DAO接口
* @author JeeSpring
* @version 2018-10-12
*/
@Mapper
public interface TestDataChild2Dao extends InterfaceBaseDao<TestDataChild2> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.dao.onetomany;
import com.jeespring.common.persistence.InterfaceBaseDao;
import org.apache.ibatis.annotations.Mapper;
import com.jeespring.modules.test.entity.onetomany.TestDataChild3;
/**
* 订票DAO接口
* @author JeeSpring
* @version 2018-10-12
*/
@Mapper
public interface TestDataChild3Dao extends InterfaceBaseDao<TestDataChild3> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.dao.onetomany;
import com.jeespring.common.persistence.InterfaceBaseDao;
import org.apache.ibatis.annotations.Mapper;
import com.jeespring.modules.test.entity.onetomany.TestDataChild;
/**
* 订票DAO接口
* @author JeeSpring
* @version 2018-10-12
*/
@Mapper
public interface TestDataChildDao extends InterfaceBaseDao<TestDataChild> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.dao.onetomany;
import com.jeespring.common.persistence.InterfaceBaseDao;
import org.apache.ibatis.annotations.Mapper;
import com.jeespring.modules.test.entity.onetomany.TestDataMain;
/**
* 订票DAO接口
* @author JeeSpring
* @version 2018-10-12
*/
@Mapper
public interface TestDataMainDao extends InterfaceBaseDao<TestDataMain> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.dao.tree;
import com.jeespring.common.persistence.TreeDao;
import com.jeespring.common.persistence.annotation.MyBatisDao;
import org.apache.ibatis.annotations.Mapper;
import com.jeespring.modules.test.entity.tree.TestTree;
/**
* 树DAO接口
* @author JeeSpring
* @version 2018-10-11
*/
@Mapper
public interface TestTreeDao extends TreeDao<TestTree> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.entity.one;
import com.jeespring.modules.sys.entity.User;
import javax.validation.constraints.NotNull;
import com.jeespring.modules.sys.entity.Office;
import com.jeespring.modules.sys.entity.Area;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeespring.common.persistence.AbstractBaseEntity;
import com.jeespring.common.utils.excel.annotation.ExcelField;
import com.jeespring.modules.sys.utils.DictUtils;
/**
* 请假Entity
* @author JeeSpring
* @version 2018-10-12
*/
public class FormLeave extends AbstractBaseEntity<FormLeave> {
private static final long serialVersionUID = 1L;
private com.jeespring.modules.sys.entity.User user; // 员工
private com.jeespring.modules.sys.entity.Office office; // 归属部门
private com.jeespring.modules.sys.entity.Area area; // 归属区域
private java.util.Date beginDate; // 请假开始日期
private java.util.Date endDate; // 请假结束日期
public FormLeave() {
super();
}
public FormLeave(String id){
super(id);
}
@NotNull(message="员工不能为空")
@ExcelField(title="员工", fieldType=User.class, value="user.name", align=2, sort=1)
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@NotNull(message="归属部门不能为空")
@ExcelField(title="归属部门", fieldType=Office.class, value="office.name", align=2, sort=2)
public Office getOffice() {
return office;
}
public void setOffice(Office office) {
this.office = office;
}
@ExcelField(title="归属区域", fieldType=Area.class, value="area.name", align=2, sort=3)
public Area getArea() {
return area;
}
public void setArea(Area area) {
this.area = area;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@NotNull(message="请假开始日期不能为空")
@ExcelField(title="请假开始日期", align=2, sort=4)
public Date getBeginDate() {
return beginDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@NotNull(message="请假结束日期不能为空")
@ExcelField(title="请假结束日期", align=2, sort=5)
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.entity.onetomany;
import com.jeespring.modules.sys.entity.Area;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeespring.common.persistence.AbstractBaseEntity;
import com.jeespring.common.utils.excel.annotation.ExcelField;
import com.jeespring.modules.sys.utils.DictUtils;
/**
* 订票Entity
* @author JeeSpring
* @version 2018-10-12
*/
public class TestDataChild extends AbstractBaseEntity<TestDataChild> {
private static final long serialVersionUID = 1L;
private com.jeespring.modules.sys.entity.Area start; // 出发地
private com.jeespring.modules.sys.entity.Area end; // 目的地
private Double price; // 代理价格
private TestDataMain testDataMain; // 业务主表ID 父类testDataMain.id
public TestDataChild() {
super();
}
public TestDataChild(String id){
super(id);
}
public TestDataChild(TestDataMain testDataMain){
this.testDataMain = testDataMain;
}
@NotNull(message="出发地不能为空")
@ExcelField(title="出发地", fieldType=Area.class, value="start.name", align=2, sort=1)
public Area getStart() {
return start;
}
public void setStart(Area start) {
this.start = start;
}
@NotNull(message="目的地不能为空")
@ExcelField(title="目的地", fieldType=Area.class, value="end.name", align=2, sort=2)
public Area getEnd() {
return end;
}
public void setEnd(Area end) {
this.end = end;
}
@NotNull(message="代理价格不能为空")
@ExcelField(title="代理价格", align=2, sort=3)
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
@Length(min=0, max=64, message="业务主表ID长度必须介于 0 和 64 之间")
@JsonIgnore
@JSONField(serialize=false)
public TestDataMain getTestDataMain() {
return testDataMain;
}
public void setTestDataMain(TestDataMain testDataMain) {
this.testDataMain = testDataMain;
}
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.jeespring.modules.test.entity.onetomany;
import com.jeespring.modules.sys.entity.Area;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeespring.common.persistence.AbstractBaseEntity;
import com.jeespring.common.utils.excel.annotation.ExcelField;
import com.jeespring.modules.sys.utils.DictUtils;
/**
* 订票Entity
* @author JeeSpring
* @version 2018-10-12
*/
public class TestDataChild2 extends AbstractBaseEntity<TestDataChild2> {
private static final long serialVersionUID = 1L;
private com.jeespring.modules.sys.entity.Area start; // 出发地
private com.jeespring.modules.sys.entity.Area end; // 目的地
private Double price; // 代理价格
private TestDataMain testDataMain; // 外键 父类testDataMain.id
public TestDataChild2() {
super();
}
public TestDataChild2(String id){
super(id);
}
public TestDataChild2(TestDataMain testDataMain){
this.testDataMain = testDataMain;
}
@NotNull(message="出发地不能为空")
@ExcelField(title="出发地", fieldType=Area.class, value="start.name", align=2, sort=1)
public Area getStart() {
return start;
}
public void setStart(Area start) {
this.start = start;
}
@NotNull(message="目的地不能为空")
@ExcelField(title="目的地", fieldType=Area.class, value="end.name", align=2, sort=2)
public Area getEnd() {
return end;
}
public void setEnd(Area end) {
this.end = end;
}
@ExcelField(title="代理价格", align=2, sort=3)
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
@Length(min=1, max=64, message="外键长度必须介于 1 和 64 之间")
@JsonIgnore
@JSONField(serialize=false)
public TestDataMain getTestDataMain() {
return testDataMain;
}
public void setTestDataMain(TestDataMain testDataMain) {
this.testDataMain = testDataMain;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment