| @@ -65,7 +65,7 @@ public class DouYinPayHelper { | |||
| signStr.append(sep).append(s); | |||
| sep = "&"; | |||
| } | |||
| log.error("加密字符串"+signStr); | |||
| log.info("加密字符串"+signStr); | |||
| return md5FromStr(signStr.toString()); | |||
| } | |||
| @@ -352,6 +352,32 @@ public class DouYinPayHelper { | |||
| } | |||
| } | |||
| //https://developer.toutiao.com/api/apps/ecpay/v1/unsettle_amount | |||
| public static void unsettleAmount(String appId,String salt,String outOrderId,String thirdParytyId) { | |||
| Map map = new HashMap(); | |||
| map.put("app_id",appId); | |||
| map.put("salt",salt); | |||
| map.put("out_order_no",outOrderId); | |||
| map.put("sign",getSign(map)); | |||
| map.remove("salt"); | |||
| String response = doPost("https://developer.toutiao.com/api/apps/ecpay/v1/unsettle_amount", map); | |||
| log.info("查询待分账金额 request:"+map.toString()+" response:"+response); | |||
| JSONObject jsonObject = JSON.parseObject(response); | |||
| // Integer code = jsonObject.getInteger("err_no"); | |||
| // if (null != code && code.intValue() == 0 ) { | |||
| // JSONObject info = jsonObject.getJSONObject("settle_info"); | |||
| // QuerySettleResult result = new QuerySettleResult(); | |||
| // result.setSettleNo(info.getString("settle_no")); | |||
| // result.setSettleAmount(info.getInteger("settle_amount")); | |||
| // result.setSettleStatus(info.getString("settle_status")); | |||
| // result.setMsg(jsonObject.getString("err_tips")); | |||
| // return result; | |||
| // }else { | |||
| // log.error("settleQuery reponse error. request: "+JSON.toJSONString(map)+" response:"+response); | |||
| //// return null; | |||
| // } | |||
| } | |||
| public static void main(String[] args) { | |||
| //测试 | |||
| // String mcuid = "70777649963225930610";//商户号 | |||
| @@ -360,8 +386,9 @@ public class DouYinPayHelper { | |||
| //生产 | |||
| // String mcuid = "69739487619282066230"; | |||
| String appid = "ttc0cdb6705ff345f301"; | |||
| String salt = "FhGHClzfdDEPW6Cq4hw2GyoynJbpeq6wLQyM5iub"; | |||
| String appid = "tt620e14b3fd30264101"; | |||
| String salt = "Ti1rt3eS5QlmQ7I8kCv4pOBuHNWUIaCglikYyLDS"; | |||
| // AppAddSubMerchant appAddSubMerchant = new AppAddSubMerchant(); | |||
| // appAddSubMerchant.setAppId("ttef6599d8705b49b101"); | |||
| @@ -399,13 +426,15 @@ public class DouYinPayHelper { | |||
| // System.out.println(settle1.toString()); | |||
| QuerySettleResult querySettleResult = settleQuery(appid, salt, "687210746524631040", null); | |||
| System.out.println(querySettleResult.toString()); | |||
| // QuerySettleResult querySettleResult = settleQuery(appid, salt, "687210746524631040", null); | |||
| // System.out.println(querySettleResult.toString()); | |||
| // OrderQueryResult orderQueryResult = orderQuery(appid, salt, "613879951804915712", null); | |||
| // System.out.println(orderQueryResult.toString()); | |||
| // QueryMerchantResult queryMerchantResult = queryMerchantStatus(appid, salt, "69845881593843571583", "5041", null); | |||
| // System.out.println(queryMerchantResult.toString()); | |||
| // unsettleAmount(appid, salt, "833530893035925504", null); | |||
| } | |||
| } | |||
| @@ -361,8 +361,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| Integer type = cardInfo.getStatus() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode(); | |||
| String remark = user.getUsername() + "给卡密[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(type).getInfo(); | |||
| insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon, type, remark); | |||
| insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon, type, remark, wxCardInfo.getRemainingAmount()); | |||
| }catch (Exception e){ | |||
| logger.error("startOrStop insert error"); | |||
| @@ -522,7 +521,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| } | |||
| String remark = user.getUsername() + "给卡密[" + wxCardInfo.getId() + "]" + "充值,金额:" + wxCardInfo.getAmount() + "分"; | |||
| insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon,EnumOperateLogType.RECHARGE.getCode(),remark); | |||
| insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon,EnumOperateLogType.RECHARGE.getCode(),remark, cardInfo.getAmount()); | |||
| if(record.getCardBeforeAmount().equals(0)){ | |||
| if (wxCardSpendService.cardFinishedUsing(currentDate, cardInfo)) { | |||
| @@ -535,12 +534,12 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| } | |||
| public void insertWxCardDailyLogInfo(MallUserInfo user, WxCardInfo wxCardInfo, WxCoupon wxCoupon, Integer code, String remark) { | |||
| public void insertWxCardDailyLogInfo(MallUserInfo user, WxCardInfo wxCardInfo, WxCoupon wxCoupon, Integer code, String remark, Integer amount) { | |||
| try { | |||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | |||
| cardSetPrice.updateTenantInfo(wxCardInfo); | |||
| cardSetPrice.setCardPasswordId(wxCardInfo.getCouponPasswordId()); | |||
| cardSetPrice.setPrice(wxCardInfo.getAmount()); | |||
| cardSetPrice.setPrice(amount); | |||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| cardSetPrice.setOperatorId(user.getId()); | |||
| cardSetPrice.setOperatorUser(user.getUsername()); | |||
| @@ -341,7 +341,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | |||
| cardSetPrice.updateTenantInfo(wxCouponPassword); | |||
| cardSetPrice.setCardPasswordId(wxCouponPassword.getId()); | |||
| cardSetPrice.setPrice(cardInfo.getAmount()); | |||
| cardSetPrice.setPrice(cardInfo.getRemainingAmount()); | |||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| cardSetPrice.setOperatorId(user.getId()); | |||
| cardSetPrice.setOperatorUser(user.getUsername()); | |||
| @@ -394,10 +394,10 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| cardSetPrice.setOperatorId(user.getId()); | |||
| cardSetPrice.setOperatorUser(user.getUsername()); | |||
| cardSetPrice.setCouponId(wxCouponPassword.getCouponId()); | |||
| cardSetPrice.setCouponId(wxCoupon.getCouponId()); | |||
| cardSetPrice.setType(EnumOperateLogType.SET_DENOMINATION.getCode()); | |||
| cardSetPrice.setCount(1); | |||
| cardSetPrice.setRemark(user.getUsername() + "给卡密[" + cardSetPrice.getCardInfoId() + "]设置了面额,金额:" + cardSetPrice.getPrice() + "分"); | |||
| cardSetPrice.setRemark(user.getUsername() + "给卡密[" + cardSetPrice.getCardPasswordId() + "]设置了面额,金额:" + cardSetPrice.getPrice() + "分"); | |||
| wxCardDailyLogService.saveOrUpdate(cardSetPrice); | |||
| } | |||
| return count; | |||
| @@ -35,7 +35,6 @@ import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.service.pay.service.share.PayShareAdapterService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.swagger.models.auth.In; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -658,7 +657,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| wxCouponMapper.insert(record); | |||
| insertWxCardDailyLogInfo(user, record, true); | |||
| String remark = (user != null ? user.getUsername() : "") + "创建了卡[" + record.getTitle() + "]," + record.getInventory() + "张卡密"; | |||
| insertWxCardDailyLogInfo(user, record, true, remark); | |||
| } else { | |||
| if(EnumCouponType.getDouYinType().contains(record.getType())){ | |||
| @@ -1828,12 +1828,13 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| wxCouponChannelService.spuStatusSyncByCoupon(tenantInfo,couponId); | |||
| WxCoupon record = wxCouponMapper.selectById(couponId, tenantInfo.getTenantId()); | |||
| insertWxCardDailyLogInfo(user, record,false); | |||
| String remark = (user != null ? user.getUsername() : "") + "创建了卡[" + record.getTitle() + "], 库存:"; | |||
| insertWxCardDailyLogInfo(user, record, false, remark); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| public void insertWxCardDailyLogInfo(MallUserInfo user, WxCoupon record, Boolean flag) { | |||
| public void insertWxCardDailyLogInfo(MallUserInfo user, WxCoupon record, Boolean flag, String remark) { | |||
| if (EnumCouponType.CARD_MULTIMCH.getCode().equals(record.getType())) { | |||
| try { | |||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | |||
| @@ -1845,7 +1846,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| cardSetPrice.setOperatorType(user != null ? EnumUserType.MALLUSER.getCode() : 0); | |||
| cardSetPrice.setOperatorId(user != null ? user.getId() : 0); | |||
| cardSetPrice.setOperatorUser(user != null ? user.getUsername() : ""); | |||
| cardSetPrice.setRemark((user != null ? user.getUsername() : "") + "创建了卡[" + record.getTitle() + "]" + "库存:" + cardSetPrice.getPrice()); | |||
| cardSetPrice.setRemark(flag ? remark : remark + cardSetPrice.getPrice()); | |||
| wxCardDailyLogService.saveOrUpdate(cardSetPrice); | |||
| } catch (Exception e) { | |||
| logger.error("insertWxCardDailyLogInfo insert error"); | |||