Commit 2e74479d9b24e93898d3c2045ba805a4553d9d1f

Authored by unknown
1 parent b7723c8d
Exists in master

1.export wxorderfile

resources/application-local.properties 0 → 100644
@@ -0,0 +1,139 @@ @@ -0,0 +1,139 @@
  1 +
  2 +server.port=80
  3 +server.session.timeout=10
  4 +
  5 +spring.servlet.multipart.max-file-size=10MB
  6 +spring.servlet.multipart.max-request-size=20MB
  7 +
  8 +spring.jackson.time-zone=GMT+8
  9 +spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
  10 +spring.mvc.dateFormat = yyyy-MM-dd HH:mm:ss
  11 +spring.gson.serialize-nulls=true
  12 +
  13 +tokenfilter.enable=false
  14 +
  15 +logging.config=classpath:logback-local.xml
  16 +
  17 +
  18 +mail.host=smtp.taover.com
  19 +mail.port=25
  20 +mail.username=taover-robot@taover.com
  21 +mail.password=Lexi@1798
  22 +mail.smtp.auth=true
  23 +mail.smtp.sendFrom=taover-robot@taover.com
  24 +
  25 +spring.mvc.dispatch-options-request=true
  26 +
  27 +#spring.datasource.url=jdbc\:mysql\://192.168.3.189\:3306/8zyun_wxorder?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&zeroDateTimeBehavior\=convertToNull&transformedBitIsBoolean\=true
  28 +#spring.datasource.username=root
  29 +#spring.datasource.password=root
  30 +
  31 +
  32 +spring.datasource.url=jdbc\:mysql\://121.42.142.102\:3306/bzyun_wxorder?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&zeroDateTimeBehavior\=convertToNull&transformedBitIsBoolean\=true
  33 +spring.datasource.username=dev
  34 +spring.datasource.password=taover02
  35 +spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  36 +spring.datasource.max-idle=10
  37 +spring.datasource.max-wait=10000
  38 +spring.datasource.min-idle=5
  39 +spring.datasource.initial-size=5
  40 +
  41 +#zto analysis address url
  42 +#zto.analysisAddress.url=https://localhost/Word_AnalysisAddress
  43 +zto.analysisAddress.url=https://hdgateway.zto.com/Word_AnalysisAddress
  44 +#taover analysis address url
  45 +taover.analysisAddress.url=http://address.taover.com/
  46 +#kuaibao
  47 +kuaibao.analysisAddress.url=https://kop.kuaidihelp.com/api
  48 +kuaibao.analysisAddress.appId=105128
  49 +kuaibao.analysisAddress.appKey=3310236ba4d6296e6e2346a7d9c824662510ff87
  50 +kuaibao.analysisAddress.method=cloud.address.resolve
  51 +kuaibao.analysisAddress.methodSimple=cloud.address.cleanse
  52 +
  53 +#aliyun oss
  54 +accessKeyId=H4fIVB56iHjR6zQw
  55 +accessKeySecret=7bA395UltFp16kWPJT7Pfz0XYXCk4Q
  56 +endpoint=oss-cn-beijing.aliyuncs.com
  57 +bucket_contact=8zyun-oss
  58 +aliyun.mnsEndpoint=http://1225610490807748.mns.cn-hangzhou.aliyuncs.com
  59 +#https://8zyun-oss.oss-cn-beijing.aliyuncs.com
  60 +#mobile message url
  61 +wwltData=sname=dlmzty00&spwd=A6cU4Tyx&scorpid=&sprdid=1012888
  62 +wwltUrl=https://seccf.51welink.com/submitdata/service.asmx/g_Submit
  63 +
  64 +#root ssy callcenter api config
  65 +ssy.callcenter.appid=c2MkSTjT8ghM
  66 +ssy.callcenter.seckey=7105ec065b8bb30fa6e3f13fccf92d0f
  67 +
  68 +pc.callcenter.appid=c2MkSTjT8ghZ
  69 +pc.callcenter.seckey=7105ec065b8bb30fa6e3f13fccf92d0G
  70 +
  71 +ssy.callcenter.subscribePreffixUrl=http://localhost/api/
  72 +ssy.callcenter.subscribeSuffixUrl=/wxagentssymessagesubscribe
  73 +
  74 +
  75 +ssy.callcenter.url.openapiSurrogacyAgent=/api/v2/openapi/surrogacy/agent
  76 +ssy.callcenter.url.openapiSurrogacyQuerycontacts=/api/v2/openapi/surrogacy/querycontacts
  77 +ssy.callcenter.url.openapiSurrogacySendmessage=/api/v2/openapi/surrogacy/sendmessage
  78 +ssy.callcenter.url.openapiSurrogacyRegisteropenapi=/api/v2/openapi/surrogacy/registeropenapi
  79 +ssy.callcenter.url.openapiSurrogacyUnregisteropenapi=/api/v2/openapi/surrogacy/unregisteropenapi
  80 +ssy.callcenter.url.openapiCallcenterapibridgeService=/api/v2/openapi/callcenterapibridge/service
  81 +ssy.callcenter.url.openapiCallGroupMember=/api/v2/openapi/surrogacy/querygroupmember
  82 +
  83 +
  84 +
  85 +
  86 +ssy.upload.url=https://ssep.umsapi.com/api/v1/upload
  87 +
  88 +ssy.callcenter.sendMessage.preffixUrl=https://ssep.umsapi.com
  89 +
  90 +#weixin group text order confirm url
  91 +wxorder.url.grouptextorder.confirm=http://localhost:8100/confirm/
  92 +wxorder.url.express.search=http://localhost:8100/confirm/query-logistics/
  93 +
  94 +#ssy file server domain
  95 +ssy.fileserver.urlpreffix=https://ss0.umsapi.com
  96 +
  97 +wxorder.front.url.host=http://localhost:8100
  98 +
  99 +platform.shop.registerUrl=http://localhost/common/authorization/index
  100 +
  101 +wxorder.platformgoods.matchurl=http://localhost/goods/channelgoods
  102 +wxorder.platformgoods.errororderurl=https://localhost/ordererror/index
  103 +wxorder.url.excellist=http://localhost/groupexcel/index
  104 +
  105 +#pc api
  106 +pc.callcenter.url.openapiSurrogacyRegisteropenapi=http://192.168.3.236:18308/v1/agent
  107 +pc.callcenter.url.openapiSurrogacyQuerycontacts=http://192.168.3.236:18308/v1/contacts/
  108 +pc.callcenter.url.openapiCallGroupMember=http://192.168.3.236:18308/v1/contact/group_members/
  109 +pc.callcenter.url.openapiSurrogacyAgent=http://192.168.3.236:18308/v1/agent
  110 +pc.callcenter.url.openapiSurrogacySendmessage=http://192.168.3.236:18308/v1/message_task
  111 +pc.callcenter.subscribeUrl=http://192.168.3.146/api/wxagentpcmessagesubscribe
  112 +pc.callcenter.url.sendMessageQueueName=oms-pc-msg
  113 +pc.callcenter.url.openapiContactsFeaturesgroup=http://192.168.3.236:18308/v1/contacts/
  114 +
  115 +pc.message.url.messageTaskListUrl=http://192.168.3.236:18308/v1/message_task_list
  116 +pc.message.url.agentMessageTask=http://192.168.3.236:18308/v1/agent_message_task
  117 +
  118 +#cainiao param
  119 +cainiao.link.url=http://link.cainiao.com/gateway/link.do
  120 +cainiao.link.paramFormat=json
  121 +cainiao.link.appKey=650167
  122 +cainiao.link.secretKey=lDO6y26nBJ6b5K96lnA1an447H1L0XK3
  123 +cainiao.link.auth.grantpage=http://lcp.cloud.cainiao.com/permission/isv/grantpage.do
  124 +cainiao.link.auth.tokenUrl=http://lcp.cloud.cainiao.com/api/permission/exchangeToken.do
  125 +cainiao.link.auth.callbackUrl=https://api.oms.8zyun.cn/api/expressprint/auth/cainiao
  126 +
  127 +#fa wang
  128 +fineex.method.addOrder=fineex.wms.trades.add
  129 +fineex.method.cancelOrder=fineex.wms.trade.cancel
  130 +fineex.method.orderProcess=fineex.wms.trade.orderprocess.get
  131 +fineex.apiAddress=http://apicloud.fineex.net/Interface/InterfaceWeb/InterfaceFwWMS.ashx
  132 +fineex.method.goodsInventory=fineex.wms.product.inventory.get
  133 +fineex.method.orderConfirm=fineex.wms.trade.orderdetail.confirm
  134 +fineex.method.returnorderAdd=fineex.wms.trade.returnorder.add
  135 +
  136 +
  137 +qimen.api.appKey=30303007
  138 +qimen.api.appSecret=80c63d1d8cf36a4c68b2df25fb93f703
  139 +qimen.api.url=https://qimen.api.taobao.com/router/qmtest
