Merge branch 'develop_client_permission' into develop

master
kira 6 years ago
commit ed42133822

@ -87,17 +87,18 @@ public class ActChairtyServiceImp implements ActChairtyService {
@Override @Override
public JSONObject gettotal() { public JSONObject gettotal() {
List<JSONObject> gettotalnum = actChairtyMapper.chairtyClientNum(); List<JSONObject> gettotalnum = actChairtyMapper.chairtyClientNum();
int amount=0 ; BigDecimal amount= new BigDecimal(0) ;
double chairty=0.00; double chairty=0.00;
for (JSONObject gettotals : gettotalnum) { for (JSONObject gettotals : gettotalnum) {
amount += gettotals.getIntValue("sum_ordernum"); amount = amount.add(gettotals.getBigDecimal("sum_ordernum"));
chairty += gettotals.getDoubleValue("count_ordernum") * 0.01; chairty += gettotals.getIntValue("count_ordernum") * 0.01;
} }
BigDecimal bg = new BigDecimal(chairty); 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(); JSONObject gettotal = new JSONObject();
gettotal.put("amount", amount); gettotal.put("amount", f1);
gettotal.put("chairty", f1); gettotal.put("chairty", f2);
return gettotal; return gettotal;
} }

@ -29,24 +29,24 @@ public class ActChairtyController {
@Resource @Resource
private ActChairtyService actChairtyService; 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) { public JSONObject listAttendingClients(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
// todo params // todo params
return actChairtyService.listChairClients(page, limit); 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, public void configClient(@PathVariable String clientMoniker, @RequestBody @Valid ActChairtyBean config, Errors errors,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
actChairtyService.configClient(clientMoniker, config, manager); 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<JSONObject> traAnalysis(ActChairtyQuery params) { public List<JSONObject> traAnalysis(ActChairtyQuery params) {
return actChairtyService.getWeekendAnalysis(params.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) { public JSONObject getRanking(ActChairtyQuery params) {
PageList<JSONObject> clientRank = actChairtyService.getClientRank(params.params()); PageList<JSONObject> clientRank = actChairtyService.getClientRank(params.params());
if(clientRank==null){ if(clientRank==null){
@ -55,7 +55,7 @@ public class ActChairtyController {
return PageListUtils.buildPageListResult(clientRank); 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() { public JSONObject getTotal() {
return actChairtyService.gettotal(); return actChairtyService.gettotal();
} }

Loading…
Cancel
Save