Merge branch 'mondelay' into develop

# Conflicts:
#	src/db/modify.sql
#	src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java
master
eason.qian 7 years ago
commit 6eb7c8b64f

@ -238,6 +238,51 @@ alter table statistics_customer_order add column refund_amount DECIMAL(20,2) DEF
ALTER TABLE `financial_bd_prize_log` ALTER TABLE `financial_bd_prize_log`
MODIFY COLUMN `manager_id` varchar(50) NOT NULL COMMENT 'bd user id' AFTER `record_id`; MODIFY COLUMN `manager_id` varchar(50) NOT NULL COMMENT 'bd user id' AFTER `record_id`;
CREATE TABLE act_mon_delay_settle
(
id VARCHAR(50) PRIMARY KEY NOT NULL,
client_id INT(11) NOT NULL,
account_id VARCHAR(50) NOT NULL,
account_name VARCHAR(100) COMMENT '商户账户名称',
create_time DATETIME NOT NULL COMMENT '参与开始时间(若在周一,下周生效)',
expire_time DATETIME COMMENT '结束时间',
is_valid TINYINT DEFAULT 1,
rate DECIMAL(4,2) COMMENT '年化收益率'
);
CREATE TABLE act_mon_delay_settle_redpack
(
id VARCHAR(50) PRIMARY KEY NOT NULL,
client_id INT(11) NOT NULL,
settle_amount DECIMAL(10,2) NOT NULL,
rate DECIMAL(4,2) COMMENT '收益率',
redpack_amount DECIMAL(10,2) COMMENT '奖励金额',
create_time DATETIME NOT NULL,
send_time DATETIME COMMENT '奖励发放时间'
);
CREATE TABLE `act_app_list` (
`act_id` varchar(50) NOT NULL,
`act_name` varchar(100) NOT NULL COMMENT '活动名称',
`act_url` varchar(400) DEFAULT NULL COMMENT '活动链接',
`is_valid` tinyint(1) NOT NULL DEFAULT 0,
`params_json` text DEFAULT NULL COMMENT '活动参数',
`create_time` datetime DEFAULT NULL,
`desc` varchar(400) DEFAULT NULL COMMENT '活动简介',
`act_content` text DEFAULT NULL COMMENT 'html',
`show_type` smallint(6) DEFAULT 0 COMMENT '0:url;1:content',
`is_show_window` tinyint(4) DEFAULT 0 COMMENT 'app是否弹框',
`act_img` varchar(200) DEFAULT NULL COMMENT '广告位图片',
`window_img` varchar(200) DEFAULT NULL COMMENT 'app弹框图片',
`update_time` datetime DEFAULT NULL,
`active_date` date NOT NULL COMMENT '生效日期',
`expire_date` date DEFAULT NULL COMMENT '活动结束日期',
PRIMARY KEY (`act_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='app活动'

@ -0,0 +1,174 @@
package au.com.royalpay.payment.manage.activities.app_index.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 org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import javax.xml.crypto.Data;
import java.text.ParseException;
import java.util.Date;
/**
* Created by yuan on 2018/3/14.
*/
public class AppActBean {
private static final String[] DATE_PATTERNS = {"yyyy-MM-dd"};
private String act_name;
private String act_url;
private String params_json;
private Boolean is_valid = true;
private String desc;
private String act_content;
private String show_type;
private Boolean is_show_window;
private String act_img;
private String window_img;
private String active_date;
private String expire_date;
public JSONObject toJsonParam(){
JSONObject params = new JSONObject();
if(StringUtils.isNotEmpty(act_name)){
params.put("act_name",act_name);
}
if(StringUtils.isNotEmpty(act_url)){
params.put("act_url",act_url);
}
if(StringUtils.isNotEmpty(params_json)){
params.put("params_json",params_json);
}
if(StringUtils.isNotEmpty(desc)){
params.put("desc",desc);
}
if(StringUtils.isNotEmpty(act_content)){
params.put("act_content",act_content);
}
if(StringUtils.isNotEmpty(show_type)){
params.put("show_type",show_type);
}
if(StringUtils.isNotEmpty(act_img)){
params.put("act_img",act_img);
}
if(StringUtils.isNotEmpty(window_img)){
params.put("window_img",window_img);
}
if (active_date != null) {
try {
Date fromDate = DateUtils.parseDate(active_date, DATE_PATTERNS);
params.put("active_date", fromDate);
} catch (ParseException e) {
throw new ParamInvalidException("active_date", "error.payment.valid.invalid_date_format");
}
}
if (expire_date != null) {
try {
Date fromDate = DateUtils.parseDate(expire_date, DATE_PATTERNS);
params.put("expire_date", fromDate);
} catch (ParseException e) {
throw new ParamInvalidException("expire_date", "error.payment.valid.invalid_date_format");
}
}
params.put("is_show_window",is_show_window);
params.put("is_valid",is_valid);
return params;
}
public String getAct_name() {
return act_name;
}
public void setAct_name(String act_name) {
this.act_name = act_name;
}
public String getAct_url() {
return act_url;
}
public void setAct_url(String act_url) {
this.act_url = act_url;
}
public String getParams_json() {
return params_json;
}
public void setParams_json(String params_json) {
this.params_json = params_json;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getAct_content() {
return act_content;
}
public void setAct_content(String act_content) {
this.act_content = act_content;
}
public String getAct_img() {
return act_img;
}
public void setAct_img(String act_img) {
this.act_img = act_img;
}
public String getWindow_img() {
return window_img;
}
public void setWindow_img(String window_img) {
this.window_img = window_img;
}
public String getShow_type() {
return show_type;
}
public void setShow_type(String show_type) {
this.show_type = show_type;
}
public Boolean getIs_show_window() {
return is_show_window;
}
public void setIs_show_window(Boolean is_show_window) {
this.is_show_window = is_show_window;
}
public Boolean getIs_valid() {
return is_valid;
}
public void setIs_valid(Boolean is_valid) {
this.is_valid = is_valid;
}
public String getActive_date() {
return active_date;
}
public void setActive_date(String active_date) {
this.active_date = active_date;
}
public String getExpire_date() {
return expire_date;
}
public void setExpire_date(String expire_date) {
this.expire_date = expire_date;
}
}

@ -0,0 +1,45 @@
package au.com.royalpay.payment.manage.activities.app_index.beans;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
/**
* Created by yuan on 2018/3/15.
*/
public class AppActQueryBean {
private boolean is_valid;
private int page = 1;
private int limit = 10;
public JSONObject toJsonParam(){
JSONObject params = new JSONObject();
if(is_valid){
params.put("is_valid",is_valid);
}
return params;
}
public boolean isIs_valid() {
return is_valid;
}
public void setIs_valid(boolean is_valid) {
this.is_valid = is_valid;
}
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,21 @@
package au.com.royalpay.payment.manage.activities.app_index.core;
import au.com.royalpay.payment.manage.activities.app_index.beans.AppActBean;
import au.com.royalpay.payment.manage.activities.app_index.beans.AppActQueryBean;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import java.util.List;
public interface AppActService {
List<JSONObject> listAppActs();
JSONObject newAppAct(JSONObject manager, AppActBean appActBean);
PageList<JSONObject> listAppActs(JSONObject manager, AppActQueryBean appActQueryBean);
JSONObject getActDetail(JSONObject manager,String act_id);
void updateAct(JSONObject manager,String act_id,AppActBean appActBean);
}

@ -0,0 +1,62 @@
package au.com.royalpay.payment.manage.activities.app_index.core.impls;
import au.com.royalpay.payment.manage.activities.app_index.beans.AppActBean;
import au.com.royalpay.payment.manage.activities.app_index.beans.AppActQueryBean;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.mappers.act.ActAppMapper;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class AppActServiceImp implements AppActService {
@Resource
private ActAppMapper actAppMapper;
@Override
public List<JSONObject> listAppActs(){
// List<JSONObject> list = actAppMapper.listActs();
// for (JSONObject act:list){
// String url = act.getString("act_url");
// act.put("act_url", PlatformEnvironment.getEnv().concatUrl(url));
// }
return actAppMapper.listActs();
}
@Override
public PageList<JSONObject> listAppActs(JSONObject manager, AppActQueryBean appActQueryBean){
JSONObject params = appActQueryBean.toJsonParam();
return actAppMapper.listAppActs(params,new PageBounds(appActQueryBean.getPage(), appActQueryBean.getLimit(), Order.formString("create_time.desc")));
}
@Override
public JSONObject getActDetail(JSONObject manager, String act_id) {
return actAppMapper.getActDetail(act_id);
}
@Override
public void updateAct(JSONObject manager, String act_id, AppActBean appActBean) {
JSONObject act = actAppMapper.getActDetail(act_id);
Assert.notNull(act);
JSONObject params = appActBean.toJsonParam();
params.put("act_id",act_id);
params.put("update_time",new Date());
actAppMapper.updateAct(params);
}
@Override
public JSONObject newAppAct(JSONObject manager, AppActBean appActBean) {
JSONObject params = appActBean.toJsonParam();
params.put("create_time",new Date());
actAppMapper.newAppAct(params);
return params;
}
}

@ -0,0 +1,42 @@
package au.com.royalpay.payment.manage.activities.app_index.web;
import au.com.royalpay.payment.manage.activities.app_index.beans.AppActBean;
import au.com.royalpay.payment.manage.activities.app_index.beans.AppActQueryBean;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.activities.monsettledelay.beans.MonDelayBean;
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 au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/manager/app/act")
public class AppActController {
@Autowired
private AppActService appActService;
@ManagerMapping(value = "/list",method = RequestMethod.GET,role = ManagerRole.SITE_MANAGER)
public JSONObject getAppActList(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, AppActQueryBean appActQueryBean){
PageList<JSONObject> appActList = appActService.listAppActs(manager,appActQueryBean);
return PageListUtils.buildPageListResult(appActList);
}
@ManagerMapping(value = "/{act_id}/act_detail",method = RequestMethod.GET,role = ManagerRole.SITE_MANAGER)
public JSONObject getAppActDetail(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String act_id){
return appActService.getActDetail(manager,act_id);
}
@ManagerMapping(value = "/new",method = RequestMethod.PUT,role = ManagerRole.SITE_MANAGER)
public JSONObject newAppAct(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody AppActBean appActBean){
return appActService.newAppAct(manager,appActBean);
}
@ManagerMapping(value = "/{act_id}",method = RequestMethod.PUT,role = ManagerRole.SITE_MANAGER)
public void updateAppAct(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String act_id,@RequestBody AppActBean appActBean){
appActService.updateAct(manager,act_id,appActBean);
}
}

@ -0,0 +1,85 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.beans;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import java.text.ParseException;
import java.util.Date;
/**
* Created by yuan on 2018/3/13.
*/
public class MonDelayBean {
private static final String[] DATE_PATTERNS = {"yyyyMMdd", "yyyy-MM-dd"};
private String client_moniker;
private String begin;
private String end;
private int page = 1;
private int limit = 10;
public JSONObject toJsonParam() {
JSONObject param = new JSONObject();
if (StringUtils.isNotBlank(client_moniker)) {
param.put("client_moniker", client_moniker);
}
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");
}
}
return param;
}
public String getClient_moniker() {
return client_moniker;
}
public void setClient_moniker(String client_moniker) {
this.client_moniker = client_moniker;
}
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,24 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.core;
import au.com.royalpay.payment.manage.activities.monsettledelay.beans.MonDelayBean;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import java.util.List;
/**
* Created by yuan on 2018/3/13.
*/
public interface ActMonDelaySettleManagerService {
JSONObject listAttendingClients(JSONObject manager, MonDelayBean monDelayBean);
//void disableClient(String clientMoniker);
PageList<JSONObject> getMonDelayClientRank(JSONObject manager,MonDelayBean monDelayBean);
List<JSONObject> getWeekendAnalysis(JSONObject manager,MonDelayBean monDelayBea);
JSONObject analysisCashback(JSONObject manager,MonDelayBean monDelayBean);
PageList<JSONObject> clientRedPackList(JSONObject manager,MonDelayBean monDelayBean,String clientMoniker);
}

@ -0,0 +1,13 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.core;
import com.alibaba.fastjson.JSONObject;
public interface ActMonDelaySettleService {
JSONObject getActNotice(JSONObject device);
JSONObject getActDetail(JSONObject device);
void actApply(JSONObject device);
void cancelAct(JSONObject device);
}

@ -0,0 +1,79 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.core.impls;
import au.com.royalpay.payment.manage.activities.monsettledelay.beans.MonDelayBean;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleManagerService;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* Created by yuan on 2018/3/13.
*/
@Service
public class ActMonDelaySettleManagerServiceImpl implements ActMonDelaySettleManagerService {
@Autowired
private ActMonDelaySettleMapper actMonDelaySettleMapper;
@Resource
private ClientMapper clientMapper;
@Autowired
private ActMonDelaySettleRedPackMapper actMonDelaySettleRedPackMapper;
@Override
public JSONObject listAttendingClients(JSONObject manager,MonDelayBean monDelayBean) {
JSONObject params = monDelayBean.toJsonParam();
PageList<JSONObject> clients = actMonDelaySettleMapper.listAttendClients(params, new PageBounds(monDelayBean.getPage(), monDelayBean.getLimit(), Order.formString("create_time.desc")));
return PageListUtils.buildPageListResult(clients);
}
/* @Override
public void disableClient(String clientMoniker) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client.getInteger("client_id"));
if (clientLogs.isEmpty() || clientLogs.size()==0){
throw new BadRequestException("您未参加活动,不可取消");
}
JSONObject clientLog = clientLogs.get(0);
clientLog.put("is_valid",0);
clientLog.put("expire_time",new Date());
actMonDelaySettleMapper.update(clientLog);
}
*/
@Override
public PageList<JSONObject> getMonDelayClientRank(JSONObject manager,MonDelayBean monDelayBean) {
JSONObject params = monDelayBean.toJsonParam();
return actMonDelaySettleRedPackMapper.getMonDelayRank(params,new PageBounds(monDelayBean.getPage(),monDelayBean.getLimit()));
}
@Override
public List<JSONObject> getWeekendAnalysis(JSONObject manager,MonDelayBean monDelayBean) {
JSONObject params = monDelayBean.toJsonParam();
return actMonDelaySettleRedPackMapper.getMondayAmount(params);
}
@Override
public JSONObject analysisCashback(JSONObject manager,MonDelayBean monDelayBean) {
JSONObject params = monDelayBean.toJsonParam();
return actMonDelaySettleRedPackMapper.analysisCashback(params);
}
@Override
public PageList<JSONObject> clientRedPackList(JSONObject manager, MonDelayBean monDelayBean,String clientMoniker) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
PageList<JSONObject> list = actMonDelaySettleRedPackMapper.listRedpacks(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
return list;
}
}

@ -0,0 +1,133 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.core.impls;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService;
import au.com.royalpay.payment.manage.mappers.act.ActAppMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
@Service
public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
@Resource
private ActMonDelaySettleRedPackMapper actMonDelaySettleRedPackMapper;
@Resource
private ActMonDelaySettleMapper actMonDelaySettleMapper;
@Resource
private DeviceSupport deviceSupport;
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private ActAppMapper actAppMapper;
@Override
public JSONObject getActNotice(JSONObject device){
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id);
JSONObject res = new JSONObject();
res.put("total_redpack",total_redpack);
res.put("desc","你有一份奖励待领取");
res.put("url", PlatformEnvironment.getEnv().concatUrl("/api/v1.0/retail/app/act/mondelay/desc"));
res.put("show",true);
return res;
}
@Override
public JSONObject getActDetail(JSONObject device){
JSONObject act = actAppMapper.getActDetail("1");
if (!act.getBoolean("is_valid")){
throw new BadRequestException("Activity is not valid");
}
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
JSONObject res = new JSONObject();
Boolean apply = false;
if (!clientLogs.isEmpty() && clientLogs.size()>0){
apply = true;
}
if (new Date().compareTo(act.getDate("active_date"))<0){
res.put("active",false);
res.put("active_date",act.getDate("active_date"));
res.put("expire",false);
}else if (new Date().compareTo(act.getDate("expire_date"))>0){
res.put("active",false);
res.put("expire",true);
}else {
res.put("active",true);
res.put("expire",false);
}
BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id);
PageList<JSONObject> list = actMonDelaySettleRedPackMapper.listRedpacks(client_id,new PageBounds(Order.formString("create_time.desc")));
res.put("apply",apply);
res.put("total_redpack",total_redpack);
res.put("list",list);
return res;
}
@Override
public void actApply(JSONObject device){
JSONObject act = actAppMapper.getActDetail("1");
if (!act.getBoolean("is_valid")){
throw new BadRequestException("The activity is not valid");
}
if (new Date().compareTo(act.getDate("active_date"))<0){
throw new BadRequestException("The activity has not yet begin");
}
if (new Date().compareTo(act.getDate("expire_date"))>0){
throw new BadRequestException("The activity has expired");
}
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
if (!clientLogs.isEmpty() && clientLogs.size()>0){
throw new BadRequestException("您已经参与过活动,无需重复报名");
}
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
throw new ForbiddenException("You have no permission");
}
device.put("account_name",account.getString("display_name"));
device.put("create_time",new Date());
device.put("rate",new BigDecimal(12));
device.put("expire_time",act.getDate("expire_date"));
actMonDelaySettleMapper.save(device);
}
@Override
public void cancelAct(JSONObject device){
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
if (clientLogs.isEmpty() || clientLogs.size()==0){
throw new BadRequestException("您未参加活动,不可取消");
}
JSONObject clientLog = clientLogs.get(0);
clientLog.put("is_valid",0);
clientLog.put("expire_time",new Date());
actMonDelaySettleMapper.update(clientLog);
}
}

@ -0,0 +1,65 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.web;
import au.com.royalpay.payment.manage.activities.monsettledelay.beans.MonDelayBean;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleManagerService;
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 au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by yuan on 2018/3/13.
*/
@RequestMapping(value = "/manage/mon_delay")
@RestController
public class ActMonDelayManagerController {
@Resource
private ActMonDelaySettleManagerService monDelayManagerService;
@ManagerMapping(value = "/clients", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
public JSONObject listAttendingClients(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, MonDelayBean monDelayBean) {
return monDelayManagerService.listAttendingClients(manager,monDelayBean);
}
/*@ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.DELETE, role = { ManagerRole.ADMIN })
public void disableClient(@PathVariable String clientMoniker) {
monDelayManagerService.disableClient(clientMoniker);
}*/
@ManagerMapping(value = "/{clientMoniker}/clients", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
public JSONObject clientRedPackList(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,MonDelayBean monDelayBean,@PathVariable String clientMoniker) {
PageList<JSONObject> redPackList = monDelayManagerService.clientRedPackList(manager,monDelayBean,clientMoniker);
if(redPackList==null){
return null;
}
return PageListUtils.buildPageListResult(redPackList);
}
@ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
public List<JSONObject> traAnalysis(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, MonDelayBean monDelayBean) {
return monDelayManagerService.getWeekendAnalysis(manager,monDelayBean);
}
@ManagerMapping(value = "/ranking", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
public JSONObject getRanking(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, MonDelayBean monDelayBean) {
PageList<JSONObject> clientRank = monDelayManagerService.getMonDelayClientRank(manager,monDelayBean);
if(clientRank==null){
return null;
}
return PageListUtils.buildPageListResult(clientRank);
}
@ManagerMapping(value = "/total", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
public JSONObject getTotal(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, MonDelayBean monDelayBean) {
return monDelayManagerService.analysisCashback(manager,monDelayBean);
}
}

@ -0,0 +1,16 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@RestController
@RequestMapping("/act/mondelay")
public class ActMonDelaySettleController {
@RequestMapping(value = "/desc", method = RequestMethod.GET)
public ModelAndView encourageLogs() {
ModelAndView mav = new ModelAndView("activity/");
return mav;
}
}

@ -1,6 +1,8 @@
package au.com.royalpay.payment.manage.appclient.web; package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
@ -28,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -51,6 +54,10 @@ public class RetailAppController {
@Resource @Resource
private BillService billService; private BillService billService;
@Resource @Resource
private ActMonDelaySettleService actMonDelaySettleService;
@Resource
private AppActService appActService;
@Resource
private ClientContractService clientContractService; private ClientContractService clientContractService;
@Resource @Resource
private SysConfigManager sysConfigManager; private SysConfigManager sysConfigManager;
@ -65,6 +72,7 @@ public class RetailAppController {
return retailAppService.listSubClients(device); return retailAppService.listSubClients(device);
} }
@RequestMapping(value = "/common", method = RequestMethod.GET) @RequestMapping(value = "/common", method = RequestMethod.GET)
public JSONObject getTransactionCommonData(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) { public JSONObject getTransactionCommonData(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) {
return retailAppService.getTransactionCommonData(device, appQueryBean); return retailAppService.getTransactionCommonData(device, appQueryBean);
@ -107,21 +115,20 @@ public class RetailAppController {
return retailAppService.getClientSettlementLog(device, appQueryBean); return retailAppService.getClientSettlementLog(device, appQueryBean);
} }
@RequestMapping("/transaction_log/{clearing_detail_id}") @RequestMapping("/transaction_log/{clearing_detail_id}")
public JSONObject getTransactionLogByClearingDetailId(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable int clearing_detail_id, public JSONObject getTransactionLogByClearingDetailId(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable int clearing_detail_id, @RequestParam(required = false) String timezone) {
@RequestParam(required = false) String timezone) {
return retailAppService.getTransactionLogsByClearingDetailId(device, clearing_detail_id, timezone); return retailAppService.getTransactionLogsByClearingDetailId(device, clearing_detail_id, timezone);
} }
/* 消息模块begin */ /*消息模块begin*/
@RequestMapping(value = "/notice", method = RequestMethod.GET) @RequestMapping(value = "/notice", method = RequestMethod.GET)
public JSONObject listNotices(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam Map<String, Object> params) { public JSONObject listNotices(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam Map<String, Object> params) {
return retailAppService.listNotices(device, (JSONObject) JSON.toJSON(params)); return retailAppService.listNotices(device, (JSONObject) JSON.toJSON(params));
} }
@RequestMapping(value = "/notice/{noticeId}", method = RequestMethod.PUT) @RequestMapping(value = "/notice/{noticeId}", method = RequestMethod.PUT)
public void updateNoticePartnerHasRead(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId, public void updateNoticePartnerHasRead(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId, @RequestBody JSONObject account_param) {
@RequestBody JSONObject account_param) {
if (!device.getString("account_id").equals(account_param.getString("account_id"))) { if (!device.getString("account_id").equals(account_param.getString("account_id"))) {
throw new ForbiddenException("You have no permission"); throw new ForbiddenException("You have no permission");
} }
@ -132,12 +139,12 @@ public class RetailAppController {
public JSONObject getNoticeId(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId) { public JSONObject getNoticeId(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId) {
return retailAppService.getNoticeDetailById(device, noticeId); return retailAppService.getNoticeDetailById(device, noticeId);
} }
/* 消息模块end */ /*消息模块end*/
/* 我的页面begin */ /*我的页面begin*/
@RequestMapping(value = "/partner_password/{account_id}", method = RequestMethod.PUT) @RequestMapping(value = "/partner_password/{account_id}", method = RequestMethod.PUT)
public void changePassword(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String account_id, public void changePassword(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String account_id, @RequestBody @Valid ChangePwdBean change, Errors errors) {
@RequestBody @Valid ChangePwdBean change, Errors errors) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
retailAppService.changeAccountPassword(device, change, account_id); retailAppService.changeAccountPassword(device, change, account_id);
} }
@ -161,12 +168,12 @@ public class RetailAppController {
public void signOut(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public void signOut(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
retailAppService.sign_out(device); retailAppService.sign_out(device);
} }
/* 我的页面end */ /*我的页面end*/
/* 活动页面 begin */ /*活动页面 begin*/
@RequestMapping(value = "/activities", method = RequestMethod.GET) @RequestMapping(value = "/activities", method = RequestMethod.GET)
public JSONObject getActivities(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam(defaultValue = "activity_page") String type, public JSONObject getActivities(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam(defaultValue = "activity_page") String type,
@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) { @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
return retailAppService.getActivities(device, type, page, limit); return retailAppService.getActivities(device, type, page, limit);
} }
@ -180,7 +187,7 @@ public class RetailAppController {
return retailAppService.checkT1Client(device); return retailAppService.checkT1Client(device);
} }
/* 活动页面 end */ /*活动页面 end*/
/** /**
* *
@ -198,19 +205,16 @@ public class RetailAppController {
return retailAppService.getClientInfo(device); return retailAppService.getClientInfo(device);
} }
@RequestMapping(value = "/client/check", method = RequestMethod.GET)
public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getCheckClientInfo(device);
}
@RequestMapping(value = "/client", method = RequestMethod.PUT) @RequestMapping(value = "/client", method = RequestMethod.PUT)
public void updateClient(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody AppClientBean appClientBean) { public void updateClient(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody AppClientBean appClientBean) {
retailAppService.updateClient(device, appClientBean); retailAppService.updateClient(device, appClientBean);
} }
@RequestMapping(value = "/daily_transactions/date/{dateStr}", method = RequestMethod.GET) @RequestMapping(value = "/daily_transactions/date/{dateStr}", method = RequestMethod.GET)
public JSONObject listDailyTransactions(@PathVariable String dateStr, @RequestParam(defaultValue = "Australia/Melbourne") String timezone, public JSONObject listDailyTransactions(@PathVariable String dateStr, @RequestParam(defaultValue = "Australia/Melbourne") String timezone,
@RequestParam(defaultValue = "false") boolean thisdevice, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { @RequestParam(defaultValue = "false") boolean thisdevice,
@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.listDailyTransactions(dateStr, timezone, thisdevice, device); return retailAppService.listDailyTransactions(dateStr, timezone, thisdevice, device);
} }
@ -260,8 +264,7 @@ public class RetailAppController {
} }
@RequestMapping(value = "/cash_back/clean_info", method = RequestMethod.GET) @RequestMapping(value = "/cash_back/clean_info", method = RequestMethod.GET)
public JSONObject getCashbackCleanInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, public JSONObject getCashbackCleanInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam(value = "client_id", required = false) String client_id) {
@RequestParam(value = "client_id", required = false) String client_id) {
if (client_id == null) { if (client_id == null) {
client_id = device.getString("client_id"); client_id = device.getString("client_id");
} }
@ -273,11 +276,11 @@ public class RetailAppController {
signInStatusManager.clientQRCodeAppSignIn(device, codeId); signInStatusManager.clientQRCodeAppSignIn(device, codeId);
} }
/* 优惠券Begin */
/*优惠券Begin*/
@RequestMapping(value = "/coupon/used", method = RequestMethod.GET) @RequestMapping(value = "/coupon/used", method = RequestMethod.GET)
public JSONObject getCoupons(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam(value = "page", defaultValue = "1") int page, public JSONObject getCoupons(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int limit) {
@RequestParam(value = "limit", defaultValue = "10") int limit) {
return retailAppService.getCoupons(device, page, limit); return retailAppService.getCoupons(device, page, limit);
} }
@ -290,7 +293,8 @@ public class RetailAppController {
public void useCoupon(@PathVariable String coupon_log_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public void useCoupon(@PathVariable String coupon_log_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
retailAppService.useCoupon(device, coupon_log_id); retailAppService.useCoupon(device, coupon_log_id);
} }
/* 优惠券End */ /*优惠券End*/
/** /**
* 广 * 广
@ -305,36 +309,57 @@ public class RetailAppController {
return retailAppService.getAdDetail(device, article_id); return retailAppService.getAdDetail(device, article_id);
} }
@RequestMapping(value = "/bills/{bill_id}", method = RequestMethod.GET)
public JSONObject getBill(@PathVariable("bill_id") String bill_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return billService.getBillDetail(bill_id, device.getIntValue("client_id"));
}
@RequestMapping(value = "/bills/list", method = RequestMethod.GET)
public JSONObject getBills(QueryBillBean queryBillBean, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return billService.queryBills(device.getIntValue("client_id"), queryBillBean);
}
@RequestMapping(value = "/bills", method = RequestMethod.PUT) @RequestMapping(value = "/bills/{bill_id}",method = RequestMethod.GET)
public JSONObject addBill(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody NewBillBean newBillBean) { public JSONObject getBill(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
JSONObject result = billService.save(device.getIntValue("client_id"), newBillBean); return billService.getBillDetail(bill_id,device.getIntValue("client_id"));
}
@RequestMapping(value = "/bills/list",method = RequestMethod.GET)
public JSONObject getBills(QueryBillBean queryBillBean,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
return billService.queryBills(device.getIntValue("client_id"),queryBillBean);
}
@RequestMapping(value = "/bills",method = RequestMethod.PUT)
public JSONObject addBill(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestBody NewBillBean newBillBean){
JSONObject result = billService.save(device.getIntValue("client_id"),newBillBean);
result.remove("bill"); result.remove("bill");
return result; return result;
} }
@RequestMapping(value = "/bills/{bill_id}/close",method = RequestMethod.POST)
public void closeBill(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
billService.updateBillStatus(bill_id,"2",device.getIntValue("client_id"));
}
@RequestMapping(value = "/bills/orders/{bill_id}",method = RequestMethod.GET)
public JSONObject getBillOrders(@PathVariable("bill_id")String bill_id, QueryBillOrderBean queryBillOrderBean,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
JSONObject result =billOrderService.query(bill_id,device.getIntValue("client_id"),queryBillOrderBean);
result.put("analysis",billOrderService.analysis(bill_id,device.getIntValue("client_id"),queryBillOrderBean));
return result;
}
@RequestMapping(value = "/acts",method = RequestMethod.GET)
public List<JSONObject> getIndexAct(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
return appActService.listAppActs();
}
@RequestMapping(value = "/bills/{bill_id}/close", method = RequestMethod.POST) @RequestMapping(value = "/act/mondelay/desc", method = RequestMethod.GET)
public void closeBill(@PathVariable("bill_id") String bill_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public ModelAndView getActDetail(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
billService.updateBillStatus(bill_id, "2", device.getIntValue("client_id")); ModelAndView mav = new ModelAndView("activity/mondelay/mondelay");
mav.addAllObjects(actMonDelaySettleService.getActDetail(device));
return mav;
} }
@RequestMapping(value = "/bills/orders/{bill_id}", method = RequestMethod.GET) @RequestMapping(value = "/act/mondelay/apply", method = RequestMethod.POST)
public JSONObject getBillOrders(@PathVariable("bill_id") String bill_id, QueryBillOrderBean queryBillOrderBean, public void apply(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { actMonDelaySettleService.actApply(device);
JSONObject result = billOrderService.query(bill_id, device.getIntValue("client_id"), queryBillOrderBean);
result.put("analysis", billOrderService.analysis(bill_id, device.getIntValue("client_id"), queryBillOrderBean));
return result;
} }
@RequestMapping(value = "/act/mondelay/cancel", method = RequestMethod.PUT)
public void cancel(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
actMonDelaySettleService.cancelAct(device);
}
@RequestMapping(value = "/file/agree", method = RequestMethod.GET) @RequestMapping(value = "/file/agree", method = RequestMethod.GET)
public JSONObject generateSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public JSONObject generateSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
JSONObject file = clientContractService.getSourceAgreement(device.getIntValue("client_id")); JSONObject file = clientContractService.getSourceAgreement(device.getIntValue("client_id"));

@ -0,0 +1,31 @@
package au.com.royalpay.payment.manage.mappers.act;
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.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import java.util.List;
@AutoMapper(tablename = "act_app_list", pkName = "act_id")
public interface ActAppMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
List<JSONObject> listActs ();
@AutoSql(type = SqlType.SELECT)
PageList<JSONObject> listAppActs (JSONObject params,PageBounds pagination);
@AutoSql(type = SqlType.SELECT)
JSONObject getActDetail(String act_id);
@AutoSql(type = SqlType.UPDATE)
void updateAct(JSONObject params);
@AutoSql(type = SqlType.INSERT)
void newAppAct(JSONObject params);
}

@ -0,0 +1,27 @@
package au.com.royalpay.payment.manage.mappers.act;
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.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@AutoMapper(tablename = "act_mon_delay_settle", pkName = "id")
public interface ActMonDelaySettleMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject clientlog);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject clientlog);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
List<JSONObject> clientLog (@Param("client_id") int client_id);
PageList<JSONObject> listAttendClients(JSONObject params, PageBounds pagination);
}

@ -0,0 +1,31 @@
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.math.BigDecimal;
import java.util.List;
@AutoMapper(tablename = "act_mon_delay_settle_redpack", pkName = "id")
public interface ActMonDelaySettleRedPackMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject dietOrderInfo);
BigDecimal getTotalRedPack(int client_id);
@AutoSql(type = SqlType.SELECT)
PageList<JSONObject> listRedpacks(@Param("client_id") int client_id, PageBounds pagination);
PageList<JSONObject> getMonDelayRank(JSONObject params, PageBounds pageBounds);
List<JSONObject> getMondayAmount(JSONObject params);
JSONObject analysisCashback(JSONObject params);
}

@ -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.act.ActMonDelaySettleMapper">
<select id="listAttendClients" resultType="com.alibaba.fastjson.JSONObject">
select act.account_name,act.create_time,act.client_id,c.client_moniker
FROM act_mon_delay_settle act
LEFT JOIN sys_clients c ON act.client_id = c.client_id
<where>
act.is_valid = 1 and c.is_valid = 1
<if test="client_moniker!=null">and c.client_moniker = #{client_moniker}</if>
<if test="begin != null">
and act.create_time &gt;= #{begin}
</if>
<if test="end != null">
and act.create_time &lt;= #{end}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,60 @@
<?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.ActMonDelaySettleRedPackMapper">
<select id="getTotalRedPack" resultType="java.math.BigDecimal">
SELECT sum(redpack_amount)
FROM act_mon_delay_settle_redpack where client_id=#{client_id}
</select>
<select id="getMonDelayRank" resultType="com.alibaba.fastjson.JSONObject">
select sum(red.settle_amount) settle_amount,sum(red.redpack_amount) redpack_amount, c.client_moniker,red.send_time
FROM act_mon_delay_settle_redpack red
LEFT JOIN act_mon_delay_settle act ON red.client_id = act.client_id
LEFT JOIN sys_clients c ON act.client_id = c.client_id
<where>
act.is_valid = 1 AND c.is_valid = 1
<if test="begin != null">
and red.send_time &gt; #{begin}
</if>
<if test="end != null">
and red.send_time &lt;= #{end}
</if>
</where>
group by red.client_id
order by settle_amount desc
</select>
<select id="getMondayAmount" resultType="com.alibaba.fastjson.JSONObject">
select DATE_FORMAT(red.send_time,'%Y-%m-%d') send_time,red.settle_amount,red.redpack_amount
from act_mon_delay_settle_redpack red
LEFT JOIN act_mon_delay_settle act ON red.client_id = act.client_id
LEFT JOIN sys_clients c ON red.client_id = c.client_id
<where>
act.is_valid = 1 AND c.is_valid = 1 and dayofweek(red.send_time)=2
<if test="begin != null">
and red.send_time &gt; #{begin}
</if>
<if test="end != null">
and red.send_time &lt;= #{end}
</if>
</where>
ORDER BY send_time ASC
</select>
<select id="analysisCashback" resultType="com.alibaba.fastjson.JSONObject">
select sum(red.settle_amount) settle_amount,sum(red.redpack_amount) redpack_amount
from act_mon_delay_settle_redpack red
LEFT JOIN act_mon_delay_settle act ON red.client_id = act.client_id
LEFT JOIN sys_clients c ON red.client_id = c.client_id
<where>
act.is_valid = 1 AND c.is_valid = 1
<if test="begin != null">
and red.send_time &gt; #{begin}
</if>
<if test="end != null">
and red.send_time &lt;= #{end}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<meta http-equiv="cache-control" content="max-age=0">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
<meta http-equiv="pragma" content="no-cache">
<link rel="stylesheet" href="/static/lib/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/templates/activity/mondelay/mondelay.css?t=201607242202">
<title>余额增值,周一专享活动</title>
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="/static/lib/jquery/jquery-2.1.4.min.js"></script>
</head>
<body>
<div class="title_img">
<h1><img src="/static/templates/activity/mondelay/title@2x.png"></h1>
</div>
<div class="content ul_font">
<div class="h2_width">
<h2>活动说明</h2>
</div>
<ul>
<li>参与商户<b class="font_color">每周一</b>即可获得营销补贴</li>
<li>
营销补贴金额,<b class="font_color">以账户余额为基数</b>,折算<b class="font_color">年化比率不低于15%最高20%</b>
</li>
<li>
参与商户周一暂停清算,与周一营销补贴合并至周二一起清算
</li>
<li>
补贴活动周期:<b class="font_color">2018/3/10-2018/6/30</b>
</li>
<li>商户自愿参加,中途随时终止活动</li>
<li>本活动最终解释权归RoyalPay所有</li>
</ul>
</div>
<div class="button_center" th:if="!${apply}" id="applyButton">
<button class="button_position">
<span style="color: #FFFFFF;">我要参加</span>
</button>
</div>
<div th:class="${apply}?'margin_top'">
<div class="content">
<div class="h3_width">
<h2>补贴金额记录</h2>
</div>
<div class="amount_title">
<h5>累计补贴金额</h5>
<div class="total_redpack">$ <span th:text="${total_redpack}"></span></div>
</div>
<div class="content_table">
<table class="table">
<thead>
<tr>
<th>时间</th>
<th style="text-align: right">补贴金额</th>
</tr>
</thead>
<tbody>
<tr th:each="redpack:${list}">
<td th:text="${#dates.format(redpack['send_time'], 'yyyy-MM-dd')}">>04-01 12:00</td>
<td style="text-align: right" th:text="${redpack['redpack_amount']}">$5.00</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="button_center cancel_posttion" th:if="${apply}" id="cancelButton">
<button class="button_position button_color">
<span class="cancel">取消</span>
</button>
</div>
<div class="shape1_position"><img src="/static/templates/activity/mondelay/shape1@2x.png"></div>
<div class="shape2_position"><img src="/static/templates/activity/mondelay/shape2@2x.png"></div>
<div class="shape3_position"><img src="/static/templates/activity/mondelay/shape3@2x.png"></div>
<div class="shape4_position"><img src="/static/templates/activity/mondelay/shape4@2x.png"></div>
<div class="shape5_position"><img src="/static/templates/activity/mondelay/shape5@2x.png"></div>
<div class="shape6_position"><img src="/static/templates/activity/mondelay/shape6@2x.png"></div>
<footer class="royal_position"><img src="/static/templates/activity/mondelay/logo@2x.png">
</footer>
</body>
</html>
<script type="text/javascript" data-th-inline="javascript">
$(document).ready(function () {
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
}
$('#applyButton').click(function () {
var u = navigator.userAgent;
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if(is_weixin()){
} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
appCmd('{\"type\":\"cmd_join_mondelay\"');
} else if (/(Android)/i.test(navigator.userAgent)) {
android.appCmd('{\"type\":\"cmd_join_mondelay\"}');
} else {
}
});
$('#cancelButton').click(function () {
var u = navigator.userAgent;
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if(is_weixin()){
} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
appCmd('{\"type\":\"cmd_cancel_mondelay\"');
} else if (/(Android)/i.test(navigator.userAgent)) {
android.appCmd('{\"type\":\"cmd_cancel_mondelay\"}');
} else {
}
});
})
</script>

@ -283,6 +283,11 @@ margin-bottom: 10%;"/>
ng-if="('1011110'|withRole) || currentUser.org_id==null">营销服务|Promotion ng-if="('1011110'|withRole) || currentUser.org_id==null">营销服务|Promotion
</li> </li>
<li ui-sref-active="active" ng-if="'appAct'|withModule">
<a ui-sref="appAct">
<i class="fa fa-file-text-o"></i> <span>活动管理|Activity Manage</span>
</a>
</li>
<li ui-sref-active="active" ng-if="('activities'|withModule) && (currentUser.org_id==1 || currentUser.org_id==null)"> <li ui-sref-active="active" ng-if="('activities'|withModule) && (currentUser.org_id==1 || currentUser.org_id==null)">
<a ui-sref="activity.detail({act_id:'3'})" ui-sref-opts="{reload:true}"> <a ui-sref="activity.detail({act_id:'3'})" ui-sref-opts="{reload:true}">
<i class="fa fa-compass"></i> <span>店长行动|Activities</span> <i class="fa fa-compass"></i> <span>店长行动|Activities</span>
@ -328,6 +333,11 @@ margin-bottom: 10%;"/>
<i class="fa fa-users"></i> <span>周末费率减半活动</span> <i class="fa fa-users"></i> <span>周末费率减半活动</span>
</a> </a>
</li> </li>
<li ui-sref-active="active" ng-if="'monDelay'|withModule">
<a ui-sref="mon_delay" ui-sref-opts="{reload:true}">
<i class="fa fa-users"></i> <span>余额增值活动</span>
</a>
</li>
<li class="header nav-header" ng-if="('1000000000000'|withRole)">机构|Agent</li> <li class="header nav-header" ng-if="('1000000000000'|withRole)">机构|Agent</li>
<li ui-sref-active="active" ng-if="('1000000000000'|withRole)"> <li ui-sref-active="active" ng-if="('1000000000000'|withRole)">
<a ui-sref="analysis_agent" ui-sref-opts="{reload:true}"> <a ui-sref="analysis_agent" ui-sref-opts="{reload:true}">
@ -407,6 +417,7 @@ margin-bottom: 10%;"/>
<i class="fa fa-file-text-o"></i> <span>网站管理|Site Manage</span> <i class="fa fa-file-text-o"></i> <span>网站管理|Site Manage</span>
</a> </a>
</li> </li>
<li ui-sref-active="active" ng-if="('10'|withRole)||('1000000'|withRole)||('10000000'|withRole)"> <li ui-sref-active="active" ng-if="('10'|withRole)||('1000000'|withRole)||('10000000'|withRole)">
<a href="https://customer.royalpay.com.au/manage/sign_in" target="_blank"> <a href="https://customer.royalpay.com.au/manage/sign_in" target="_blank">
<i class="fa fa-file-text-o"></i> <span>积分商城|Integral Mall</span> <i class="fa fa-file-text-o"></i> <span>积分商城|Integral Mall</span>

@ -0,0 +1,97 @@
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular) {
'use strict';
var app = angular.module('appAct', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ui.select']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('appAct', {
url: '/appAct/list',
templateUrl: '/static/actapp/templates/act_app_list.html',
controller: 'appActListCtrl'
}).state('appAct.new', {
url: '/appAct/new',
templateUrl: '/static/actapp/templates/act_app_detail.html',
controller: 'appActNewCtrl'
}).state('appAct.detail', {
url: '/{act_id}/detail',
templateUrl: '/static/actapp/templates/act_app_detail.html',
controller: 'appActDetailCtrl',
resolve: {
actDetail: ['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/manager/app/act/'+ $stateParams.act_id+'/act_detail');
}]
}
})
}]);
app.controller('appActListCtrl', ['$scope', '$state', '$http','commonDialog','$filter', function ($scope, $state, $http,commonDialog,$filter) {
$scope.pagination = {};
$scope.params = {};
$scope.loadActAppList = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/manager/app/act/list', {params: params}).then(function (resp) {
$scope.app_acts = resp.data.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.publishedOrIsValid = function (act) {
$scope.act = {};
$scope.act.act_id = act.act_id;
$scope.act.is_valid = !act.is_valid;
$http.put('/manager/app/act/' + $scope.act.act_id, $scope.act).then(function (resp) {
commonDialog.alert({title: 'Success', content: '修改成功', type: 'success'});
$scope.loadActAppList(1);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
$scope.loadActAppList(1);
}]);
app.controller('appActNewCtrl', ['$rootScope', '$scope', '$http', 'commonDialog','$state','$filter', function ($rootScope, $scope, $http, commonDialog,$state,$filter) {
$scope.actDetail = {};
$scope.ctrl = {dateInput: false};
$scope.submit = function (form) {
$scope.errmsg = null;
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
if ($scope.actDetail.active_date) {
$scope.actDetail.active_date = $filter('date')($scope.actDetail.active_date, 'yyyy-MM-dd');
}
if ($scope.actDetail.expire_date) {
$scope.actDetail.expire_date = $filter('date')($scope.actDetail.expire_date, 'yyyy-MM-dd');
}
$http.put('/manager/app/act/new', $scope.actDetail).then(function (resp) {
commonDialog.alert({title: 'Success', content: '新增成功', type: 'success'});
$state.go('^.detail',{act_id:resp.data.act_id},{reload:true});
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}
}]);
app.controller('appActDetailCtrl', ['$rootScope', '$scope', '$http', 'commonDialog', 'actDetail','$state','$filter', function ($rootScope, $scope, $http, commonDialog,actDetail,$state,$filter) {
$scope.actDetail = actDetail.data;
$scope.ctrl = {dateInput: false};
$scope.actDetail.active_date = new Date($scope.actDetail.active_date);
$scope.actDetail.expire_date = new Date($scope.actDetail.expire_date);
$scope.submit = function () {
if ($scope.actDetail.active_date) {
$scope.actDetail.active_date = $filter('date')($scope.actDetail.active_date, 'yyyy-MM-dd');
}
if ($scope.actDetail.expire_date) {
$scope.actDetail.expire_date = $filter('date')($scope.actDetail.expire_date, 'yyyy-MM-dd');
}
$http.put('/manager/app/act/' + $scope.actDetail.act_id, $scope.actDetail).then(function (resp) {
commonDialog.alert({title: 'Success', content: '修改成功', type: 'success'});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}
}]);
return app;
});

@ -0,0 +1,153 @@
<div ui-view>
<section class="content-header">
<h1>APP_ACTIVITY</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> 网站管理
</li>
<li class="active">Category - APP_ACTIVITY</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">
Edit Article
</div>
<div class="row">
<div class="col-xs-12">
<form novalidate class="form-horizontal" name="appActForm">
<div class="form-group"
ng-class="{'has-error':appActForm.act_name.$invalid && appActForm.act_name.$dirty}">
<label class="control-label col-xs-4 col-sm-2"
for="actDetail.act_name">Title *</label>
<div class="col-xs-8 col-sm-4">
<input type="text" class="form-control" id="actDetail.act_name" name="act_name"
ng-model="actDetail.act_name" required>
<div ng-messages="appActForm.act_name.$error" ng-if="appActForm.act_name.$dirty">
<p class="small text-danger" ng-message="required">Title is required</p>
</div>
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':appActForm.desc.$invalid && appActForm.desc.$dirty}">
<label class="control-label col-xs-4 col-sm-2" for="actDetail.desc">ACT Desc *</label>
<div class="col-xs-8 col-sm-4">
<textarea class="form-control" id="actDetail.desc" name="desc"
ng-model="actDetail.desc" required></textarea>
<div ng-messages="appActForm.desc.$error" ng-if="appActForm.desc.$dirty">
<p class="small text-danger" ng-message="required">Desc is required</p>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-2"
for="actDetail.act_name">活动时间 *</label>
<div class="col-xs-8 col-sm-4">
<div style="display: inline-block" ng-class="{'has-error':appActForm.active_date.$invalid && appActForm.active_date.$dirty}">
<input class="form-control" id="date-from-input"
ng-model="actDetail.active_date"
uib-datepicker-popup size="10" placeholder="Active Date"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
name="active_date" required>
<div ng-messages="appActForm.active_date.$error" ng-if="appActForm.active_date.$dirty">
<p class="small text-danger" ng-message="required">Active Date is required</p>
</div>
</div>
~
<div style="display: inline-block" ng-class="{'has-error':appActForm.expire_date.$invalid && appActForm.expire_date.$dirty}">
<input class="form-control" id="date-to-input" ng-model="actDetail.expire_date"
uib-datepicker-popup size="10" placeholder="Expire Date"
is-open="dateTo.open" ng-click="dateTo.open=true"
name="expire_date" required>
<div ng-messages="appActForm.expire_date.$error" ng-if="appActForm.expire_date.$dirty">
<p class="small text-danger" ng-message="required">Expire Date is required</p>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-2" for="actDetail.params_json">Parms
Json</label>
<div class="col-xs-8 col-sm-4">
<textarea class="form-control" id="actDetail.params_json"
ng-model="actDetail.params_json"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-2">Show Window</label>
<div class="col-xs-8 col-sm-4">
<input type="checkbox" class="checkbox-inline checkbox" ng-model="actDetail.is_show_window">
</div>
</div>
<div class="form-group" ng-if="actDetail.is_show_window">
<label class="control-label col-xs-4 col-sm-2" for="actDetail.window_img">Window
Img</label>
<div class="col-xs-8 col-sm-4">
<input type="text" class="form-control" id="actDetail.window_img"
ng-model="actDetail.window_img">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-2" for="actDetail.act_img">Act
Img</label>
<div class="col-xs-8 col-sm-4">
<input type="text" class="form-control" id="actDetail.act_img"
ng-model="actDetail.act_img">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-2">Show
Type</label>
<div class="col-xs-8 col-sm-4">
<label class="radio-inline">
<input type="radio" name="optionsRadiosinline" id="optionsRadios3" value="0" checked
ng-model="actDetail.show_type"> Url
</label>
<label class="radio-inline">
<input type="radio" name="optionsRadiosinline" id="optionsRadios4" value="1"
ng-model="actDetail.show_type"> Content
</label>
</div>
</div>
<div class="form-group" ng-if="actDetail.show_type == 0">
<label class="control-label col-xs-4 col-sm-2" for="actDetail.act_url">Act
Url</label>
<div class="col-xs-8 col-sm-4">
<input type="text" class="form-control" id="actDetail.act_url"
ng-model="actDetail.act_url">
</div>
</div>
<div class="form-group" ng-if="actDetail.show_type == 1">
<label class="control-label col-xs-4 col-sm-2" for="actDetail.act_content">Act
Content</label>
<div class="col-xs-8 col-sm-4">
<input type="text" class="form-control" id="actDetail.act_content"
ng-model="actDetail.act_content">
</div>
</div>
<div class="col-xs-12">
<div class="btn-group">
<button class="btn btn-success" type="button" ng-click="submit(appActForm)">
Submit
</button>
</div>
<div class="btn-group">
<button class="btn btn-danger" type="button" ui-sref="appAct">
Cancel
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,92 @@
<div ui-view>
<section class="content-header">
<h1>APP_ACTIVITY</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> 网站管理
</li>
<li class="active">Category - APP_ACTIVITY</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">
<div class="form-inline">
<div class="form-group">
<button class="btn btn-success" type="button" ui-sref=".new"><i class="fa fa-plus"></i> New ACT</button>
<div class="checkbox">
<label>
<input type="checkbox" ng-click="loadActAppList(1)" ng-model="params.is_valid">Published
</label>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">ACT List</h3>
</div>
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Title</th>
<th>Add Time</th>
<th>Active Date</th>
<th>Expire Date</th>
<th>Published</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="act in app_acts">
<td ng-bind="act.act_name"></td>
<td ng-bind="act.create_time"></td>
<td ng-bind="act.active_date"></td>
<td ng-bind="act.expire_date"></td>
<td>
<span ng-click="publishedOrIsValid(act)">
<i class="text-success fa fa-check" ng-if="act.is_valid"></i>
<i class="text-danger fa fa-close" ng-if="!act.is_valid"></i>
</span>
</td>
<td>
<a class="text-primary" role="button" title="Detail"
ui-sref=".detail({act_id:act.act_id})">
<i class="fa fa-edit"></i> Edit
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="app_acts.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="loadActAppList()"
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>
</div>

@ -0,0 +1,224 @@
define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angular) {
'use strict';
var colors = ['#00c0ef', '#00a65a', '#ff851b'];
var app = angular.module('monDelay', ['ui.bootstrap', 'ui.router', 'ngEcharts']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('mon_delay', {
url: '/mon_delay',
templateUrl: '/static/analysis/mondelay/templates/mon_delay_merchants.html',
controller: 'monDelayDialogCtrl'
}).state('mon_delay.analysis',{
url:'/mon_delay/analysis',
templateUrl: '/static/analysis/mondelay/templates/mon_delay_analysis.html',
controller: 'monDelayAnalysisDialogCtrl'
})
}]);
app.controller('monDelayDialogCtrl', ['$scope', '$http', '$filter','$uibModal', function ($scope, $http, $filter,$uibModal) {
$scope.pagination = {};
$scope.params = {};
$scope.loadClients = function (page) {
var params = angular.copy($scope.params);
if(params.begin){
params.begin = $filter('date')($scope.params.begin, 'yyyy-MM-dd')
}
if(params.end){
params.end = $filter('date')($scope.params.end, 'yyyy-MM-dd')
}
params.page = page || $scope.pagination.page || 1;
$http.get('/manage/mon_delay/clients', {params: params}).then(function (resp) {
$scope.clients = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
$scope.loadClients();
$scope.ctrl = {dateInput: false};
$scope.clientRedPackList = function (client) {
$uibModal.open({
templateUrl: '/static/analysis/mondelay/templates/mon_delay_merchants_detail.html',
controller: 'monDelayMerchantsDetailDialogCtrl',
size: 'lg',
resolve: {
clientMoniker: function () {
return client.client_moniker;
}
}
}).result.then(function () {
});
};
/* $scope.disableClient = function (client) {
$http.delete('/manage/mon_delay/clients/' + client.client_moniker).then(function () {
$scope.loadClients();
});
};*/
}]);
app.controller('monDelayMerchantsDetailDialogCtrl', ['$scope', '$http', '$filter', 'clientMoniker',function ($scope, $http, $filter,clientMoniker) {
$scope.pagination = {};
$scope.params = {};
$scope.loadRepackList = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/manage/mon_delay/'+ clientMoniker + '/clients', {params: params}).then(function (resp) {
$scope.redPackList = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
$scope.loadRepackList();
}]);
app.controller('monDelayAnalysisDialogCtrl', ['$scope', '$http', '$filter','$state', function ($scope, $http, $filter,$state) {
$scope.params = {};
$scope.today = new Date();
$scope.params.end = new Date();
var date = new Date();
date.setDate(date.getDate()-30);
$scope.params.begin = date;
$scope.thisMonth = function () {
$scope.params.end = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
$scope.doAnalysis(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.doAnalysis(1);
};
$scope.doPartnerTotalRanking = function (page) {
var params = {};
params.page = page||$scope.total_ranking_pagination.page || 1;
params.limit = 20;
$http.get('/manage/mon_delay/ranking', {params: params}).then(function (resp) {
$scope.redPackPartnersRanking = resp.data.data;
$scope.total_ranking_pagination = resp.data.pagination;
})
};
$scope.getTotalCashBack = function(){
$http.get('/manage/mon_delay/total').then(function (resp) {
$scope.totalCashBack = resp.data.redpack_amount;
})
}
$scope.getClientsCashbackRankingByDate = function (date,page) {
$scope.event_date = date;
var params = {};
params.begin = date;
var event_date_format=date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3");
var endDate = new Date(event_date_format);
endDate.setDate(endDate.getDate());
params.end =$filter('date')(endDate,'yyyyMMdd');
params.page = page||$scope.day_ranking_pagination.page || 1;
params.limit = 20;
$http.get('/manage/mon_delay/ranking', {params: params}).then(function (resp) {
$scope.cashbackPartnersRankingByDate = resp.data.data;
if(resp.data.data != null){
$scope.event_date = $filter('date')(new Date($scope.cashbackPartnersRankingByDate[0].send_time),'yyyy-MM-dd');
}
$scope.day_ranking_pagination = resp.data.pagination;
});
};
$scope.doAnalysis = function () {
var params = angular.copy($scope.params);
if (params.begin) {
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
} else {
params.begin = $filter('date')(new Date(), 'yyyyMMdd');
}
if (params.end) {
params.end = $filter('date')(params.end, 'yyyyMMdd');
} else {
params.end = $filter('date')(new Date(), 'yyyyMMdd');
}
$http.get('/manage/mon_delay/traAnalysis', {params: params}).then(function (resp) {
$scope.cashbackDaily = angular.copy(resp.data);
if($scope.cashbackDaily.length != 0){
var params ={};
params.dataIndex = 0;
$scope.monDelay(params);
}
var dates = [];
var mon_net_amount = [];
var cashback = [];
resp.data.forEach(function (e) {
dates.push(e.send_time);
cashback.push(e.redpack_amount);
mon_net_amount.push(e.settle_amount);
});
var cashbackHistoryConfig = function (dates,mon_net_amount, cashback) {
return {
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
data: ['周一清算额','返现']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: dates
}
],
yAxis: [
{
type: 'value',
name: 'Amount(AUD)'
}
],
series: [{
name: '周一清算额',
type: 'bar',
data: mon_net_amount
},
{
name: '返现',
type: 'bar',
data: cashback
}
]
};
};
$scope.settleDelayHistory = cashbackHistoryConfig(dates,mon_net_amount, cashback);
});
$scope.doPartnerTotalRanking(1);
$scope.getTotalCashBack(1);
};
$scope.doAnalysis(1);
$scope.settleDelayEchart = function (chart) {
chart.on('click', function (params) {
$scope.monDelay(params);
})
};
$scope.monDelay = function (params) {
$scope.cashBack_total_daily = $scope.cashbackDaily[params.dataIndex].redpack_amount;
var event_date = $scope.cashbackDaily[params.dataIndex].send_time;
if (event_date) {
event_date+="";
var event_date_format=event_date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3");
var date = new Date(event_date_format);
$scope.getClientsCashbackRankingByDate($filter('date')(date,'yyyyMMdd'),1);
}
}
}]);
return app;
});

@ -0,0 +1,130 @@
<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:settleDelayHistory.nodata}"></div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">Settle Delay 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="totalCashBack!=null">(总额:{{totalCashBack}})</span></p>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Partner Name</th>
<th>Cashback Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in redPackPartnersRanking">
<!--<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.redpack_amount"></td>
</tr>
</tbody>
</table>
</div>
<uib-pagination ng-if="cashbackPartnersRanking.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="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></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>Cashback Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in cashbackPartnersRankingByDate">
<td ng-bind="client.client_moniker"></td>
<td ng-bind="client.redpack_amount"></td>
</tr>
</tbody>
</table>
</div>
<uib-pagination ng-if="cashbackPartnersRankingByDate.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="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></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,105 @@
<section class="content-header">
<h4>周一返现</h4>
<ol class="breadcrumb">
<li>
<i class="fa fa-users"></i> Payment
</li>
<li class="active">
MonDelay
</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="mon_delay">Merchants</a>
</li>
<li ui-sref-active="active">
<a ui-sref="mon_delay.analysis">Analysis</a>
</li>
</ul>
<div class="tab-content" ui-view>
<div class="modal-body">
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
<div class="form-inline">
<div class="form-group">
<input class="form-control" placeholder="Client Moniker" ng-model="params.client_moniker">
</div>
<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>
<button class="btn btn-success" ng-click="loadClients()"><i
class="fa fa-search"></i> Search</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>Attend Date</th>
<th>Account Name</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in clients">
<td ng-bind="client.client_moniker"></td>
<td ng-bind="client.create_time"></td>
<td ng-bind="client.account_name"></td>
<td>
<!--<a role="button" class="text-danger" ng-click="disableClient(client)"><i class="fa fa-ban"></i></a>-->
<a class="text-primary" role="button" title="Detail"
ng-click="clientRedPackList(client)">
<i class="fa fa-search"></i> Detail
</a>
</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="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
</div>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,54 @@
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="modal-body">
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
<div class="row" ng-if="redPackList.length">
<div class="col-xs-12 table-responsive">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>Send Time</th>
<th>Redpack Amount</th>
<th>Settle Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="redPack in redPackList">
<td ng-bind="redPack.send_time"></td>
<td ng-bind="redPack.redpack_amount"></td>
<td ng-bind="redPack.settle_amount"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<uib-pagination ng-if="redPackList.length"
class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadRepackList()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
</div>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}
</div>
</div>
</div>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

@ -0,0 +1,206 @@
body{
background: url(background@2x.png) no-repeat center top;
background-size: 100%;
background-color: #02218A;
}
.title_img{
text-align: center;
}
.title_img img{
height: 100px;
margin-top: 40px;
margin-bottom: 15px;
}
.h2_width{
width: 100px;
margin: 0 auto;
}
.h3_width{
width: 140px;
margin: 0 auto;
}
.amount_title{
margin-top: 24px;
margin-bottom: 10px;
text-align: center;
font-family: PingFangSC-Regular;
color: #2849DF;
letter-spacing: 0px;
}
amount_title h5{
font-size: 12px;
}
.total_redpack{
margin-top: -10px;
font-family: Avenir-Heavy;
font-size: 25px;
}
h2{
font-family:PingFang-SC-Medium;
font-size: 17px;
color: #2F4FDF;
letter-spacing: 0px;
border-bottom:2px solid #2F4FDF;
border-top: 2px solid #2F4FDF;
text-align: center;
padding: 7px;
margin-top: 10px;
}
.content{
background: #FFFFFF;
border-radius: 4px;
padding: 10px;
margin-right: 30px;
margin-left: 30px;
}
.font_color{
background-color: #9BFBFE;
}
.ul_font{
font-family: PingFangSC-Regular;
font-size: 14px;
color: #2849DF;
letter-spacing: 0px;
line-height: 26px;
}
.button_center{
text-align: center;
}
.button_position{
text-align: center;
font-family: PingFang-SC-Semibold;
font-size: 17px;
color: #FFFFFF;
letter-spacing: 0px;
margin-top: 38px;
margin-bottom: 38px;
background-image: linear-gradient(0deg, #E3066B 0%, #FFC70E 100%);
border-radius: 100px;
border-style: none;
padding: 15px 50px;
}
.button_active{
background: url("button@2x.png") no-repeat center;
border-radius: 100px;
padding: 15px 30px;
}
.button_active span{
font-family: Avenir-Medium;
font-size: 17px;
letter-spacing: 0px;
}
.button_color{
background-image: linear-gradient(0deg, #195ED0 0%, #4BBCF3 100%);
border-radius: 100px;
margin-bottom: -16px;
}
.cancel{
color: #FFFFFF;
padding: 13px 24px;
}
.content_table{
font-family: PingFang-SC-Semibold;
font-size: 14px;
letter-spacing: 0px;
}
table{
width: 100%;
border-style: hidden;
}
table td{
color:#2849DF;;
border-style: hidden;
}
table tr{
color:#2849DF;
border-style: hidden;
}
tbody tr:nth-child(odd){
background-color: #9BFBFE;
opacity: 0.7;
}
.royal_position{
margin-top: 50px;
margin-bottom: 20px;
text-align: center;
}
.royal_position img{
height: 25px;
}
.shape1_position{
position: absolute;
left: 20px;
top: 250px;
}
.shape1_position img{
height: 33px;
width: 55px;
}
.shape2_position{
position: absolute;
right: 5px;
top: 180px;
}
.shape2_position img{
height: 63px;
width: 90px;
}
.shape3_position{
position: absolute;
top: 232px;
right: 23px;
}
.shape3_position img{
height: 16px;
}
.shape4_position{
position: absolute;
left: 0px;
top: 460px;
}
.shape4_position img{
width: 75px;
height: 135px;
}
.shape5_position{
position: absolute;
right: 0px;
top: 550px;
}
.shape5_position img{
width: 95px;
height: 100px;
}
.shape6_position{
position: absolute;
left: -9px;
z-index: -1;
}
.shape6_position img{
height: 100px;
}
.margin_top{
margin-top: 50px;
}
.margin_bottom{
margin-bottom: 35px;
}
.activity_close{
display: flex;
width: 70%;
margin: 0 auto 25px auto;
}
.line{
flex: 1;
position: relative;
top: -15px;
border-bottom: 1px solid #FFFFFF;;
}
.activity_text{
font-family:PingFang-SC-Medium;
font-size: 22px;
color: #FFFFFF;
letter-spacing: 0px;
padding: 0 8px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Loading…
Cancel
Save