resources/application-production.properties 0 → 100644
@@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
  1 +
  2 +server.port=8200
  3 +server.session.timeout=10
  4 +server.connection-timeout=120000
  5 +
  6 +spring.servlet.multipart.max-file-size=10MB
  7 +spring.servlet.multipart.max-request-size=20MB
  8 +
  9 +spring.jackson.time-zone=GMT+8
  10 +spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
  11 +spring.mvc.dateFormat = yyyy-MM-dd HH:mm:ss
  12 +spring.gson.serialize-nulls=true
  13 +
  14 +#email config
  15 +mail.host=smtp.taover.com
  16 +mail.port=25
  17 +mail.username=taover-robot@taover.com
  18 +mail.password=Lexi@1798
  19 +mail.smtp.auth=true
  20 +mail.smtp.sendFrom=taover-robot@taover.com
  21 +
  22 +#logback xml config
  23 +logging.config=classpath:logback-production.xml
  24 +
  25 +#allow http method options
  26 +spring.mvc.dispatch-options-request=true
  27 +spring.mvc.async.request-timeout=200000
  28 +
  29 +#DB info
  30 +spring.datasource.url=jdbc:mysql://rdsifmezqifmezqo.mysql.rds.aliyuncs.com:3306/bzyun_wxorder_prd?useUnicode=true&characterEncoding=UTF8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
  31 +spring.datasource.username=tylife
  32 +spring.datasource.password=lexi365
  33 +spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  34 +spring.datasource.max-idle=10
  35 +spring.datasource.max-wait=10000
  36 +spring.datasource.min-idle=5
  37 +spring.datasource.initial-size=5
  38 +
  39 +#zto analysis address url
  40 +zto.analysisAddress.url=https://hdgateway.zto.com/Word_AnalysisAddress
  41 +#taover analysis address url
  42 +taover.analysisAddress.url=http://address.taover.com/
  43 +#kuaibao
  44 +kuaibao.analysisAddress.url=https://kop.kuaidihelp.com/api
  45 +kuaibao.analysisAddress.appId=105128
  46 +kuaibao.analysisAddress.appKey=3310236ba4d6296e6e2346a7d9c824662510ff87
  47 +kuaibao.analysisAddress.method=cloud.address.resolve
  48 +kuaibao.analysisAddress.methodSimple=cloud.address.cleanse
  49 +
  50 +#aliyun oss address
  51 +accessKeyId=H4fIVB56iHjR6zQw
  52 +accessKeySecret=7bA395UltFp16kWPJT7Pfz0XYXCk4Q
  53 +endpoint=oss-cn-beijing.aliyuncs.com
  54 +bucket_contact=8zyun-oss
  55 +aliyun.mnsEndpoint=http://1225610490807748.mns.cn-hangzhou.aliyuncs.com
  56 +#mobile message url
  57 +wwltData=sname=dlmzty00&spwd=A6cU4Tyx&scorpid=&sprdid=1012888
  58 +wwltUrl=https://seccf.51welink.com/submitdata/service.asmx/g_Submit
  59 +
  60 +#pc api
  61 +pc.callcenter.url.openapiSurrogacyRegisteropenapi=https://ws.8zyun.cn:8080/v1/agent
  62 +pc.callcenter.url.openapiSurrogacyQuerycontacts=https://ws.8zyun.cn:8080/v1/contacts/
  63 +pc.callcenter.url.openapiCallGroupMember=https://ws.8zyun.cn:8080/v1/contact/group_members/
  64 +pc.callcenter.url.openapiSurrogacyAgent=https://ws.8zyun.cn:8080/v1/agent
  65 +pc.callcenter.url.openapiSurrogacySendmessage=https://ws.8zyun.cn:8080/v1/message_task
  66 +pc.callcenter.url.openapiContactsFeaturesgroup=https://ws.8zyun.cn:8080/v1/contactsMessageCount
  67 +
  68 +pc.callcenter.appid=c2MkSTjT8ghZ
  69 +pc.callcenter.seckey=7105ec065b8bb30fa6e3f13fccf92d0G
  70 +pc.callcenter.subscribeUrl=https://api.oms.8zyun.cn/api/wxagentpcmessagesubscribe
  71 +pc.callcenter.url.sendMessageQueueName=oms-pc-msg-production
  72 +
  73 +pc.message.url.messageTaskListUrl=https://ws.8zyun.cn:8080/v1/message_task_list
  74 +pc.message.url.agentMessageTask=https://ws.8zyun.cn:8080/v1/agent_message_task
