提交 a68572c1 作者: zhenjie

小猪算账配置修改及公众号模板消息发送修改

上级 ce573ec4
......@@ -7,11 +7,9 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author: zj
......@@ -26,60 +24,41 @@ public class WxMsgVO implements Serializable {
@ApiModelProperty(value = "用户id-仅适用云享飞客户端")
private Integer userAccountId;
@ApiModelProperty(value = "公众号的openId")
private String openId;
private String touser;
@ApiModelProperty(value = "unionId-全局通用")
private String unionId;
@ApiModelProperty(value = "模板id")
@NotNull(message = "模板id不能为空")
private String templemteId;
private String templateId;
@ApiModelProperty(value = "网页跳转连接")
private String url;
@ApiModelProperty(value = "小程序APPID")
private String wxAppltAppId;
private String wxAppletAppId;
@ApiModelProperty(value = "小程序跳转连接")
private String appletPath;
@ApiModelProperty(value = "标题")
private MsgData title;
@ApiModelProperty(value = "消息数组")
private List<MsgData> data;
@ApiModelProperty(value = "消息备注")
private MsgData remark;
@ApiModelProperty(value = "按照接口文档传数据")
private JSONObject dataObject;
public String buildMsgJson() {
JSONObject obj = new JSONObject();
obj.put("touser", this.openId);
obj.put("template_id", this.templemteId);
public String buildTemplateMsg() {
JSONObject msg = new JSONObject();
msg.put("touser", this.touser);
msg.put("template_id", this.templateId);
// 跳转页面
if (!StringUtils.isBlank(this.url)) {
obj.put("url", this.url);
msg.put("url", this.url);
}
if (!StringUtils.isBlank(this.wxAppltAppId) && !StringUtils.isBlank(this.appletPath)) {
// 跳转小程序页面设置
if (!StringUtils.isBlank(this.wxAppletAppId) && !StringUtils.isBlank(this.appletPath)) {
JSONObject mini = new JSONObject();
mini.put("appid", this.wxAppltAppId);
mini.put("appid", this.wxAppletAppId);
mini.put("pagepath", this.appletPath);
obj.put("miniprogram", mini);
}
JSONObject jd = new JSONObject();
jd.put("first", this.convertMsg(title));
if (!CollectionUtils.isEmpty(this.data)) {
for (int i = 0; i < data.size(); i++) {
String key = "keyword" + (i + 1);
jd.put(key, this.convertMsg(data.get(i)));
}
}
if (this.remark != null && !StringUtils.isBlank(this.remark.getValue())) {
jd.put("remark", this.convertMsg(this.remark));
msg.put("miniprogram", mini);
}
obj.put("data", jd);
return obj.toJSONString();
}
public JSONObject convertMsg(MsgData msg) {
JSONObject jb = new JSONObject();
jb.put("value", msg.getValue());
jb.put("color", msg.getColor());
return jb;
msg.put("data", this.dataObject);
return msg.toString();
}
}
......@@ -10,7 +10,6 @@ import com.mmc.iuav.user.constant.WxConstant;
import com.mmc.iuav.user.dao.UserSubInfoDao;
import com.mmc.iuav.user.entity.UserSubInfoDO;
import com.mmc.iuav.user.model.vo.AppletMsgVO;
import com.mmc.iuav.user.model.vo.MsgData;
import com.mmc.iuav.user.model.vo.WxLoginVO;
import com.mmc.iuav.user.model.vo.WxMsgVO;
import com.mmc.iuav.user.service.WxService;
......@@ -219,7 +218,7 @@ public class WxServiceImpl implements WxService {
try {
accessToken = this.getSubAccessToken();
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
String param = ws.buildMsgJson();
String param = ws.buildTemplateMsg();
String result = HttpHelper.httpPost(url, param);
log.info("模板消息发送结果:{}", result);
} catch (Exception e) {
......@@ -230,47 +229,6 @@ public class WxServiceImpl implements WxService {
return ResultBody.success();
}
/**
* 模板消息请求参数-例子
*
* @param ws
* @return
*/
public JSONObject buildTemplateMsg(WxMsgVO ws) {
JSONObject msg = new JSONObject();
msg.put("touser", ws.getOpenId());
msg.put("template_id", "IYtNq2t8lqdwEUbMyFWhlI-1M9KyDw_UT-ycZksJPVs");
// 跳转页面
if (!StringUtils.isBlank(ws.getUrl())) {
msg.put("url", ws.getUrl());
}
// 跳转小程序页面设置
if (!StringUtils.isBlank(ws.getWxAppltAppId()) && !StringUtils.isBlank(ws.getAppletPath())) {
JSONObject mini = new JSONObject();
mini.put("appid", ws.getWxAppltAppId());
mini.put("pagepath", ws.getAppletPath());
msg.put("miniprogram", mini);
}
JSONObject data = new JSONObject();
data.put("first", ws.getTitle());
MsgData amount2 = new MsgData();
amount2.setValue("100");
data.put("amount2", amount2);
MsgData amount3 = new MsgData();
amount3.setValue("100");
data.put("amount3", amount3);
MsgData thing6 = new MsgData();
thing6.setValue("云享金充值");
data.put("thing6", thing6);
msg.put("data", data);
return msg;
}
@Override
public ResultBody getUnLimitedQRCode(String path, String scene) {
String base64 = "";
......
......@@ -90,7 +90,7 @@ public class XzServiceImpl implements XzService {
PiggyOpenBasicsClient piggyOpenBasicsClient = PiggyOpenBasicsClient.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain());
JSONObject jsonObject = piggyOpenBasicsClient.getTaxFundCashPooling(PiggyBasicsVo.builder()
.appKey(userSystemConstant.getXzAppKey())
.taxFundID("8ae605f565884a1f9a5e91d5a661ce58")
.taxFundID(userSystemConstant.getTaxFundId())
.build());
System.out.println(jsonObject.toString());
return jsonObject.get("data", UsableCashPoolingDTO.class);
......@@ -197,7 +197,7 @@ public class XzServiceImpl implements XzService {
PiggySingleWithdrawalApiV2Client v2Client = PiggySingleWithdrawalApiV2Client.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain());
JSONObject jsonObject = v2Client.singleSubmit(PiggySingleWithdrawV2Vo.builder()
.appKey(userSystemConstant.getXzAppKey())
.bizAESContent(PiggyOpenBasicsAesUtil.produceAesData(userSystemConstant.getXzAppSecret(), "0000000000000000", PiggySingleWithdrawV2Vo.SingleWithdrawV2Vo.builder()
.bizAESContent(PiggyOpenBasicsAesUtil.produceAesData(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzAes(), PiggySingleWithdrawV2Vo.SingleWithdrawV2Vo.builder()
.notifyUrl(userSystemConstant.getWithdrawNotify())
.taxFundId(userSystemConstant.getTaxFundId())
.month(xzWithdrawalVO.getMonth())
......@@ -224,7 +224,7 @@ public class XzServiceImpl implements XzService {
PiggySingleWithdrawalApiV2Client v2Client = PiggySingleWithdrawalApiV2Client.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain());
JSONObject jsonObject = v2Client.singleSubmitLimit(PiggySingleWithdrawV2Vo.builder()
.appKey(userSystemConstant.getXzAppKey())
.bizAESContent(PiggyOpenBasicsAesUtil.produceAesData(userSystemConstant.getXzAppKey(), "0000000000000000", PiggySingleWithdrawV2Vo.SingleWithdrawV2Vo.builder()
.bizAESContent(PiggyOpenBasicsAesUtil.produceAesData(userSystemConstant.getXzAppKey(), userSystemConstant.getXzAes(), PiggySingleWithdrawV2Vo.SingleWithdrawV2Vo.builder()
.notifyUrl(xzWithdrawalVO.getNotifyUrl())
.taxFundId(xzWithdrawalVO.getTaxFundId())
.month(xzWithdrawalVO.getMonth())
......@@ -350,7 +350,7 @@ public class XzServiceImpl implements XzService {
byte[] raw = userSystemConstant.getXzAppSecret().getBytes("ASCII");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
IvParameterSpec iv = new IvParameterSpec("0000000000000000".getBytes());
IvParameterSpec iv = new IvParameterSpec(userSystemConstant.getXzAes().getBytes());
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
Charset charset = Charset.forName("UTF-8");
String tempStr = URLDecoder.decode(aesData, charset);
......
......@@ -70,11 +70,16 @@ third-party:
app-key: 5015e664848d406ab1ca4b505c3da803
secret-key: 7C4DB8CCECC148175E46392CC0A1B410
xzsz:
appKey: 1e8e59e056be41f8a05c090964d7ce37
appSecret: ceshihuanjingyanshizhanghao00000
# appKey: 1e8e59e056be41f8a05c090964d7ce37
# appSecret: ceshihuanjingyanshizhanghao00000
# aes: 0000000000000000
# domain: https://uat.xzsz.ltd/
# position: 销售推广
appKey: 37f76305f1864339adc8d6d03fbf918d
appSecret: hangzhouyunxiangfeikeji000000000
aes: 0000000000000000
domain: https://uat.xzsz.ltd/
position: 销售推广
domain: https://saas.xzsz.ltd
position: 市场推广
taxFundId: xxxxxxxxxxxxxxxxxxxxxxx
authNotify: https://test.iuav.shop/userapp/xz/xzAuthNotify
withdrawNotify: https://test.iuav.shop/userapp/xz/xzWithdrawNotify
......
......@@ -67,6 +67,15 @@ third-party:
qcc:
app-key: 5015e664848d406ab1ca4b505c3da803
secret-key: 7C4DB8CCECC148175E46392CC0A1B410
xzsz:
appKey: 37f76305f1864339adc8d6d03fbf918d
appSecret: hangzhouyunxiangfeikeji000000000
aes: 0000000000000000
domain: https://saas.xzsz.ltd
position: 市场推广
taxFundId: xxxxxxxxxxxxxxxxxxxxxxx
authNotify: https://www.iuav.shop/userapp/xz/xzAuthNotify
withdrawNotify: https://www.iuav.shop/userapp/xz/xzWithdrawNotify
iuav:
pay:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论