From ef3cd5d822d936705ff00d9dfb0ba4b1ca7b246a Mon Sep 17 00:00:00 2001 From: luoyang14z7 <704328506@qq.com> Date: Thu, 12 Jul 2018 19:27:14 +0800 Subject: [PATCH 1/6] fix : ActChairty --- .../payment/manage/mappers/act/ActChairtyMapper.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml index dcf7d88f4..a958486dd 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml @@ -2,16 +2,16 @@ - select DISTINCT (count(order_id)) as count_ordernum ,client_moniker,active_time,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum + select count(DISTINCT order_id) as count_ordernum ,client_moniker,active_time,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.channel != 'Settlement' - GROUP BY act_charity.client_id order by sum_ordernum desc + GROUP BY act_charity.client_id order by count_ordernum desc - select DISTINCT (count(order_id)) as count_ordernum,date_format(pmt_transactions.transaction_time,'%Y-%m-%d') as orderdate,client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity inner JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id + select count(DISTINCT order_id) as count_ordernum,date_format(pmt_transactions.transaction_time,'%Y-%m-%d') as orderdate,client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity inner JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end} and pmt_transactions.transaction_time>=act_charity.active_time and pmt_transactions.channel != 'Settlement' group by date_format(pmt_transactions.transaction_time,'%Y-%m-%d') @@ -19,8 +19,8 @@ - select DISTINCT (count(pmt_transactions.order_id)) *0.01 as chair_ordernum,act_charity.client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id + select count(DISTINCT pmt_transactions.order_id) *0.01 as chair_ordernum,act_charity.client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end} and pmt_transactions.transaction_time>=act_charity.active_time - GROUP BY act_charity.client_moniker order by sum_ordernum desc + GROUP BY act_charity.client_moniker order by chair_ordernum desc \ No newline at end of file From b182cb794bae11ebe1a7def083885dfa274426e0 Mon Sep 17 00:00:00 2001 From: luoyang14z7 <704328506@qq.com> Date: Fri, 13 Jul 2018 13:06:50 +0800 Subject: [PATCH 2/6] fix : ActChairty --- .../core/impls/ActChairtyServiceImp.java | 88 +++++++++---------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java index b7d86ffbf..494d041c8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java @@ -10,6 +10,9 @@ import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; 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 javax.annotation.Resource; @@ -26,7 +29,7 @@ import java.util.List; */ @Service public class ActChairtyServiceImp implements ActChairtyService { - + Logger logger = LoggerFactory.getLogger(getClass()); @Resource private ClientManager clientManager; @Resource @@ -64,54 +67,49 @@ public class ActChairtyServiceImp implements ActChairtyService { public List getWeekendAnalysis(JSONObject params) { List result = new ArrayList<>(); List getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(params.getDate("begin"), params.getDate("end")); - SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd"); - Calendar cal = Calendar.getInstance(); - cal.setTime(params.getDate("begin")); - cal.add(cal.DAY_OF_MONTH, -1); - long beginTime = params.getDate("begin").getTime(); - long endTime = params.getDate("end").getTime(); - long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24)); - List weekStart = new ArrayList(); - for(int i=0;i<=betweenDays;i++){ - cal.add(cal.DAY_OF_MONTH, 1);//DATE=日 - if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) { - weekStart.add(df.format(cal.getTime())); - } + DateFormatUtils df = new DateFormatUtils(); + Calendar cal = Calendar.getInstance(); + cal.setTime(params.getDate("begin")); + cal.add(cal.DAY_OF_MONTH, -1); + long beginTime = params.getDate("begin").getTime(); + long endTime = params.getDate("end").getTime(); + long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24)); + List weekStart = new ArrayList<>(); + for(int i=0;i<=betweenDays;i++){ + cal.add(cal.DAY_OF_MONTH, 1);//DATE=日 + if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) { + weekStart.add(df.format(cal.getTime(),"yyyy-MM-dd")); } - for(int i=0;i= dateStar.getTime() && orderDate < dateEnd.getTime()) { - count_ordernum = count_ordernum.add(getAnalysis.get(b).getBigDecimal("count_ordernum")); - sum_ordernum = sum_ordernum.add(getAnalysis.get(b).getBigDecimal("sum_ordernum")); - } + } + for(int i=0;i= dateStar.getTime() && orderDate < dateEnd.getTime()) { + count_ordernum = count_ordernum.add(getAnalysis.get(b).getBigDecimal("count_ordernum")); + sum_ordernum = sum_ordernum.add(getAnalysis.get(b).getBigDecimal("sum_ordernum")); } - BigDecimal chairty = new BigDecimal(0.01); - BigDecimal chairty_amount = count_ordernum.multiply(chairty); - double f1 = sum_ordernum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - double f2 = chairty_amount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - - weekDay.put("weekstart", weekStart.get(i)); - weekDay.put("count_ordernum", count_ordernum); - weekDay.put("sum_ordernum", f1); - weekDay.put("chairty_amount",f2 ); - result.add(weekDay); - } catch (Exception e) { - e.printStackTrace(); - } + BigDecimal chairty = new BigDecimal(0.01); + BigDecimal chairty_amount = count_ordernum.multiply(chairty); + BigDecimal f1 = sum_ordernum.setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal f2 = chairty_amount.setScale(2, BigDecimal.ROUND_HALF_UP); + weekDay.put("weekstart", weekStart.get(i)); + weekDay.put("count_ordernum", count_ordernum); + weekDay.put("sum_ordernum", f1); + weekDay.put("chairty_amount",f2 ); + result.add(weekDay); + } catch (Exception e) { + logger.info("Act_Chairty Error:",e); + } + } return result; } From af40eff1b5a033ce190e2c31f5c02f9adc90376f Mon Sep 17 00:00:00 2001 From: luoyang14z7 <704328506@qq.com> Date: Fri, 13 Jul 2018 14:03:39 +0800 Subject: [PATCH 3/6] fix : ActChairty --- .../ui/static/actchairty/templates/act_chairty_merchants.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/ui/static/actchairty/templates/act_chairty_merchants.html b/src/main/ui/static/actchairty/templates/act_chairty_merchants.html index b08680a38..b928a00ab 100644 --- a/src/main/ui/static/actchairty/templates/act_chairty_merchants.html +++ b/src/main/ui/static/actchairty/templates/act_chairty_merchants.html @@ -74,7 +74,11 @@ next-text="›" first-text="«" last-text="»"> + + Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}} + + From 77bb3ea3b5220d030a453374aafac0b7b50aabe5 Mon Sep 17 00:00:00 2001 From: eason Date: Fri, 13 Jul 2018 14:08:19 +0800 Subject: [PATCH 4/6] fix actChairty --- .../royalpay/payment/manage/mappers/act/ActChairtyMapper.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml index a958486dd..addc41843 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml @@ -6,7 +6,7 @@ from act_charity left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time - and pmt_transactions.transaction_time<'2018-09-01' + and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09' and pmt_transactions.channel != 'Settlement' GROUP BY act_charity.client_id order by count_ordernum desc @@ -14,6 +14,7 @@ select count(DISTINCT order_id) as count_ordernum,date_format(pmt_transactions.transaction_time,'%Y-%m-%d') as orderdate,client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity inner JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end} and pmt_transactions.transaction_time>=act_charity.active_time and pmt_transactions.channel != 'Settlement' + and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09' group by date_format(pmt_transactions.transaction_time,'%Y-%m-%d') @@ -21,6 +22,7 @@ select count(DISTINCT pmt_transactions.order_id) *0.01 as chair_ordernum,act_charity.client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end} and pmt_transactions.transaction_time>=act_charity.active_time + and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09' GROUP BY act_charity.client_moniker order by chair_ordernum desc \ No newline at end of file From 4f596ec1d330cf96e83e67658e9cb1e1aca75da5 Mon Sep 17 00:00:00 2001 From: luoyang14z7 <704328506@qq.com> Date: Fri, 13 Jul 2018 16:56:16 +0800 Subject: [PATCH 5/6] fix : ActChairty --- src/main/ui/static/actchairty/act_chairty.js | 6 ++++-- .../static/actchairty/templates/act_chairty_merchants.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/ui/static/actchairty/act_chairty.js b/src/main/ui/static/actchairty/act_chairty.js index 4cd8fc7ef..3f9294646 100644 --- a/src/main/ui/static/actchairty/act_chairty.js +++ b/src/main/ui/static/actchairty/act_chairty.js @@ -29,15 +29,17 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul $scope.new_conf = {}; $scope.ctrl = {dateInput: false}; $scope.submitClient = function () { - $scope.errmsg = null; + var client_moniker = $scope.new_conf.client_moniker; + $scope.msg = null; var conf = { date: $filter('date')($scope.new_conf.date, 'yyyy-MM-dd'), }; $http.put('/actchairty/clients/' + $scope.new_conf.client_moniker, conf).then(function () { $scope.new_conf = {}; $scope.loadClients(); + $scope.msg = "商户创建成功!商户ID:"+ client_moniker + " 参加时间:" + conf.date; }, function (resp) { - $scope.errmsg = resp.data.message; + $scope.msg = resp.data.message; }); }; }]); diff --git a/src/main/ui/static/actchairty/templates/act_chairty_merchants.html b/src/main/ui/static/actchairty/templates/act_chairty_merchants.html index b928a00ab..4893f4e50 100644 --- a/src/main/ui/static/actchairty/templates/act_chairty_merchants.html +++ b/src/main/ui/static/actchairty/templates/act_chairty_merchants.html @@ -23,7 +23,7 @@ - + From de82418d700fc740aa0b755e96b78e56bbc83304 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Fri, 13 Jul 2018 18:44:23 +0800 Subject: [PATCH 6/6] encourage money --- .../web/EncourageMoneyController.java | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java b/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java index 6aa15d077..e7547971c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java @@ -2,10 +2,17 @@ package au.com.royalpay.payment.manage.customers.web; import au.com.royalpay.payment.manage.customers.core.EncourageService; import au.com.royalpay.payment.tools.CommonConsts; -import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType; -import au.com.royalpay.payment.tools.permission.wechat.WechatMapping; + import com.alibaba.fastjson.JSONObject; -import org.springframework.web.bind.annotation.*; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; @@ -16,15 +23,22 @@ import javax.annotation.Resource; @RestController @RequestMapping("/act/encourage_money") public class EncourageMoneyController { + Logger logger = LoggerFactory.getLogger(getClass()); @Resource private EncourageService encourageService; - @RequestMapping(value = "/orders/{orderId}", method = RequestMethod.PUT) - public JSONObject takeEncourageMoney(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) { - if (wxUser == null) { + @RequestMapping(value = "/orders/{orderId}", method = RequestMethod.GET) + public JSONObject takeEncourageMoney(@PathVariable String orderId,@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) { + String user_id = ""; + if(wxUser==null){ + user_id = aliuser.getString("user_id"); + }else { + user_id = wxUser.getString("openid"); + } + if(StringUtils.isEmpty(user_id)){ return new JSONObject(); } - return encourageService.takeEncourageMoney(orderId, wxUser.getString("openid")); + return encourageService.takeEncourageMoney(orderId, user_id); } @RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT) @@ -32,21 +46,27 @@ public class EncourageMoneyController { return encourageService.doubleEncourageMoney(orderId); } - @WechatMapping(value = "/my", method = RequestMethod.GET, oauthType = WxOauthType.USERINFO) - public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) { + @RequestMapping(value = "/my", method = RequestMethod.GET) + public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) { ModelAndView mav = new ModelAndView("activity/encourage_money/my"); mav.addObject("wxUser", wxUser); - JSONObject balanceStatus = encourageService.getBalanceStatus(wxUser.getString("openid")); + String user_id = ""; + if(wxUser==null){ + user_id = aliuser.getString("user_id"); + }else { + user_id = wxUser.getString("openid"); + } + JSONObject balanceStatus = encourageService.getBalanceStatus(user_id); mav.addObject("balance_status", balanceStatus); return mav; } - @WechatMapping(value = "/desc",method = RequestMethod.GET) + @RequestMapping(value = "/desc",method = RequestMethod.GET) public ModelAndView descPage(){ return new ModelAndView("activity/encourage_money/desc"); } - @WechatMapping(value = "/merchants",method = RequestMethod.GET) + @RequestMapping(value = "/merchants",method = RequestMethod.GET) public ModelAndView merchantsPage(){ return new ModelAndView("activity/encourage_money/merchants"); }