resources/application.properties 0 → 100644
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +#RUNTIME_ENV=local development production
  2 +spring.profiles.active=local
resources/logback-local.xml 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +<configuration>
  2 +
  3 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  4 + encoders are assigned the type
  5 + ch.qos.logback.classic.encoder.PatternLayoutEncoder by default
  6 + <encoder>
  7 + <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread]%logger{56}.%method:%L -%msg %n</pattern>
  8 + </encoder>
  9 + </appender>
  10 +
  11 + <root level="INFO">
  12 + <appender-ref ref="STDOUT" />
  13 + </root>
  14 +</configuration>
resources/logback-production.xml 0 → 100644
@@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
  1 +<configuration>
  2 +
  3 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  4 + <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
  5 + <encoder>
  6 + <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread]%logger{56}.%method:%L -%msg %n</pattern>
  7 + </encoder>
  8 + </appender>
  9 +
  10 + <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
  11 + <smtpHost>smtp.taover.com</smtpHost>
  12 + <smtpPort>465</smtpPort>
  13 + <SSL>true</SSL>
  14 + <username>taover-robot@taover.com</username>
  15 + <password>Lexi@1798</password>
  16 +
  17 + <from>taover-robot@taover.com</from>
  18 + <to>wangbin@taover.com</to>
  19 + <to>gaoming@taover.com</to>
  20 + <to>liuyunpeng@taover.com</to>
  21 + <subject>八爪云-data-analysis/ERROR:%logger{20}</subject>
  22 + <layout class="ch.qos.logback.classic.html.HTMLLayout"/>
  23 + <!-- 这里采用等级过滤器,指定等级相符才发送,这里指定ERROR级别才发送 -->
  24 + <filter class="ch.qos.logback.classic.filter.LevelFilter">
  25 + <level>ERROR</level>
  26 + <onMatch>ACCEPT</onMatch>
  27 + <onMismatch>DENY</onMismatch>
  28 + </filter>
  29 + <!-- 每个电子邮件只发送一个日志条目 -->
  30 + <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
  31 + <bufferSize>3</bufferSize>
  32 + </cyclicBufferTracker>
  33 + </appender>
  34 +
  35 + <appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
  36 + <file>logback-rolling.log</file>
  37 + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  38 + <!-- rollover daily -->
  39 + <fileNamePattern>logback-roll-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  40 + <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
  41 + <maxFileSize>100MB</maxFileSize>
  42 + <maxHistory>60</maxHistory>
  43 + <totalSizeCap>5GB</totalSizeCap>
  44 + </rollingPolicy>
  45 + <encoder>
  46 + <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread]%logger{56}.%method:%L -%msg %n</pattern>
  47 + </encoder>
  48 + </appender>
  49 +
  50 + <root level="ERROR">
  51 + <appender-ref ref="EMAIL"/>
  52 + </root>
  53 +
  54 + <root level="INFO">
  55 + <appender-ref ref="ROLLING"/>
  56 + <appender-ref ref="STDOUT" />
  57 + </root>
  58 +
  59 +</configuration>
