Commit a2d19547 by peterchu

fix:

1. 完成销售明细报表功能业务
2. 完善销售汇总业务
parent 20d4885b
...@@ -90,5 +90,7 @@ ...@@ -90,5 +90,7 @@
<orderEntry type="library" name="Maven: cglib:cglib:3.1" level="project" /> <orderEntry type="library" name="Maven: cglib:cglib:3.1" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:4.2" level="project" /> <orderEntry type="library" name="Maven: org.ow2.asm:asm:4.2" level="project" />
<orderEntry type="library" name="Maven: org.ehcache:ehcache:3.2.2" level="project" /> <orderEntry type="library" name="Maven: org.ehcache:ehcache:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -134,6 +134,11 @@ ...@@ -134,6 +134,11 @@
<artifactId>yutu_common</artifactId> <artifactId>yutu_common</artifactId>
<version>1.0.37</version> <version>1.0.37</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -3,13 +3,13 @@ package com.yutu.base.controller; ...@@ -3,13 +3,13 @@ package com.yutu.base.controller;
import com.yutu.base.entity.Response; import com.yutu.base.entity.Response;
import com.yutu.base.service.SaleDetailService; import com.yutu.base.service.SaleDetailService;
import com.yutu.base.service.SalesSummaryService;
import com.yutu.comm.entity.exception.NoteResult; import com.yutu.comm.entity.exception.NoteResult;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 报表管理: * 报表管理:
...@@ -24,13 +24,15 @@ public class StatementController { ...@@ -24,13 +24,15 @@ public class StatementController {
private Logger logger = Logger.getLogger("download"); private Logger logger = Logger.getLogger("download");
@Autowired @Autowired
private SaleDetailService saleDetailService; private SaleDetailService saleDetailService;
@Autowired
private SalesSummaryService salesSummaryService;
/** /**
* 销售明细报表页面 获取销售明细数据 * 销售明细报表页面 获取销售明细数据
* @param requestBody * @param requestBody
* @return * @return
*/ */
@RequestMapping(value = "salesDetail/getSalesDetailList",method = RequestMethod.POST) @RequestMapping(value = "salesDetail/getSalesDetailList", method = RequestMethod.POST)
public NoteResult getSalesDetailList(@RequestBody String requestBody){ public NoteResult getSalesDetailList(@RequestBody String requestBody){
return saleDetailService.getSalesDetailList(requestBody); return saleDetailService.getSalesDetailList(requestBody);
} }
...@@ -41,12 +43,20 @@ public class StatementController { ...@@ -41,12 +43,20 @@ public class StatementController {
* @param requestBody * @param requestBody
* @return * @return
*/ */
@RequestMapping(value = "salesDetail/downloadSalesDetailReport",method = RequestMethod.POST) @RequestMapping(value = "salesDetail/downloadSalesDetailReport", method = RequestMethod.POST)
public NoteResult saleDetailReportFromAutoSource(@RequestBody String requestBody){ public NoteResult saleDetailReportFromAutoSource(@RequestBody String requestBody, HttpServletResponse response){
return saleDetailService.downloadSalesDetailReportExcel(requestBody); return saleDetailService.downloadSalesDetailReportExcel(requestBody, response);
} }
/**
* 查询销售汇总数据 salesSummary
* @param requestBody
* @return
*/
@RequestMapping(value = "salesSummary/getSalesSummaryList", method = RequestMethod.POST)
public NoteResult getSalesSummaryList(@RequestBody String requestBody){
return salesSummaryService.getSalesSummaryList(requestBody);
}
......
...@@ -2,6 +2,7 @@ package com.yutu.base.service; ...@@ -2,6 +2,7 @@ package com.yutu.base.service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yutu.base.entity.SaleDetail;
import com.yutu.base.entity.Store; import com.yutu.base.entity.Store;
import com.yutu.base.entity.User; import com.yutu.base.entity.User;
import com.yutu.base.utils.httpClient.HttpUtil; import com.yutu.base.utils.httpClient.HttpUtil;
...@@ -9,6 +10,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -9,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -67,4 +69,6 @@ public class BaseService { ...@@ -67,4 +69,6 @@ public class BaseService {
} }
return storeList; return storeList;
} }
} }
package com.yutu.base.service;
import com.alibaba.fastjson.JSONObject;
import com.yutu.base.utils.HttpsSendData;
import com.yutu.comm.entity.exception.NoteResult;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
/**
* 销售汇总
* @author pc
* @date 2021年03月24日 18:41
*/
@Service
public class SalesSummaryService {
@Value("${spring.urlConfig.statementApiUrl}")
private String statementApiUrl;
private static Logger logger = Logger.getLogger("saleDetail");
/**
* 获取销售汇总报表数据
* 参数:
* startCreateOrderTime endCreateOrderTime 生单时间
* startTicketTime endTicketTime 出票时间
*
* @param requestBody
* @return
*/
public NoteResult getSalesSummaryList(String requestBody) {
NoteResult noteResult = new NoteResult();
if (StringUtils.isBlank(requestBody)) {
noteResult.setStatus(300);
noteResult.setMsg("参数不能为空 [requestBody] ");
return noteResult;
}
logger.info("开始获取数据,参数: " + requestBody);
long beginTime = System.currentTimeMillis();
String result = HttpsSendData.getPost(statementApiUrl + "salesSummary/getSalesSummaryList", requestBody);
// String result = "{\"status\":0,\"msg\":\"查询成功\",\"data\":[{\"id\":\"00027727-2e16-485a-b1b3-f13d5079645a\",\"key\":\"df0286f1-eaac-11e7-adf4-a4badb3682ff_2018-10-25_2018-10-26\",\"createTime\":\"2018-12-21 09:41:41\",\"updateTime\":\"2018-12-21 09:41:41\",\"createOrderTime\":\"2018-10-24 16:24:26\",\"ticketTime\":\"2018-10-25 00:55:41\",\"outerOrderNo\":\"1380889117689\",\"channel\":\"Taobao\",\"store\":\"tbml\",\"tairLine\":\"HKT-DMK\",\"flightTime\":\"1544358000000\",\"flightNumber\":\"FD3028\",\"tripType\":\"单程\",\"pnrType\":\"去程\",\"pnr\":\"BWSTUZ\",\"passengerCount\":1,\"salePrice\":128,\"luggagePrice\":0,\"points\":0,\"purchaseCurrency\":\"CNY\",\"purchasePrice_local\":92,\"purchasePrice_rmb\":92,\"transactionDetail_local\":92,\"transactionDetail_rmb\":92,\"payMethod\":\"支付宝huochepiao3\",\"cardNumber\":\"支付宝huochepiao3\",\"profit\":36,\"transactionNumber\":\" \",\"orderValueAddedNo\":\" \",\"purchaseChannel\":\"艺龙\",\"purchaseAccount\":\"18513092060----huidarui\",\"purchaseOrderNo\":\"IT7JP5181024MO515179\",\"policyType\":\"普通促销\",\"policyCode\":\"TGJ泰国-中国\",\"orderStatus\":\"已出票\",\"operator\":\"曹坤祥\",\"purchaseTime\":\"2018-10-24 19:01:39\",\"orderValueAdded\":\" \",\"orderValueAddedSpecific\":\" \",\"remark\":\" \",\"officalReceivedPaymentStatus\":\" \",\"officalActualExpendAmount\":0,\"officalBalance\":0,\"officalRateAdjustDate\":null,\"passengerNames\":null,\"adultCount\":1,\"childCount\":0,\"sortIndex\":438}],\"info\":null}";
if (StringUtils.isBlank(result)) {
noteResult.setStatus(300);
noteResult.setMsg("获取数据失败!");
noteResult.setData(new HashMap<String, String>());
return noteResult;
}
JSONObject resultObj = JSONObject.parseObject(result);
if (resultObj.getInteger("status") != 200) {
noteResult.setMsg("获取数据失败!");
return noteResult;
}
logger.info("获取数据成功,共用时:" + (System.currentTimeMillis() - beginTime));
return JSONObject.toJavaObject(resultObj, NoteResult.class);
}
}
package com.yutu.base.utils; package com.yutu.base.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections4.Get;
import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PostMethod;
...@@ -180,6 +181,58 @@ public class HttpsSendData { ...@@ -180,6 +181,58 @@ public class HttpsSendData {
} }
/**
* get 请求
* @param url
* @param body
* @return
*/
public static String httpGet(String url, String body) {
//System.out.println("准备开始发送请求:"+System.currentTimeMillis());
String result = null;
GetMethod getMethod = new GetMethod(url);
PostMethod postMethod = new PostMethod(url);
if(body!=null && !"".equals(body)){
StringRequestEntity requestEntity;
try {
requestEntity = new StringRequestEntity(body,"application/json","UTF-8");
postMethod.setRequestEntity(requestEntity);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
HttpClientParams httparams = new HttpClientParams();
httparams.setSoTimeout(180000);
postMethod.setParams(httparams);
postMethod.setRequestHeader("Content-Type","application/json;charset=UTF-8");
HttpClient httpClient = new HttpClient();
httpClient.getParams().setParameter(
HttpMethodParams.HTTP_CONTENT_CHARSET, "utf-8");
try {
int statusCode = httpClient.executeMethod(postMethod);
if (statusCode == HttpStatus.SC_OK) {
//result = postMethod.getResponseBodyAsString();//原来的方式
InputStream is = postMethod.getResponseBodyAsStream();
Scanner scanner = new Scanner(is, "UTF-8");
result=scanner.useDelimiter("\\A").next();
} else {
System.out.println("请求状态:"+statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}finally {
if (postMethod != null) {
//释放链接
postMethod.releaseConnection();
}
}
//System.out.println("收到响应:"+System.currentTimeMillis());
return result;
}
......
spring: spring:
urlConfig: urlConfig:
overseasCheetahUrl: 'http://127.0.0.1:18092/polestar/' overseasCheetahUrl: 'http://127.0.0.1:18092/polestar/'
overseasAirTicketUrl: 'http://127.0.0.1:18071/OverseasAirTicket/' # overseasAirTicketUrl: 'http://127.0.0.1:18071/OverseasAirTicket/'
overseasAirTicketUrl: 'http://192.168.11.158:8080/ordercenterApi/'
productServiceUrl: 'http://127.0.0.1:28071/20160907_InterfaceConnected/' productServiceUrl: 'http://127.0.0.1:28071/20160907_InterfaceConnected/'
polestarLogsServicesUrl: 'http://127.0.0.1:8089/' polestarLogsServicesUrl: 'http://127.0.0.1:8089/'
dataApiUrl: 'http://127.0.0.1:38071/iffs-data-api/' dataApiUrl: 'http://14.18.207.91:38071/iffs-data-api/'
# 订单服务 ordercenter
statementApiUrl: 'http://http://121.36.16.56:32482/ordercenterApi/'
pathConfig: pathConfig:
saleDetailReportExcelPath: 'D:\\polestar_ExcelFile/' saleDetailReportExcelPath: 'D:\\polestar_ExcelFile/' # 销售明细报表导出保存的本地路径
saleReportExcelPath: 'D:/polestar_ExcelFile/' saleReportExcelPath: 'D:/polestar_ExcelFile/' #
server: server:
port: 8066 port: 8066
compression: compression:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment