优化话费定时任务代码

dev-discount
袁野 2 years ago
parent 4d6f7bc23a
commit ac8801bed3
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 2
      hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java
  3. 2
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  4. 2
      hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java
  5. 3
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  6. 33
      hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java
  7. 164
      hai-service/src/main/java/com/hai/config/WeChatQrcodeUtils.java
  8. 7
      hai-service/src/main/java/com/hai/config/WxConfig.java
  9. 38
      hai-service/src/main/java/com/hai/enum_type/WxQrCodeTypeEnum.java
  10. 23
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java
  11. 3
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  12. 7
      hai-service/src/main/resources/dev/commonConfig.properties
  13. 3
      hai-service/src/main/resources/pre/commonConfig.properties
  14. 3
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  15. 3
      hai-service/src/main/resources/prod/commonConfig.properties
  16. 219
      v1/src/main/java/com/v1/controller/WxMsgController.java
  17. 10
      v1/src/main/java/com/v1/controller/business/GzSinopecController.java
  18. 4
      v1/src/main/java/com/v1/controller/business/RefuelOnlineController.java
  19. 2
      v1/src/main/resources/dev/application.yml
  20. 80
      v1/src/main/resources/dev/logback.xml
  21. 58
      v1/src/main/resources/prod/application.yml
  22. 106
      v1/src/main/resources/prod/logback.xml

File diff suppressed because one or more lines are too long

@ -30,7 +30,7 @@ public class HighIntegralSchedule {
@Resource @Resource
private HighUserService highUserService; private HighUserService highUserService;
@Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次 @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次
public void integralRebateOrder() { public void integralRebateOrder() {
List<HighGoldRec> list = highGoldRecService.selectByExpiringSoonByAll(365); List<HighGoldRec> list = highGoldRecService.selectByExpiringSoonByAll(365);

@ -74,7 +74,7 @@ public class HighOrderSchedule {
* @Param [] * @Param []
* @return void * @return void
*/ */
@Scheduled(cron="0 0/10 * * * ?") //每 5分钟执行一次 @Scheduled(cron="0 0/10 * * * ?") //每 10分钟执行一次
public void integralRebateOrder() { public void integralRebateOrder() {
// 查询满足初步返利条件订单 // 查询满足初步返利条件订单

@ -53,7 +53,7 @@ public class HighRechargeOrderSchedule {
* @Date 14:18 2022/5/31 * @Date 14:18 2022/5/31
* @Param [] * @Param []
*/ */
@Scheduled(cron = "0 0/5 * * * ?") //每5分钟执行一次 @Scheduled(cron = "0 0/7 * * * ?") //每7分钟执行一次
public void initRechargeOrder() { public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("payStatus", String.valueOf(102)); map.put("payStatus", String.valueOf(102));

@ -121,4 +121,7 @@ public class CommonSysConfig {
private String wxAppId; private String wxAppId;
private String wxAppSecret; private String wxAppSecret;
private String wxH5AppId;
private String wxH5AppSecret;
} }

@ -15,6 +15,8 @@ import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighUserCoupon; import com.hai.entity.HighUserCoupon;
import com.hai.enum_type.OrderPushType; import com.hai.enum_type.OrderPushType;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -39,6 +41,8 @@ import java.util.*;
@Component @Component
public class HuiLianTongConfig { public class HuiLianTongConfig {
private static Logger log = LoggerFactory.getLogger(HuiLianTongUnionCardConfig.class);
@Resource @Resource
private RedisUtil redisUtil; private RedisUtil redisUtil;
@ -73,7 +77,14 @@ public class HuiLianTongConfig {
map.put("couTypeCode", couTypeCode); map.put("couTypeCode", couTypeCode);
map.put("phone", phone); map.put("phone", phone);
map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId());
return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/recharge", map); log.info("============请求任务Start=============");
log.info("下单购买加油券-请求参数: " + JSON.toJSONString(map));
JSONObject returnObject = HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/recharge", map);
log.info("下单购买加油券-响应参数: " + returnObject.toJSONString());
log.info("============请求任务End==============");
return returnObject;
} }
/** /**
@ -86,7 +97,14 @@ public class HuiLianTongConfig {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("couNo", couNo); map.put("couNo", couNo);
map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId());
return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/getPayOrderByCouNo", map); log.info("============请求任务Start=============");
log.info("购买加油券充值订单-请求参数: " + JSON.toJSONString(map));
JSONObject returnObject = HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/getPayOrderByCouNo", map);
log.info("购买加油券充值订单-响应参数: " + returnObject.toJSONString());
log.info("============请求任务End==============");
return returnObject;
} }
/** /**
@ -99,7 +117,16 @@ public class HuiLianTongConfig {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("rechargeOrderId", rechargeOrderId); map.put("rechargeOrderId", rechargeOrderId);
map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId()); map.put("distributorId", CommonSysConst.getSysConfig().getHuiliantongDistributorId());
return HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/costRechargeOrder", map);
log.info("============请求任务Start=============");
log.info("购买加油券充值订单-请求参数: " + JSON.toJSONString(map));
JSONObject returnObject = HuiLianTongUnionCardConfig.request(CommonSysConst.getSysConfig().getHuiliantongSinopecUrl()+"/costRechargeOrder", map);
log.info("购买加油券充值订单-响应参数: " + returnObject.toJSONString());
log.info("============请求任务End==============");
return returnObject;
} }
/** /**

@ -1,7 +1,16 @@
package com.v1.config; package com.hai.config;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.model.TextMessage; import com.hai.model.TextMessage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
@ -10,9 +19,21 @@ import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map; import java.util.Map;
import static org.apache.catalina.manager.Constants.CHARSET;
/** /**
* @serviceName WeChatQrcodeUtils.java * @serviceName WeChatQrcodeUtils.java
* @author Sum1Dream * @author Sum1Dream
@ -27,6 +48,9 @@ public class WeChatQrcodeUtils {
@Autowired @Autowired
private WxMpService wxMpService; private WxMpService wxMpService;
@Resource
private RedisUtil redisUtil;
/** /**
* <pre> * <pre>
* 创建临时二维码ticket * 创建临时二维码ticket
@ -79,6 +103,40 @@ public class WeChatQrcodeUtils {
return wxMpService.getQrcodeService().qrCodeCreateLastTicket(sceneStr); return wxMpService.getQrcodeService().qrCodeCreateLastTicket(sceneStr);
} }
// 创建微信二维码
public JSONObject createWxQrCode(String sceneStr) {
JSONObject object = new JSONObject();
JSONObject objectScene = new JSONObject();
JSONObject objectActionInfo = new JSONObject();
objectScene.put("scene_str" , sceneStr);
objectActionInfo.put("scene" , objectScene);
object.put("action_name" , "QR_STR_SCENE");
object.put("expire_seconds" , 2592000);
object.put("action_info" , objectActionInfo);
if (redisUtil.get("WxToken") == null) {
getWxToken();
}
return HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + redisUtil.get("WxToken"), object);
}
// 获取微信Token存入redis
public void getWxToken() {
// 获取access_token
Map<String, Object> params = new HashMap<>();
params.put("appid", CommonSysConst.getSysConfig().getWxH5AppId());
params.put("secret", CommonSysConst.getSysConfig().getWxH5AppSecret());
params.put("grant_type", "client_credential");
JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params);
if (accessTokenObject != null && accessTokenObject.getString("access_token") != null) {
redisUtil.set("WxToken" , accessTokenObject.getString("access_token") , 7000);
}
}
/** /**
* <pre> * <pre>
* 换取二维码图片文件jpg格式 * 换取二维码图片文件jpg格式
@ -200,5 +258,109 @@ public class WeChatQrcodeUtils {
return object; return object;
} }
/**
* @Author Sum1Dream
* @Name downloadQrCode
* @Description // 下载微信二维码到本地
* @Date 15:03 2023/3/8
* @Param [wxQrUrl]
* @Return java.lang.String
*/
public String downloadQrCode(String wxQrUrl) throws Exception {
//定义一个URL对象,就是你想下载的图片的URL地址
URL urld = new URL(wxQrUrl);
//打开连接
HttpURLConnection conn = (HttpURLConnection) urld.openConnection();
//设置请求方式为"GET"
conn.setRequestMethod("GET");
//超时响应时间为10秒
conn.setConnectTimeout(10 * 1000);
//通过输入流获取图片数据
InputStream is = conn.getInputStream();
//得到图片的二进制数据,以二进制封装得到数据,具有通用性
byte[] data = readInputStream(is);
//创建一个文件对象用来保存图片,默认保存当前工程根目录
String downloadQrCodeImgUrl = CommonSysConst.getSysConfig().getFileUrl() + "/downloadQrCodeImg.jpg";
File imageFile = new File(downloadQrCodeImgUrl);
//创建输出流
FileOutputStream outStream = new FileOutputStream(imageFile);
//写入数据
outStream.write(data);
//关闭输出流,释放资源
outStream.close();
return downloadQrCodeImgUrl;
}
/**
* @Author Sum1Dream
* @Name decoderQRCode
* @Description // 解析二维码内容
* @Date 15:06 2023/3/8
* @Param [downloadQrCodeImgUrl]
* @Return java.lang.String
*/
public String decoderQRCode(String downloadQrCodeImgUrl) throws Exception {
BufferedImage image;
image = ImageIO.read(new File(downloadQrCodeImgUrl));
if (image == null) {
return null;
}
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result;
Hashtable hints = new Hashtable();
hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
QRCodeReader reader = new QRCodeReader();
result = reader.decode(bitmap, hints);
return result.getText();
}
/**
* @Author Sum1Dream
* @Name readInputStream
* @Description // 读取插入内容
* @Date 15:03 2023/3/8
* @Param [inStream]
* @Return byte[]
*/
public static byte[] readInputStream(InputStream inStream) throws Exception {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
//创建一个Buffer字符串
byte[] buffer = new byte[6024];
//每次读取的字符串长度,如果为-1,代表全部读取完毕
int len;
//使用一个输入流从buffer里把数据读取出来
while ((len = inStream.read(buffer)) != -1) {
//用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
outStream.write(buffer, 0, len);
}
//关闭输入流
inStream.close();
//把outStream里的数据写入内存
return outStream.toByteArray();
}
public String qrCodeImgUrl(String type , String code , String encryptType) throws Exception {
// 组装 二维码参数
String sceneId = "type=" + type + "&code=" + code + "&encryptType=" + encryptType;
// 获取二维码参数
JSONObject wxQr = createWxQrCode(sceneId);
return wxQr.getString("url");
}
public String qrCodeImgUrl(String type , String code) throws Exception {
// 组装 二维码参数
String sceneId = "type=" + type + "&code=" + code;
// 获取二维码参数
JSONObject wxQr = createWxQrCode(sceneId);
return wxQr.getString("url");
}
} }

@ -1,6 +1,5 @@
package com.v1.config; package com.hai.config;
import com.hai.config.CommonSysConst;
import com.hai.model.TextMessage; import com.hai.model.TextMessage;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
@ -31,9 +30,9 @@ public class WxConfig {
public WxMpConfigStorage wxMpConfigStorage() { public WxMpConfigStorage wxMpConfigStorage() {
WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl(); WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl();
// 公众号appId // 公众号appId
configStorage.setAppId(SysConst.getSysConfig().getWxH5AppId()); configStorage.setAppId(CommonSysConst.getSysConfig().getWxH5AppId());
// 公众号appSecret // 公众号appSecret
configStorage.setSecret(SysConst.getSysConfig().getWxH5AppSecret()); configStorage.setSecret(CommonSysConst.getSysConfig().getWxH5AppSecret());
return configStorage; return configStorage;
} }

@ -0,0 +1,38 @@
package com.hai.enum_type;
public enum WxQrCodeTypeEnum {
type1("1", "推广扫码"),
type2("2", "门店扫码"),
type3("3", "查看视频教程"),
type4("4", "支付扫码"),
type5("5", "扫码贵州中石化二维码"),
type6("6", "扫码重庆中石油二维码"),
;
private String type;
private String name;
WxQrCodeTypeEnum(String type,String name) {
this.type = type;
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -6,13 +6,16 @@ import com.hai.common.QRCodeGenerator;
import com.hai.common.security.AESEncodeUtil; import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator; import com.hai.common.utils.IDGenerator;
import com.hai.config.WeChatQrcodeUtils;
import com.hai.dao.HighDiscountAgentRelMapper; import com.hai.dao.HighDiscountAgentRelMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.WxQrCodeTypeEnum;
import com.hai.service.HighAgentService; import com.hai.service.HighAgentService;
import com.hai.service.HighDiscountAgentCodeService; import com.hai.service.HighDiscountAgentCodeService;
import com.hai.service.HighDiscountAgentRelService; import com.hai.service.HighDiscountAgentRelService;
import com.hai.service.HighDiscountService; import com.hai.service.HighDiscountService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -41,6 +44,9 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
@Resource @Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService; private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Autowired
private WeChatQrcodeUtils weChatQrcodeUtils;
@Override @Override
@Transactional(propagation= Propagation.REQUIRED) @Transactional(propagation= Propagation.REQUIRED)
public void insertDiscountAgentRel(HighDiscountAgentRel highDiscountAgentRel,Integer stockCount) throws Exception { public void insertDiscountAgentRel(HighDiscountAgentRel highDiscountAgentRel,Integer stockCount) throws Exception {
@ -49,12 +55,8 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
} else { } else {
highDiscountAgentRelMapper.insert(highDiscountAgentRel); highDiscountAgentRelMapper.insert(highDiscountAgentRel);
} }
Map<String,Object> map = new HashMap<>();
map.put("type", "DISCOUNT");
HighDiscountAgentCode code; HighDiscountAgentCode code;
String path = "/home/project/hsg/filesystem/agentQrCode/";
String folder = highDiscountAgentRel.getAgentId() + "/" + highDiscountAgentRel.getDiscountId() + "/";
for (int i = 0;i < stockCount;i++) { for (int i = 0;i < stockCount;i++) {
code = new HighDiscountAgentCode(); code = new HighDiscountAgentCode();
@ -62,15 +64,10 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
code.setStatus(1); code.setStatus(1);
code.setCreateTime(new Date()); code.setCreateTime(new Date());
highDiscountAgentCodeService.insertCode(code); highDiscountAgentCodeService.insertCode(code);
// 二维码参数
map.put("id", code.getId()); // 生成二维码地址
String qrCodeImg = DateUtil.date2String(new Date(),highDiscountAgentRel.getId()+"yyyyMMddHHmmss") + IDGenerator.nextId(10) +".png"; code.setExt1(weChatQrcodeUtils.qrCodeImgUrl(WxQrCodeTypeEnum.type5.getType(), code.getId().toString() , "DISCOUNT"));
code.setExt2("2");
// 生成二维码
String param = "https://hsg.dctpay.com/wx/?action=gogogo&id=" + Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(map)));
QRCodeGenerator.generateQRCodeImage(param, 350, 350, path + folder + qrCodeImg);
code.setQrCode(qrCodeImg);
code.setExt1(param);
highDiscountAgentCodeService.updateCode(code); highDiscountAgentCodeService.updateCode(code);
} }
} }

@ -903,6 +903,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
JSONObject jsonObject = RechargeConfig.checkOrderByHg(object); JSONObject jsonObject = RechargeConfig.checkOrderByHg(object);
if (jsonObject.getJSONArray("data") == null) { if (jsonObject.getJSONArray("data") == null) {
if (jsonObject.getInteger("code") == 20001) {
return 2;
}
return 99; return 99;
} else { } else {
JSONArray objectJSONArray = jsonObject.getJSONArray("data"); JSONArray objectJSONArray = jsonObject.getJSONArray("data");

@ -109,9 +109,12 @@ unionRsaKey=891f6775fba7f12cc23df7c75e02b39b891f6775fba7f12c
#url #url
fileUrl=/home/project/hsg/filesystem/ #fileUrl=/home/project/hsg/filesystem/
#fileUrl=/Volumes/work/code/filesystem/ fileUrl=/Volumes/work/
#wx #wx
wxAppId=wx8d49e2f83025229d wxAppId=wx8d49e2f83025229d
wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5

@ -87,3 +87,6 @@ CyPostUrl=http://120.24.83.85:8999/
unionAppId=ced46392acfe42be863fdfdd3e61164a unionAppId=ced46392acfe42be863fdfdd3e61164a
unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa
unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586 unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586
wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5

@ -108,3 +108,6 @@ fileUrl=/home/project/hsg/filesystem/
wxAppId=wx8d49e2f83025229d wxAppId=wx8d49e2f83025229d
wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5

@ -113,3 +113,6 @@ fileUrl=/home/project/hsg/filesystem/
wxAppId=wx8d49e2f83025229d wxAppId=wx8d49e2f83025229d
wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5

@ -1,23 +1,30 @@
package com.v1.controller; package com.v1.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
import com.hai.common.Base64Util;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.IOUtil; import com.hai.common.pay.util.IOUtil;
import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.XmlUtil;
import com.hai.common.utils.HttpsUtils; import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.RedisUtil; import com.hai.common.utils.*;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.config.WeChatQrcodeUtils;
import com.hai.entity.HighUser; import com.hai.entity.HighUser;
import com.hai.enum_type.WxQrCodeTypeEnum;
import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.HighMerchantStoreService; import com.hai.service.HighMerchantStoreService;
import com.hai.service.HighUserService; import com.hai.service.HighUserService;
import com.v1.config.SysConst; import com.v1.config.SysConst;
import com.v1.config.WeChatQrcodeUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -27,24 +34,28 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*; import java.util.*;
import static org.apache.catalina.manager.Constants.CHARSET;
/** /**
* @author sum1dream * @author sum1dream
*/ */
@Controller @Controller
@RequestMapping(value = "/wxMsg") @RequestMapping(value = "/wxMsg")
@Api(value = "自建站接口") @Api(value = "微信")
public class WxMsgController { public class WxMsgController {
private static Logger log = LoggerFactory.getLogger(ThirdPartyController.class); private static Logger log = LoggerFactory.getLogger(ThirdPartyController.class);
@ -97,10 +108,9 @@ public class WxMsgController {
// 微信支付系统发送的数据(<![CDATA[product_001]]>格式) // 微信支付系统发送的数据(<![CDATA[product_001]]>格式)
String notifyXml; String notifyXml;
notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8"); notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
log.info("微信系统发送的数据:" + notifyXml); log.info("微信系统发送的数据:" + notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8"); SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
Map<String,Object> mapQrCode = new HashMap<>();
// openId // openId
String userOpenId = map.get("FromUserName"); String userOpenId = map.get("FromUserName");
// 微信账号 // 微信账号
@ -111,40 +121,109 @@ public class WxMsgController {
String msgType = map.get("MsgType"); String msgType = map.get("MsgType");
// 二维码参数 // 二维码参数
String eventKey = map.get("EventKey"); String eventKey = map.get("EventKey");
log.info("二维码参数:" + eventKey);
// 判断用户是否是新用户 // 判断用户是否是新用户
HighUser user = highUserService.findByOpenIdH5(userOpenId); HighUser user = highUserService.findByOpenIdH5(userOpenId);
String linkContent = "";
String linkContent = null; String newUserContent = "";
String newUserContent = null; String content = "";
String content = null;
if (eventKey != null && eventKey.length() != 0) { if (eventKey != null && eventKey.length() != 0) {
JSONObject object = weChatQrcodeUtils.paramPars(eventKey); JSONObject object = weChatQrcodeUtils.paramPars(eventKey);
// type = 1 推广扫码 type = 2 商户门店 3:查看视频教程 4:支付扫码 // type = 1 推广扫码
if (Objects.equals(object.getString("qrscene_type"), "1") || Objects.equals(object.getString("type"), "1")) { if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type1.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type1.getType())) {
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000010&key=&code=" + object.getString("code") + "'>点击查看更多优惠</a>\n\n"; // todo 推广扫码
} else if (Objects.equals(object.getString("qrscene_type"), "2") || Objects.equals(object.getString("type"), "2")){ }
// type = 2 在线加油门店扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type2.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type2.getType())){
// 商户门店 // 商户门店
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code")); HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code"));
linkContent = "<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>欢迎来到" + store.getStoreName()+"</a>" + "[哇][哇][哇]\n\n<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>点击这里一键加油</a>\n\n"; linkContent =
} else if (Objects.equals(object.getString("qrscene_type"), "3") || Objects.equals(object.getString("type"), "3")){ "<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey="
+ object.getString("code") + "&staffCode='>欢迎来到" + store.getStoreName()+"</a>"
+ "[哇][哇][哇]\n\n<a href='"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=000000&gasKey="
+ object.getString("code")
+ "&staffCode='>点击这里一键加油</a>\n\n";
}
// 3:查看视频教程
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type3.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type3.getType())){
// 重庆
if ( Objects.equals(object.getString("code"), "1")) {
linkContent =
"加油优惠选我们,你的出行不再忧愁\uD83D\uDC97\n\n"
+ "<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>查看中石油操作流程</a>\n\n"
+ "走得更远,看得更美的风景,加油添生活![太阳]\n\n"
+ "好车要好油,优惠更加牛![發]\n\n";
}
// 贵州
if (Objects.equals(object.getString("code"), "2")) {
linkContent =
"加满好油,一路畅游!✨✨\n\n"
+ "<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>查看中石化操作流程</a>\n\n"
+ "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n"
+ "油客来自五湖四海,在这里祝您一路顺风。\n\n";
}
}
// 4:支付码牌扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type4.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type4.getType())){
// todo 支付扫码
}
// 5:扫码贵州中石化优惠券二维码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type5.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type5.getType())){
mapQrCode.put("type", object.getString("encryptType"));
// 二维码参数
mapQrCode.put("id", object.getString("code"));
log.info("map参数:" + mapQrCode);
// 商户门店 // 商户门店
linkContent = "<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>点击查看重庆中石油视频教程</a>" + linkContent =
"[哇][哇][哇]\n\n<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>点击查看贵州中石化视频教程</a>\n\n"; "山高水远,相伴致远[爱心][爱心]\n\n"
+ "<a href='"
+ "https://hsgcs.dctpay.com"
// + CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000011&key=&code="
+ Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(mapQrCode)))
+ "'>领取中石化加油券</a>\n\n"
+ "您追求实惠的折扣,我们追求高超的品质\uD83D\uDD16\n\n"
+ "迎南来北往宾朋尊驾,[福]\n\n"
+ "送平安顺遂诚意祝福![福]\n\n";
log.info("地址参数:" + linkContent);
}
// 6:扫码重庆中石油优惠券二维码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type6.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type6.getType())){
mapQrCode.put("type", object.getString("encryptType"));
// 二维码参数
mapQrCode.put("id", object.getString("code"));
log.info("map参数:" + mapQrCode);
// 商户门店
linkContent =
"加好油,添好运,我们更适意[礼物]\n\n"
+ "<a href='"
+ "https://hsgcs.dctpay.com"
// + CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000011&key=&code="
+ Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(mapQrCode)))
+ "'>领取中石油加油券</a>\n\n"
+ "致力于质量与福利,赢得客户心。\n\n"
+ "一路精彩,“油”我相伴!\uD83C\uDF1F\n\n";
log.info("地址参数:" + linkContent);
} }
} else { } else {
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击查看更多优惠</a>\n\n"; linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击查看更多优惠</a>\n\n";
} }
// 判断是否是新用户 // 判断是否是新用户
if (user == null) { // if (user == null) {
newUserContent = "特意为您奉上" + // newUserContent = "特意为您奉上" +
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" + // "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" +
",放在您的"+ // ",放在您的"+
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+ // "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n"; // "里面,记得及时使用哦[爱心][爱心][爱心]\n\n";
} // }
log.info("二维码参数:" + eventKey); log.info("二维码参数:" + eventKey);
@ -163,29 +242,16 @@ public class WxMsgController {
// 用户关注公众号 // 用户关注公众号
if ("subscribe".equals(event)) { if ("subscribe".equals(event)) {
log.info("进入扫码关注流程:" + event); log.info("进入扫码关注流程:" + event);
// todo 业务处理
content = content =
"终于等到你,还好我没放弃[玫瑰][玫瑰][玫瑰]\n\n" +
"您好,感谢关注嗨森逛商城!\n\n" + "您好,感谢关注嗨森逛商城!\n\n" +
linkContent + linkContent +
"在线等你来撩~[哇][哇][哇]\n\n" + newUserContent + "服务热线:400-023-6806"
"【如遇任何问题请致电客服:400-678-0738】"
; ;
// todo 业务处理
} }
// 用户扫码进入公众号 // 用户扫码进入公众号
else if ("SCAN".equals(event)) { else if ("SCAN".equals(event)) {
// todo 业务处理 content = linkContent + "服务热线:400-023-6806";
content =
"油价很贵,诗和远方也很贵[可怜]\n\n" +
"“一键加油”有”油“惠[红包][红包][红包]\n\n" +
linkContent +
"多重好礼为您助力\n\n" +
"加油的时候少点心疼,踩油门的时候多点豪横![得意][得意][得意]\n\n" +
"【如遇任何问题请致电客服:400-678-0738】"
;
}else if ("unsubscribe".equals(event)) { }else if ("unsubscribe".equals(event)) {
// todo 取消关注 业务处理 // todo 取消关注 业务处理
@ -194,6 +260,7 @@ public class WxMsgController {
String mapToXml = weChatQrcodeUtils.handleEventSubscribe(map); String mapToXml = weChatQrcodeUtils.handleEventSubscribe(map);
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.getWriter().print(mapToXml); response.getWriter().print(mapToXml);
} }
} catch (Exception e) { } catch (Exception e) {
// return null; // return null;
@ -241,12 +308,38 @@ public class WxMsgController {
@RequestParam(name = "code", required = false) String code) { @RequestParam(name = "code", required = false) String code) {
try { try {
String sceneId = "type=" + type + "&code=" + code; String jsonData;
String sceneId;
if (Objects.equals(type, "5")) {
jsonData = AESEncodeUtil.aesDecrypt(Base64Util.decode(code));
JSONObject jsonObject = JSON.parseObject(jsonData);
Long id = jsonObject.getLong("id");
sceneId = "type=" + type + "&code=" + id;
} else {
sceneId = "type=" + type + "&code=" + code;
}
String ticket = weChatQrcodeUtils.qrCodeCreateLastTicket(sceneId).getTicket(); String ticket = weChatQrcodeUtils.qrCodeCreateLastTicket(sceneId).getTicket();
return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodePictureUrl(ticket)); return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodePictureUrl(ticket));
} catch (WxErrorException e) { } catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/qrCodeImgUrl", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "二维码地址解析")
public ResponseData qrCodeImgUrl(@RequestParam(name = "type", required = false) String type,
@RequestParam(name = "code", required = false) String code) {
try {
return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodeImgUrl(type , code , "DISCOUNT"));
} catch (Exception e) {
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@ -361,4 +454,30 @@ public class WxMsgController {
// } // }
@RequestMapping(value = "/createMenu", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建菜单")
public ResponseData createMenu(@RequestBody JSONObject object) {
try {
Map<String, Object> params = new HashMap<>();
params.put("appid", SysConst.getSysConfig().getWxH5AppId());
params.put("secret", SysConst.getSysConfig().getWxH5AppSecret());
params.put("grant_type", "client_credential");
JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params);
if (accessTokenObject == null) {
log.error("getH5UserInfo error!", "获取微信access_token失败" );
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败");
}
JSONObject jsonObject = HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + accessTokenObject.getString("access_token"), object);
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
} }

@ -203,16 +203,6 @@ public class GzSinopecController {
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data")); JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data"));
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class); JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class);
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(object.getString("orderNo"));
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("respCode"));
highGasOrderPush.setRequestContent(object.toJSONString());
highGasOrderPush.setReturnContent(dataArray.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
return ResponseMsgUtil.success(dataArray); return ResponseMsgUtil.success(dataArray);
} else { } else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "下单失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "下单失败");

@ -59,10 +59,10 @@ public class RefuelOnlineController {
@Resource @Resource
private ApiCommonConfig apiCommonConfig; private ApiCommonConfig apiCommonConfig;
@RequestMapping(value = "/getStationStores", method = RequestMethod.POST) @RequestMapping(value = "/getStationStore", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取油站门店") @ApiOperation(value = "获取油站门店")
public ResponseData getStationStores(@RequestBody JSONObject object , HttpServletRequest request ) { public ResponseData getStationStore(@RequestBody JSONObject object , HttpServletRequest request ) {
try { try {
String ip = ""; String ip = "";

@ -4,7 +4,7 @@ server:
context-path: /v1 context-path: /v1
#配置是否为debug模式,debug模式下,不开启权限校验 #配置是否为debug模式,debug模式下,不开启权限校验
debug: false debug: true
#datasource数据源设置 #datasource数据源设置
spring: spring:

@ -58,6 +58,57 @@
</encoder> </encoder>
</appender> </appender>
<appender name="HltCardLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/HltCardLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/hlt/hltcard.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="PayNotify"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/PayNotify.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/paynotify/paynotify.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="QzLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/QzLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/QzLog/QzLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="RechargeLog" <appender name="RechargeLog"
class="ch.qos.logback.core.rolling.RollingFileAppender"> class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/RechargeLog.log</File> <File>log/RechargeLog.log</File>
@ -76,6 +127,23 @@
</encoder> </encoder>
</appender> </appender>
<appender name="wechatPayLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/wechatPay.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/wechatPayLog/wechatPayLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG"> <root level="DEBUG">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
</root> </root>
@ -92,10 +160,22 @@
<appender-ref ref="errorlog" /> <appender-ref ref="errorlog" />
</logger> </logger>
<logger name="com.hai.config.HuiLianTongUnionCardConfig" level="INFO">
<appender-ref ref="HltCardLog" />
</logger>
<logger name="com.web.controller.OrderPayNotifyController" level="INFO">
<appender-ref ref="PayNotify" />
</logger>
<logger name="com.hai.config.QianZhuConfig" level="INFO">
<appender-ref ref="QzLog" />
</logger>
<logger name="com.hai.config.RechargeConfig" level="INFO"> <logger name="com.hai.config.RechargeConfig" level="INFO">
<appender-ref ref="RechargeLog" /> <appender-ref ref="RechargeLog" />
</logger> </logger>
<logger name="com.hai.service.impl.OutRechargeOrderServiceImpl" level="INFO"> <logger name="com.hai.service.impl.OutRechargeOrderServiceImpl" level="INFO">
<appender-ref ref="RechargeLog" /> <appender-ref ref="RechargeLog" />
</logger> </logger>
<logger name="com.hai.config.WxOrderConfig" level="INFO">
<appender-ref ref="wechatPayLog" />
</logger>
</configuration> </configuration>

@ -4,7 +4,7 @@ server:
context-path: /v1 context-path: /v1
#配置是否为debug模式,debug模式下,不开启权限校验 #配置是否为debug模式,debug模式下,不开启权限校验
debug: false debug: true
#datasource数据源设置 #datasource数据源设置
spring: spring:
@ -29,7 +29,7 @@ spring:
maxOpenPreparedStatements: 20 maxOpenPreparedStatements: 20
redis: redis:
database: 0 database: 0
host: 127.0.0.1 host: 139.159.177.244
port: 36379 port: 36379
password: HF123456.Redis password: HF123456.Redis
timeout: 1000 timeout: 1000
@ -42,44 +42,58 @@ spring:
#MQTT配置信息 #MQTT配置信息
mqtt: mqtt:
#MQTT服务地址 #MQTT服务地址
url: ws://122.9.135.148:8083/mqtt url: ws://139.159.177.244:8083/mqtt
#用户名 #用户名
username: printer_provider username: printer_provider
#密码 #密码
password: abcd123! password: 123654
#客户端id(不能重复) #客户端id(不能重复)
# client: # client:
# id: provider-id # id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定 #MQTT默认的消息推送主题,实际可在调用接口是指定
# default: # default:
# topic: topic # topic: topic
#thymelea模板配置 rocketmq:
thymeleaf: name-server: 139.159.177.244:9876
prefix: classpath:/templates/ producer:
suffix: .html #必须指定group
mode: HTML5 group: default-group
encoding: UTF-8
#热部署文件,页面不产生缓存,及时更新
cache: false
#配置日期返回至前台为时间戳 #配置日期返回至前台为时间戳
jackson: jackson:
serialization: serialization:
write-dates-as-timestamps: true write-dates-as-timestamps: true
thymeleaf:
cache: false
prefix: classpath:/templates/
suffix: .html
encoding: UTF-8
content-type: text/html
mode: HTML5
mybatis: mybatis:
mapperLocations: mapperLocations:
- classpath*:sqlmap*/*.xml - classpath*:sqlmap*/*.xml
type-aliases-package: type-aliases-package:
org.springboot.sample.entity org.springboot.sample.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#开启MyBatis的二级缓存
cache-enabled: true
jetcache:
statIntervalMinutes: 15
areaInCacheName: false
local:
default:
type: linkedhashmap
keyConvertor: fastjson
remote:
default:
type: redis
host: 139.159.177.244
port: 36379
password: HF123456.Redis
keyConvertor: fastjson
broadcastChannel: projectA
valueEncoder: java
valueDecoder: java
poolConfig:
minIdle: 5
maxIdle: 20
maxTotal: 50
pagehelper: pagehelper:
helperDialect: mysql helperDialect: mysql

@ -57,6 +57,93 @@
<charset>UTF-8</charset> <!-- 此处设置字符集 --> <charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder> </encoder>
</appender> </appender>
<appender name="HltCardLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/HltCardLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/hlt/hltcard.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="PayNotify"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/PayNotify.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/paynotify/paynotify.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="QzLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/QzLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/QzLog/QzLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="RechargeLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/RechargeLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/RechargeLog/RechargeLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="wechatPayLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/wechatPay.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/wechatPayLog/wechatPayLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG"> <root level="DEBUG">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
</root> </root>
@ -69,4 +156,23 @@
<logger name="com.hai" level="ERROR"> <logger name="com.hai" level="ERROR">
<appender-ref ref="errorlog" /> <appender-ref ref="errorlog" />
</logger> </logger>
<logger name="com.hai.config.HuiLianTongUnionCardConfig" level="INFO">
<appender-ref ref="HltCardLog" />
</logger>
<logger name="com.web.controller.OrderPayNotifyController" level="INFO">
<appender-ref ref="PayNotify" />
</logger>
<logger name="com.hai.config.QianZhuConfig" level="INFO">
<appender-ref ref="QzLog" />
</logger>
<logger name="com.hai.config.RechargeConfig" level="INFO">
<appender-ref ref="RechargeLog" />
</logger>
<logger name="com.hai.service.impl.OutRechargeOrderServiceImpl" level="INFO">
<appender-ref ref="RechargeLog" />
</logger>
<logger name="com.hai.config.WxOrderConfig" level="INFO">
<appender-ref ref="wechatPayLog" />
</logger>
</configuration> </configuration>

Loading…
Cancel
Save