src/com/taover/bazhuayun/analysis/script/goodscollect/GroupInfoExcelDataHeader.java
@@ -36,19 +36,14 @@ public class GroupInfoExcelDataHeader { @@ -36,19 +36,14 @@ public class GroupInfoExcelDataHeader {
36 continue; 36 continue;
37 } 37 }
38 } 38 }
39 - }  
40 - 39 + }
41 40
42 public Integer getSenderNicknameIndex() { 41 public Integer getSenderNicknameIndex() {
43 return senderNicknameIndex; 42 return senderNicknameIndex;
44 } 43 }
45 -  
46 -  
47 public void setSenderNicknameIndex(Integer senderNicknameIndex) { 44 public void setSenderNicknameIndex(Integer senderNicknameIndex) {
48 this.senderNicknameIndex = senderNicknameIndex; 45 this.senderNicknameIndex = senderNicknameIndex;
49 } 46 }
50 -  
51 -  
52 public Integer getGroupNameIndex() { 47 public Integer getGroupNameIndex() {
53 return groupNameIndex; 48 return groupNameIndex;
54 } 49 }
@@ -67,6 +62,4 @@ public class GroupInfoExcelDataHeader { @@ -67,6 +62,4 @@ public class GroupInfoExcelDataHeader {
67 public void setFielPathIndex(Integer fielPathIndex) { 62 public void setFielPathIndex(Integer fielPathIndex) {
68 this.fielPathIndex = fielPathIndex; 63 this.fielPathIndex = fielPathIndex;
69 } 64 }
70 -  
71 -  
72 } 65 }
src/com/taover/bazhuayun/analysis/script/goodscollect/Main.java
@@ -21,10 +21,11 @@ public class Main { @@ -21,10 +21,11 @@ public class Main {
21 public static void analysisGoodsName() throws Exception { 21 public static void analysisGoodsName() throws Exception {
22 String[] goodsNamePatternArr = new String[]{"商品名称","商品标题","货品名称","商品名称","商品信息","品名","商品型号","商品名","商品简称"}; 22 String[] goodsNamePatternArr = new String[]{"商品名称","商品标题","货品名称","商品名称","商品信息","品名","商品型号","商品名","商品简称"};
23 String[] goodsSkuNameParrternArr = new String[]{"商品规格名","规格","商品规格","规格名称","商品型号"}; 23 String[] goodsSkuNameParrternArr = new String[]{"商品规格名","规格","商品规格","规格名称","商品型号"};
24 - String groupInfoFilePath = "C:\\Users\\86136\\Desktop\\悟空家数据分析\\groupinfo.xls";  
25 - String goodsDataFileDirPath = "C:\\Users\\86136\\Desktop\\悟空家数据分析\\data";  
26 - String logFilePath = "C:\\Users\\86136\\Desktop\\悟空家数据分析\\dealinfo.log";  
27 - String resultDataFilePath = "C:\\Users\\86136\\Desktop\\悟空家数据分析\\result.xls"; 24 + String dataDirPath = "C:\\Users\\Administrator\\Desktop\\悟空家数据核对-lff";
  25 + String groupInfoFilePath = dataDirPath + File.separator + "groupinfo.csv";
  26 + String goodsDataFileDirPath = dataDirPath + File.separator + "data";
  27 + String logFilePath = dataDirPath + File.separator + "dealinfo.log";
  28 + String resultDataFilePath = dataDirPath + File.separator + "result.xls";
28 29
29 //加载基础数据,文件来源 30 //加载基础数据,文件来源
30 GroupInfoExcelData groupInfoData = new GroupInfoExcelData(); 31 GroupInfoExcelData groupInfoData = new GroupInfoExcelData();
src/com/taover/bazhuayun/analysis/script/goodscollect/WindowMain.java 0 → 100644
@@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
  1 +package com.taover.bazhuayun.analysis.script.goodscollect;
  2 +
  3 +import java.awt.EventQueue;
  4 +import java.awt.event.ActionEvent;
  5 +import java.awt.event.ActionListener;
  6 +
  7 +import javax.swing.JFileChooser;
  8 +import javax.swing.JFrame;
  9 +
  10 +public class WindowMain {
  11 +
  12 + private JFrame frame;
  13 +
  14 + /**
  15 + * Launch the application.
  16 + */
  17 + public static void main(String[] args) {
  18 + EventQueue.invokeLater(new Runnable() {
  19 + public void run() {
  20 + try {
  21 + WindowMain window = new WindowMain();
  22 + window.frame.setVisible(true);
  23 + } catch (Exception e) {
  24 + e.printStackTrace();
  25 + }
  26 + }
  27 + });
  28 + }
  29 +
  30 + /**
  31 + * Create the application.
  32 + */
  33 + public WindowMain() {
  34 + initialize();
  35 + }
  36 +
  37 + /**
  38 + * Initialize the contents of the frame.
  39 + */
  40 + private void initialize() {
  41 + frame = new JFrame();
  42 + frame.setBounds(100, 100, 450, 300);
  43 + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  44 +
  45 + JFileChooser chooser = new JFileChooser();
  46 + chooser.setSize(200, 50);
  47 + chooser.addActionListener(new ActionListener() {
  48 +
  49 + @Override
  50 + public void actionPerformed(ActionEvent e) {
  51 + }
  52 + });
  53 + frame.add(chooser);
  54 + }
  55 +
  56 +}
src/com/taover/bazhuayun/analysis/script/orderdownload/Main.java 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +package com.taover.bazhuayun.analysis.script.orderdownload;
  2 +
  3 +public class Main {
  4 + public static void main(String[] args) {
  5 + try {
  6 + //时间区间:21号凌晨 25号凌晨
  7 + } catch (Exception e) {
  8 + e.printStackTrace();
  9 + }
  10 + }
  11 +}
src/com/taover/bazhuayun/analysis/util/FileContentTypeUtils.java 0 → 100644
@@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
  1 +package com.taover.bazhuayun.analysis.util;
  2 +
  3 +public class FileContentTypeUtils {
  4 +
  5 + public static String contentType(String filenameExtension) {
  6 + if (filenameExtension.equals(".BMP") || filenameExtension.equals(".bmp")
  7 + || filenameExtension.toUpperCase().equals(".BMP")) {
  8 + return "image/bmp";
  9 + }
  10 + if (filenameExtension.equals(".GIF") || filenameExtension.equals(".gif")
  11 + || filenameExtension.toUpperCase().equals(".GIF")) {
  12 + return "image/gif";
  13 + }
  14 + if (filenameExtension.equals(".JPEG") || filenameExtension.equals(".jpeg") || filenameExtension.equals(".JPG")
  15 + || filenameExtension.equals(".jpg") || filenameExtension.equals(".PNG")
  16 + || filenameExtension.equals(".png") || filenameExtension.toUpperCase().equals(".JPEG")
  17 + || filenameExtension.toUpperCase().equals(".JPG") || filenameExtension.toUpperCase().equals(".PNG")) {
  18 + return "image/jpeg";
  19 + }
  20 + if (filenameExtension.equals(".HTML") || filenameExtension.equals(".html")) {
  21 + return "text/html";
  22 + }
  23 + if (filenameExtension.equals(".TXT") || filenameExtension.equals(".txt")
  24 + || filenameExtension.toUpperCase().equals(".TXT")) {
  25 + return "text/plain";
  26 + }
  27 + if (filenameExtension.equals(".VSD") || filenameExtension.equals(".vsd")
  28 + || filenameExtension.toUpperCase().equals(".VSD")) {
  29 + return "application/vnd.visio";
  30 + }
  31 + if (filenameExtension.equals(".PPTX") || filenameExtension.equals(".pptx") || filenameExtension.equals(".PPT")
  32 + || filenameExtension.equals(".ppt") || filenameExtension.toUpperCase().equals(".PPTX")
  33 + || filenameExtension.toUpperCase().equals(".PPT")) {
  34 + return "application/vnd.ms-powerpoint";
  35 + }
  36 + if (filenameExtension.equals(".DOCX") || filenameExtension.equals(".docx") || filenameExtension.equals(".DOC")
  37 + || filenameExtension.equals(".doc") || filenameExtension.toUpperCase().equals(".DOCX")
  38 + || filenameExtension.toUpperCase().equals(".DOC")) {
  39 + return "application/msword";
  40 + }
  41 + if (filenameExtension.toUpperCase().equals(".XLSX")) {
  42 + return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  43 + }
  44 + if (filenameExtension.toUpperCase().equals(".XLS")) {
  45 + return "application/vnd.ms-excel";
  46 + }
  47 + if (filenameExtension.equals(".XML") || filenameExtension.equals(".xml")
  48 + || filenameExtension.toUpperCase().equals(".XML")) {
  49 + return "text/xml";
  50 + }
  51 + if (filenameExtension.equals(".pdf") || filenameExtension.equals(".PDF")
  52 + || filenameExtension.toUpperCase().equals(".PDF")) {
  53 + return "application/pdf";
  54 + }
  55 + return null;
  56 + }
  57 +
  58 + public static String imgTypeValid(String dataPrix) {
  59 + if ("data:image/jpeg;".equalsIgnoreCase(dataPrix)) {
  60 + return ".jpeg";
  61 + } else if ("data:image/jpg;".equalsIgnoreCase(dataPrix)) {
  62 + return ".jpg";
  63 + } else if ("data:image/gif;".equalsIgnoreCase(dataPrix)) {
  64 + return ".gif";
  65 + } else if ("data:image/png;".equalsIgnoreCase(dataPrix)) {
  66 + return ".png";
  67 + } else if ("data:image/apng;".equalsIgnoreCase(dataPrix)) {
  68 + return ".apng";
  69 + } else if ("data:image/svg;".equalsIgnoreCase(dataPrix)) {
  70 + return ".svg";
  71 + } else if ("data:image/bmp;".equalsIgnoreCase(dataPrix)) {
  72 + return ".bmp";
  73 + }
  74 + return null;
  75 + }
  76 +
  77 + public static String fileTypeValid(String dataPrix) {
  78 + if ("data:text/plain;".equalsIgnoreCase(dataPrix)) {
  79 + return ".txt";
  80 + }
  81 + return null;
  82 + }
  83 +}
src/com/taover/bazhuayun/analysis/web/StartUp.java
1 package com.taover.bazhuayun.analysis.web; 1 package com.taover.bazhuayun.analysis.web;
2 2
3 -import org.apache.catalina.connector.Connector;  
4 import org.springframework.boot.SpringApplication; 3 import org.springframework.boot.SpringApplication;
5 import org.springframework.boot.autoconfigure.SpringBootApplication; 4 import org.springframework.boot.autoconfigure.SpringBootApplication;
6 -import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;  
7 -import org.springframework.boot.web.servlet.server.ServletWebServerFactory;  
8 -import org.springframework.context.ConfigurableApplicationContext;  
9 -import org.springframework.context.annotation.Bean;  
10 import org.springframework.context.annotation.EnableAspectJAutoProxy; 5 import org.springframework.context.annotation.EnableAspectJAutoProxy;
11 -import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;  
12 -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;  
13 -import org.springframework.web.util.UrlPathHelper;  
14 6
15 @SpringBootApplication 7 @SpringBootApplication
16 @EnableAspectJAutoProxy(exposeProxy=true, proxyTargetClass=true) 8 @EnableAspectJAutoProxy(exposeProxy=true, proxyTargetClass=true)
17 -public class StartUp implements WebMvcConfigurer {  
18 - public static ConfigurableApplicationContext context;  
19 - 9 +public class StartUp {
20 public static void main(String[] args) { 10 public static void main(String[] args) {
21 - System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");  
22 - StartUp.context = SpringApplication.run(StartUp.class, args);  
23 - }  
24 -  
25 - @Override  
26 - public void configurePathMatch(PathMatchConfigurer configurer) {  
27 - UrlPathHelper urlPathHelper = new UrlPathHelper();  
28 - urlPathHelper.setUrlDecode(false);  
29 - configurer.setUrlPathHelper(urlPathHelper);  
30 - }  
31 -  
32 - @Bean  
33 - public ServletWebServerFactory servletContainer() {  
34 - TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();  
35 - tomcat.addAdditionalTomcatConnectors(createStandardConnector());  
36 - return tomcat;  
37 - }  
38 -  
39 - private Connector createStandardConnector() {  
40 - Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");  
41 - connector.setPort(0);  
42 - return connector; 11 + SpringApplication.run(StartUp.class, args);
43 } 12 }
44 } 13 }
45 \ No newline at end of file 14 \ No newline at end of file
src/com/taover/bazhuayun/analysis/web/controller/ExportCenterController.java 0 → 100644
@@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
  1 +package com.taover.bazhuayun.analysis.web.controller;
  2 +
  3 +import java.io.File;
  4 +import java.io.FileInputStream;
  5 +import java.io.IOException;
  6 +import java.io.OutputStream;
  7 +import java.text.ParseException;
  8 +import java.text.SimpleDateFormat;
  9 +import java.util.Date;
  10 +
  11 +import javax.annotation.Resource;
  12 +import javax.servlet.http.HttpServletResponse;
  13 +
  14 +import org.apache.commons.lang.StringUtils;
  15 +import org.springframework.web.bind.annotation.GetMapping;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RequestParam;
  18 +import org.springframework.web.bind.annotation.RestController;
  19 +
  20 +import com.taover.bazhuayun.analysis.util.FileContentTypeUtils;
  21 +import com.taover.bazhuayun.analysis.web.service.ExportCenterService;
  22 +import com.taover.util.UtilLog;
  23 +
  24 +@RestController("exportcenter")
  25 +@RequestMapping("/exportcenter")
  26 +public class ExportCenterController {
  27 + @Resource
  28 + private ExportCenterService exportCenterService;
  29 +
  30 + @GetMapping("/wareorderfile")
  31 + public void wareOrderFile(@RequestParam(name="tenantId", required=true) Integer tenantId,
  32 + @RequestParam(name="startDate", defaultValue = "") String startDateStr,
  33 + @RequestParam(name="endDate", defaultValue = "") String endDateStr,
  34 + HttpServletResponse response) {
  35 + Date startDate = new Date();
  36 + Date endDate = new Date();
  37 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  38 + if(StringUtils.isNotBlank(startDateStr)) {
  39 + try {
  40 + startDate = sdf.parse(startDateStr.substring(0, 10));
  41 + } catch (ParseException e) {
  42 + e.printStackTrace();
  43 + }
  44 + }
  45 + if(StringUtils.isNotBlank(endDateStr)) {
  46 + try {
  47 + endDate = sdf.parse(endDateStr.substring(0, 10));
  48 + } catch (ParseException e) {
  49 + e.printStackTrace();
  50 + }
  51 + }
  52 +
  53 + File orderFile = null;
  54 + try {
  55 + orderFile = this.exportCenterService.wareOrderFile(tenantId, startDate, endDate);
  56 + } catch (IOException e1) {
  57 + UtilLog.errorForException(e1, this.getClass());
  58 + return;
  59 + }
  60 + try {
  61 + this.writeFielToResponse(response, orderFile);
  62 + } catch (IOException e) {
  63 + UtilLog.errorForException(e, this.getClass());
  64 + }
  65 + }
  66 +
  67 + private void writeFielToResponse(HttpServletResponse response, File file) throws IOException {
  68 + OutputStream stream = response.getOutputStream();
  69 + FileInputStream reader = new FileInputStream(file);
  70 + byte[] data= new byte[(int)file.length()];
  71 + reader.read(data);
  72 + reader.close();
  73 +
  74 + //记得设置ContentType
  75 + String fileName = file.getName();
  76 + response.setContentType(FileContentTypeUtils.contentType(fileName.substring(fileName.lastIndexOf("."))));
  77 + response.setHeader("Content-Dis", "filename="+file.getName());
  78 + stream.write(data);
  79 + stream.flush();
  80 + }
  81 +}
src/com/taover/bazhuayun/analysis/web/service/ExportCenterService.java 0 → 100644
@@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
  1 +package com.taover.bazhuayun.analysis.web.service;
  2 +
  3 +import java.io.File;
  4 +import java.io.IOException;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.ArrayList;
  7 +import java.util.Date;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import javax.annotation.Resource;
  12 +
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.stereotype.Service;
  15 +
  16 +import cn.hutool.poi.excel.ExcelUtil;
  17 +
  18 +@Service
  19 +public class ExportCenterService {
  20 + @Resource
  21 + private JdbcTemplate jdbcTemplate;
  22 +
  23 + public File wareOrderFile(Integer tenantId, Date startDate, Date endDate) throws IOException {
  24 + //查询agentID
  25 + String agentIdQuery = "select agent_id from wxorder_agent_pc where tenant_id="+tenantId+" limit 1 ";
  26 + Integer agentId = this.jdbcTemplate.queryForObject(agentIdQuery, Integer.class);
  27 +
  28 + //查询仓库对应群列表
  29 + String wareGroupQuery = "select wx_group_ssid,wx_group_nickname,name from wxorder_ware where tenant_id="+tenantId;
  30 + List<Map<String, Object>> groupData = this.jdbcTemplate.queryForList(wareGroupQuery);
  31 +
  32 + //依据群id,获取数据列表
  33 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  34 + String startDateStr = sdf.format(startDate)+" 00:00:00";
  35 + String endDateStr = sdf.format(endDate)+" 00:00:00";
  36 + List<Map<String, Object>> messageData = new ArrayList<Map<String, Object>>();
  37 + String messageQuery = "select room_wxid,sender_nickname,created_at,file_path from bzyun_wechat.messages where created_at>'"+startDateStr+"' and created_at<'"+endDateStr+"' and agent_id="+agentId+" and kind='FILE' and file_path not like '%【异常物流信息】%' and recall=0 and room_wxid=? ";
  38 + for(Map<String, Object> item: groupData) {
  39 + String wxGroupSsid = item.get("wx_group_ssid").toString();
  40 + List<Map<String, Object>> itemData = this.jdbcTemplate.queryForList(messageQuery, wxGroupSsid);
  41 + for(Map<String, Object> messageItem: itemData) {
  42 + messageItem.putAll(item);
  43 + }
  44 + messageData.addAll(itemData);
  45 + }
  46 +
  47 + //生成本地excel文件
  48 + List<List<Object>> data = new ArrayList<List<Object>>();
  49 + List<Object> headerData = new ArrayList<Object>();
  50 + headerData.add("群名称");
  51 + headerData.add("room_wxid");
  52 + headerData.add("创建时间");
  53 + headerData.add("发送人昵称");
  54 + headerData.add("文件路径");
  55 + headerData.add("仓库名称");
  56 + data.add(headerData);
  57 + for(Map<String, Object> item: messageData) {
  58 + List<Object> itemData = new ArrayList<Object>();
  59 + itemData.add(item.get("wx_group_nickname"));
  60 + itemData.add(item.get("room_wxid"));
  61 + itemData.add(item.get("created_at"));
  62 + itemData.add(item.get("sender_nickname"));
  63 + itemData.add(item.get("file_path"));
  64 + itemData.add(item.get("name"));
  65 + data.add(itemData);
  66 + }
  67 + File excelFile = File.createTempFile("wareorderfile", ".xlsx");
  68 + ExcelUtil.getWriter(true).write(data).flush(excelFile);
  69 + return excelFile;
  70 + }
  71 +
  72 +}