From 3cd97ffbdea0cfbac6a410e68fc30ad42db096fb Mon Sep 17 00:00:00 2001 From: luoyang14z7 <704328506@qq.com> Date: Wed, 11 Jul 2018 11:12:20 +0800 Subject: [PATCH 1/2] fix : develop_act_Chairty --- .../manage/actchairty/web/ActChairtyController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java b/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java index cc3ad7daa..5535f93e6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java +++ b/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java @@ -29,24 +29,24 @@ public class ActChairtyController { @Resource private ActChairtyService actChairtyService; - @ManagerMapping(value = "/clients", method = RequestMethod.GET, role = { ManagerRole.ADMIN }) + @ManagerMapping(value = "/clients", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) public JSONObject listAttendingClients(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) { // todo params return actChairtyService.listChairClients(page, limit); } - @ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.PUT, role = { ManagerRole.ADMIN }) + @ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.PUT, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) public void configClient(@PathVariable String clientMoniker, @RequestBody @Valid ActChairtyBean config, Errors errors, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { HttpUtils.handleValidErrors(errors); actChairtyService.configClient(clientMoniker, config, manager); } - @ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN }) + @ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) public List traAnalysis(ActChairtyQuery params) { return actChairtyService.getWeekendAnalysis(params.params()); } - @ManagerMapping(value = "/ranking", method = RequestMethod.GET, role = { ManagerRole.ADMIN }) + @ManagerMapping(value = "/ranking", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) public JSONObject getRanking(ActChairtyQuery params) { PageList clientRank = actChairtyService.getClientRank(params.params()); if(clientRank==null){ @@ -55,7 +55,7 @@ public class ActChairtyController { return PageListUtils.buildPageListResult(clientRank); } - @ManagerMapping(value = "/total", method = RequestMethod.GET, role = {ManagerRole.ADMIN}) + @ManagerMapping(value = "/total", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) public JSONObject getTotal() { return actChairtyService.gettotal(); } From 48d5daf4ca2f2894914eb50d4df2de5615028afe Mon Sep 17 00:00:00 2001 From: luoyang14z7 <704328506@qq.com> Date: Wed, 11 Jul 2018 11:34:01 +0800 Subject: [PATCH 2/2] fix : develop_act_Chairty --- .../actchairty/core/impls/ActChairtyServiceImp.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 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 3aec253af..5ba7e36fd 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 @@ -87,17 +87,18 @@ public class ActChairtyServiceImp implements ActChairtyService { @Override public JSONObject gettotal() { List gettotalnum = actChairtyMapper.chairtyClientNum(); - int amount=0 ; + BigDecimal amount= new BigDecimal(0) ; double chairty=0.00; for (JSONObject gettotals : gettotalnum) { - amount += gettotals.getIntValue("sum_ordernum"); - chairty += gettotals.getDoubleValue("count_ordernum") * 0.01; + amount = amount.add(gettotals.getBigDecimal("sum_ordernum")); + chairty += gettotals.getIntValue("count_ordernum") * 0.01; } BigDecimal bg = new BigDecimal(chairty); - double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + double f1 = amount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + double f2 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); JSONObject gettotal = new JSONObject(); - gettotal.put("amount", amount); - gettotal.put("chairty", f1); + gettotal.put("amount", f1); + gettotal.put("chairty", f2); return gettotal; }