wangning 7 years ago
commit 068904c74b

@ -538,5 +538,9 @@ CREATE TABLE `sys_client_pre_apply` (
alter table sys_accounts add COLUMN nation_code VARCHAR(5) DEFAULT NULL ;
ALTER TABLE `sys_client_pre_apply`
MODIFY COLUMN `agree` tinyint(1) DEFAULT 0;
alter table sys_client_pre_apply add COLUMN `client_moniker` varchar(20) DEFAULT NULL COMMENT '客户简写识别码';
alter table sys_client_pre_apply modify COLUMN `agree` tinyint(1) DEFAULT 0;
insert into `royalpay_production`.`sys_configs` ( `config_key`, `config_value`) values ( 'royalpayindustry.json', '[{"children":[{"children":[],"label":"机票","mccCode":"10001"},{"children":[],"label":"旅游行业","mccCode":"10002"},{"children":[],"label":"私人定制旅游","mccCode":"10003"},{"children":[],"label":"租车","mccCode":"10004"},{"children":[],"label":"巴士","mccCode":"10005"}],"label":"旅游出行","mccCode":"1"},{"children":[{"children":[],"label":"饭店","mccCode":"20001"},{"children":[],"label":"奶茶店","mccCode":"20002"},{"children":[],"label":"烧烤","mccCode":"20003"},{"children":[],"label":"火锅","mccCode":"20004"},{"children":[],"label":"Coffee","mccCode":"20005"},{"children":[],"label":"酒吧","mccCode":"20006"}],"label":"餐饮","mccCode":"2"},{"children":[{"children":[],"label":"培训类","mccCode":"30001"},{"children":[],"label":"移民留学","mccCode":"30002"},{"children":[],"label":"私人幼儿园","mccCode":"30003"}],"label":"教育","mccCode":"3"},{"children":[{"children":[],"label":"换汇","mccCode":"40001"},{"children":[],"label":"房产","mccCode":"40002"}],"label":"商务咨询","mccCode":"4"},{"children":[{"children":[],"label":"公众号服务商","mccCode":"50001"},{"children":[],"label":"各种媒体类宣传","mccCode":"50002"}],"label":"传媒","mccCode":"5","value":"{\"category\":\"SERVICE\",\"code\":\"7542\",\"description\":\"Car Washes\",\"parentCode\":\"S10\"}"},{"children":[{"children":[],"label":"美容院","mccCode":"60001"},{"children":[],"label":"医疗美容","mccCode":"60002"}],"label":"医美","mccCode":"6"},{"children":[{"label":"超市","mccCode":"70001"},{"children":[],"label":"服装店","mccCode":"70002"},{"children":[],"label":"鞋店","mccCode":"70003"},{"children":[],"label":"珠宝店","mccCode":"70004"},{"children":[],"label":"箱包","mccCode":"70005"}],"label":"零售","mccCode":"7"},{"children":[{"children":[],"label":"桌游吧","mccCode":"80001"},{"children":[],"label":"演唱会","mccCode":"80002"},{"children":[],"label":"马术训练","mccCode":"80003"},{"children":[],"label":"瑜伽","mccCode":"80004"},{"children":[],"label":"健身","mccCode":"80005"},{"children":[],"label":"社团","mccCode":"80006"},{"children":[],"label":"网吧","mccCode":"80007"},{"children":[],"label":"KTV","mccCode":"80008"},{"children":[],"label":"电影","mccCode":"80009"}],"label":"休闲娱乐","mccCode":"8"},{"children":[{"children":[],"label":"摄影","mccCode":"90001"},{"children":[],"label":"massage","mccCode":"90002"},{"children":[],"label":"通讯运营商","mccCode":"90003"},{"children":[],"label":"车行","mccCode":"90004"},{"children:":[],"label":"软件服务","mccCode":"90005"}],"label":"其他服务类","mccCode":"9"},{"children":[{"children":[],"label":"Hotel","mccCode":"100001"},{"children":[],"label":"Motel","mccCode":"100002"}],"label":"酒店","mccCode":"10"},{"children":[{"children":[],"label":"代购","mccCode":"110001"},{"children":[],"label":"物流(大宗出口贸易)","mccCode":"110002"},{"children":[],"label":"红酒出口","mccCode":"110003"},{"children":[],"label":"综合电商","mccCode":"110004"}],"label":"出口贸易","mccCode":"11"},{"children":[{"children":[],"label":"建材","mccCode":"120001"},{"children":[],"label":"家居","mccCode":"120002"}],"label":"家居建材","mccCode":"12"}]');

@ -0,0 +1,120 @@
package au.com.royalpay.payment.manage.analysis.beans;
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 java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* Created by yuan on 2018/6/5.
*/
public class AreaMerchantTradeQueryBean {
private final DateFormat format = new SimpleDateFormat("yyyyMMdd");
int page = 1;
int limit = 10;
private String state;
private String org_id;
private String bd;
private String begin;
private String end;
private String client_moniker;
public JSONObject toParams(){
JSONObject params = new JSONObject();
if (StringUtils.isNotEmpty(state)) {
params.put("state",state);
}
if (StringUtils.isNotEmpty(org_id)) {
params.put("org_id",org_id);
}
if (StringUtils.isNotEmpty(bd)) {
params.put("bd_user",bd);
}
if (StringUtils.isNotEmpty(client_moniker)) {
params.put("client_monikers",client_moniker.split(","));
}
if (begin != null) {
try {
params.put("begin", format.parse(begin));
} catch (ParseException e) {
throw new ParamInvalidException("begin", "error.payment.valid.invalid_date_format");
}
}
if (end != null) {
try {
params.put("end", DateUtils.addDays(format.parse(end), 1));
} catch (ParseException e) {
throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format");
}
}
return params;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getOrg_id() {
return org_id;
}
public void setOrg_id(String org_id) {
this.org_id = org_id;
}
public String getBd() {
return bd;
}
public void setBd(String bd) {
this.bd = bd;
}
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;
}
public String getClient_moniker() {
return client_moniker;
}
public void setClient_moniker(String client_moniker) {
this.client_moniker = client_moniker;
}
}

@ -0,0 +1,16 @@
package au.com.royalpay.payment.manage.analysis.core;
import au.com.royalpay.payment.manage.analysis.beans.AreaMerchantTradeQueryBean;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletResponse;
/**
* Created by yuan on 2018/6/5.
*/
public interface AreaMerchantTradeAnalysis {
JSONObject listAreaMerchantTrade(JSONObject manager,AreaMerchantTradeQueryBean queryBean);
void importTradeExcel(JSONObject manager,AreaMerchantTradeQueryBean queryBean,HttpServletResponse response) throws Exception;
}

@ -0,0 +1,254 @@
package au.com.royalpay.payment.manage.analysis.core.impls;
import au.com.royalpay.payment.manage.analysis.beans.AreaMerchantTradeQueryBean;
import au.com.royalpay.payment.manage.analysis.core.AreaMerchantTradeAnalysis;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONArray;
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.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
/**
* Created by yuan on 2018/6/5.
*/
@Service
public class AreaMerchantTradeAnalysisImpl implements AreaMerchantTradeAnalysis{
@Autowired
private TransactionAnalysisMapper transactionAnalysisMapper;
@Autowired
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
@Autowired
private OrgManager orgManager;
@Autowired
private SysConfigManager sysConfigManager;
@Override
public JSONObject listAreaMerchantTrade(JSONObject manager, AreaMerchantTradeQueryBean queryBean) {
if (manager == null || !manager.getBooleanValue("is_valid")) {
throw new ForbiddenException();
}
JSONObject params = queryBean.toParams();
PageList<JSONObject> clientAmount = null;
orgManager.checkOrgIds(manager,params);
if(params.containsKey("begin") && params.containsKey("end")){
if (params.getDate("end").after(new Date()) && params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
clientAmount = transactionAnalysisMapper.getAreaMerchantAmountAnalysis(params,new PageBounds(queryBean.getPage(),queryBean.getLimit()));
}else {
clientAmount = customerAndOrdersStatisticsMapper.getAreaMerchantTradeAnalysis(params,new PageBounds(queryBean.getPage(),queryBean.getLimit()));
}
}
return PageListUtils.buildPageListResult(clientAmount);
}
@Override
public void importTradeExcel(JSONObject manager, AreaMerchantTradeQueryBean queryBean,HttpServletResponse response) throws Exception {
if (manager == null || !manager.getBooleanValue("is_valid")) {
throw new ForbiddenException();
}
JSONObject params = queryBean.toParams();
orgManager.checkOrgIds(manager,params);
PageList<JSONObject> clientAmount = null;
if(params.containsKey("begin") && params.containsKey("end")){
if (params.getDate("end").after(new Date()) && params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
clientAmount = transactionAnalysisMapper.getAreaMerchantAmountAnalysis(params,new PageBounds());
}else {
clientAmount = customerAndOrdersStatisticsMapper.getAreaMerchantTradeAnalysis(params,new PageBounds());
}
}
HSSFWorkbook workbook = new HSSFWorkbook();
// 声明一个工作薄
// 生成一个表格
HSSFSheet sheet = workbook.createSheet("clientAmount_excel");
// 设置表格默认列宽度为15个字节
sheet.setDefaultColumnWidth((short) 40);
// 生成一个样式
HSSFCellStyle style = workbook.createCellStyle();
// 设置这些样式
style.setFillForegroundColor(HSSFColor.LIGHT_ORANGE.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont font = workbook.createFont();
font.setFontHeightInPoints((short) 16);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
// 把字体应用到当前的样式
style.setFont(font);
HSSFCellStyle style2 = workbook.createCellStyle();
// 设置这些样式
style2.setFillForegroundColor(HSSFColor.WHITE.index);
style2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style2.setBorderRight(HSSFCellStyle.BORDER_THIN);
style2.setBorderTop(HSSFCellStyle.BORDER_THIN);
style2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont font2 = workbook.createFont();
font2.setFontHeightInPoints((short) 12);
font2.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
// 把字体应用到当前的样式
style2.setFont(font2);
HSSFRow row0 = sheet.createRow(0);
HSSFCell cell00 = row0.createCell(0);
HSSFCell cell01 = row0.createCell(1);
HSSFCell cell02 = row0.createCell(2);
HSSFCell cell03 = row0.createCell(3);
HSSFCell cell04 = row0.createCell(4);
HSSFCell cell05 = row0.createCell(5);
HSSFCell cell06 = row0.createCell(6);
HSSFCell cell07 = row0.createCell(7);
HSSFCell cell08 = row0.createCell(8);
HSSFCell cell09 = row0.createCell(9);
HSSFCell cell10 = row0.createCell(10);
HSSFCell cell11 = row0.createCell(11);
cell00.setCellStyle(style);
cell01.setCellStyle(style);
cell02.setCellStyle(style);
cell03.setCellStyle(style);
cell04.setCellStyle(style);
cell05.setCellStyle(style);
cell06.setCellStyle(style);
cell07.setCellStyle(style);
cell08.setCellStyle(style);
cell09.setCellStyle(style);
cell10.setCellStyle(style);
cell11.setCellStyle(style);
HSSFRichTextString text00 = new HSSFRichTextString("Partner Code");
HSSFRichTextString text01 = new HSSFRichTextString("Short name");
HSSFRichTextString text02 = new HSSFRichTextString("Bd name");
HSSFRichTextString text03 = new HSSFRichTextString("State");
HSSFRichTextString text04 = new HSSFRichTextString("Suburb");
HSSFRichTextString text05 = new HSSFRichTextString("Industry");
HSSFRichTextString text06 = new HSSFRichTextString("Amount");
HSSFRichTextString text07 = new HSSFRichTextString("Orders");
HSSFRichTextString text08 = new HSSFRichTextString("Alipay Amount");
HSSFRichTextString text09 = new HSSFRichTextString("Alipay Orders");
HSSFRichTextString text10 = new HSSFRichTextString("Wechat Amount");
HSSFRichTextString text11 = new HSSFRichTextString("Wechat Orders");
cell00.setCellValue(text00);
cell01.setCellValue(text01);
cell02.setCellValue(text02);
cell03.setCellValue(text03);
cell04.setCellValue(text04);
cell05.setCellValue(text05);
cell06.setCellValue(text06);
cell07.setCellValue(text07);
cell08.setCellValue(text08);
cell09.setCellValue(text09);
cell10.setCellValue(text10);
cell11.setCellValue(text11);
JSONObject sysConfig = sysConfigManager.getSysConfig();
String json = sysConfig.getString("royalpayindustry.json");
JSONArray jsonArray = JSONObject.parseArray(json);
for (int i = 0; i < clientAmount.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
HSSFCell cell5 = row.createCell(5);
HSSFCell cell6 = row.createCell(6);
HSSFCell cell7 = row.createCell(7);
HSSFCell cell8 = row.createCell(8);
HSSFCell cell9 = row.createCell(9);
HSSFCell cel10 = row.createCell(10);
HSSFCell cel11 = row.createCell(11);
cell0.setCellStyle(style2);
cell1.setCellStyle(style2);
cell2.setCellStyle(style2);
cell3.setCellStyle(style2);
cell4.setCellStyle(style2);
cell5.setCellStyle(style2);
cell6.setCellStyle(style2);
cell7.setCellStyle(style2);
cell8.setCellStyle(style2);
cell9.setCellStyle(style2);
cel10.setCellStyle(style2);
cel11.setCellStyle(style2);
String industry = getRoyalpayIindustry(clientAmount.get(i).getString("royalpayindustry"),jsonArray);
HSSFRichTextString text0 = new HSSFRichTextString(clientAmount.get(i).getString("client_moniker"));
HSSFRichTextString text1 = new HSSFRichTextString(clientAmount.get(i).getString("short_name"));
HSSFRichTextString text2 = new HSSFRichTextString(clientAmount.get(i).getString("bd_user_name"));
HSSFRichTextString text3 = new HSSFRichTextString(clientAmount.get(i).getString("state"));
HSSFRichTextString text4 = new HSSFRichTextString(clientAmount.get(i).getString("suburb"));
HSSFRichTextString text5 = new HSSFRichTextString(industry == null?"":industry);
HSSFRichTextString text6 = new HSSFRichTextString(clientAmount.get(i).getString("total"));
HSSFRichTextString text7 = new HSSFRichTextString(clientAmount.get(i).getString("orders"));
HSSFRichTextString text8 = new HSSFRichTextString(clientAmount.get(i).getString("alipay_total"));
HSSFRichTextString text9 = new HSSFRichTextString(clientAmount.get(i).getString("alipay_order"));
HSSFRichTextString text_10 = new HSSFRichTextString(clientAmount.get(i).getString("wechat_toatl"));
HSSFRichTextString text_11 = new HSSFRichTextString(clientAmount.get(i).getString("wechat_order"));
cell0.setCellValue(text0);
cell1.setCellValue(text1);
cell2.setCellValue(text2);
cell3.setCellValue(text3);
cell4.setCellValue(text4);
cell5.setCellValue(text5);
cell6.setCellValue(text6);
cell7.setCellValue(text7);
cell8.setCellValue(text8);
cell9.setCellValue(text9);
cel10.setCellValue(text_10);
cel11.setCellValue(text_11);
}
JSONObject parmerters = new JSONObject();
parmerters.put("dateFrom", StringUtils.isNotBlank(queryBean.getBegin()) ? queryBean.getBegin() : "");
parmerters.put("dateTo", StringUtils.isNotBlank(queryBean.getEnd()) ? queryBean.getEnd() : DateFormatUtils.format(new Date(), "yyyyMMdd"));
response.setContentType("application/vnd.ms-excel");
String fileName = StringUtils.isEmpty(parmerters.getString("dateFrom")) ? parmerters.getString("dateTo")
: (parmerters.getString("dateFrom") + "~" + parmerters.getString("dateTo"));
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
OutputStream outputStream = response.getOutputStream();
try {
workbook.write(outputStream);
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private String getRoyalpayIindustry(String industryMccCode,JSONArray jsonArray) {
String industry = null;
for(int i = 0;i<jsonArray.size();i++){
JSONObject myjObject = jsonArray.getJSONObject(i);
if(myjObject.getString("mccCode").equals(industryMccCode)){
industry = myjObject.getString("label");
}else {
JSONArray children = myjObject.getJSONArray("children");
for(int j = 0;j<children.size();j++){
JSONObject child = children.getJSONObject(j);
if(child.getString("mccCode").equals(industryMccCode)) {
industry = child.getString("label");
}
}
}
}
return industry;
}
}

@ -3,6 +3,8 @@ 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.List;
@ -48,4 +50,5 @@ public interface CustomerAndOrdersStatisticsMapper {
JSONObject getCommonCount(JSONObject params);
PageList<JSONObject> getAreaMerchantTradeAnalysis(JSONObject params, PageBounds pageBounds);
}

@ -72,4 +72,6 @@ public interface TransactionAnalysisMapper {
int getCountCustomers(@Param("date") Date date);
JSONObject getClientTransaction(JSONObject params);
PageList<JSONObject> getAreaMerchantAmountAnalysis(JSONObject params,PageBounds pagination);
}

@ -0,0 +1,36 @@
package au.com.royalpay.payment.manage.analysis.web;
import au.com.royalpay.payment.manage.analysis.beans.AreaMerchantTradeQueryBean;
import au.com.royalpay.payment.manage.analysis.core.AreaMerchantTradeAnalysis;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
* Created by yuan on 2018/6/5.
*/
@RestController
@RequestMapping("/area/merchant")
public class AreaMerchantTradeController {
@Resource
private AreaMerchantTradeAnalysis areaMerchantTradeAnalysis;
@ManagerMapping(value = "",method = RequestMethod.GET,role = ManagerRole.ADMIN)
public JSONObject listClientAmount(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,AreaMerchantTradeQueryBean queryBean){
return areaMerchantTradeAnalysis.listAreaMerchantTrade(manager,queryBean);
}
@ManagerMapping(value = "/excel",method = RequestMethod.GET,role = ManagerRole.ADMIN)
public void exportExcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,AreaMerchantTradeQueryBean queryBean,HttpServletResponse httpResponse)throws Exception{
areaMerchantTradeAnalysis.importTradeExcel(manager,queryBean,httpResponse);
}
}

@ -145,4 +145,8 @@ public interface RetailAppService {
void uploadAuthFiles(JSONObject device,ClientAuthFilesInfo clientAuthFilesInfo);
void updateMerchantInfo(JSONObject device, ClientUpdateInfo clientUpdateInfo);
void applyToCompliance(JSONObject device);
JSONObject sendVerifyEmail(JSONObject device);
}

@ -278,20 +278,23 @@ public class RetailAppServiceImp implements RetailAppService {
public void changeSurchargeEnable(JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if(PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN){
if (PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN) {
throw new ForbiddenException("You have no permission");
}
if (client == null) {
throw new NotFoundException("Client not found, please check");
}
if (updateSurchargeDTO.getApiSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"api_surcharge",updateSurchargeDTO.getApiSurcharge()));
clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "api_surcharge", updateSurchargeDTO.getApiSurcharge()));
}
if (updateSurchargeDTO.getQrcodeSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"qrcode_surcharge",updateSurchargeDTO.getQrcodeSurcharge()));
clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "qrcode_surcharge", updateSurchargeDTO.getQrcodeSurcharge()));
}
if (updateSurchargeDTO.getRetailSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"retail_surcharge",updateSurchargeDTO.getRetailSurcharge()));
clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "retail_surcharge", updateSurchargeDTO.getRetailSurcharge()));
}
}
@ -341,7 +344,7 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getAuthFiles(JSONObject device) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
return clientManager.getAuthFiles(account,client.getString("client_moniker"));
return clientManager.getAuthFiles(account, client.getString("client_moniker"));
}
@Override
@ -351,28 +354,58 @@ public class RetailAppServiceImp implements RetailAppService {
clientAuthFilesInfo.setFile_id_info(null);
clientAuthFilesInfo.setAuthStatus(0);
clientAuthFilesInfo.setFile_agreement_info(null);
clientManager.uploadAuthFiles(account,client.getString("client_moniker"),clientAuthFilesInfo);
clientManager.uploadAuthFiles(account, client.getString("client_moniker"), clientAuthFilesInfo);
}
@Override
public void updateMerchantInfo(JSONObject device, ClientUpdateInfo clientRegisterInfo) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if(PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN){
if (PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN) {
throw new ForbiddenException("You have no permission");
}
if (client == null) {
throw new NotFoundException("Client not found, please check");
}
if (client.getIntValue("approve_result") != 1 && client.getIntValue("source") == 4){
if (client.getIntValue("approve_result") != 1 && client.getIntValue("source") == 4) {
JSONObject record = clientRegisterInfo.appClientInfo();
record.put("client_moniker",client.getString("client_moniker"));
clientManager.updateClientRegisterInfoV2(null,client.getString("client_moniker"),record);
}else {
record.put("client_moniker", client.getString("client_moniker"));
clientManager.updateClientRegisterInfoV2(null, client.getString("client_moniker"), record);
} else {
throw new BadRequestException("已通过审核,暂不能提交和修改");
}
}
@Override
public void applyToCompliance(JSONObject device) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if (client == null) {
throw new NotFoundException("Merchant Not Found");
}
if (account == null) {
throw new NotFoundException("Account Not Found");
}
clientManager.applyToCompliance(client.getString("client_moniker"), account);
}
@Override
public JSONObject sendVerifyEmail(JSONObject device) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if (client == null) {
throw new NotFoundException("Merchant Not Found");
}
if (account == null) {
throw new NotFoundException("Account Not Found");
}
clientManager.sendVerifyEmail(client, account.getString("account_id"));
JSONObject result = new JSONObject();
result.put("email", client.getString("contact_email"));
return result;
}
@Override
public void updateClient(JSONObject device, AppClientBean appClientBean) {
String clientType = device.getString("client_type");
@ -410,8 +443,14 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getClientInfoMe(JSONObject device) {
JSONObject result = new JSONObject();
JSONObject client = clientMapper.findClient(device.getIntValue("client_id"));
if (StringUtils.isEmpty(client.getString("store_photo"))|| StringUtils.isEmpty(client.getString("logo_url"))|| StringUtils.isEmpty(client.getString("company_photo"))) {
if(StringUtils.isEmpty(client.getString("business_structure"))||
StringUtils.isEmpty(client.getString("logo_url"))||
StringUtils.isEmpty(client.getString("description")) ||
("Company".equals(client.getString("business_structure")) && StringUtils.isEmpty(client.getString("acn")))||
(!"Company".equals(client.getString("business_structure")) && StringUtils.isEmpty(client.getString("abn")))||
(StringUtils.isEmpty(client.getString("company_website")) && StringUtils.isEmpty(client.getString("company_photo")) &&StringUtils.isEmpty(client.getString("store_photo")))) {
result.put("base_info_lack", true);
}
JSONObject file = clientManager.getAuthFiles(null, client.getString("client_moniker"));
for (String s : fileName) {
@ -420,6 +459,8 @@ public class RetailAppServiceImp implements RetailAppService {
}
}
result.putAll(file);
result.put("approve_result",client.getString("approve_result"));
result.put("mail_confirm",client.getBoolean("mail_confirm"));
return result;
}
@ -637,10 +678,10 @@ public class RetailAppServiceImp implements RetailAppService {
}
break;
case "Wechat":
JSONObject weUser = new JSONObject();
if (customer_id.startsWith("olH")){
JSONObject weUser = new JSONObject();
if (customer_id.startsWith("olH")) {
weUser = customerMapper.findCustomerGlobalpayByOpenId(customer_id);
}else {
} else {
weUser = customerMapper.findCustomerByOpenId(customer_id);
}
if (weUser != null && !weUser.isEmpty()) {

@ -13,6 +13,8 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
@ -40,7 +42,6 @@ import au.com.royalpay.payment.manage.bill.core.BillOrderService;
import au.com.royalpay.payment.manage.bill.core.BillService;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.settlement.core.ManualSettleSupport;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
@ -60,6 +61,7 @@ import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
@AppClientController
@RequestMapping("/api/v1.0/retail/app")
public class RetailAppController {
Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private RetailAppService retailAppService;
@Resource
@ -78,8 +80,6 @@ public class RetailAppController {
private ManualSettleSupport manualSettleSupport;
@Resource
private AttachmentClient attachmentClient;
@Resource
private ClientManager clientManager;
@RequestMapping(value = "/token", method = RequestMethod.PUT)
@ -248,9 +248,16 @@ public class RetailAppController {
@RequestMapping(value = "/client/apply", method = RequestMethod.PUT)
@ResponseBody
public void updatePartnerInfo(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestBody ClientUpdateInfo info) {
logger.info(info.toString());
retailAppService.updateMerchantInfo(device,info);
}
@RequestMapping(value = "/client/compliance_audit", method = RequestMethod.POST)
@ResponseBody
public void commitAudit(@ModelAttribute(RETAIL_DEVICE) JSONObject device) {
retailAppService.applyToCompliance(device);
}
@RequestMapping(value = "/client/realtime", method = RequestMethod.GET)
public JSONObject getClientInfoRealtime(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientInfoRealtime(device);
@ -261,6 +268,12 @@ public class RetailAppController {
return retailAppService.getClientInfoMe(device);
}
@RequestMapping(value = "/client/verify/email", method = RequestMethod.PUT)
@ResponseBody
public JSONObject sendVerifyEmail(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.sendVerifyEmail(device);
}
@RequestMapping(value = "/client/check", method = RequestMethod.GET)
public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
JSONObject defaultResult = new JSONObject();
@ -527,5 +540,4 @@ public class RetailAppController {
return attachmentClient.uploadFile(file,false);
}
}

@ -29,8 +29,8 @@ public class ClientUpdateInfo {
private String abn;
private String acn;
private String industry;
@JSONField(name = "alipayindustry")
private String alipayIndustry;
// @JSONField(name = "alipayindustry")
// private String alipayIndustry;
@JSONField(name = "company_photo")
private String companyPhoto;
@JSONField(name = "store_photo")
@ -57,18 +57,18 @@ public class ClientUpdateInfo {
private String country;
@Pattern(regexp = "^((Australia/West)|(Australia/Eucla)|(Australia/North)|(Australia/South)|(Australia/Brisbane)|(Australia/Melbourne)|(Australia/LHI))$", message = "error.payment.valid.invalid_timezone")
private String timezone;
private String jdindustry;
private String royalpayindustry;
private String referrer_id;
private String referrer_name;
// 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;
//
// 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);
@ -325,75 +325,110 @@ public class ClientUpdateInfo {
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;
// 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;
// }
@Override
public String toString() {
return "ClientUpdateInfo{" +
"clientMoniker='" + clientMoniker + '\'' +
", companyName='" + companyName + '\'' +
", shortName='" + shortName + '\'' +
", businessName='" + businessName + '\'' +
", businessStructure='" + businessStructure + '\'' +
", abn='" + abn + '\'' +
", acn='" + acn + '\'' +
", industry='" + industry + '\'' +
", companyPhoto='" + companyPhoto + '\'' +
", storePhoto='" + storePhoto + '\'' +
", companyWebsite='" + companyWebsite + '\'' +
", companyPhone='" + companyPhone + '\'' +
", description='" + description + '\'' +
", remark='" + remark + '\'' +
", sector='" + sector + '\'' +
", logoId='" + logoId + '\'' +
", contactPerson='" + contactPerson + '\'' +
", contactPhone='" + contactPhone + '\'' +
", contactEmail='" + contactEmail + '\'' +
", address='" + address + '\'' +
", suburb='" + suburb + '\'' +
", postcode='" + postcode + '\'' +
", state='" + state + '\'' +
", country='" + country + '\'' +
", timezone='" + timezone + '\'' +
", client_apply_id='" + client_apply_id + '\'' +
'}';
}
}

@ -643,7 +643,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client.getIntValue("client_id");
List<JSONObject> clients = clientMapper.listChildClients(clientId);
String logoId = info.getString("logoId");
String logoId = info.getString("logo_id");
if (StringUtils.isNotEmpty(logoId)) {
String fileUrl = attachmentClient.getFileUrl(logoId);
info.put("logo_url", fileUrl);

@ -13,6 +13,8 @@ public interface OrgManager {
List<JSONObject> listOrgsWithChid(JSONObject manager,OrgInfo orgInfo);
List<JSONObject> listOrgAndChild(JSONObject manager);
JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager);
JSONObject getOrgDetail(int orgId,JSONObject manager);

@ -63,7 +63,25 @@ public class OrgManagerImpl implements OrgManager {
return orgs;
}
@Override
public List<JSONObject> listOrgAndChild(JSONObject manager) {
JSONObject params = new JSONObject();
params.put("type",0);
List<JSONObject> listOrgsByChild = orgMapper.listOrgsWithChid(params);
List<JSONObject> listOrgs = orgMapper.listOrgsWithParent(params);
for(JSONObject org: listOrgs){
List<JSONObject> children = new ArrayList<>();
for(JSONObject child:listOrgsByChild){
if(child.getIntValue("parent_org_id") == org.getIntValue("org_id")){
children.add(child);
}
}
if(children.size()> 0){
org.put("children",children);
}
}
return listOrgs;
}
@Override
public JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager) {

@ -37,6 +37,12 @@ public class OrgManageController {
return orgManager.listOrgsWithChid(manager,orgInfo);
}
@RequestMapping(value = "/child",method = RequestMethod.GET)
@RequireManager
public List<JSONObject> listOrgAndChild(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,OrgInfo orgInfo) {
return orgManager.listOrgAndChild(manager);
}
@RequestMapping(value = "/listsOrg", method = RequestMethod.GET)
@RequireManager
public JSONObject listsOrg(OrgInfo orgInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {

@ -354,4 +354,33 @@
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</where>
</select>
<select id="getAreaMerchantTradeAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(s.total) total,sum(s.orders) orders,c.client_moniker,c.short_name,c.bd_user_name,c.suburb,c.state,c.royalpayindustry,sum(if(s.channel='Alipay',s.total,0)) alipay_total,
sum(if(s.channel='Alipay',s.orders,0)) alipay_order,sum(if(s.channel='Wechat',s.total,0)) wechat_toatl,sum(if(s.channel='Wechat',s.orders,0)) wechat_order
FROM statistics_customer_order s
RIGHT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= date(now()) and (d.end_date is null or date(d.end_date)&gt;= date(now())) and
d.is_valid=1
</if>
<where>
<if test="begin!=null">and s.date &gt;= #{begin}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
<if test="org_id!=null">and c.org_id = #{org_id}</if>
<if test="state!=null">and c.state = #{state}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="client_monikers!=null">
AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
#{client_moniker}
</foreach>
</if>
</where>
GROUP BY s.client_id ORDER BY total DESC
</select>
</mapper>

@ -793,4 +793,35 @@
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select>
<select id="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total,
sum(if(t.transaction_type='Credit',1,0)) orders,
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay'AND t.transaction_type='Credit',t.clearing_amount,0)) alipay_total,
sum(if(t.channel='Alipay'AND t.transaction_type='Credit',1,0)) alipay_order,sum(if(t.channel='Wechat'AND t.transaction_type='Credit',t.clearing_amount,0)) wechat_toatl,
sum(if(t.channel='Wechat'AND t.transaction_type='Credit',1,0)) wechat_order
FROM pmt_transactions t
INNER JOIN pmt_orders ord on ord.order_id = t.order_id
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= date(now()) and (d.end_date is null or date(d.end_date)&gt;= date(now())) and
d.is_valid=1
</if>
where (t.transaction_type = 'Credit' or t.refund_id is not null)
<if test="begin!=null">and t.transaction_time &gt;= #{begin}</if>
<if test="end!=null">and t.transaction_time &lt;= #{end}</if>
<if test="state!=null">and c.state &lt;= #{state}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="client_monikers!=null">
AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
#{client_moniker}
</foreach>
</if>
GROUP BY c.client_id order by total desc
</select>
</mapper>

@ -0,0 +1,146 @@
define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','./transaction/analysis-transaction'], function (angular) {
'use strict';
var app = angular.module('merchantAmount', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('analysis_transaction.merchantAmountAnalysis', {
url: '/amount',
templateUrl: '/static/analysis/templates/merchant_amount_analysis.html',
controller: 'clientAmountListCtrl'
})
}]);
app.controller('clientAmountListCtrl', ['$scope', '$http','$filter', '$uibModal', 'commonDialog','stateMap' , function ($scope, $http,$filter, $uibModal, commonDialog,stateMap) {
$scope.params = {yesterday:new Date(new Date().setDate(new Date().getDate()-1))};
$scope.pagination = {};
$scope.states = stateMap.configs();
$scope.chooseToday = function () {
$scope.params.begin = $scope.params.end = new Date();
$scope.loadClientsAmount(1);
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.begin = $scope.params.end = yesterday;
$scope.loadClientsAmount(1);
};
$scope.thisMonth = function () {
$scope.params.end = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
$scope.loadClientsAmount(1);
};
$scope.lastMonth = function () {
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.params.end = monthFinish;
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
$scope.loadClientsAmount(1);
};
$scope.loadBdsOrOrgs = function () {
$http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) {
$scope.bds = resp.data;
});
$http.get('/sys/orgs/child', {params: {}}).then(function (resp) {
$scope.orgs = resp.data;
});
};
$scope.chooseOrg = function (org) {
if(org != null){
$scope.params.org_id = org.org_id;
$scope.org_name = org.name;
}else {
$scope.params.org_id = '';
$scope.org_name = 'All';
}
};
$scope.loadBdsOrOrgs();
$scope.export = function () {
$scope.exportUrl='/area/merchant/excel';
var connectSymbol = '?';
var params = angular.copy($scope.params);
if(!params.begin || !params.end){
commonDialog.alert({title: 'Error', content: '开始时间和截止时间不能为空', type: 'error'});
return;
}
if (checkDate(params.end,params.begin)>31){
commonDialog.alert({title: 'Error', content: '日期区间不能超过31天', type: 'error'});
return;
}
if (params.begin) {
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
$scope.exportUrl += connectSymbol + 'begin=' + params.begin;
connectSymbol = '&';
}
if (params.end) {
params.end = $filter('date')(params.end, 'yyyyMMdd');
$scope.exportUrl += connectSymbol + 'end=' + params.end;
connectSymbol = '&';
}
if (params.bd) {
$scope.exportUrl += connectSymbol + 'bd=' + params.bd;
}
if (params.state) {
$scope.exportUrl += connectSymbol + 'state=' + params.state;
}
if (params.org_id) {
$scope.exportUrl += connectSymbol + 'org_id=' + params.org_id;
}
if (params.client_moniker) {
$scope.exportUrl += connectSymbol + 'client_moniker=' + params.client_moniker;
}
};
$scope.loadClientsAmount = function (page) {
var params = angular.copy($scope.params);
if(!params.begin || !params.end){
commonDialog.alert({title: 'Error', content: '开始时间和截止时间不能为空', type: 'error'});
return;
}
if (checkDate(params.end,params.begin)>31){
commonDialog.alert({title: 'Error', content: '日期区间不能超过31天', type: 'error'});
return;
}
if (params.begin) {
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
}
if (params.end) {
params.end = $filter('date')(params.end, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
$http.get('/area/merchant', {params: params}).then(function (resp) {
$scope.clientAmount = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
$scope.lastMonth();
function checkDate(d1,d2){
d1 = $filter('date')(d1, 'yyyy-MM-dd');
d2 = $filter('date')(d2, 'yyyy-MM-dd');
var day = 24 * 60 * 60 *1000;
try{
var dateArr = d1.split("-");
var checkDate = new Date();
checkDate.setFullYear(dateArr[0], dateArr[1]-1, dateArr[2]);
var checkTime = checkDate.getTime();
var dateArr2 = d2.split("-");
var checkDate2 = new Date();
checkDate2.setFullYear(dateArr2[0], dateArr2[1]-1, dateArr2[2]);
var checkTime2 = checkDate2.getTime();
var cha = (checkTime - checkTime2)/day;
return cha;
}catch(e){
return false;
}
};
}]);
return app;
});

@ -0,0 +1,201 @@
<style>
.dropdown-submenu {
position: relative;
}
.dropdown-submenu > .dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover > .dropdown-menu {
display: block;
}
.triangle > a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #ccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover > a:after {
border-left-color: #fff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left > .dropdown-menu {
left: -100%;
margin-left: 10px;
-webkit-border-radius: 6px 0 6px 6px;
-moz-border-radius: 6px 0 6px 6px;
border-radius: 6px 0 6px 6px;
}
</style>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="row">
<div class="col-xs-12">
<div class="form-horizontal">
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4">Organization</label>
<div class="col-xs-6">
<div class="dropdown">
<input id="dLabel" data-toggle="dropdown" data-target="#" class="form-control"
ng-model="org_name" placeholder="All"
maxlength="50" readonly="readonly">
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
<li class="dropdown-submenu">
<a tabindex="-1" href="" ng-click="chooseOrg(org)">All</a>
</li>
<li class="dropdown-submenu" ng-repeat="org in orgs" ng-class="{'triangle':org.children}">
<a tabindex="-1" href="" ng-model="org.org_id" ng-click="chooseOrg(org)">{{org.name}}</a>
<ul class="dropdown-menu" ng-if="org.children">
<li><a tabindex="-1" href="javascript:;" ng-repeat="child in org.children" ng-click="chooseOrg(child)">{{child.name}}</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
>BD User</label>
<div class="col-xs-6">
<select id="bd-select" class="form-control" ng-model="params.bd"
ng-options="bd.manager_id as bd.display_name group by bd.org_name for bd in bds|bdOrg:params.org_id">
<option value="">All</option>
</select>
</div>
</div>
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4">State</label>
<div class="col-xs-6">
<select class="form-control" name="state"
ng-model="params.state" maxlength="20"
ng-options="state.value as state.label for state in states">
<option value="">All</option>
</select>
</div>
</div>
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4">
Partner Code</label>
<div class="col-xs-6">
<textarea type="text" class="form-control" id="suburb-search"
ng-model="params.client_moniker" placeholder="code1,code2,code3,……"></textarea>
</div>
</div>
<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-9 col-xs-8">
<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.yesterday}">
</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:params.yesterday}">
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseToday()">Today</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterday()">Yesterday</a>
</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>
<div class="btn-group">
<a class="btn btn-primary" type="button" ng-click="loadClientsAmount(1)"><i
class="fa fa-search"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">List of Client</h3>
<a ng-if="clientAmount.length" class="btn btn-primary pull-right" role="button" ng-click="export()" ng-href="{{exportUrl}}"><i class="glyphicon glyphicon-save"></i> Excel</a>
</div>
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Partner Code</th>
<th>Short name</th>
<th>Bd name</th>
<th>State</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in clientAmount">
<td ng-bind="client.client_moniker"></td>
<td ng-bind="client.short_name"></td>
<td ng-bind="client.bd_user_name"></td>
<td ng-bind="client.state"></td>
<td ng-bind="client.total"></td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="clientAmount.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadClientsAmount()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></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>

@ -31,6 +31,10 @@
<li ui-sref-active="active" ng-if="('dashboard'|withModule)&&(currentUser.org_id==null)">
<a ui-sref="analysis_transaction.amountlsAnalysis"><i class="fa fa-area-chart"></i>交易金额分析|Transaction Amount Analysis</a>
</li>
<li ui-sref-active="active" ng-if="('merchantAmount'|withModule) &&('1'|withRole) ">
<a ui-sref="analysis_transaction.merchantAmountAnalysis"><i class="fa fa-area-chart"></i>商户交易额</a>
</li>
</ul>
</div>
</div>

Loading…
Cancel
Save