|
@@ -16,6 +16,7 @@ import com.pj.api.wx.WxUtils;
|
|
|
import com.pj.api.wx.bo.*;
|
|
|
import com.pj.api.wx.vo.PrePayVO;
|
|
|
import com.pj.current.config.MyConfig;
|
|
|
+import com.pj.current.config.PartConfig;
|
|
|
import com.pj.current.config.WxConfig;
|
|
|
import com.pj.project.tb_account.TbAccountService;
|
|
|
import com.pj.project.tb_business.TbBusiness;
|
|
@@ -57,6 +58,8 @@ public class WxService {
|
|
|
WxConfig wxConfig;
|
|
|
@Resource
|
|
|
MyConfig myConfig;
|
|
|
+ @Resource
|
|
|
+ PartConfig partConfig;
|
|
|
|
|
|
@Resource
|
|
|
WxUtils wxUtils;
|
|
@@ -83,6 +86,7 @@ public class WxService {
|
|
|
String tradeType = request.getParameter("tradeType");
|
|
|
String money = request.getParameter("money");
|
|
|
String openid = request.getParameter("openid");
|
|
|
+ String desc = request.getParameter("desc");
|
|
|
// String openid = "oDWvn5w-hVkzUuKeY7OBXBV_l1rU";
|
|
|
String businessId = request.getParameter("b");
|
|
|
String c = request.getParameter("c");
|
|
@@ -95,11 +99,10 @@ public class WxService {
|
|
|
params.put("mch_id", wxConfig.getMachId());
|
|
|
params.put("openid", openid);
|
|
|
params.put("nonce_str", RandomUtil.randomString(32));
|
|
|
- params.put("body", "支付中心-业务订单支付");
|
|
|
+ params.put("body", desc);
|
|
|
params.put("out_trade_no", out_trade_no);
|
|
|
params.put("attach", JSONUtil.toJsonStr(atchMap));
|
|
|
- String total_free = NumberUtil.mul(money, 100 + "").intValue() + "";
|
|
|
-// String total_free = "1";
|
|
|
+ String total_free = partConfig.isTestEnv() ? "1" : NumberUtil.mul(money, 100 + "").intValue() + "";
|
|
|
log.info("pay free:{}", total_free);
|
|
|
params.put("total_fee", total_free);
|
|
|
// params.put("total_fee", "1");
|
|
@@ -132,7 +135,6 @@ public class WxService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public Map<String, String> getPayParams(String openid, String prePayId) {
|
|
|
Map<String, String> signMap = new HashMap<>(10);
|
|
|
signMap.put("appId", wxConfig.getAppId());
|
|
@@ -145,7 +147,8 @@ public class WxService {
|
|
|
signMap.put("openId", openid);
|
|
|
return signMap;
|
|
|
}
|
|
|
- public Map<String, String> getPayP(String timeStamp,String nonceStr,String openid, String pack) {
|
|
|
+
|
|
|
+ public Map<String, String> getPayP(String timeStamp, String nonceStr, String openid, String pack) {
|
|
|
Map<String, String> signMap = new HashMap<>(10);
|
|
|
signMap.put("appId", wxConfig.getAppId());
|
|
|
signMap.put("timeStamp", timeStamp);
|
|
@@ -203,7 +206,7 @@ public class WxService {
|
|
|
car.setPay(1).setMoney(car.getMoney().add(price));
|
|
|
tbBusinessCarService.updateById(car);
|
|
|
TbBusiness business = tbBusinessService.getById(car.getBusinessId());
|
|
|
- if (business!=null){
|
|
|
+ if (business != null) {
|
|
|
business.setPayMoney(business.getPayMoney().add(price));
|
|
|
business.setPayStatus(business.getPayMoney().equals(business.getTotalMoney()) ? 3 : 4);
|
|
|
tbBusinessService.updateById(business);
|
|
@@ -228,7 +231,7 @@ public class WxService {
|
|
|
.setOutTradeNo(tradeNo)
|
|
|
.setTransactionId(transactionId)
|
|
|
.setPayMoney(money);
|
|
|
- if (tbCostomer!=null){
|
|
|
+ if (tbCostomer != null) {
|
|
|
payRecord.setCustomerId(tbCostomer.getId()).setCustomerName(tbCostomer.getName());
|
|
|
}
|
|
|
tbPayRecordService.save(payRecord);
|