commit
36ec9d4b6b
@ -0,0 +1,33 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.beans;
|
||||
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
public class ActChairtyBean {
|
||||
@JSONField(name = "date")
|
||||
private String date;
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public java.util.Date toDate() {
|
||||
try {
|
||||
return DateUtils.parseDate(date, new String[]{"yyyy-MM-dd"});
|
||||
} catch (ParseException e) {
|
||||
throw new BadRequestException("Invalid To Date");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.beans;
|
||||
|
||||
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* redpack query
|
||||
* Created by davep on 2016-08-03.
|
||||
*/
|
||||
public class ActChairtyQuery {
|
||||
private static final String[] DATE_PATTERNS = {"yyyyMMdd", "yyyy-MM-dd"};
|
||||
private String begin;
|
||||
private String end;
|
||||
private int page = 1;
|
||||
private int limit = 20;
|
||||
|
||||
public JSONObject params() {
|
||||
JSONObject param = new JSONObject();
|
||||
if (begin != null) {
|
||||
try {
|
||||
Date fromDate = DateUtils.parseDate(begin, DATE_PATTERNS);
|
||||
param.put("begin", fromDate);
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("begin", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (end != null) {
|
||||
try {
|
||||
Date fromDate = DateUtils.addDays(DateUtils.parseDate(end, DATE_PATTERNS), 1);
|
||||
param.put("end", fromDate);
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
param.put("page",page);
|
||||
param.put("limit",limit);
|
||||
return param;
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public void setBegin(String begin) {
|
||||
this.begin = begin;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.core;
|
||||
|
||||
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyBean;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
|
||||
public interface ActChairtyService {
|
||||
|
||||
void configClient(String clientMoniker, ActChairtyBean config, JSONObject manager);
|
||||
|
||||
JSONObject listChairClients(int page, int limit);
|
||||
|
||||
List<JSONObject> getWeekendAnalysis(JSONObject params);
|
||||
|
||||
PageList<JSONObject> getClientRank(JSONObject params);
|
||||
|
||||
JSONObject gettotal();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,145 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.core.impls;
|
||||
|
||||
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyBean;
|
||||
import au.com.royalpay.payment.manage.actchairty.core.ActChairtyService;
|
||||
import au.com.royalpay.payment.manage.mappers.act.ActChairtyMapper;
|
||||
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
||||
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
||||
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;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
@Service
|
||||
public class ActChairtyServiceImp implements ActChairtyService {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Resource
|
||||
private ClientManager clientManager;
|
||||
@Resource
|
||||
private ActChairtyMapper actChairtyMapper;
|
||||
@Override
|
||||
public void configClient(String clientMoniker, ActChairtyBean config, JSONObject manager) {
|
||||
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
||||
if (client == null) {
|
||||
throw new InvalidShortIdException();
|
||||
}
|
||||
JSONObject findChairty = actChairtyMapper.findChairtyClient(clientMoniker);
|
||||
if (findChairty == null) {
|
||||
JSONObject chairtyClient = new JSONObject();
|
||||
chairtyClient.put("client_id", client.get("client_id"));
|
||||
chairtyClient.put("client_moniker", clientMoniker);
|
||||
chairtyClient.put("active_time", config.toDate());
|
||||
actChairtyMapper.save(chairtyClient);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject listChairClients(int page, int limit) {
|
||||
PageList<JSONObject> clients = actChairtyMapper.chairtyClientNum(new PageBounds(page, limit));
|
||||
for (JSONObject client : clients){
|
||||
client.put("client_moniker", client.getString("client_moniker"));
|
||||
client.put("active_time", DateFormatUtils.format(client.getDate("active_time"), "yyyy/MM/dd"));
|
||||
BigDecimal bg = new BigDecimal(client.getIntValue("count_ordernum") * 0.01);
|
||||
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
client.put("chairty_num", f1);
|
||||
}
|
||||
return PageListUtils.buildPageListResult(clients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getWeekendAnalysis(JSONObject params) {
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
List<JSONObject> getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(params.getDate("begin"), params.getDate("end"));
|
||||
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<String> 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<weekStart.size();i++){
|
||||
JSONObject weekDay = new JSONObject();
|
||||
BigDecimal count_ordernum = new BigDecimal(0);
|
||||
BigDecimal sum_ordernum = new BigDecimal(0);
|
||||
String weekS = weekStart.get(i);
|
||||
try {
|
||||
Date dateStar = DateUtils.parseDate(weekS,"yyyy-MM-dd");
|
||||
Date dateEnd = DateUtils.addDays(dateStar, 7);
|
||||
for (int b = 0; b < getAnalysis.size(); b++) {
|
||||
long orderDate = getAnalysis.get(b).getDate("orderdate").getTime();
|
||||
if (orderDate >= 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);
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<JSONObject> getClientRank(JSONObject params) {
|
||||
PageList<JSONObject> getChairtyWeekRaking = actChairtyMapper.getChairtyWeekRaking(params.getDate("begin"), params.getDate("end"),new PageBounds(params.getIntValue("page"), params.getIntValue("limit")));
|
||||
return getChairtyWeekRaking;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject gettotal() {
|
||||
List<JSONObject> gettotalnum = actChairtyMapper.chairtyClientNum();
|
||||
BigDecimal amount= new BigDecimal(0) ;
|
||||
double chairty=0.00;
|
||||
for (JSONObject gettotals : gettotalnum) {
|
||||
amount = amount.add(gettotals.getBigDecimal("sum_ordernum"));
|
||||
chairty += gettotals.getIntValue("count_ordernum") * 0.01;
|
||||
}
|
||||
BigDecimal bg = new BigDecimal(chairty);
|
||||
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", f1);
|
||||
gettotal.put("chairty", f2);
|
||||
return gettotal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyBean;
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyQuery;
|
||||
import au.com.royalpay.payment.manage.actchairty.core.ActChairtyService;
|
||||
import au.com.royalpay.payment.manage.cashback.core.CashbackService;
|
||||
import au.com.royalpay.payment.manage.management.clearing.core.SettleDelayConfigurer;
|
||||
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
import au.com.royalpay.payment.tools.http.HttpUtils;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
|
||||
@RequestMapping(value = "/actchairty")
|
||||
@RestController
|
||||
public class ActChairtyController {
|
||||
@Resource
|
||||
private ActChairtyService actChairtyService;
|
||||
|
||||
@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,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,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
|
||||
public List<JSONObject> traAnalysis(ActChairtyQuery params) {
|
||||
return actChairtyService.getWeekendAnalysis(params.params());
|
||||
}
|
||||
@ManagerMapping(value = "/ranking", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
|
||||
public JSONObject getRanking(ActChairtyQuery params) {
|
||||
PageList<JSONObject> clientRank = actChairtyService.getClientRank(params.params());
|
||||
if(clientRank==null){
|
||||
return null;
|
||||
}
|
||||
return PageListUtils.buildPageListResult(clientRank);
|
||||
}
|
||||
|
||||
@ManagerMapping(value = "/total", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
|
||||
public JSONObject getTotal() {
|
||||
return actChairtyService.gettotal();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,476 @@
|
||||
package au.com.royalpay.payment.manage.dev.bean;
|
||||
|
||||
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
|
||||
/**
|
||||
* Created by yixian on 2016-07-01.
|
||||
*/
|
||||
public class AliExcel {
|
||||
private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private String textType;
|
||||
private String searchText;
|
||||
private String client_moniker;
|
||||
private String state;
|
||||
private String suburb;
|
||||
private String short_name;
|
||||
private String sub_merchant_id;
|
||||
private String org_id;
|
||||
private String org_ids;
|
||||
private String bd;
|
||||
private String business_structure;
|
||||
private String industry;
|
||||
private Integer clean_day;
|
||||
private String bd_city;
|
||||
private String surcharge_start_rate;
|
||||
private String surcharge_end_rate;
|
||||
private String create_start_time;
|
||||
private String datefrom;
|
||||
private String create_end_time;
|
||||
private String dateto;
|
||||
private String transaction_start_time;
|
||||
private String transaction_end_time;
|
||||
private boolean approving = false;
|
||||
private int page = 1;
|
||||
private int limit = 10;
|
||||
private boolean onlyMe = false;
|
||||
private boolean tempMchId = false;
|
||||
private boolean quickPass = false;
|
||||
private boolean greenChannel = false;
|
||||
private boolean greenChannelBdTodo = false;
|
||||
private boolean pass = false;
|
||||
private boolean completed_contract = false;
|
||||
private boolean apply_to_back = false;
|
||||
private boolean bd_upload_material = false;
|
||||
private boolean is_valid = false;
|
||||
private String merchant_id;
|
||||
|
||||
public String getClient_moniker() {
|
||||
return StringUtils.isEmpty(client_moniker) ? null : client_moniker;
|
||||
}
|
||||
|
||||
public void setClient_moniker(String client_moniker) {
|
||||
this.client_moniker = client_moniker;
|
||||
}
|
||||
|
||||
public String getShort_name() {
|
||||
return short_name;
|
||||
}
|
||||
|
||||
public void setShort_name(String short_name) {
|
||||
this.short_name = short_name;
|
||||
}
|
||||
|
||||
public String getSub_merchant_id() {
|
||||
return sub_merchant_id;
|
||||
}
|
||||
|
||||
public void setSub_merchant_id(String sub_merchant_id) {
|
||||
this.sub_merchant_id = sub_merchant_id;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public JSONObject toJsonParam() {
|
||||
JSONObject param = new JSONObject();
|
||||
if (StringUtils.isNotBlank(client_moniker)) {
|
||||
param.put("client_moniker", getClient_moniker());
|
||||
}
|
||||
if (StringUtils.isNotBlank(short_name)) {
|
||||
param.put("short_name", short_name);
|
||||
}
|
||||
if (StringUtils.isNotBlank(sub_merchant_id)) {
|
||||
param.put("sub_merchant_id", sub_merchant_id);
|
||||
}
|
||||
if (StringUtils.isNotBlank(state)) {
|
||||
param.put("state", state);
|
||||
}
|
||||
if (StringUtils.isNotBlank(suburb)) {
|
||||
param.put("suburb", suburb);
|
||||
}
|
||||
if (StringUtils.isNotBlank(searchText)) {
|
||||
param.put("search_text", searchText);
|
||||
if (StringUtils.isNotBlank(textType)) {
|
||||
param.put("text_type", textType);
|
||||
} else {
|
||||
param.put("text_type", "all");
|
||||
}
|
||||
}
|
||||
if (approving) {
|
||||
param.put("approving", true);
|
||||
}
|
||||
if (org_id != null) {
|
||||
param.put("org_id", org_id);
|
||||
}
|
||||
if (org_ids != null) {
|
||||
param.put("org_ids", org_ids);
|
||||
}
|
||||
if (StringUtils.isNotBlank(bd)) {
|
||||
param.put("bd_user", bd);
|
||||
}
|
||||
if (quickPass){
|
||||
param.put("quickPass",true);
|
||||
}
|
||||
if (greenChannel){
|
||||
param.put("greenChannel",true);
|
||||
}
|
||||
if (business_structure!=null && !business_structure.equals("")){
|
||||
param.put("business_structure",business_structure);
|
||||
}
|
||||
if (industry!=null && !industry.equals("")){
|
||||
param.put("industry",industry);
|
||||
}
|
||||
if (bd_city!=null && !bd_city.equals("")){
|
||||
param.put("bd_city",bd_city);
|
||||
}
|
||||
if (clean_day!=null){
|
||||
param.put("clean_day",clean_day);
|
||||
}
|
||||
if (surcharge_start_rate!=null) {
|
||||
param.put("surcharge_start_rate",surcharge_start_rate);
|
||||
}
|
||||
if (surcharge_end_rate!=null){
|
||||
param.put("surcharge_end_rate",surcharge_end_rate);
|
||||
}
|
||||
if (transaction_start_time != null) {
|
||||
try {
|
||||
param.put("transaction_start_time", format.parse(transaction_start_time));
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("transaction_start_time", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (transaction_end_time != null) {
|
||||
try {
|
||||
param.put("transaction_end_time", DateUtils.addDays(format.parse(transaction_end_time), 1));
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("transaction_end_time", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (create_start_time != null) {
|
||||
try {
|
||||
param.put("create_start_time", format.parse(create_start_time));
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("create_start_time", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (create_end_time != null) {
|
||||
try {
|
||||
param.put("create_end_time", DateUtils.addDays(format.parse(create_end_time), 1));
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("create_end_time", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (datefrom != null) {
|
||||
try {
|
||||
param.put("datefrom", format.parse(datefrom));
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("approve_start_time", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (dateto != null) {
|
||||
try {
|
||||
param.put("dateto", DateUtils.addDays(format.parse(dateto), 1));
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("approve_end_time", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (greenChannelBdTodo){
|
||||
param.put("greenChannelBdTodo",true);
|
||||
}
|
||||
if (is_valid){
|
||||
param.put("is_valid",true);
|
||||
}
|
||||
if (pass){
|
||||
param.put("pass",true);
|
||||
}
|
||||
if (completed_contract){
|
||||
param.put("completed_contract",true);
|
||||
}
|
||||
if (apply_to_back){
|
||||
param.put("apply_to_back",true);
|
||||
}
|
||||
if (bd_upload_material){
|
||||
param.put("bd_upload_material",true);
|
||||
}
|
||||
if (merchant_id != null){
|
||||
param.put("merchant_id",merchant_id);
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getTextType() {
|
||||
return textType;
|
||||
}
|
||||
|
||||
public void setTextType(String textType) {
|
||||
this.textType = textType;
|
||||
}
|
||||
|
||||
public String getSearchText() {
|
||||
return searchText;
|
||||
}
|
||||
|
||||
public void setSearchText(String searchText) {
|
||||
this.searchText = searchText;
|
||||
}
|
||||
|
||||
public String getOrg_id() {
|
||||
return org_id;
|
||||
}
|
||||
|
||||
public void setOrg_id(String org_id) {
|
||||
this.org_id = org_id;
|
||||
}
|
||||
|
||||
public void setOnlyMe(boolean onlyMe) {
|
||||
this.onlyMe = onlyMe;
|
||||
}
|
||||
|
||||
public boolean getOnlyMe() {
|
||||
return onlyMe;
|
||||
}
|
||||
|
||||
public boolean isTempMchId() {
|
||||
return tempMchId;
|
||||
}
|
||||
|
||||
public void setTempMchId(boolean tempMchId) {
|
||||
this.tempMchId = tempMchId;
|
||||
}
|
||||
|
||||
public String getBusiness_structure() {
|
||||
return business_structure;
|
||||
}
|
||||
|
||||
public void setBusiness_structure(String business_structure) {
|
||||
this.business_structure = business_structure;
|
||||
}
|
||||
|
||||
public String getIndustry() {
|
||||
return industry;
|
||||
}
|
||||
|
||||
public void setIndustry(String industry) {
|
||||
this.industry = industry;
|
||||
}
|
||||
|
||||
public Integer getClean_day() {
|
||||
return clean_day;
|
||||
}
|
||||
|
||||
public void setClean_day(Integer clean_day) {
|
||||
this.clean_day = clean_day;
|
||||
}
|
||||
|
||||
public String getBd_city() {
|
||||
return bd_city;
|
||||
}
|
||||
|
||||
public void setBd_city(String bd_city) {
|
||||
this.bd_city = bd_city;
|
||||
}
|
||||
|
||||
public String getCreate_start_time() {
|
||||
return create_start_time;
|
||||
}
|
||||
|
||||
public void setCreate_start_time(String create_start_time) {
|
||||
this.create_start_time = create_start_time;
|
||||
}
|
||||
|
||||
public String getDatefrom() {
|
||||
return datefrom;
|
||||
}
|
||||
|
||||
public void setDatefrom(String datefrom) {
|
||||
this.datefrom = datefrom;
|
||||
}
|
||||
|
||||
public String getCreate_end_time() {
|
||||
return create_end_time;
|
||||
}
|
||||
|
||||
public void setCreate_end_time(String create_end_time) {
|
||||
this.create_end_time = create_end_time;
|
||||
}
|
||||
|
||||
public String getDateto() {
|
||||
return dateto;
|
||||
}
|
||||
|
||||
public void setDateto(String dateto) {
|
||||
this.dateto = dateto;
|
||||
}
|
||||
|
||||
public String getSurcharge_start_rate() {
|
||||
return surcharge_start_rate;
|
||||
}
|
||||
|
||||
public void setSurcharge_start_rate(String surcharge_start_rate) {
|
||||
this.surcharge_start_rate = surcharge_start_rate;
|
||||
}
|
||||
|
||||
public String getTransaction_start_time() {
|
||||
return transaction_start_time;
|
||||
}
|
||||
|
||||
public void setTransaction_start_time(String transaction_start_time) {
|
||||
this.transaction_start_time = transaction_start_time;
|
||||
}
|
||||
|
||||
public String getTransaction_end_time() {
|
||||
return transaction_end_time;
|
||||
}
|
||||
|
||||
public void setTransaction_end_time(String transaction_end_time) {
|
||||
this.transaction_end_time = transaction_end_time;
|
||||
}
|
||||
|
||||
public String getSurcharge_end_rate() {
|
||||
return surcharge_end_rate;
|
||||
}
|
||||
|
||||
public void setSurcharge_end_rate(String surcharge_end_rate) {
|
||||
this.surcharge_end_rate = surcharge_end_rate;
|
||||
}
|
||||
|
||||
public boolean isOnlyMe() {
|
||||
return onlyMe;
|
||||
}
|
||||
|
||||
public boolean isApproving() {
|
||||
return approving;
|
||||
}
|
||||
|
||||
public void setApproving(boolean approving) {
|
||||
this.approving = approving;
|
||||
}
|
||||
|
||||
public boolean isQuickPass() {
|
||||
return quickPass;
|
||||
}
|
||||
|
||||
public void setQuickPass(boolean quickPass) {
|
||||
this.quickPass = quickPass;
|
||||
}
|
||||
|
||||
public boolean isGreenChannel() {
|
||||
return greenChannel;
|
||||
}
|
||||
|
||||
public void setGreenChannel(boolean greenChannel) {
|
||||
this.greenChannel = greenChannel;
|
||||
}
|
||||
public void setGreenChannelAndBDtodo(boolean bDTodo){
|
||||
this.greenChannelBdTodo = bDTodo;
|
||||
}
|
||||
public void setIs_valid(boolean is_valid){
|
||||
this.is_valid=is_valid;
|
||||
}
|
||||
|
||||
public DateFormat getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public boolean isGreenChannelBdTodo() {
|
||||
return greenChannelBdTodo;
|
||||
}
|
||||
|
||||
public void setGreenChannelBdTodo(boolean greenChannelBdTodo) {
|
||||
this.greenChannelBdTodo = greenChannelBdTodo;
|
||||
}
|
||||
|
||||
public boolean isPass() {
|
||||
return pass;
|
||||
}
|
||||
|
||||
public void setPass(boolean pass) {
|
||||
this.pass = pass;
|
||||
}
|
||||
|
||||
public boolean isCompleted_contract() {
|
||||
return completed_contract;
|
||||
}
|
||||
|
||||
public void setCompleted_contract(boolean completed_contract) {
|
||||
this.completed_contract = completed_contract;
|
||||
}
|
||||
|
||||
public boolean isApply_to_back() {
|
||||
return apply_to_back;
|
||||
}
|
||||
|
||||
public void setApply_to_back(boolean apply_to_back) {
|
||||
this.apply_to_back = apply_to_back;
|
||||
}
|
||||
|
||||
public boolean isBd_upload_material() {
|
||||
return bd_upload_material;
|
||||
}
|
||||
|
||||
public void setBd_upload_material(boolean bd_upload_material) {
|
||||
this.bd_upload_material = bd_upload_material;
|
||||
}
|
||||
|
||||
public boolean isIs_valid() {
|
||||
return is_valid;
|
||||
}
|
||||
|
||||
public String getOrg_ids() {
|
||||
return org_ids;
|
||||
}
|
||||
|
||||
public void setOrg_ids(String org_ids) {
|
||||
this.org_ids = org_ids;
|
||||
}
|
||||
|
||||
public void setBd(String bd) {
|
||||
this.bd = bd;
|
||||
}
|
||||
|
||||
public String getMerchant_id() {
|
||||
return merchant_id;
|
||||
}
|
||||
|
||||
public void setMerchant_id(String merchant_id) {
|
||||
this.merchant_id = merchant_id;
|
||||
}
|
||||
|
||||
public String getSuburb() {
|
||||
return suburb;
|
||||
}
|
||||
|
||||
public void setSuburb(String suburb) {
|
||||
this.suburb = suburb;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,355 @@
|
||||
package au.com.royalpay.payment.manage.dev.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import javax.validation.constraints.Pattern;
|
||||
/**
|
||||
* Created by yangluo on 2018/06/28.
|
||||
*/
|
||||
public class ClientTestRegisterInfo {
|
||||
@JSONField(name = "client_moniker")
|
||||
@NotEmpty(message = "error.payment.valid.param_missing")
|
||||
@Pattern(regexp = "^[a-zA-Z0-9]{4}$", message = "Parameter error(partner code):Only letters or numbers are allowed")
|
||||
private String clientMoniker;
|
||||
private String companyName;
|
||||
private String shortName;
|
||||
private String businessName;
|
||||
private String businessStructure;
|
||||
// @NotEmpty(message = "error.payment.valid.param_missing")
|
||||
private String abn;
|
||||
private String acn;
|
||||
// @NotEmpty(message = "error.payment.valid.param_missing")
|
||||
private String industry;
|
||||
/* @NotEmpty(message = "error.payment.valid.param_missing")*/
|
||||
private String alipayIndustry;
|
||||
private String companyPhoto;
|
||||
private String storePhoto;
|
||||
private String companyWebsite;
|
||||
private String companyPhone;
|
||||
private String description;
|
||||
private String remark;
|
||||
private String sector;
|
||||
@JSONField(name = "logo_id")
|
||||
private String logoId;
|
||||
@JSONField(name = "contact_person")
|
||||
private String contactPerson;
|
||||
@JSONField(name = "contact_phone")
|
||||
private String contactPhone;
|
||||
@JSONField(name = "contact_email")
|
||||
private String contactEmail;
|
||||
private String address;
|
||||
private String suburb;
|
||||
private String postcode;
|
||||
private String state;
|
||||
private String country;
|
||||
private String timezone;
|
||||
private String jdindustry;
|
||||
private String royalpayindustry;
|
||||
|
||||
private String referrer_id;
|
||||
private String referrer_name;
|
||||
|
||||
private String client_apply_id;
|
||||
|
||||
private String business_hours;
|
||||
private String merchant_introduction;
|
||||
private String merchant_tag;
|
||||
private String merchant_video_url;
|
||||
|
||||
public JSONObject insertObject() {
|
||||
JSONObject res = (JSONObject) JSON.toJSON(this);
|
||||
if (client_apply_id==null){
|
||||
res.remove("client_apply_id");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public JSONObject updateObject() {
|
||||
JSONObject obj = insertObject();
|
||||
obj.remove("client_moniker");
|
||||
return obj;
|
||||
}
|
||||
|
||||
public String getClientMoniker() {
|
||||
return clientMoniker.toUpperCase();
|
||||
}
|
||||
|
||||
public void setClientMoniker(String clientMoniker) {
|
||||
this.clientMoniker = clientMoniker;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
public void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
public String getBusinessName() {
|
||||
return businessName;
|
||||
}
|
||||
|
||||
public void setBusinessName(String businessName) {
|
||||
this.businessName = businessName;
|
||||
}
|
||||
|
||||
public String getAbn() {
|
||||
return abn;
|
||||
}
|
||||
|
||||
public void setAbn(String abn) {
|
||||
this.abn = abn;
|
||||
}
|
||||
|
||||
public String getAcn() {
|
||||
return acn;
|
||||
}
|
||||
|
||||
public void setAcn(String acn) {
|
||||
this.acn = acn;
|
||||
}
|
||||
|
||||
public String getIndustry() {
|
||||
return industry;
|
||||
}
|
||||
|
||||
public void setIndustry(String industry) {
|
||||
this.industry = industry;
|
||||
}
|
||||
|
||||
public String getCompanyPhoto() {
|
||||
return companyPhoto;
|
||||
}
|
||||
|
||||
public void setCompanyPhoto(String companyPhoto) {
|
||||
this.companyPhoto = companyPhoto;
|
||||
}
|
||||
|
||||
public String getStorePhoto() {
|
||||
return storePhoto;
|
||||
}
|
||||
|
||||
public void setStorePhoto(String storePhoto) {
|
||||
this.storePhoto = storePhoto;
|
||||
}
|
||||
|
||||
public String getCompanyWebsite() {
|
||||
return companyWebsite;
|
||||
}
|
||||
|
||||
public void setCompanyWebsite(String companyWebsite) {
|
||||
this.companyWebsite = companyWebsite;
|
||||
}
|
||||
|
||||
public String getCompanyPhone() {
|
||||
return companyPhone;
|
||||
}
|
||||
|
||||
public void setCompanyPhone(String companyPhone) {
|
||||
this.companyPhone = companyPhone;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getSector() {
|
||||
return sector;
|
||||
}
|
||||
|
||||
public void setSector(String sector) {
|
||||
this.sector = sector;
|
||||
}
|
||||
|
||||
public String getLogoId() {
|
||||
return logoId;
|
||||
}
|
||||
|
||||
public void setLogoId(String logoId) {
|
||||
this.logoId = logoId;
|
||||
}
|
||||
|
||||
public String getContactPerson() {
|
||||
return contactPerson;
|
||||
}
|
||||
|
||||
public void setContactPerson(String contactPerson) {
|
||||
this.contactPerson = contactPerson;
|
||||
}
|
||||
|
||||
public String getContactPhone() {
|
||||
return contactPhone;
|
||||
}
|
||||
|
||||
public void setContactPhone(String contactPhone) {
|
||||
this.contactPhone = contactPhone;
|
||||
}
|
||||
|
||||
public String getContactEmail() {
|
||||
return contactEmail;
|
||||
}
|
||||
|
||||
public void setContactEmail(String contactEmail) {
|
||||
this.contactEmail = contactEmail;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getSuburb() {
|
||||
return suburb;
|
||||
}
|
||||
|
||||
public void setSuburb(String suburb) {
|
||||
this.suburb = suburb;
|
||||
}
|
||||
|
||||
public String getPostcode() {
|
||||
return postcode;
|
||||
}
|
||||
|
||||
public void setPostcode(String postcode) {
|
||||
this.postcode = postcode;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
public void setTimezone(String timezone) {
|
||||
this.timezone = timezone;
|
||||
}
|
||||
|
||||
public String getClient_apply_id() {
|
||||
return client_apply_id;
|
||||
}
|
||||
|
||||
public void setClient_apply_id(String client_apply_id) {
|
||||
this.client_apply_id = client_apply_id;
|
||||
}
|
||||
|
||||
public String getBusinessStructure() {
|
||||
return businessStructure;
|
||||
}
|
||||
|
||||
public void setBusinessStructure(String businessStructure) {
|
||||
this.businessStructure = businessStructure;
|
||||
}
|
||||
|
||||
public String getReferrer_id() {
|
||||
return referrer_id;
|
||||
}
|
||||
|
||||
public void setReferrer_id(String referrer_id) {
|
||||
this.referrer_id = referrer_id;
|
||||
}
|
||||
|
||||
public String getReferrer_name() {
|
||||
return referrer_name;
|
||||
}
|
||||
|
||||
public void setReferrer_name(String referrer_name) {
|
||||
this.referrer_name = referrer_name;
|
||||
}
|
||||
|
||||
public String getAlipayIndustry() {
|
||||
return alipayIndustry;
|
||||
}
|
||||
|
||||
public void setAlipayIndustry(String alipayIndustry) {
|
||||
this.alipayIndustry = alipayIndustry;
|
||||
}
|
||||
|
||||
public String getJdindustry() {
|
||||
return jdindustry;
|
||||
}
|
||||
|
||||
public void setJdindustry(String jdindustry) {
|
||||
this.jdindustry = jdindustry;
|
||||
}
|
||||
|
||||
public String getRoyalpayindustry() {
|
||||
return royalpayindustry;
|
||||
}
|
||||
|
||||
public void setRoyalpayindustry(String royalpayindustry) {
|
||||
this.royalpayindustry = royalpayindustry;
|
||||
}
|
||||
|
||||
public String getBusiness_hours() {
|
||||
return business_hours;
|
||||
}
|
||||
|
||||
public void setBusiness_hours(String business_hours) {
|
||||
this.business_hours = business_hours;
|
||||
}
|
||||
|
||||
public String getMerchant_introduction() {
|
||||
return merchant_introduction;
|
||||
}
|
||||
|
||||
public void setMerchant_introduction(String merchant_introduction) {
|
||||
this.merchant_introduction = merchant_introduction;
|
||||
}
|
||||
|
||||
public String getMerchant_tag() {
|
||||
return merchant_tag;
|
||||
}
|
||||
|
||||
public void setMerchant_tag(String merchant_tag) {
|
||||
this.merchant_tag = merchant_tag;
|
||||
}
|
||||
|
||||
public String getMerchant_video_url() {
|
||||
return merchant_video_url;
|
||||
}
|
||||
|
||||
public void setMerchant_video_url(String merchant_video_url) {
|
||||
this.merchant_video_url = merchant_video_url;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package au.com.royalpay.payment.manage.dev.core;
|
||||
|
||||
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
|
||||
import au.com.royalpay.payment.manage.dev.bean.AliExcel;
|
||||
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface AliforexcelService {
|
||||
JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package au.com.royalpay.payment.manage.dev.core;
|
||||
|
||||
import au.com.royalpay.payment.manage.dev.bean.ClientTestRegisterInfo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018-6-28.
|
||||
*/
|
||||
public interface NewpartnerService {
|
||||
@Transactional
|
||||
JSONObject registerClient(String clientMoniker, ClientTestRegisterInfo registery, JSONObject manager);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package au.com.royalpay.payment.manage.dev.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.manage.dev.bean.AliExcel;
|
||||
import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
|
||||
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AliforexcelServiceImpl implements AliforexcelService {
|
||||
@Resource
|
||||
private ClientMapper clientMapper;
|
||||
|
||||
@Override
|
||||
public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) {
|
||||
OutputStream ous = null;
|
||||
try{
|
||||
JSONObject params = query.toJsonParam();
|
||||
List<JSONObject> partners = clientMapper.passPartners(params);
|
||||
httpResponse.setContentType("application/octet-stream;");
|
||||
httpResponse.setCharacterEncoding("utf-8");
|
||||
String fileName = "支付宝进件专用--";
|
||||
String codedFileName = java.net.URLEncoder.encode(fileName, "UTF-8");
|
||||
httpResponse.addHeader("Content-Disposition", "attachment; filename=" + codedFileName +query.getDatefrom() + "~" +query.getDateto() + ".xls");
|
||||
ous = httpResponse.getOutputStream();
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("支付宝进件专用" );
|
||||
sheet.createFreezePane(1, 2);
|
||||
sheet.setDefaultColumnWidth((short) 25);
|
||||
int rowNum = 0;
|
||||
Row row = sheet.createRow(rowNum);
|
||||
String[] title = {"Company name", "Store name", "Partner Code","Industry","Store address","Business hours","Contact information","Video link (optional)","Store description","Tags"};
|
||||
for (int i = 0; i < title.length; i++) {
|
||||
row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]);
|
||||
}
|
||||
for(JSONObject partner : partners){
|
||||
row = sheet.createRow(++rowNum);
|
||||
row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("company_name"));
|
||||
row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("short_name"));
|
||||
row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("client_moniker"));
|
||||
row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("alipayindustry"));
|
||||
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("address")+","+partner.getString("suburb") + "," + partner.getString("state") + "," + partner.getString("postcode"));
|
||||
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("business_hours"));
|
||||
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("company_phone"));
|
||||
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(partner.getString(""));
|
||||
row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("merchant_introduction"));
|
||||
row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(partner.getString(""));
|
||||
}
|
||||
wb.write(ous);
|
||||
ous.flush();
|
||||
|
||||
|
||||
}catch (IOException e){
|
||||
} finally {
|
||||
IOUtils.closeQuietly(ous);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
package au.com.royalpay.payment.manage.dev.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
|
||||
import au.com.royalpay.payment.manage.dev.bean.ClientTestRegisterInfo;
|
||||
import au.com.royalpay.payment.manage.dev.core.NewpartnerService;
|
||||
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
|
||||
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018-6-28.
|
||||
*/
|
||||
@Service
|
||||
public class NewpartnerServiceImpl implements NewpartnerService {
|
||||
@Resource
|
||||
private ClientMapper clientMapper;
|
||||
@Resource
|
||||
private ClientConfigService clientConfigService;
|
||||
@Resource
|
||||
private AttachmentClient attachmentClient;
|
||||
|
||||
|
||||
|
||||
@Cacheable(value = ":app_client_info_moniker:", key = "#clientMoniker")
|
||||
public JSONObject getClientInfoByMoniker(String clientMoniker) {
|
||||
return clientMapper.findClientByMoniker(clientMoniker);
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
public JSONObject registerClient(String clientMoniker, ClientTestRegisterInfo registery, JSONObject manager) {
|
||||
JSONObject partner = registery.insertObject();
|
||||
if (clientMoniker != null && !clientMoniker.equals("")) {
|
||||
JSONObject superClient = getClientInfoByMoniker(clientMoniker);
|
||||
if (superClient == null) {
|
||||
throw new InvalidShortIdException();
|
||||
} else {
|
||||
checkOrgPermission(manager, superClient);
|
||||
partner.put("parent_client_id", superClient.getIntValue("client_id"));
|
||||
}
|
||||
}
|
||||
partner.put("create_time", new Date());
|
||||
partner.put("ali_sub_merchant_id", registery.getClientMoniker());
|
||||
partner.put("credential_code", RandomStringUtils.random(32, true, true));
|
||||
partner.put("creator", manager.getString("manager_id"));
|
||||
partner.put("contact_phone", "+611111111111111");
|
||||
partner.put("industry", "327");
|
||||
partner.put("contact_email", "a@qq.com");
|
||||
partner.put("contact_person", "aa");
|
||||
partner.put("company_name", "AA");
|
||||
partner.put("short_name", "a");
|
||||
partner.put("company_phone", "+611111111111111");
|
||||
|
||||
// if (manager.getIntValue("org_id") == 0) {
|
||||
// throw new ForbiddenException("You were not belong to any organizations so that you cannot create new
|
||||
// client");
|
||||
// }
|
||||
partner.put("org_id", 1);
|
||||
partner.put("approve_result", 1);
|
||||
partner.put("approve_time", new Date());
|
||||
partner.put("open_status", 5);
|
||||
|
||||
if (StringUtils.isNotEmpty(registery.getLogoId())) {
|
||||
partner.put("logo_url", attachmentClient.getFileUrl(registery.getLogoId()));
|
||||
partner.put("logo_thumbnail", attachmentClient.getThumbnail(registery.getLogoId(), 600).getString("url"));
|
||||
}
|
||||
if (ManagerRole.OPERATOR.hasRole(manager.getIntValue("role"))) {
|
||||
partner.put("approve_result", 1);
|
||||
partner.put("approver", manager.getString("manager_id"));
|
||||
partner.put("approve_time", new Date());
|
||||
}
|
||||
if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
|
||||
partner.put("bd_user", manager.getString("manager_id"));
|
||||
partner.put("bd_user_name", manager.getString("display_name"));
|
||||
}
|
||||
if (clientMapper.findClientByMoniker(registery.getClientMoniker()) != null) {
|
||||
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
|
||||
}
|
||||
try {
|
||||
clientMapper.save(partner);
|
||||
JSONObject clientConfig = new JSONObject();
|
||||
clientConfig.put("client_id", partner.getIntValue("client_id"));
|
||||
clientConfig.put("client_moniker", partner.getString("client_moniker"));
|
||||
clientConfigService.save(clientConfig);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return partner;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package au.com.royalpay.payment.manage.management.sysconfig.beans;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/07/05.
|
||||
*/
|
||||
public class PartnerModuleInfo {
|
||||
|
||||
@JSONField(name = "js_module")
|
||||
private String jsModule;
|
||||
@JSONField(name = "js_path")
|
||||
private String jsPath;
|
||||
private String remark;
|
||||
@JSONField(name = "initialize")
|
||||
private Boolean initialize;
|
||||
|
||||
public String getJsModule() {
|
||||
return jsModule;
|
||||
}
|
||||
|
||||
public void setJsModule(String jsModule) {
|
||||
this.jsModule = jsModule;
|
||||
}
|
||||
|
||||
public String getJsPath() {
|
||||
return jsPath;
|
||||
}
|
||||
|
||||
public void setJsPath(String jsPath) {
|
||||
this.jsPath = jsPath;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Boolean getInitialize() {
|
||||
return initialize;
|
||||
}
|
||||
|
||||
public void setInitialize(Boolean initialize) {
|
||||
this.initialize = initialize;
|
||||
}
|
||||
|
||||
public void initObject(JSONObject mod) {
|
||||
mod.put("id", mod.getLong("id"));
|
||||
mod.put("js_module", getJsModule());
|
||||
mod.put("js_path", getJsPath());
|
||||
mod.put("remark", getRemark());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package au.com.royalpay.payment.manage.management.sysconfig.beans;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/4
|
||||
*/
|
||||
public class PermissionClientVO {
|
||||
private Long id;
|
||||
private String clientMoniker;
|
||||
private int clientId;
|
||||
private boolean isValid;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getClientMoniker() {
|
||||
return clientMoniker;
|
||||
}
|
||||
|
||||
public void setClientMoniker(String clientMoniker) {
|
||||
this.clientMoniker = clientMoniker;
|
||||
}
|
||||
|
||||
public int getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(int clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public boolean getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
public void setValid(boolean valid) {
|
||||
isValid = valid;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package au.com.royalpay.payment.manage.management.sysconfig.core;
|
||||
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo;
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/07/05.
|
||||
*/
|
||||
public interface PermissionPartnerManager {
|
||||
void synchronizeFunctions();
|
||||
|
||||
JSONObject listFunctions();
|
||||
|
||||
List<JSONObject> listModules();
|
||||
|
||||
void saveOrUpdateModule(String moduleName, PartnerModuleInfo module);
|
||||
|
||||
void checkAndDeleteModule(String moduleName);
|
||||
|
||||
void updateFuncInfo(String funcId, FuncInfo funcInfo);
|
||||
|
||||
void setFunctionModule(String funcId, String moduleName);
|
||||
|
||||
List<String> listRoleFunctions(ManagerRole role);
|
||||
|
||||
void authorizeRole(ManagerRole role, List<String> functions);
|
||||
|
||||
List<JSONObject> listUserFunctions(int role);
|
||||
|
||||
JSONObject getPartnerFuncById(String funcId);
|
||||
|
||||
void permissionClientModuleSave(int clientId,String clientMoniker);
|
||||
}
|
||||
@ -0,0 +1,223 @@
|
||||
package au.com.royalpay.payment.manage.management.sysconfig.core.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo;
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo;
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager;
|
||||
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerFunctionMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerModuleMapper;
|
||||
import au.com.royalpay.payment.manage.permission.manager.scanner.PermissionNode;
|
||||
import au.com.royalpay.payment.manage.permission.manager.scanner.PermissionPartnerReader;
|
||||
import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import au.com.royalpay.payment.tools.utils.id.IdUtil;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/07/05.
|
||||
*/
|
||||
@Service
|
||||
public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
|
||||
@Resource
|
||||
private PermissionPartnerFunctionMapper permissionPartnerFunctionMapper;
|
||||
@Resource
|
||||
private PermissionPartnerModuleMapper permissionPartnerModuleMapper;
|
||||
@Resource
|
||||
private PermissionPartnerReader permissionPartnerReader;
|
||||
@Resource
|
||||
private PermissionClientModuleMapper permissionClientModuleMapper;
|
||||
@Resource
|
||||
private PermissionClientModulesService permissionClientModulesService;
|
||||
@Resource
|
||||
private ClientMapper clientMapper;
|
||||
|
||||
@Override
|
||||
public void synchronizeFunctions() {
|
||||
List<JSONObject> functions = permissionPartnerFunctionMapper.listAll();
|
||||
Map<String, JSONObject> funcMapFromDB = new HashMap<>();
|
||||
for (JSONObject func : functions) {
|
||||
funcMapFromDB.put(func.getString("func_id"), func);
|
||||
}
|
||||
|
||||
List<PermissionNode> nodes = permissionPartnerReader.listFunctions();
|
||||
for (PermissionNode node : nodes) {
|
||||
String funcId = node.getFuncId();
|
||||
if (funcMapFromDB.containsKey(funcId)) {
|
||||
funcMapFromDB.remove(funcId);
|
||||
JSONObject func = node.initFuncObject();
|
||||
func.remove("role");
|
||||
permissionPartnerFunctionMapper.update(func);
|
||||
} else {
|
||||
JSONObject func = node.initFuncObject();
|
||||
permissionPartnerFunctionMapper.save(func);
|
||||
}
|
||||
}
|
||||
|
||||
for (String funcId : funcMapFromDB.keySet()) {
|
||||
permissionPartnerFunctionMapper.delete(funcId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject listFunctions() {
|
||||
List<JSONObject> funcs = permissionPartnerFunctionMapper.listAll();
|
||||
Map<String, List<JSONObject>> moduleMap = new TreeMap<>();
|
||||
List<JSONObject> noModule = new ArrayList<>();
|
||||
for (JSONObject func : funcs) {
|
||||
String module = func.getString("module");
|
||||
if (module == null) {
|
||||
noModule.add(func);
|
||||
continue;
|
||||
}
|
||||
List<JSONObject> funcsInModule = moduleMap.get(module);
|
||||
if (funcsInModule == null) {
|
||||
funcsInModule = new ArrayList<>();
|
||||
moduleMap.put(module, funcsInModule);
|
||||
}
|
||||
funcsInModule.add(func);
|
||||
}
|
||||
JSONObject report = new JSONObject();
|
||||
report.put("no_module", noModule);
|
||||
List<JSONObject> modules = new ArrayList<>();
|
||||
for (String module : moduleMap.keySet()) {
|
||||
JSONObject mod = new JSONObject();
|
||||
mod.put("module_name", module);
|
||||
List<JSONObject> funcList = moduleMap.get(module);
|
||||
mod.put("remark", funcList.get(0).getString("mod_remark"));
|
||||
mod.put("module_id", funcList.get(0).getString("module_id"));
|
||||
mod.put("js_module", funcList.get(0).getString("js_module"));
|
||||
mod.put("js_path", funcList.get(0).getString("js_path"));
|
||||
mod.put("funcs", funcList);
|
||||
modules.add(mod);
|
||||
}
|
||||
|
||||
report.put("modules", modules);
|
||||
return report;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void permissionClientModuleSave(int clientId, String clientMoniker) {
|
||||
List<JSONObject> moduleId = permissionPartnerModuleMapper.list();
|
||||
for (JSONObject moduleClientAdd : moduleId) {
|
||||
moduleClientAdd.put("client_id", clientId);
|
||||
moduleClientAdd.put("client_moniker", clientMoniker);
|
||||
moduleClientAdd.put("module_id", moduleClientAdd.getString("id"));
|
||||
moduleClientAdd.put("is_valid", 1);
|
||||
permissionClientModulesService.save(moduleClientAdd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> listModules() {
|
||||
return permissionPartnerModuleMapper.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateModule(String moduleName, PartnerModuleInfo module) {
|
||||
JSONObject mod = permissionPartnerModuleMapper.find(moduleName);
|
||||
if (mod == null) {
|
||||
mod = new JSONObject();
|
||||
mod.put("module_name", moduleName);
|
||||
module.initObject(mod);
|
||||
permissionPartnerModuleMapper.save(mod);
|
||||
List<JSONObject> IdandMoniker = clientMapper.listClientsIdAndMoniker();
|
||||
JSONObject nModuleId = permissionPartnerModuleMapper.listModuleId(moduleName);
|
||||
for (JSONObject clientMod : IdandMoniker) {
|
||||
clientMod.put("client_id", clientMod.getString("client_id"));
|
||||
clientMod.put("client_moniker", clientMod.getString("client_moniker"));
|
||||
clientMod.put("module_id", nModuleId.getString("id"));
|
||||
clientMod.put("is_valid", module.getInitialize());
|
||||
clientMod.put("id", IdUtil.getId());
|
||||
permissionClientModulesService.save(clientMod);
|
||||
}
|
||||
}
|
||||
|
||||
module.initObject(mod);
|
||||
permissionPartnerModuleMapper.update(mod);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkAndDeleteModule(String moduleName) {
|
||||
List<JSONObject> funcs = permissionPartnerFunctionMapper.listByModule(moduleName);
|
||||
if (funcs.isEmpty()) {
|
||||
permissionClientModuleMapper.delete(moduleName);
|
||||
permissionPartnerModuleMapper.delete(moduleName);
|
||||
|
||||
} else {
|
||||
throw new BadRequestException("Module have functions. Move them first.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFuncInfo(String funcId, FuncInfo funcInfo) {
|
||||
JSONObject update = new JSONObject();
|
||||
update.put("func_id", funcId);
|
||||
update.put("name", funcInfo.getName());
|
||||
update.put("remark", funcInfo.getRemark());
|
||||
permissionPartnerFunctionMapper.update(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = ":login:managers:", allEntries = true)
|
||||
public void setFunctionModule(String funcId, String moduleName) {
|
||||
if (moduleName == null) {
|
||||
throw new BadRequestException("module name not provided");
|
||||
}
|
||||
JSONObject mod = permissionPartnerModuleMapper.find(moduleName);
|
||||
if (mod == null) {
|
||||
throw new BadRequestException("Module:" + moduleName + " not exists!");
|
||||
}
|
||||
JSONObject nModuleId = permissionPartnerModuleMapper.listModuleId(moduleName);
|
||||
JSONObject update = new JSONObject();
|
||||
update.put("func_id", funcId);
|
||||
update.put("module", moduleName);
|
||||
update.put("module_id", nModuleId.getString("id"));
|
||||
permissionPartnerFunctionMapper.update(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listRoleFunctions(ManagerRole role) {
|
||||
List<JSONObject> funcs = permissionPartnerFunctionMapper.listByRoleMask(role.getMask());
|
||||
List<String> funcIds = new ArrayList<>();
|
||||
for (JSONObject func : funcs) {
|
||||
funcIds.add(func.getString("func_id"));
|
||||
}
|
||||
return funcIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(value = ":login:managers:", allEntries = true)
|
||||
public void authorizeRole(ManagerRole role, List<String> functions) {
|
||||
permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask());
|
||||
permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> listUserFunctions(int role) {
|
||||
return permissionPartnerFunctionMapper.listByRoleMask(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getPartnerFuncById(String funcId) {
|
||||
return permissionPartnerFunctionMapper.find(funcId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package au.com.royalpay.payment.manage.management.sysconfig.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.beans.PermissionClientVO;
|
||||
import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2017-02-28.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping( value = "/sys/permission")
|
||||
public class SysPermissionClientController {
|
||||
@Resource
|
||||
private PermissionClientModulesService permissionClientModulesService;
|
||||
|
||||
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public List<JSONObject> list(@RequestParam String client_moniker) {
|
||||
return permissionClientModulesService.listByClientMoniker(client_moniker);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.POST)
|
||||
public void modify(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @PathVariable Long id, @RequestBody PermissionClientVO permissionClientVO) {
|
||||
permissionClientModulesService.switchValid(id,permissionClientVO.getIsValid(),loginManager);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package au.com.royalpay.payment.manage.management.sysconfig.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo;
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo;
|
||||
import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/07/05.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping( value = "/sys/permissionPartner")
|
||||
public class SysPermissionPartnerConfigController {
|
||||
@Resource
|
||||
private PermissionPartnerManager permissionPartnerManager;
|
||||
|
||||
@RequestMapping(value = "/synchronize", method = RequestMethod.POST)
|
||||
public void synchronizeFunctions() {
|
||||
permissionPartnerManager.synchronizeFunctions();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/functions", method = RequestMethod.GET)
|
||||
public JSONObject listFunctions() {
|
||||
return permissionPartnerManager.listFunctions();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/functions/{funcId}.end", method = RequestMethod.PUT)
|
||||
public void updateFunctionInfo(@PathVariable String funcId, @RequestBody FuncInfo funcInfo) {
|
||||
permissionPartnerManager.updateFuncInfo(funcId, funcInfo);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/functions/{funcId}/modules", method = RequestMethod.PUT)
|
||||
public void setFuncModule(@PathVariable String funcId, @RequestBody JSONObject module) {
|
||||
permissionPartnerManager.setFunctionModule(funcId, module.getString("module_name"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/modules", method = RequestMethod.GET)
|
||||
public List<JSONObject> listModuless() {
|
||||
return permissionPartnerManager.listModules();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/modules/{moduleName}.end", method = RequestMethod.PUT)
|
||||
public void updateModulee(@PathVariable String moduleName, @RequestBody PartnerModuleInfo module) {
|
||||
permissionPartnerManager.saveOrUpdateModule(moduleName, module);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/modules/{moduleName}.end", method = RequestMethod.DELETE)
|
||||
public void deleteModulee(@PathVariable String moduleName) {
|
||||
permissionPartnerManager.checkAndDeleteModule(moduleName);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/roles/{roleMask}/functions", method = RequestMethod.GET)
|
||||
public List<String> listRoleAuthorizedFunctions(@PathVariable String roleMask) {
|
||||
try {
|
||||
int mask = Integer.parseInt(roleMask, 2);
|
||||
for (ManagerRole role : ManagerRole.values()) {
|
||||
if (mask == role.getMask()) {
|
||||
return permissionPartnerManager.listRoleFunctions(role);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
throw new BadRequestException("Invalid role mask:" + roleMask);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/roles/{roleMask}/functions",method = RequestMethod.PUT)
|
||||
public void authorizeRole(@PathVariable String roleMask, @RequestBody List<String> functions){
|
||||
try {
|
||||
int mask = Integer.parseInt(roleMask, 2);
|
||||
for (ManagerRole role : ManagerRole.values()) {
|
||||
if (mask == role.getMask()) {
|
||||
permissionPartnerManager.authorizeRole(role,functions);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
throw new BadRequestException("Invalid role mask:" + roleMask);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package au.com.royalpay.payment.manage.mappers.act;
|
||||
|
||||
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 com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
@AutoMapper(tablename = "act_charity", pkName = "client_moniker")
|
||||
public interface ActChairtyMapper {
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findChairtyClient(@Param("client_moniker") String clientMoniker);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject chairtyClient);
|
||||
|
||||
PageList<JSONObject> chairtyClientNum(PageBounds pageBounds);
|
||||
|
||||
List<JSONObject> getChairtyWeekAnalysis(@Param("begin") Date begin, @Param("end") Date end);
|
||||
|
||||
PageList<JSONObject> getChairtyWeekRaking(@Param("begin") Date begin, @Param("end") Date end,PageBounds pageBounds);
|
||||
|
||||
List<JSONObject> chairtyClientNum();
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
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 com.fasterxml.jackson.databind.jsonFormatVisitors.JsonAnyFormatVisitor;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2017-02-28.
|
||||
*/
|
||||
@AutoMapper(tablename = "sys_permission_partner_modules_clients", pkName = "id")
|
||||
public interface PermissionClientModuleMapper {
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject clientmodules);
|
||||
|
||||
void delete(@Param("module_name") String moduleName);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2017-02-28.
|
||||
*/
|
||||
@AutoMapper(tablename = "sys_permission_partner_functions", pkName = "func_id")
|
||||
public interface PermissionPartnerFunctionMapper {
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject func);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject func);
|
||||
|
||||
List<JSONObject> listByRoleMask(@Param("mask") int mask);
|
||||
|
||||
List<JSONObject> listAll();
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> listByModule(@Param("module") String moduleName);
|
||||
|
||||
@AutoSql(type = SqlType.DELETE)
|
||||
void delete(@Param("func_id") String funcId);
|
||||
|
||||
void clearRolePermission(@Param("mask") int mask);
|
||||
|
||||
void authorizeRole(@Param("mask") int mask, @Param("func_ids") List<String> functions);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject find(@Param("func_id") String funcId);
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2017-02-28.
|
||||
*/
|
||||
@AutoMapper(tablename = "sys_permission_partner_modules", pkName = "id",pkAutoIncrement = true)
|
||||
public interface PermissionPartnerModuleMapper {
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject module);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject module);
|
||||
|
||||
@AutoSql(type = SqlType.DELETE)
|
||||
void delete(@Param("module_name") String moduleName);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> list();
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject find(@Param("module_name") String moduleName);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject listModuleId(@Param("module_name") String moduleName);
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2017-02-28.
|
||||
*/
|
||||
@AutoMapper(tablename = "sys_permission_partner_modules_clients", pkName = "id")
|
||||
public interface SysPermissionClientModulesMapper {
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject module);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject module);
|
||||
|
||||
@AutoSql(type = SqlType.DELETE)
|
||||
void delete(@Param("id") Long id);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> listByClientId(@Param("client_id") int client_id);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject find(@Param("id") Long id);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> listByClientMoniker(@Param("client_moniker")String client_moniker);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
@AdvanceSelect(addonWhereClause = "is_valid = 1")
|
||||
List<JSONObject> listValidByClientId(@Param("client_id") int client_id);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,104 @@
|
||||
package au.com.royalpay.payment.manage.permission.manager.scanner;
|
||||
|
||||
import au.com.royalpay.payment.manage.permission.manager.RequirePartner;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2017-02-28.
|
||||
*/
|
||||
@Component
|
||||
public class PartnerPermissionScanner implements BeanPostProcessor, PermissionPartnerReader {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private Map<String, PermissionNode> permissionNodes = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
Class<?> clazz = bean.getClass();
|
||||
if (AnnotatedElementUtils.isAnnotated(clazz, Controller.class)) {
|
||||
|
||||
Method[] methods = clazz.getDeclaredMethods();
|
||||
RequestMapping clazzRequestMapping = AnnotatedElementUtils.findMergedAnnotation(clazz, RequestMapping.class);
|
||||
RequirePartner clazzPermission = AnnotatedElementUtils.findMergedAnnotation(clazz, RequirePartner.class);
|
||||
for (Method method : methods) {
|
||||
if (AnnotatedElementUtils.isAnnotated(method, RequestMapping.class)) {
|
||||
RequestMapping methodMapping = AnnotatedElementUtils.findMergedAnnotation(method, RequestMapping.class);
|
||||
RequirePartner methodPermission = AnnotatedElementUtils.findMergedAnnotation(method, RequirePartner.class);
|
||||
|
||||
if (clazzPermission != null || methodPermission != null) {
|
||||
registerPermissionMapping(clazz, method, clazzRequestMapping, clazzPermission, methodMapping, methodPermission);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
private void registerPermissionMapping(Class<?> controller, Method method, RequestMapping clazzRequestMapping, RequirePartner clazzPermission, RequestMapping methodMapping, RequirePartner methodPermission) {
|
||||
|
||||
//get request uri and methods
|
||||
PermissionNode node = new PermissionNode(controller.getSimpleName(), method.getName());
|
||||
getRequestInfo(node, clazzRequestMapping, methodMapping);
|
||||
node.setPartnerPermissions(clazzPermission, methodPermission);
|
||||
logger.debug("register permission:" + node.getFuncName() + ":" + node.getRequestId());
|
||||
if (permissionNodes.containsKey(node.getFuncId())) {
|
||||
throw new RuntimeException("Duplicated permission function ID:" + controller.getName() + "." + method.getName());
|
||||
}
|
||||
permissionNodes.put(node.getFuncId(), node);
|
||||
|
||||
}
|
||||
|
||||
private void getRequestInfo(PermissionNode node, RequestMapping clazzRequestMapping, RequestMapping methodMapping) {
|
||||
String uri = "";
|
||||
RequestMethod[] methods = {};
|
||||
if (clazzRequestMapping != null) {
|
||||
if (clazzRequestMapping.value().length > 0) {
|
||||
uri += clazzRequestMapping.value()[0];
|
||||
}
|
||||
methods = clazzRequestMapping.method();
|
||||
}
|
||||
if (!uri.startsWith("/")) {
|
||||
uri = "/" + uri;
|
||||
}
|
||||
if (uri.endsWith("/")) {
|
||||
uri = uri.substring(0, uri.length() - 1);
|
||||
}
|
||||
if (methodMapping.value().length > 0) {
|
||||
String val = methodMapping.value()[0];
|
||||
if (val.startsWith("/")) {
|
||||
val = val.substring(1);
|
||||
}
|
||||
uri += "/" + val;
|
||||
}
|
||||
if (methodMapping.method().length > 0) {
|
||||
methods = methodMapping.method();
|
||||
}
|
||||
node.setUri(uri);
|
||||
node.setMethods(methods);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PermissionNode> listFunctions() {
|
||||
return new ArrayList<>(permissionNodes.values());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package au.com.royalpay.payment.manage.permission.manager.scanner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2017-02-28.
|
||||
*/
|
||||
public interface PermissionPartnerReader {
|
||||
List<PermissionNode> listFunctions();
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package au.com.royalpay.payment.manage.system.core;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/4
|
||||
*/
|
||||
public interface PermissionClientModulesService {
|
||||
|
||||
void save(JSONObject record);
|
||||
|
||||
List<JSONObject> listValidByClientId(int clientId);
|
||||
|
||||
List<JSONObject> listByClientMoniker(String clientMoniker);
|
||||
|
||||
void switchValid(Long id,boolean isValid,JSONObject account);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package au.com.royalpay.payment.manage.system.core;
|
||||
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/5
|
||||
*/
|
||||
@Service
|
||||
public class SystemPackageCacheSupport {
|
||||
|
||||
@CacheEvict(value = ":system:client_permission:", key = "#client_moniker")
|
||||
public void clearClientPermission(String client_moniker){
|
||||
|
||||
}
|
||||
@CacheEvict(value = ":system:client_permission:", key = "#client_id+''")
|
||||
public void clearClientPermission(int client_id){
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package au.com.royalpay.payment.manage.system.core.beans;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/4
|
||||
*/
|
||||
@Document(collection = "permission_client_module_log")
|
||||
public class PermissionClientModuleLog {
|
||||
|
||||
private long id;
|
||||
private int clientId;
|
||||
private String clientMoniker;
|
||||
private String business;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String originData;
|
||||
private String newData;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+10")
|
||||
private Date createTime;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(int clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientMoniker() {
|
||||
return clientMoniker;
|
||||
}
|
||||
|
||||
public void setClientMoniker(String clientMoniker) {
|
||||
this.clientMoniker = clientMoniker;
|
||||
}
|
||||
|
||||
public String getBusiness() {
|
||||
return business;
|
||||
}
|
||||
|
||||
public void setBusiness(String business) {
|
||||
this.business = business;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getOriginData() {
|
||||
return originData;
|
||||
}
|
||||
|
||||
public void setOriginData(String originData) {
|
||||
this.originData = originData;
|
||||
}
|
||||
|
||||
public String getNewData() {
|
||||
return newData;
|
||||
}
|
||||
|
||||
public void setNewData(String newData) {
|
||||
this.newData = newData;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package au.com.royalpay.payment.manage.system.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.system.SysPermissionClientModulesMapper;
|
||||
import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
|
||||
import au.com.royalpay.payment.manage.system.core.SystemPackageCacheSupport;
|
||||
import au.com.royalpay.payment.manage.system.core.beans.PermissionClientModuleLog;
|
||||
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
|
||||
import au.com.royalpay.payment.tools.utils.id.IdUtil;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/4
|
||||
*/
|
||||
@Service
|
||||
public class PermissionClientModulesServiceImpl implements PermissionClientModulesService {
|
||||
|
||||
@Resource
|
||||
private SysPermissionClientModulesMapper permissionClientModulesMapper;
|
||||
|
||||
@Resource
|
||||
private MongoTemplate mongoTemplate;
|
||||
@Resource
|
||||
private SystemPackageCacheSupport systemPackageCacheSupport;
|
||||
|
||||
|
||||
@Override
|
||||
public void save(JSONObject record) {
|
||||
record.put("id",IdUtil.getId());
|
||||
permissionClientModulesMapper.save(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = ":system:client_permission:", key = "#clientId+''")
|
||||
public List<JSONObject> listValidByClientId(int clientId) {
|
||||
return permissionClientModulesMapper.listValidByClientId(clientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = ":system:client_permission:", key = "#clientMoniker")
|
||||
public List<JSONObject> listByClientMoniker(String clientMoniker) {
|
||||
return permissionClientModulesMapper.listByClientMoniker(clientMoniker);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void switchValid(Long id, boolean isValid, JSONObject account) {
|
||||
JSONObject record = permissionClientModulesMapper.find(id);
|
||||
if (record == null) {
|
||||
throw new NotFoundException("Permission Client Module Not Found id:" + id);
|
||||
}
|
||||
JSONObject updateRecord = new JSONObject();
|
||||
updateRecord.put("is_valid", isValid);
|
||||
saveMongoLog(account,record,updateRecord,(isValid?"打开":"关闭")+"模块 id:"+record.getString("module_id"));
|
||||
updateRecord.put("id", record.getLong("id"));
|
||||
permissionClientModulesMapper.update(updateRecord);
|
||||
systemPackageCacheSupport.clearClientPermission(record.getString("client_moniker"));
|
||||
systemPackageCacheSupport.clearClientPermission(record.getIntValue("client_id"));
|
||||
|
||||
}
|
||||
|
||||
private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) {
|
||||
modifyData.remove("id");
|
||||
PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog();
|
||||
mongoRecord.setBusiness(business);
|
||||
mongoRecord.setClientId(oldRecord.getIntValue("client_id"));
|
||||
mongoRecord.setClientMoniker(oldRecord.getString("client_moniker"));
|
||||
mongoRecord.setCreateTime(new Date());
|
||||
mongoRecord.setId(IdUtil.getId());
|
||||
mongoRecord.setUserId(account.getString("manager_id"));
|
||||
mongoRecord.setUserName(account.getString("display_name"));
|
||||
mongoRecord.setNewData(modifyData.toJSONString());
|
||||
Map<String, Object> beforeModify = modifyData.keySet().stream().collect(Collectors.toMap(key -> key, oldRecord::get));
|
||||
mongoRecord.setOriginData(JSON.toJSONString(beforeModify));
|
||||
mongoTemplate.insert(mongoRecord);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
<?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.act.ActChairtyMapper">
|
||||
<select id="chairtyClientNum" resultType="com.alibaba.fastjson.JSONObject">
|
||||
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.transaction_time>='2018-07-09'
|
||||
and pmt_transactions.channel != 'Settlement'
|
||||
GROUP BY act_charity.client_id order by count_ordernum desc
|
||||
</select>
|
||||
<select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
||||
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')
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getChairtyWeekRaking" resultType="com.alibaba.fastjson.JSONObject">
|
||||
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
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,8 @@
|
||||
<?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.system.PermissionClientModuleMapper">
|
||||
<delete id="delete">
|
||||
delete from sys_permission_partner_modules_clients
|
||||
where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name})
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,39 @@
|
||||
<?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.system.PermissionPartnerFunctionMapper">
|
||||
<sql id="joinModule">
|
||||
SELECT
|
||||
f.*,
|
||||
m.js_module,
|
||||
m.js_path,
|
||||
m.remark mod_remark
|
||||
FROM sys_permission_partner_functions f
|
||||
LEFT JOIN sys_permission_partner_modules m ON m.module_name = f.module
|
||||
</sql>
|
||||
<update id="clearRolePermission">
|
||||
<![CDATA[
|
||||
UPDATE sys_permission_partner_functions
|
||||
SET role = role & #{mask}
|
||||
]]>
|
||||
</update>
|
||||
<update id="authorizeRole">
|
||||
<![CDATA[
|
||||
UPDATE sys_permission_partner_functions
|
||||
SET role = role | #{mask}
|
||||
WHERE func_id in
|
||||
]]>
|
||||
<foreach collection="func_ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<select id="listByRoleMask" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<include refid="joinModule"/>
|
||||
<![CDATA[
|
||||
WHERE f.role & #{mask} >0
|
||||
]]>
|
||||
</select>
|
||||
<select id="listAll" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<include refid="joinModule"/>
|
||||
ORDER BY f.module ASC,f.func_id ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,19 @@
|
||||
<?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.system.SysPermissionClientModulesMapper">
|
||||
<sql id="joinModule">
|
||||
SELECT
|
||||
f.*,
|
||||
m.js_module,
|
||||
m.js_path,
|
||||
m.remark mod_remark
|
||||
FROM sys_permission_functions f
|
||||
LEFT JOIN sys_permission_modules m ON m.module_name = f.module
|
||||
</sql>
|
||||
|
||||
<select id="listByClientMoniker" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select pmc.*,pm.module_name from sys_permission_partner_modules_clients pmc left join sys_permission_partner_modules pm
|
||||
on pmc.module_id = pm.id and pmc.client_moniker = #{client_moniker}
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,138 @@
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group col-xs-12 col-sm-12">
|
||||
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="form-control-static form-inline">
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-from-input"
|
||||
ng-model="params.begin"
|
||||
uib-datepicker-popup size="10" placeholder="From"
|
||||
is-open="dateBegin.open" ng-click="dateBegin.open=true"
|
||||
datepicker-options="{maxDate:params.end||today}">
|
||||
</div>
|
||||
~
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-to-input" ng-model="params.end"
|
||||
uib-datepicker-popup size="10" placeholder="To"
|
||||
is-open="dateTo.open" ng-click="dateTo.open=true"
|
||||
datepicker-options="{minDate:params.begin,maxDate:today}">
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm"
|
||||
ng-click="thisMonth()">This Month</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm" ng-click="lastMonth()">Last Month</a>
|
||||
</div>
|
||||
<button class="btn btn-success" type="button"
|
||||
ng-click="doAnalysis()">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<!--<div class="box-header with-border">Trading customer quantity trends</div>-->
|
||||
<div class="box-body">
|
||||
<div class="chart col-md-12" echarts="settleDelayHistory" style="height: 300px"
|
||||
chart-setter="settleDelayEchart($chart)"
|
||||
ng-class="{nodata:redPackSendLogsHistory.nodata}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Chairty Ranking</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row cen col-sm-12">
|
||||
<div class="col-md-6">
|
||||
<p class="text-center">到目前为止交易总金额排名<span ng-if="totalAmount!=null">(总额:{{totalAmount}})</span>
|
||||
<span ng-if="totalChairty!=null">(总公益额:{{totalChairty}})</span>
|
||||
</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Partner Name</th>
|
||||
<th>Amount</th>
|
||||
<th>订单量</th>
|
||||
<th>捐款额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in chairtyPartnersRanking">
|
||||
<!--<td style="text-align: center;font-style: italic;font-size: larger"-->
|
||||
<!--ng-bind="$index+1+'.'"></td>-->
|
||||
<td ng-bind="client.client_moniker"></td>
|
||||
<td ng-bind="client.sum_ordernum"></td>
|
||||
<td ng-bind="client.count_ordernum"></td>
|
||||
<td ng-bind="client.chairty_num"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<uib-pagination ng-if="chairtyPartnersRanking.length"
|
||||
class="pagination"
|
||||
total-items="total_ranking_pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="total_ranking_pagination.page"
|
||||
items-per-page="total_ranking_pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="doPartnerTotalRanking()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{total_ranking_pagination.totalCount}};Total Pages:{{total_ranking_pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p class="text-center"><span style="color: red">{{event_date}}</span> 商户半边天公益活动总排名 <span
|
||||
style="font-size: smaller;color: grey">(选择上图相应的日期获取当日排名)</span><span ng-if="cashBack_total_daily!=null">当日总额:{{cashBack_total_daily}}</span></p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Partner Name</th>
|
||||
<th>Amount</th>
|
||||
<th>捐款额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in cashbackPartnersRankingByDate">
|
||||
<td ng-bind="client.client_moniker"></td>
|
||||
<td ng-bind="client.sum_ordernum"></td>
|
||||
<td ng-bind="client.chair_ordernum"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<uib-pagination ng-if="chairtyPartnersRanking.length"
|
||||
class="pagination"
|
||||
total-items="day_ranking_pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="day_ranking_pagination.page"
|
||||
items-per-page="day_ranking_pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="getClientsCashbackRankingByDate(event_date)"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{day_ranking_pagination.totalCount}};Total Pages:{{day_ranking_pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,93 @@
|
||||
<section class="content-header">
|
||||
<h4>半边天公益活动</h4>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-users"></i> Activity
|
||||
</li>
|
||||
<li class="active">
|
||||
Act Chairty
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li ui-sref-active-eq="active">
|
||||
<a ui-sref="act_chairty">Config</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="act_chairty.analysis">Analysis</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" ui-view>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger" ng-if="msg" ng-bind="msg"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input class="form-control" placeholder="Client Moniker" ng-model="new_conf.client_moniker">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" placeholder="Date" ng-model="new_conf.date"
|
||||
uib-datepicker-popup size="10" is-open="ctrl.dateInput" ng-click="ctrl.dateInput=true"
|
||||
>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-success" ng-click="submitClient()">Submit</button>
|
||||
</div>
|
||||
<div class="row" ng-if="clients.length">
|
||||
<div class="col-xs-12 table-responsive">
|
||||
<table class="table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client Moniker</th>
|
||||
<th>Active Time</th>
|
||||
<th>订单量</th>
|
||||
<th>订单金额</th>
|
||||
<th>捐款额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in clients">
|
||||
<td ng-bind="client.client_moniker"></td>
|
||||
<td ng-bind="client.active_time"></td>
|
||||
<td ng-bind="client.count_ordernum"></td>
|
||||
<td ng-bind="client.sum_ordernum"></td>
|
||||
<td ng-bind="client.chairty_num"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="clients.length"
|
||||
class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadClients()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
<section class="content-header">
|
||||
<h1>支付宝进件表格导出</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-cog"></i> Basic Config
|
||||
</li>
|
||||
<li><a ui-sref="^">Dev Tools</a></li>
|
||||
<li class="active">aliforexcel</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-from-input"
|
||||
ng-model="params.datefrom"
|
||||
uib-datepicker-popup size="10" placeholder="From"
|
||||
is-open="dateBegin.open" ng-click="dateBegin.open=true"
|
||||
datepicker-options="{maxDate:params.dateto||today}">
|
||||
</div>
|
||||
~
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-to-input"
|
||||
ng-model="params.dateto"
|
||||
uib-datepicker-popup size="10" placeholder="To"
|
||||
is-open="dateTo.open" ng-click="dateTo.open=true"
|
||||
datepicker-options="{minDate:params.datefrom,maxDate:today}">
|
||||
</div>   
|
||||
<a class="fa fa-download"
|
||||
ng-href="{{Export()}}"
|
||||
type="button">
|
||||
Export
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -0,0 +1,32 @@
|
||||
<section class="content-header">
|
||||
<h1>Company test user </h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-cog"></i> Basic Config
|
||||
</li>
|
||||
<li><a ui-sref="^">Dev Tools</a></li>
|
||||
<li class="active">Test Partner</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="box-solid">
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<form role="form" style="margin:0px auto;width: 50%">
|
||||
<div class="form-group">
|
||||
<label>Partner Code</label>
|
||||
<input ng-model="company" name="code" class="form-control" type="text"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary btn-block" ng-click="regist()">commit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,20 @@
|
||||
<div class="modal-header">
|
||||
<h4>Edit Function Detail</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<p class="form-control-static text-bold" ng-bind="func.func_id"></p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="name-input">Name</label>
|
||||
<input class="form-control" id="name-input" ng-model="func.name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="remark-input">Remark</label>
|
||||
<input class="form-control" id="remark-input" ng-model="func.remark">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" ng-click="modifyFunction()">Save</button>
|
||||
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
|
||||
</div>
|
||||
@ -0,0 +1,16 @@
|
||||
<div class="modal-header">
|
||||
<h4>Authorize To Role</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div ng-repeat="mod in modules.modules" class="list-group">
|
||||
<div class="list-group-item list-group-item-info" ng-bind="mod.module_name+' - '+mod.remark"></div>
|
||||
<a role="button" class="list-group-item" ng-repeat="func in mod.funcs" ng-bind="func.func_id+(func.remark?'('+func.remark+')':'')"
|
||||
ng-class="{active:authorized.indexOf(func.func_id)>=0}" ng-click="toggleAuthorize(func)">
|
||||
</a>
|
||||
</div>
|
||||
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" ng-click="submitAuthorize()">Submit</button>
|
||||
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
|
||||
</div>
|
||||
@ -0,0 +1,16 @@
|
||||
<div class="modal-header">
|
||||
<h4>Choose Module</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="list-group">
|
||||
<a class="list-group-item" ng-repeat="mod in modules" ng-click="chooseModule(mod)" role="button">
|
||||
<p>
|
||||
<span class="pull-left" ng-bind="mod.module_name"></span>
|
||||
<span class="pull-right" ng-bind="mod.remark"></span>
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
|
||||
</div>
|
||||
@ -0,0 +1,38 @@
|
||||
<section class="content-header">
|
||||
<h1>Permission Config</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<a ui-sref="^"><i class="fa fa-cog"></i> System Config</a>
|
||||
</li>
|
||||
<li>Partner Permission Config</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li ui-sref-active-eq="active">
|
||||
<a ui-sref="sysconfig.permissionPartner">Permissions</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref=".functions">Functions</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref=".modules">Modules</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" ui-view>
|
||||
<a class="btn btn-app" role="button" ng-click="authorizeRole('1')">
|
||||
<i class="fa fa-user-secret"></i>
|
||||
Administrator
|
||||
</a>
|
||||
<a class="btn btn-app" role="button" ng-click="authorizeRole('10')">
|
||||
<i class="fa fa-eye"></i>
|
||||
Compliance
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -0,0 +1,43 @@
|
||||
<div class="row margin-bottom">
|
||||
<div class="col-xs-12">
|
||||
<button class="btn btn-primary" ng-click="syncFunctions()">
|
||||
<i class="fa fa-refresh"></i> Synchronize Code
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-warning" ng-if="modFunctions.no_module.length">
|
||||
<div class="panel-heading">Functions With No Modules</div>
|
||||
<div class="panel-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<tbody>
|
||||
<tr ng-repeat="func in modFunctions.no_module">
|
||||
<th ng-bind="func.func_id" title="{{func.remark}}"></th>
|
||||
<td ng-bind="func.uri+'['+func.req_methods+']'" title="{{func.remark}}"></td>
|
||||
<td ng-bind="func.name"></td>
|
||||
<td>
|
||||
<a role="button" ng-click="moveFunction(func)" title="Move"><i class="fa fa-arrows"></i></a>
|
||||
<a role="button" ng-click="editFunctionInfo(func)" title="Edit"><i class="fa fa-edit"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<uib-accordion>
|
||||
<uib-accordion-group ng-repeat="mod in modFunctions.modules" heading="{{mod.module_name+' - '+mod.remark}}">
|
||||
<table class="table table-hover">
|
||||
<tbody>
|
||||
<tr ng-repeat="func in mod.funcs">
|
||||
<th ng-bind="func.func_id+(func.remark?'('+func.remark+')':'')" title="{{func.remark}}"></th>
|
||||
<td ng-bind="func.uri+'['+func.req_methods+']'" title="{{func.remark}}"></td>
|
||||
<td ng-bind="func.name"></td>
|
||||
<td>
|
||||
<a role="button" ng-click="moveFunction(func)" title="Move"><i class="fa fa-arrows"></i></a>
|
||||
<a role="button" ng-click="editFunctionInfo(func)" title="Edit"><i class="fa fa-edit"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</uib-accordion-group>
|
||||
</uib-accordion>
|
||||
@ -0,0 +1,35 @@
|
||||
<div class="modal-header">
|
||||
<h4 ng-if="!nameEditable">Edit Module</h4>
|
||||
<h4 ng-if="nameEditable">New Module</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">Module Name</label>
|
||||
<input ng-if="nameEditable" class="form-control" ng-model="module.module_name" placeholder="Module Name">
|
||||
<p class="form-control-static" ng-bind="module.module_name" ng-if="!nameEditable"></p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="jsModule">Js Module</label>
|
||||
<input class="form-control" id="jsModule" ng-model="module.js_module">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="jsPath">Js Path</label>
|
||||
<input class="form-control" id="jsPath" ng-model="module.js_path">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="remark">Remark</label>
|
||||
<input class="form-control" id="remark" ng-model="module.remark">
|
||||
</div>
|
||||
<div class="form-group" ng-if="nameEditable">
|
||||
<label class="control-label">是否开放</label>
|
||||
<input class="control-in" type="checkbox" ng-model="module.initialize" bs-switch
|
||||
switch-change="init()">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" ng-click="save()">Submit</button>
|
||||
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
|
||||
</div>
|
||||
@ -0,0 +1,30 @@
|
||||
<div class="row margin-bottom">
|
||||
<div class="col-xs-12">
|
||||
<button class="btn btn-success" type="button" ng-click="newPartnerModule()"><i class="fa fa-plus"></i> Add Module</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Module ID</th>
|
||||
<th>Module Name</th>
|
||||
<th>Js Module</th>
|
||||
<th>Remark</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="mod in modules">
|
||||
<td ng-bind="mod.id"></td>
|
||||
<td ng-bind="mod.module_name"></td>
|
||||
<td ng-bind="mod.js_module"></td>
|
||||
<td ng-bind="mod.remark|limitTo:20" title="{{mod.remark}}"></td>
|
||||
<td>
|
||||
<a role="button" ng-click="editPartnerModule(mod)" title="Edit"><i class="fa fa-edit"></i></a>
|
||||
<a role="button" class="text-danger" ng-click="deletePartnerModule(mod)" title="Delete"><i class="fa fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 82 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue