Commit 2805f5d8 authored by 张永's avatar 张永

升成dockerfile,修改改日志

parent 85efec44
FROM dockerhub.linkfern.com/b2c/jdk1.8_image:V1.0.0
EXPOSE 20001
#定义时区参数
ENV TZ=Asia/Shanghai
#设置时区
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
ENV LANG C.UTF-8
ARG JAR_FILE
ADD target/${JAR_FILE} /data/app.jar
#ENTRYPOINT ["java", "-jar","/data/app.jar"]
#定义jvm参数变量
ENV JAVA_OPTS="-server -Xms1024m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M"
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /data/app.jar
...@@ -21,10 +21,90 @@ ...@@ -21,10 +21,90 @@
<version>2.1.0.RELEASE</version> <version>2.1.0.RELEASE</version>
</parent> </parent>
<distributionManagement>
<repository>
<id>user-releases</id>
<name>User Porject Snapshot</name>
<url>http://123.157.244.130:9003/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>user-snapshot</id>
<name>User Porject Snapshot</name>
<url>http://123.157.244.130:9003/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>my</id>
<name>my</name>
<url>http://123.157.244.130:9003/nexus/content/groups/public/</url>
</repository>
<repository>
<id>repo1</id>
<name>repo1</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>mvnrepository</id>
<name>mvnrepository</name>
<url>https://mvnrepository.com/</url>
</repository>
<repository>
<id>bintray-qcloud-maven-repo</id>
<name>qcloud-maven-repo</name>
<url>https://dl.bintray.com/qcloud/maven-repo/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- start 改为jetty 处理tomcat版本的 The valid characters are defined in RFC
7230 and RFC 3986 异常 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<!-- end 改为 jetty -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -52,12 +132,18 @@ ...@@ -52,12 +132,18 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.70</version> <version>2.0.10</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.egolm</groupId> <groupId>com.egolm</groupId>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<version>0.0.1-RELEASE</version> <version>0.0.1-RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
...@@ -89,10 +175,6 @@ ...@@ -89,10 +175,6 @@
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version> <version>2.9.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.solr</groupId> <groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId> <artifactId>solr-solrj</artifactId>
...@@ -137,7 +219,7 @@ ...@@ -137,7 +219,7 @@
<!-- 腾讯云 end --> <!-- 腾讯云 end -->
<!-- Aliyun LOG Producer start --> <!-- Aliyun LOG Producer start -->
<dependency> <!-- <dependency>
<groupId>com.aliyun.openservices</groupId> <groupId>com.aliyun.openservices</groupId>
<artifactId>aliyun-log-producer</artifactId> <artifactId>aliyun-log-producer</artifactId>
<version>0.3.0</version> <version>0.3.0</version>
...@@ -151,64 +233,42 @@ ...@@ -151,64 +233,42 @@
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
<version>2.5.0</version> <version>2.5.0</version>
</dependency> </dependency> -->
<!-- Aliyun LOG Producer end --> <!-- Aliyun LOG Producer end -->
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>${mybatis.generator.version}</version>
<configuration> <configuration>
<mainClass>${start-class}</mainClass> <verbose>true</verbose>
<layout>ZIP</layout> <overwrite>true</overwrite>
</configuration> </configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<executions> <executions>
<execution> <execution>
<goals> <id>default</id>
<goal>repackage</goal>
</goals>
</execution> </execution>
</executions> </executions>
<configuration>
<repository>dockerhub.linkfern.com/b2c/shopapi</repository>
<tag>V1.0.0</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<repositories>
<repository>
<id>my</id>
<name>my</name>
<url>https://gitlab.linkfern.com/content/groups/public/</url>
</repository>
<repository>
<id>repo1</id>
<name>repo1</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>mvnrepository</id>
<name>mvnrepository</name>
<url>http://mvnrepository.com/</url>
</repository>
<repository>
<id>bintray-qcloud-maven-repo</id>
<name>qcloud-maven-repo</name>
<url>https://dl.bintray.com/qcloud/maven-repo/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project> </project>
\ No newline at end of file
package com.egolm.shop.api;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
@ApiIgnore
@Api(tags={"接口"})
@RestController
@RequestMapping("header")
public class HeaderController {
@ApiIgnore
@ResponseBody
@GetMapping("/check")
@ApiOperation("心跳检查")
public Rjx headerCheck(HttpServletRequest request) {
return Rjx.jsonOk();
}
}
package com.egolm.shop.api.service; /*package com.egolm.shop.api.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -87,3 +87,4 @@ public interface QiyeWxService { ...@@ -87,3 +87,4 @@ public interface QiyeWxService {
} }
} }
*/
\ No newline at end of file
...@@ -4,7 +4,6 @@ import java.math.BigDecimal; ...@@ -4,7 +4,6 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -26,9 +25,6 @@ import com.egolm.common.jdbc.dialect.Dialect; ...@@ -26,9 +25,6 @@ import com.egolm.common.jdbc.dialect.Dialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect; import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.common.jdbc.dialect.bean.Sql; import com.egolm.common.jdbc.dialect.bean.Sql;
import com.egolm.shop.api.service.OrderService; import com.egolm.shop.api.service.OrderService;
import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.api.service.QiyeWxService.WxMessage;
import com.egolm.shop.api.service.QiyeWxService.WxMessage.MiniprogramNotice;
import com.egolm.shop.bean.TSalesOrder; import com.egolm.shop.bean.TSalesOrder;
import com.egolm.shop.bean.TSalesOrderDtl; import com.egolm.shop.bean.TSalesOrderDtl;
import com.egolm.shop.common.XException; import com.egolm.shop.common.XException;
...@@ -39,9 +35,9 @@ public class OrderServiceImpl implements OrderService { ...@@ -39,9 +35,9 @@ public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired /* @Autowired
QiyeWxService wxService; QiyeWxService wxService;
*/
/** /**
* 订单检查 * 订单检查
* <p>Title: orderCheck</p> * <p>Title: orderCheck</p>
...@@ -123,7 +119,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -123,7 +119,7 @@ public class OrderServiceImpl implements OrderService {
if (commitMap != null && commitMap.size() > 0 && commitMap.get(0) != null && Util.objTo(commitMap.get(0).get("Status"), Integer.class) == 0 && Util.objTo(commitMap.get(commitMap.size()-1).get("Status"), Integer.class) == 0) { if (commitMap != null && commitMap.size() > 0 && commitMap.get(0) != null && Util.objTo(commitMap.get(0).get("Status"), Integer.class) == 0 && Util.objTo(commitMap.get(commitMap.size()-1).get("Status"), Integer.class) == 0) {
String sSalesOrderID = (String)commitMap.get(0).get("SalesOrderID"); String sSalesOrderID = (String)commitMap.get(0).get("SalesOrderID");
jdbcTemplate.update("update tSalesOrder set sFormID = ?, sEmail = ?, sSalesmanNO = ? where sSalesOrderID = ?", formId, email, salesmanNo, sSalesOrderID); jdbcTemplate.update("update tSalesOrder set sFormID = ?, sEmail = ?, sSalesmanNO = ? where sSalesOrderID = ?", formId, email, salesmanNo, sSalesOrderID);
this.sendWxMessage(sSalesOrderID); //this.sendWxMessage(sSalesOrderID);
return Rjx.jsonOk().setData(commitMap).toJson(); return Rjx.jsonOk().setData(commitMap).toJson();
} else { } else {
String errorMsg = ""; String errorMsg = "";
...@@ -516,7 +512,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -516,7 +512,7 @@ public class OrderServiceImpl implements OrderService {
list.add(dtl); list.add(dtl);
} }
jdbcTemplate.batchSave(list); jdbcTemplate.batchSave(list);
this.sendWxMessage(order.getsSalesOrderID()); //this.sendWxMessage(order.getsSalesOrderID());
return order.getsSalesOrderID(); return order.getsSalesOrderID();
} }
...@@ -674,7 +670,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -674,7 +670,7 @@ public class OrderServiceImpl implements OrderService {
String sqlUpdate = "update tZHCProject set nSalePaperQty = ?, nSaleQty = ?, nSaleAmount = ? where nProjectID = ?"; String sqlUpdate = "update tZHCProject set nSalePaperQty = ?, nSaleQty = ?, nSaleAmount = ? where nProjectID = ?";
jdbcTemplate.executeUpdate(sqlUpdate, nSalePaperQty, nSaleQty, nSaleAmount, nProjectID); jdbcTemplate.executeUpdate(sqlUpdate, nSalePaperQty, nSaleQty, nSaleAmount, nProjectID);
} }
this.sendWxMessage(order.getsSalesOrderID()); //this.sendWxMessage(order.getsSalesOrderID());
return order.getsSalesOrderID(); return order.getsSalesOrderID();
} }
...@@ -794,7 +790,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -794,7 +790,7 @@ public class OrderServiceImpl implements OrderService {
dtl.setsSalesOrderID(sSalesOrderID); dtl.setsSalesOrderID(sSalesOrderID);
dtl.setsWarehouseNO(sWarehouseNO); dtl.setsWarehouseNO(sWarehouseNO);
jdbcTemplate.save(dtl); jdbcTemplate.save(dtl);
this.sendWxMessage(order.getsSalesOrderID()); //this.sendWxMessage(order.getsSalesOrderID());
return order.getsSalesOrderID(); return order.getsSalesOrderID();
} }
...@@ -861,7 +857,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -861,7 +857,7 @@ public class OrderServiceImpl implements OrderService {
} }
private void sendWxMessage(String sSalesOrderID) { private void sendWxMessage(String sSalesOrderID) {
TSalesOrder order = jdbcTemplate.queryForBean("select * from tSalesOrder where sSalesOrderID = ?", TSalesOrder.class, sSalesOrderID); /*TSalesOrder order = jdbcTemplate.queryForBean("select * from tSalesOrder where sSalesOrderID = ?", TSalesOrder.class, sSalesOrderID);
String salesmanNo = order.getsSalesmanNO(); String salesmanNo = order.getsSalesmanNO();
String shopNo = order.getsShopNO(); String shopNo = order.getsShopNO();
BigDecimal totalAmount = order.getnTotalSaleAmount(); BigDecimal totalAmount = order.getnTotalSaleAmount();
...@@ -897,7 +893,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -897,7 +893,7 @@ public class OrderServiceImpl implements OrderService {
params.put("备注", StringUtil.isBlank(shopMemo) ? " " : shopMemo); params.put("备注", StringUtil.isBlank(shopMemo) ? " " : shopMemo);
notice.setContent_item(params); notice.setContent_item(params);
wxService.sendMessage(wxMessage); wxService.sendMessage(wxMessage);
} }*/
} }
} }
package com.egolm.shop.api.service.impl; /*package com.egolm.shop.api.service.impl;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Date; import java.util.Date;
...@@ -96,3 +96,4 @@ public class QiyeWxServiceImpl implements QiyeWxService { ...@@ -96,3 +96,4 @@ public class QiyeWxServiceImpl implements QiyeWxService {
} }
*/
\ No newline at end of file
...@@ -37,9 +37,6 @@ import com.egolm.common.jdbc.dialect.Dialect; ...@@ -37,9 +37,6 @@ import com.egolm.common.jdbc.dialect.Dialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect; import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.common.jdbc.dialect.bean.Sql; import com.egolm.common.jdbc.dialect.bean.Sql;
import com.egolm.shop.api.service.CommonService; import com.egolm.shop.api.service.CommonService;
import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.api.service.QiyeWxService.WxMessage;
import com.egolm.shop.api.service.QiyeWxService.WxMessage.MiniprogramNotice;
import com.egolm.shop.api.service.SystemCtrlService; import com.egolm.shop.api.service.SystemCtrlService;
import com.egolm.shop.api.service.UserService; import com.egolm.shop.api.service.UserService;
import com.egolm.shop.bean.TCommon; import com.egolm.shop.bean.TCommon;
...@@ -54,8 +51,8 @@ public class UserServiceImpl implements UserService { ...@@ -54,8 +51,8 @@ public class UserServiceImpl implements UserService {
private static final Log logger = LogFactory.getLog(UserServiceImpl.class); private static final Log logger = LogFactory.getLog(UserServiceImpl.class);
@Autowired /* @Autowired
private QiyeWxService wxService; private QiyeWxService wxService;*/
@Value("${redis.guest.key}") @Value("${redis.guest.key}")
private String guestRedisKey; private String guestRedisKey;
...@@ -631,7 +628,7 @@ public class UserServiceImpl implements UserService { ...@@ -631,7 +628,7 @@ public class UserServiceImpl implements UserService {
String dateString = DateUtil.format(new Date()); String dateString = DateUtil.format(new Date());
String sCompanyAccountID = (String)salesman.get("sCompanyAccountID"); String sCompanyAccountID = (String)salesman.get("sCompanyAccountID");
if(StringUtil.isNotBlank(sCompanyAccountID)) { if(StringUtil.isNotBlank(sCompanyAccountID)) {
WxMessage wxMessage = new WxMessage(sCompanyAccountID); /* WxMessage wxMessage = new WxMessage(sCompanyAccountID);
MiniprogramNotice notice = new MiniprogramNotice(); MiniprogramNotice notice = new MiniprogramNotice();
wxMessage.setMiniprogram_notice(notice); wxMessage.setMiniprogram_notice(notice);
notice.setDescription(dateString); notice.setDescription(dateString);
...@@ -647,7 +644,7 @@ public class UserServiceImpl implements UserService { ...@@ -647,7 +644,7 @@ public class UserServiceImpl implements UserService {
params.put("备注", StringUtil.isBlank(memo) ? " " : memo); params.put("备注", StringUtil.isBlank(memo) ? " " : memo);
notice.setContent_item(params); notice.setContent_item(params);
wxService.sendMessage(wxMessage); wxService.sendMessage(wxMessage);*/
} }
} }
return Rjx.jsonOk().setMessage(I18NUtils.getMessage(langID, "Msg_Update_success")).toJson(); return Rjx.jsonOk().setMessage(I18NUtils.getMessage(langID, "Msg_Update_success")).toJson();
......
...@@ -13,7 +13,6 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView; ...@@ -13,7 +13,6 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.shop.common.XException; import com.egolm.shop.common.XException;
import com.egolm.shop.common.plugins.aliyunLog.AliyunLogProducer;
import com.egolm.shop.common.utils.I18NUtils; import com.egolm.shop.common.utils.I18NUtils;
import io.netty.util.internal.ThrowableUtil; import io.netty.util.internal.ThrowableUtil;
...@@ -23,8 +22,7 @@ public class ExceptionHandler implements HandlerExceptionResolver { ...@@ -23,8 +22,7 @@ public class ExceptionHandler implements HandlerExceptionResolver {
private static final Log logger = LogFactory.getLog(ExceptionHandler.class); private static final Log logger = LogFactory.getLog(ExceptionHandler.class);
@Autowired
private AliyunLogProducer logProducer;
@Override @Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
...@@ -41,7 +39,6 @@ public class ExceptionHandler implements HandlerExceptionResolver { ...@@ -41,7 +39,6 @@ public class ExceptionHandler implements HandlerExceptionResolver {
mav.addAllObjects(Rjx.jsonErr().setMessage(I18NUtils.getMessage(langID, "Msg_Exception_processFailure"))); mav.addAllObjects(Rjx.jsonErr().setMessage(I18NUtils.getMessage(langID, "Msg_Exception_processFailure")));
} finally { } finally {
logger.error("", ex); logger.error("", ex);
logProducer.sendLog(ThrowableUtil.stackTraceToString(ex));
} }
return mav; return mav;
} }
......
package com.egolm.shop.common.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.aliyun.openservices.aliyun.log.producer.LogProducer;
import com.aliyun.openservices.aliyun.log.producer.Producer;
import com.aliyun.openservices.aliyun.log.producer.ProducerConfig;
import com.aliyun.openservices.aliyun.log.producer.ProjectConfig;
@Configuration
public class LogProducerConfig {
@Value("${logProducer.project}")
private String project;
@Value("${logProducer.endpoint}")
private String endpoint;
@Value("${logProducer.accessKeyId}")
private String accessKeyId;
@Value("${logProducer.accessKeySecret}")
private String accessKeySecret;
@Bean
public Producer createProducer() {
ProducerConfig producerConfig = new ProducerConfig();
Producer producer = new LogProducer(producerConfig);
producer.putProjectConfig(new ProjectConfig(project, endpoint, accessKeyId, accessKeySecret));
return producer;
}
}
package com.egolm.shop.common.config; /*package com.egolm.shop.common.config;
import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder; import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder;
...@@ -18,3 +18,4 @@ public class SolrConfig { ...@@ -18,3 +18,4 @@ public class SolrConfig {
} }
} }
*/
\ No newline at end of file
package com.egolm.shop.common.plugins.aliyunLog;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.aliyun.openservices.aliyun.log.producer.Producer;
import com.aliyun.openservices.aliyun.log.producer.Result;
import com.aliyun.openservices.aliyun.log.producer.errors.ResultFailedException;
import com.aliyun.openservices.log.common.LogItem;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import io.netty.util.internal.ThrowableUtil;
@Component
public class AliyunLogProducer {
@Autowired
private Producer producer;
@Value("${logProducer.project}")
private String project;
@Value("${logProducer.logStore}")
private String logStore;
@Value("${logProducer.isOpen}")
private Boolean isOpen;
@Value("${logProducer.logName}")
private String logName;
private static final ExecutorService EXECUTOR_SERVICE = Executors.newCachedThreadPool();
public void sendLog(String logText) {
if(!isOpen) {
return;
}
try {
List<LogItem> logItems = new ArrayList<LogItem>();
LogItem logItem = new LogItem();
logItem.PushBack("id", String.valueOf(System.currentTimeMillis()));
logItem.PushBack(logName, logText);
logItems.add(logItem);
ListenableFuture<Result> future = producer.send(project, logStore, logItems);
Futures.addCallback(future, new SampleFutureCallback(project, logStore, logText), EXECUTOR_SERVICE);
} catch (Exception e) {
e.printStackTrace();
}
}
private static final class SampleFutureCallback implements FutureCallback<Result> {
private static final Logger LOGGER = LoggerFactory.getLogger(SampleFutureCallback.class);
private final String project;
private final String logStore;
private final String logText;
SampleFutureCallback(String project, String logStore, String logText) {
this.project = project;
this.logStore = logStore;
this.logText = logText;
}
@Override
public void onSuccess(Result result) {
LOGGER.info("Send logs successfully.");
}
@Override
public void onFailure(Throwable e) {
if (e instanceof ResultFailedException) {
Result result = ((ResultFailedException) e).getResult();
LOGGER.error("Failed to send logs, project={}, logStore={}, result={}, log={}", project, logStore, result, logText);
} else {
String errors = ThrowableUtil.stackTraceToString(e);
LOGGER.error("Failed to send logs, project={}, logStore={}, errors={}, log={}", project, logStore, errors, logText);
}
}
}
}
package com.egolm.shop.schedules.qiyewx; /*package com.egolm.shop.schedules.qiyewx;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -29,7 +29,7 @@ public class QiyeWxMsgTask { ...@@ -29,7 +29,7 @@ public class QiyeWxMsgTask {
@Autowired @Autowired
JdbcTemplate jdbcTemplate; JdbcTemplate jdbcTemplate;
/* @Scheduled(cron="${qiyewx.msg.timer}")*/ @Scheduled(cron="${qiyewx.msg.timer}")
public void execute() { public void execute() {
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nID, sSMS from tSMS where sSendType = '2' and sChannelID = 'qywx' and sSendGroup = '6'"); List<Map<String, Object>> list = jdbcTemplate.queryForList("select nID, sSMS from tSMS where sSendType = '2' and sChannelID = 'qywx' and sSendGroup = '6'");
if(list.size() > 0) { if(list.size() > 0) {
...@@ -88,3 +88,4 @@ public class QiyeWxMsgTask { ...@@ -88,3 +88,4 @@ public class QiyeWxMsgTask {
wxService.sendMessage(wxMessage); wxService.sendMessage(wxMessage);
} }
} }
*/
\ No newline at end of file
package com.egolm.shop.schedules.search; /*package com.egolm.shop.schedules.search;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -84,13 +84,13 @@ public class GoodsCollectTask extends AbstractSolrApi{ ...@@ -84,13 +84,13 @@ public class GoodsCollectTask extends AbstractSolrApi{
return Rjx.jsonOk().toJson(); return Rjx.jsonOk().toJson();
} }
/* @Scheduled(cron="${solr.goods.cron-for-day}")*/ @Scheduled(cron="${solr.goods.cron-for-day}")
public void dayExecute() { public void dayExecute() {
Date date = new Date(System.currentTimeMillis() - (offsetMinuteForDay*60L*1000L)); Date date = new Date(System.currentTimeMillis() - (offsetMinuteForDay*60L*1000L));
this.updateIndex(date); this.updateIndex(date);
} }
/*@Scheduled(cron="${solr.goods.cron-for-minute}")*/ @Scheduled(cron="${solr.goods.cron-for-minute}")
public void minuteExecute() { public void minuteExecute() {
Date date = new Date(System.currentTimeMillis() - (offsetMinuteForMinute*60L*1000L)); Date date = new Date(System.currentTimeMillis() - (offsetMinuteForMinute*60L*1000L));
this.updateIndex(date); this.updateIndex(date);
...@@ -121,3 +121,4 @@ public class GoodsCollectTask extends AbstractSolrApi{ ...@@ -121,3 +121,4 @@ public class GoodsCollectTask extends AbstractSolrApi{
} }
} }
*/
\ No newline at end of file
...@@ -17,25 +17,6 @@ spring.messages.basename=messages ...@@ -17,25 +17,6 @@ spring.messages.basename=messages
###版本号 ###版本号
maven.build.timestamp=@maven.build.timestamp@ maven.build.timestamp=@maven.build.timestamp@
sql.goods.create-index-query= sql/goods/create-index-query.sql
sql.goods.delete-index-query= sql/goods/delete-index-query.sql
sql.goods.update-index-query= sql/goods/update-index-query.sql
solr.goods.core-url= http://10.10.0.16:9090/solr/goods
solr.goods.offset-minute-for-day: 1500
solr.goods.offset-minute-for-minute: 10
solr.goods.cron-for-day: 0 0 3 * * ?
solr.goods.cron-for-minute: 0 * * * * ?
solr.baseURL=http://10.10.0.16:9090/solr/goods
logProducer.logName=AST_SHOP_ERROR_LOG
logProducer.isOpen=false
logProducer.project=linkfernlog
logProducer.logStore=linkfernlogstore
logProducer.endpoint=cn-shanghai.log.aliyuncs.com
logProducer.accessKeyId=LTAI4FvaitSjFD3X6gLeyyiR
logProducer.accessKeySecret=5zuFHabmMWzCHziPopQyoADqjKC4cv
spring.datasource.username=ERP spring.datasource.username=ERP
spring.datasource.password=qiyang@2013 spring.datasource.password=qiyang@2013
spring.datasource.url=jdbc:sqlserver://10.10.0.22:1433;instanceName=SQLSERVER;DatabaseName=B2BDB;allowMultiQueries=true spring.datasource.url=jdbc:sqlserver://10.10.0.22:1433;instanceName=SQLSERVER;DatabaseName=B2BDB;allowMultiQueries=true
...@@ -76,10 +57,11 @@ redis.guest.key=B2B_Guest ...@@ -76,10 +57,11 @@ redis.guest.key=B2B_Guest
redis.sms.code.key=B2B_Sms redis.sms.code.key=B2B_Sms
#以下没啥用
wx.appId=wxb1ec171f1bac3429 wx.appId=wxb1ec171f1bac3429
wx.md5Key=FFRlbnBheS5jb20gQ0EgQ2VudGVyMRsw wx.md5Key=FFRlbnBheS5jb20gQ0EgQ2VudGVyMRsw
wx.appSecret=eac5fb2d91004f89dcfb3c7bfc8aac96 wx.appSecret=eac5fb2d91004f89dcfb3c7bfc8aac96
#以下没啥用
qiyewx.corpid=ww0e86cf527e3e5218 qiyewx.corpid=ww0e86cf527e3e5218
qiyewx.corpsecret=aOSZ6i7oHLJtRfPJB4RSZzysyRTuOXpet2W7OtqeGZs qiyewx.corpsecret=aOSZ6i7oHLJtRfPJB4RSZzysyRTuOXpet2W7OtqeGZs
qiyewx.baseUrl=https://qyapi.weixin.qq.com/cgi-bin qiyewx.baseUrl=https://qyapi.weixin.qq.com/cgi-bin
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<property name="LOG_BASE_PATH" value="/data/logs/shop" />
<include resource="org/springframework/boot/logging/logback/base.xml" /> <include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="org" level="INFO" /> <!-- Console 输出设置 -->
<logger name="com" level="INFO" /> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<logger name="com.egolm" level="DEBUG" /> <encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="siftingAppender" class="ch.qos.logback.classic.sift.SiftingAppender"> <appender name="commonAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<discriminator>
<key>CTX_PATH</key>
<DefaultValue>shop</DefaultValue>
</discriminator>
<sift>
<appender name="rollingFileAppender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_BASE_PATH}/${CTX_PATH}-%d{yyyy-MM-dd}.log</FileNamePattern> <FileNamePattern>d:/data/logs/shop-%d{yyyy-MM-dd}.log</FileNamePattern>
<MaxHistory>30</MaxHistory> <MaxHistory>30</MaxHistory>
</rollingPolicy> </rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern> <pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder> </encoder>
</appender> </appender>
</sift>
</appender>
<root level="INFO"> <root level="INFO">
<appender-ref ref="siftingAppender" /> <appender-ref ref="commonAppender" />
<appender-ref ref="console" />
</root> </root>
</configuration> </configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_BASE_PATH" value="d:/data/logs/shop" />
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="org" level="INFO" />
<logger name="com" level="INFO" />
<logger name="com.egolm" level="DEBUG" />
<!-- <appender name="siftingAppender" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>CTX_PATH</key>
<DefaultValue>shop</DefaultValue>
</discriminator>
<sift>
<appender name="rollingFileAppender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_BASE_PATH}/${CTX_PATH}-%d{yyyy-MM-dd}.log</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
</sift>
</appender> -->
<appender name="siftingAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_BASE_PATH}/%d{yyyy-MM-dd}/shop.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>50MB</maxFileSize>
</TimeBasedFileNamingAndTriggeringPolicy>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="siftingAppender" />
</root>
</configuration>
\ No newline at end of file
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>更新说明 </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- import Vue.js -->
<script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<style type="text/css">
.title{
padding-left: 20px;
font-size: 14px;
}
</style>
</head>
<body>
<div id="app">
<el-divider content-position="left">V1.0.0</el-divider>
<p class="title">1.项目初始化</p>
</div>
</body>
<script type="text/javascript">
let app = new Vue({
el: '#app',
data() {
return{
}
},
created() {
},
mounted(){
},
methods:{
}
});
</script>
</html>
\ No newline at end of file
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