# Conflicts: # src/main/ui/static/analysis/templates/cheat_monitor_risk.htmlmaster
commit
ba79b580b0
@ -0,0 +1,15 @@
|
||||
package au.com.royalpay.payment.manage.customers.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public interface CustomerRewardLogService {
|
||||
JSONObject takeReward(String openid,String channel);
|
||||
|
||||
JSONObject getRewardDetail(String reward_id);
|
||||
|
||||
void saveReward(int type2,int type3,String type1,String date);
|
||||
|
||||
void checkRedpacksStatus(String rewardId);
|
||||
}
|
@ -0,0 +1,222 @@
|
||||
package au.com.royalpay.payment.manage.customers.core.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.customers.core.CustomerRewardLogService;
|
||||
import au.com.royalpay.payment.manage.mappers.customers.CusRewardConfigMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.customers.CusRewardCouponMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.customers.CusRewardLogsMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
|
||||
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
|
||||
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
|
||||
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WechatRedpack;
|
||||
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author: james7whm
|
||||
* @Date: 2019/1/17 16:56
|
||||
*/
|
||||
@Service
|
||||
public class CustomerRewardLogServiceImpl implements CustomerRewardLogService {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Resource
|
||||
private MpWechatApiProvider mpWechatApiProvider;
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
@Resource
|
||||
private CusRewardConfigMapper cusRewardConfigMapper;
|
||||
@Resource
|
||||
private CusRewardLogsMapper cusRewardLogsMapper;
|
||||
@Resource
|
||||
private CusRewardCouponMapper cusRewardCouponMapper;
|
||||
@Resource
|
||||
private CustomerMapper customerMapper;
|
||||
@Override
|
||||
public JSONObject takeReward(String openid,String channel) {
|
||||
String redpack_openid = openid;
|
||||
if(channel.equals("Wechat")){
|
||||
JSONObject customerRelation = customerMapper.findCustomerByOpenId(openid);
|
||||
if (customerRelation == null) {
|
||||
customerRelation = customerMapper.findCustomerGlobalpayByOpenId(openid);
|
||||
}
|
||||
redpack_openid = customerRelation.getString("redpack_openid");
|
||||
}
|
||||
try {
|
||||
Date now = new Date();
|
||||
Date begin = DateUtils.parseDate(cusRewardConfigMapper.getValue("begin").getString("value"),"yyyy-MM-dd");
|
||||
if(begin.after(now)){
|
||||
throw new ForbiddenException("活动尚未开始");
|
||||
}
|
||||
Date end = DateUtils.parseDate(cusRewardConfigMapper.getValue("end").getString("value"),"yyyy-MM-dd");
|
||||
if(end.before(now)){
|
||||
throw new ForbiddenException("活动已结束");
|
||||
}
|
||||
List<JSONObject> orders = orderMapper.listNewYearOrdersByOpenId(openid, DateFormatUtils.format(now,"yyyy-MM-dd"));
|
||||
if(orders.isEmpty()){
|
||||
throw new ForbiddenException("请至少使用微信或支付宝线下支付一笔");
|
||||
}
|
||||
int limit = cusRewardConfigMapper.getValue("limit").getIntValue("value");
|
||||
int currentDayCounts = cusRewardLogsMapper.openIdReceivedCount(redpack_openid,DateUtils.parseDate(DateFormatUtils.format(now,"yyyy-MM-dd")+" 00:00:00","yyyy-MM-dd HH:mm:ss"));
|
||||
if((limit-currentDayCounts)<=0){
|
||||
throw new ForbiddenException("您今日已达到抽奖次数上限");
|
||||
};
|
||||
//抽完一次后,还想抽下一次
|
||||
if((orders.size()-currentDayCounts)<=0){
|
||||
throw new ForbiddenException("请使用微信或支付宝再支付一笔");
|
||||
};
|
||||
String fakeOpenId = redpack_openid + DateFormatUtils.format(now, "HHmmssSSS");
|
||||
if(channel.equals("Wechat")){
|
||||
if(cusRewardLogsMapper.takeReward(now,fakeOpenId,DateFormatUtils.format(now,"yyyy-MM-dd")) > 0){
|
||||
JSONObject reward = cusRewardLogsMapper.findRewardByFakeOpenId(fakeOpenId);
|
||||
Assert.notNull(reward, "reward is null");
|
||||
String rewardId = reward.getString("reward_id");
|
||||
reward.put("openid",redpack_openid);
|
||||
cusRewardLogsMapper.update(reward);
|
||||
if (reward.getIntValue("type") == 2 || reward.getIntValue("type") == 3) {
|
||||
reward.put("status",1);
|
||||
cusRewardLogsMapper.update(reward);
|
||||
} else {
|
||||
String sendName = "RoyalPay";
|
||||
String actName = cusRewardConfigMapper.getValue("act_name").getString("value");
|
||||
String wishing = cusRewardConfigMapper.getValue("wishing").getString("value");
|
||||
String notifyUrl = PlatformEnvironment.getEnv().concatUrl("/act/new_year/redpacks/"+rewardId);
|
||||
MpWechatApi redpackApi = mpWechatApiProvider.getApi("redpack");
|
||||
WechatRedpack wechatRedpack = new WechatRedpack();
|
||||
wechatRedpack.setSendName(sendName).setOpenId(redpack_openid).setActName(actName)
|
||||
.setRemark(actName).setAmount(reward.getBigDecimal("amount").divide(new BigDecimal(100))).setWishing(wishing).setNotifyUrl(notifyUrl);
|
||||
JSONObject res = redpackApi.sendRedpack(wechatRedpack);
|
||||
logger.info("2019新年活动获取的红包信息==>"+res.toJSONString());
|
||||
reward.put("status",0);
|
||||
reward.put("send_listid",res.getString("redpack_id"));
|
||||
cusRewardLogsMapper.update(reward);
|
||||
}
|
||||
return reward;
|
||||
}
|
||||
}
|
||||
if(channel.equals("Alipay")){
|
||||
if(cusRewardLogsMapper.takeRewardNotWechat(now,openid,DateFormatUtils.format(now,"yyyy-MM-dd")) > 0){
|
||||
JSONObject reward = cusRewardLogsMapper.findRewardByFakeOpenId(fakeOpenId);
|
||||
Assert.notNull(reward, "reward is null");
|
||||
reward.put("openid",openid);
|
||||
reward.put("status",1);
|
||||
cusRewardLogsMapper.update(reward);
|
||||
return reward;
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return getRandomReward(channel.equals("Wechat")?redpack_openid:openid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getRewardDetail(String reward_id) {
|
||||
return cusRewardLogsMapper.findRewardByRewardId(reward_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveReward(int type2, int type3, String type1,String date) {
|
||||
if(type1!=null){
|
||||
String[] configs = type1.split(",");
|
||||
NumberFormat format = new DecimalFormat("00000");
|
||||
int i = 0;
|
||||
for (String config : configs) {
|
||||
config = StringUtils.trim(config);
|
||||
String[] detail = config.split("x");
|
||||
int count = Integer.parseInt(detail[1]);
|
||||
int amount = new BigDecimal(detail[0]).intValue();
|
||||
for (int num = 0; num < count; num++) {
|
||||
JSONObject redpack = new JSONObject();
|
||||
String idPrefix = "C"+ DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS") + format.format(i++);
|
||||
redpack.put("reward_id", idPrefix + RandomStringUtils.random(28 - idPrefix.length(), true, true));
|
||||
redpack.put("amount", amount);
|
||||
redpack.put("status", 0);
|
||||
redpack.put("date", date);
|
||||
redpack.put("type", 1);
|
||||
cusRewardLogsMapper.save(redpack);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(type2!=0){
|
||||
JSONObject coupon = cusRewardCouponMapper.getCoupon(2);
|
||||
NumberFormat format = new DecimalFormat("00000");
|
||||
for (int i = 0; i < type2; i++) {
|
||||
JSONObject log = new JSONObject();
|
||||
String prefix = "C" + DateFormatUtils.format(new Date(), "MMddHHmmssSSS") + format.format(i);
|
||||
log.put("reward_id", prefix + RandomStringUtils.random(28 - prefix.length(), false, true));
|
||||
log.put("type", 2);
|
||||
log.put("date", date);
|
||||
log.put("coupon_id", coupon.getString("coupon_id"));
|
||||
cusRewardLogsMapper.save(log);
|
||||
}
|
||||
}
|
||||
if(type3!=0){
|
||||
JSONObject coupon = cusRewardCouponMapper.getCoupon(3);
|
||||
NumberFormat format = new DecimalFormat("00000");
|
||||
for (int i = 0; i < type2; i++) {
|
||||
JSONObject log = new JSONObject();
|
||||
String prefix = "C" + DateFormatUtils.format(new Date(), "MMddHHmmssSSS") + format.format(i);
|
||||
log.put("reward_id", prefix + RandomStringUtils.random(28 - prefix.length(), false, true));
|
||||
log.put("type", 3);
|
||||
log.put("date", date);
|
||||
log.put("coupon_id", coupon.getString("coupon_id"));
|
||||
cusRewardLogsMapper.save(log);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkRedpacksStatus(String rewardId) {
|
||||
MpWechatApi redpackApi = mpWechatApiProvider.getApi("redpack");
|
||||
JSONObject redpack = redpackApi.redpackStatus(rewardId);
|
||||
int status = redpack.getIntValue("status");
|
||||
JSONObject params = new JSONObject();
|
||||
if(status == 2){
|
||||
params.put("status",status);
|
||||
params.put("reward_id",rewardId);
|
||||
params.put("error_code",redpack.getString("err_code"));
|
||||
params.put("error_msg",redpack.getString("err_msg"));
|
||||
cusRewardLogsMapper.update(params);
|
||||
}else {
|
||||
params.put("status",status);
|
||||
params.put("reward_id",rewardId);
|
||||
cusRewardLogsMapper.update(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private JSONObject getRandomReward(String openid){
|
||||
JSONObject reward = cusRewardCouponMapper.randomType();
|
||||
reward.remove("title");
|
||||
String prefix = "C" + DateFormatUtils.format(new Date(), "MMddHHmmssSSS");
|
||||
reward.put("reward_id", prefix + RandomStringUtils.random(28 - prefix.length(), false, true));
|
||||
reward.put("openid",openid);
|
||||
reward.put("date",DateFormatUtils.format(new Date(),"yyyy-MM-dd"));
|
||||
reward.put("send_time",new Date());
|
||||
reward.put("status",1);
|
||||
cusRewardLogsMapper.save(reward);
|
||||
return reward;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package au.com.royalpay.payment.manage.customers.task;
|
||||
|
||||
import au.com.royalpay.payment.manage.customers.core.CustomerRewardLogService;
|
||||
import au.com.royalpay.payment.manage.mappers.customers.CusRewardLogsMapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: james7whm
|
||||
* @Date: 2019/2/3 20:26
|
||||
*/
|
||||
@Component
|
||||
public class RedpackSendingTask {
|
||||
@Resource
|
||||
private CustomerRewardLogService customerRewardLogService;
|
||||
@Resource
|
||||
private CusRewardLogsMapper cusRewardLogsMapper;
|
||||
|
||||
@Scheduled(cron = "0 0 0/1 * * ?")
|
||||
public void checkRedpacks() {
|
||||
List<JSONObject> unConfirmedRedpacks = cusRewardLogsMapper.listUnconfirmRewards();
|
||||
for (JSONObject redpack : unConfirmedRedpacks) {
|
||||
customerRewardLogService.checkRedpacksStatus(redpack.getString("send_listid"));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package au.com.royalpay.payment.manage.customers.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.customers.core.CustomerRewardLogService;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Author: james7whm
|
||||
* @Date: 2019/1/16 14:35
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/act/new_year")
|
||||
public class NewYearRedPacketController {
|
||||
// @Resource
|
||||
// private MpWechatApi mpWechatApi;
|
||||
@Resource
|
||||
private CustomerRewardLogService customerRewardLogService;
|
||||
|
||||
@RequestMapping(value = "/reward", method = RequestMethod.GET)
|
||||
public String takeReward(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,
|
||||
@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
|
||||
// String user_id = "o32MzuA5H8KNIYAO2a__BGS-3iXs";
|
||||
String user_id = "";
|
||||
String channel="";
|
||||
if(aliuser == null && wxUser == null){
|
||||
throw new ForbiddenException("请使用微信或支付宝客户端打开");
|
||||
}
|
||||
if (aliuser != null) {
|
||||
user_id = aliuser.getString("user_id");
|
||||
channel = "Alipay";
|
||||
}
|
||||
if (wxUser != null) {
|
||||
user_id = wxUser.getString("openid");
|
||||
channel = "Wechat";
|
||||
}
|
||||
JSONObject reward = customerRewardLogService.takeReward(user_id,channel);
|
||||
// ModelAndView mav = new ModelAndView("activity/new_year_reward/reward");
|
||||
// JSONObject reward = new JSONObject();
|
||||
// reward.put("type",2);
|
||||
// mav.addObject("reward", reward);
|
||||
return "redirect:/act/new_year/"+reward.getString("reward_id");
|
||||
// return encourageService.takeEncourageMoney(orderId, user_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{reward_id}", method = RequestMethod.GET)
|
||||
public ModelAndView getReward(@PathVariable String reward_id){
|
||||
ModelAndView mav = new ModelAndView("activity/new_year_reward/reward");
|
||||
JSONObject reward = customerRewardLogService.getRewardDetail(reward_id);
|
||||
mav.addObject("reward", reward);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/description", method = RequestMethod.GET)
|
||||
public ModelAndView takeDescription(){
|
||||
ModelAndView mav = new ModelAndView("activity/new_year_reward/description");
|
||||
return mav;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/coupons", method = RequestMethod.GET)
|
||||
public void saveCoupons(@RequestParam("type2")int type2,@RequestParam("type3")int type3,@RequestParam("type1")String type1,@RequestParam("date")String date){
|
||||
customerRewardLogService.saveReward(type2,type3,type1,date);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/redpacks/{rewardId}", method = RequestMethod.POST)
|
||||
public void updateRedpackStatus(HttpServletRequest request, @RequestHeader String sign, @RequestHeader long timestamp, @PathVariable String rewardId) {
|
||||
// mpWechatApi(request.getRequestURI(), sign, timestamp);
|
||||
// redpackSupport.checkRedpack(rewardId);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package au.com.royalpay.payment.manage.management.clearing.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.log.ValidationLogMapper;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import netscape.javascript.JSObject;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.apache.xerces.impl.validation.ValidationManager;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: lujian
|
||||
* @Date: 2019/1/30 13:50
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/sys/financial")
|
||||
public class ArrivalNoticeController {
|
||||
|
||||
@Resource
|
||||
private ValidationLogMapper validationLogMapper;
|
||||
|
||||
@GetMapping("/notice")
|
||||
public String noticePage(HashMap<String, Object> map,
|
||||
@RequestParam("date") String date) throws ParseException {
|
||||
|
||||
JSONArray reports = new JSONArray();
|
||||
Date dt = DateUtils.parseDate(date, new String[]{"yyyyMMdd"});
|
||||
JSONObject reportItem = validationLogMapper.findByDate(dt);
|
||||
if (reportItem != null) {
|
||||
JSONObject result = JSON.parseObject(reportItem.getString("result"));
|
||||
reports = result.getJSONArray("channel_details");
|
||||
for (int i = 0; i < reports.size(); i++) {
|
||||
JSONObject channelItem = reports.getJSONObject(i);
|
||||
String channel = channelItem.getString("channel");
|
||||
if (channel.equals("Wechat") && result.containsKey("wechat_analysis")) {
|
||||
JSONObject wechatAnalysis = result.getJSONObject("wechat_analysis");
|
||||
List<JSONObject> analysis = new ArrayList<>();
|
||||
for (Map.Entry<String, Object> entry : wechatAnalysis.entrySet()) {
|
||||
JSONObject oneMerchant = new JSONObject();
|
||||
oneMerchant.put("merchant_id", entry.getKey());
|
||||
oneMerchant.put("order_amount", ((JSONObject) JSON.toJSON(entry.getValue())).getJSONObject("wechat_analysis").getBigDecimal("order_amount"));
|
||||
analysis.add(oneMerchant);
|
||||
}
|
||||
channelItem.put("analysis", analysis);
|
||||
}
|
||||
if (channel.equals("Bestpay") && result.containsKey("bestpay_valid_analysis")) {
|
||||
List<JSONObject> analysis = new ArrayList<>();
|
||||
analysis.add(result.getJSONObject("bestpay_valid_analysis"));
|
||||
reports.getJSONObject(i).put("analysis", analysis);
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("reports", reports);
|
||||
map.put("title", "到账提醒");
|
||||
return "reports/arrival_notice";
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package au.com.royalpay.payment.manage.mappers.customers;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
/**
|
||||
* @Author: james7whm
|
||||
* @Date: 2019/1/17 17:34
|
||||
*/
|
||||
@AutoMapper(tablename = "cus_reward_config",pkName = "key")
|
||||
public interface CusRewardConfigMapper {
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject getValue(@Param("key") String key);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package au.com.royalpay.payment.manage.mappers.customers;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@AutoMapper(tablename = "cus_reward_coupon",pkName = "coupon_id")
|
||||
public interface CusRewardCouponMapper {
|
||||
|
||||
@Select("SELECT * FROM cus_reward_coupon WHERE type =2 or type =3 order by rand() limit 1")
|
||||
JSONObject randomType();
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject getCoupon(@Param("type") int type);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package au.com.royalpay.payment.manage.mappers.customers;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@AutoMapper(tablename = "cus_reward_log",pkName = "reward_id")
|
||||
public interface CusRewardLogsMapper {
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject params);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findRewardByFakeOpenId(@Param("openid")String fakeOpenId);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findRewardByRewardId(@Param("reward_id")String reward_id);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject params);
|
||||
|
||||
int openIdReceivedCount(@Param("openid") String openid, @Param("send_time") Date send_time);
|
||||
|
||||
int takeReward(@Param("send_time")Date sendTime, @Param("openid")String openid, @Param("date")String date);
|
||||
|
||||
int takeRewardNotWechat(@Param("send_time")Date sendTime, @Param("openid")String openid, @Param("date")String date);
|
||||
|
||||
@Select("SELECT * FROM cus_reward_log WHERE type=1 AND (`status`=0 OR `status`=1) AND openid IS NOT NULL ORDER BY send_time ASC")
|
||||
List<JSONObject> listUnconfirmRewards();
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.customers.CusRewardLogsMapper">
|
||||
<select id="openIdReceivedCount" resultType="Integer">
|
||||
SELECT ifnull(count(l.reward_id),0) FROM cus_reward_log l WHERE openid=#{openid} AND type <= 3 AND send_time>#{send_time}
|
||||
</select>
|
||||
<update id="takeReward">
|
||||
UPDATE cus_reward_log SET send_time=#{send_time},openid=#{openid} WHERE date <=#{date} AND openid IS NULL ORDER BY rand() LIMIT 1
|
||||
</update>
|
||||
<update id="takeRewardNotWechat" >
|
||||
UPDATE cus_reward_log SET send_time=#{send_time},openid=#{openid} WHERE date <=#{date} AND openid IS NULL AND type in(2,3) ORDER BY rand() LIMIT 1
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
|
||||
<meta http-equiv="cache-control" content="max-age=0">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="expires" content="0">
|
||||
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<title th:text="${title}"></title>
|
||||
<link rel="stylesheet" href="https://pay.unifpay.com/static/lib/weui/weui_new.css">
|
||||
<link rel="stylesheet" href="https://pay.unifpay.com/static/lib/weui/example.css">
|
||||
<script type="text/javascript" src="https://pay.unifpay.com/static/lib/jquery/jquery-2.1.4.min.js"></script>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page__bd" th:each="report : ${reports}">
|
||||
<div class="weui-form-preview">
|
||||
<div class="weui-form-preview__hd">
|
||||
<div class="weui-form-preview__item">
|
||||
<em class="weui-form-preview__value" th:text="${report.channel}" style="text-align: center;"></em>
|
||||
</div>
|
||||
</div>
|
||||
<div class="weui-form-preview__bd">
|
||||
<div class="weui-form-preview__item">
|
||||
<label class="weui-form-preview__label">对账状态</label>
|
||||
<span class="weui-form-preview__value" th:text="${report.success} ? '成功' : '失败'" th:style="'color: ' + (${report.success} ? 'green' : 'red')"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="weui-form-preview__bd" th:each="item : ${report['analysis']}">
|
||||
<div class="weui-form-preview__item">
|
||||
<label class="weui-form-preview__label" th:text="${item['merchant_id']} ? ${item['merchant_id']} : 'order_amount'"></label>
|
||||
<span class="weui-form-preview__value" th:text="${item.order_amount}"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 226 KiB |
After Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,343 @@
|
||||
div,span,a,img{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 20px;
|
||||
right: 20px;
|
||||
bottom: 28px;
|
||||
background-color: #FCF7EB;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-height:670px){
|
||||
.main-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 20px;
|
||||
right: 20px;
|
||||
bottom: 26px;
|
||||
background-color: #FCF7EB;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 520px){
|
||||
.main-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 20px;
|
||||
right: 20px;
|
||||
bottom: 22px;
|
||||
background-color: #FCF7EB;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.img-top {
|
||||
width: 100%;
|
||||
background: url(/static/images/reward_top.png) no-repeat center;
|
||||
background-size: contain;
|
||||
height: 57px;
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
}
|
||||
|
||||
@media screen and (max-height:670px){
|
||||
.img-top {
|
||||
width: 100%;
|
||||
background: url(/static/images/reward_top.png) no-repeat center;
|
||||
background-size: contain;
|
||||
height: 52px;
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height:520px){
|
||||
.img-top {
|
||||
width: 100%;
|
||||
background: url(/static/images/reward_top.png) no-repeat center;
|
||||
background-size: contain;
|
||||
height: 44px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.img-bottom {
|
||||
width: 100%;
|
||||
height: 58px;
|
||||
background: url(/static/images/reward_bottom.png) no-repeat center;
|
||||
background-size: contain;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
@media screen and (max-height:670px){
|
||||
.img-bottom {
|
||||
width: 100%;
|
||||
height: 53px;
|
||||
background: url(/static/images/reward_bottom.png) no-repeat center;
|
||||
background-size: contain;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height:520px){
|
||||
.img-bottom {
|
||||
width: 100%;
|
||||
height: 45px;
|
||||
background: url(/static/images/reward_bottom.png) no-repeat center;
|
||||
background-size: contain;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.wish {
|
||||
font-size: 18px;
|
||||
color: #B99B6A;
|
||||
}
|
||||
.redpack {
|
||||
padding:20px;
|
||||
color: #EC421F;
|
||||
}
|
||||
|
||||
.redpack .amount{
|
||||
font-size: 45px;
|
||||
}
|
||||
|
||||
.redpack .currency{
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.redpack .description{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.desc-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 20px;
|
||||
right: 20px;
|
||||
bottom: 0;
|
||||
background-color: #FCF7EB;
|
||||
color:#B99B6A;
|
||||
}
|
||||
|
||||
.desc-container .desc-title{
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
.desc-container .desc-content{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.banner {
|
||||
width: 100%;
|
||||
margin-top: 15%;
|
||||
padding: 20px;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
|
||||
.banner .head-box {
|
||||
width: 65px;
|
||||
height: 65px;
|
||||
border: 3px solid #fe783b;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.desc {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.detail-box {
|
||||
position: absolute;
|
||||
top: 120px;
|
||||
bottom: 40px;
|
||||
left: 20px;
|
||||
right: 20px;
|
||||
border-radius: 5px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.detail-box .detail-heading {
|
||||
height: 54px;
|
||||
padding: 18px 20px;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
}
|
||||
.detail-box .detail-heading:after{
|
||||
content:'';
|
||||
clear:both;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.detail-box .detail-heading .date-range {
|
||||
color: #000;
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container {
|
||||
position: absolute;
|
||||
top: 55px;
|
||||
bottom: 100px;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
padding: 0 20px 15px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item {
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item:before {
|
||||
content: '';
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
left: -5px;
|
||||
border-radius: 50%;
|
||||
top: 20px;
|
||||
background: #30af69;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item:after {
|
||||
content: '';
|
||||
height: 100%;
|
||||
top: 50%;
|
||||
left: -1px;
|
||||
border-left: 2px solid #30af69;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item:last-child:after{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item .date-box{
|
||||
font-size: 16px;
|
||||
float: left;
|
||||
line-height: 50px;
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item.today .date-box{
|
||||
color: #30af69;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item .amount{
|
||||
color: #30af69;
|
||||
font-size: 20px;
|
||||
line-height: 50px;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item .amount:before{
|
||||
content: '$';
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item .amount.debit{
|
||||
color: #888888;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.detail-box .balance-log-container .item .factor{
|
||||
font-size: 12px;
|
||||
color: #888888;
|
||||
text-align: right;
|
||||
float: right;
|
||||
line-height: 12px;
|
||||
clear:both;
|
||||
margin-top: -12px;
|
||||
}
|
||||
|
||||
.detail-box .balance-footer{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
padding: 20px;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
.detail-box .balance-footer .row{
|
||||
width: 100%;
|
||||
line-height: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
.detail-box .balance-footer .row:after{
|
||||
display: block;
|
||||
content: '';
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.detail-box .balance-footer .row .label{
|
||||
font-size: 16px;
|
||||
color: #888888;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.detail-box .balance-footer .row .amount{
|
||||
color: #888888;
|
||||
font-size: 16px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.detail-box .balance-footer .row .amount:before{
|
||||
content: '$';
|
||||
}
|
||||
|
||||
.detail-box .balance-footer .row .amount.available{
|
||||
color: #30af69;
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.link-box{
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
left: 0;
|
||||
bottom: 10px;
|
||||
position: absolute;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.link-box a{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
data-box-amount{
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
}
|
||||
.used{
|
||||
text-decoration: line-through;
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
.main-body{
|
||||
height:92.3%;
|
||||
width:100%;
|
||||
/*left: 20px;*/
|
||||
/*right: 20px;*/
|
||||
position: fixed;
|
||||
/*background-color: #FCF7EB;*/
|
||||
/*bottom: 11.6%;*/
|
||||
/*text-align: center;*/
|
||||
}
|
||||
.body{
|
||||
width: 90%;
|
||||
left: 5%;;
|
||||
height: 100%;
|
||||
background-color: #FCF7EB;
|
||||
position: relative;
|
||||
z-index: 1000;
|
||||
text-align: center;
|
||||
}
|
||||
.head{
|
||||
width:100%;
|
||||
}
|
||||
.banner{
|
||||
margin-top: 15%;
|
||||
padding: 20px;
|
||||
background-size: contain;
|
||||
}
|
||||
.wish {
|
||||
font-size: 18px;
|
||||
color: #B99B6A;
|
||||
}
|
||||
.redpack {
|
||||
padding:20px;
|
||||
color: #EC421F;
|
||||
}
|
||||
|
||||
.redpack .amount{
|
||||
font-size: 45px;
|
||||
}
|
||||
|
||||
.redpack .currency{
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.redpack .description{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #8C754F;
|
||||
font-size: 14px;
|
||||
text-align:left;
|
||||
}
|
||||
.coupon{
|
||||
}
|
||||
.coupon-back{
|
||||
position: relative;
|
||||
}
|
||||
.coupon-desc{
|
||||
position: absolute;
|
||||
padding: 20px;
|
||||
top: 0;
|
||||
}
|
||||
.coupon-au8{
|
||||
color: #EC421F;
|
||||
font-size: 16px;
|
||||
}
|
||||
.coupon-head{
|
||||
padding: 20px 0;
|
||||
}
|
||||
.coupon-img{
|
||||
width: 50px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@media screen and (max-height: 520px){
|
||||
p {
|
||||
color: #8C754F;
|
||||
font-size: 11px;
|
||||
text-align:left;
|
||||
}
|
||||
.coupon-au8{
|
||||
color: #EC421F;
|
||||
font-size: 15px;
|
||||
}
|
||||
.coupon-head{
|
||||
padding: 10px 0;
|
||||
}
|
||||
}
|
||||
.coupon_content{
|
||||
|
||||
}
|
||||
/*.foot1{*/
|
||||
/*width: 100%;*/
|
||||
/*position: fixed;*/
|
||||
/*bottom: 7.7%;*/
|
||||
/*background-color: #D51727;*/
|
||||
/*height: 3.9%;*/
|
||||
/*border-radius: 20px 20px 0 0;*/
|
||||
/*}*/
|
||||
.body-bottom {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
height: 3.9%;
|
||||
bottom: 0;
|
||||
border-radius: 20px 20px 0 0;
|
||||
background-color: #D51727;
|
||||
}
|
||||
.foot{
|
||||
width: 100%;
|
||||
position:fixed;
|
||||
height:7.7%;
|
||||
bottom:0;
|
||||
background-color: #F5504B;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #FDADAA;
|
||||
line-height: 50px;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package au.com.royalpay.payment.manage.process;
|
||||
|
||||
import au.com.royalpay.payment.manage.support.abafile.ABAConfig;
|
||||
import au.com.royalpay.payment.manage.support.abafile.ABAFile;
|
||||
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
||||
import org.apache.commons.csv.CSVFormat;
|
||||
import org.apache.commons.csv.CSVParser;
|
||||
import org.apache.commons.csv.CSVRecord;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2019-01-17 12:47
|
||||
*/
|
||||
public class ABAGenerator {
|
||||
private ABAConfig.ABABase config;
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private String csvFile = "C:\\Users\\yixian\\Documents\\royalpay\\2019\\cemtexaba-template-csv.csv";
|
||||
|
||||
@Before
|
||||
public void prepareEnv() {
|
||||
PlatformEnvironment env = new PlatformEnvironment();
|
||||
env.afterInitialize();
|
||||
ReflectionTestUtils.setField(env, "foreignCurrency", "AUD");
|
||||
config = new ABAConfig.ABABase()
|
||||
.setBank("CBA")
|
||||
.setApca("301500")
|
||||
.setBsb("063109")
|
||||
.setAccountNo("11505847")
|
||||
.setAccountName("Tunnel Show Pty Ltd");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generate() {
|
||||
ABAFile file = config.initFile(new Date());
|
||||
try (FileReader reader = new FileReader(csvFile)) {
|
||||
CSVParser parser = new CSVParser(reader, CSVFormat.newFormat(','));
|
||||
List<CSVRecord> records = parser.getRecords();
|
||||
for (CSVRecord record : records) {
|
||||
logger.debug("reading record:{}", record.toString());
|
||||
String bsb = record.get(0).replace("-", "");
|
||||
String accountNo = record.get(1);
|
||||
String accountName = record.get(2);
|
||||
BigDecimal amount = new BigDecimal(record.get(3));
|
||||
String remark = record.get(4);
|
||||
file.addSettleMerchant(bsb, accountNo, accountName, amount, remark);
|
||||
}
|
||||
byte[] bytes = file.output(0);
|
||||
FileUtils.writeByteArrayToFile(new File("C:\\Users\\yixian\\Documents\\royalpay\\2019\\cemtexaba-template.aba"), bytes);
|
||||
logger.info("output done");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue