diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActBean.java b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActBean.java new file mode 100644 index 000000000..5e6c3c103 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActBean.java @@ -0,0 +1,133 @@ +package au.com.royalpay.payment.manage.activities.app_index.beans; + +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; + +/** + * Created by yuan on 2018/3/14. + */ +public class AppActBean { + private String act_name; + private String act_url; + private String parms_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; + + + 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(parms_json)){ + params.put("parms_json",parms_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); + } + 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 getParms_json() { + return parms_json; + } + + public void setParms_json(String parms_json) { + this.parms_json = parms_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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActQueryBean.java b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActQueryBean.java new file mode 100644 index 000000000..c0447207a --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/beans/AppActQueryBean.java @@ -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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/AppActService.java b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/AppActService.java index 6193c0712..11ebc3c2d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/AppActService.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/AppActService.java @@ -1,9 +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 listAppActs(); + + JSONObject newAppAct(JSONObject manager, AppActBean appActBean); + + PageList listAppActs(JSONObject manager, AppActQueryBean appActQueryBean); + + JSONObject getActDetail(JSONObject manager,String act_id); + + void updateAct(JSONObject manager,String act_id,AppActBean appActBean); } diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/impls/AppActServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/impls/AppActServiceImp.java index 38042b283..5a78e66de 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/impls/AppActServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/core/impls/AppActServiceImp.java @@ -1,11 +1,18 @@ 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 @@ -21,6 +28,35 @@ public class AppActServiceImp implements AppActService { // String url = act.getString("act_url"); // act.put("act_url", PlatformEnvironment.getEnv().concatUrl(url)); // } - return actAppMapper.listActs(); + return actAppMapper.listActs(); + } + + @Override + public PageList 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; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/web/AppActController.java b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/web/AppActController.java index 71d782040..bd9d190b6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/app_index/web/AppActController.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/app_index/web/AppActController.java @@ -1,7 +1,42 @@ package au.com.royalpay.payment.manage.activities.app_index.web; -import org.springframework.web.bind.annotation.RestController; +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 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); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/beans/MonDelayBean.java b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/beans/MonDelayBean.java new file mode 100644 index 000000000..50bed1a12 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/beans/MonDelayBean.java @@ -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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/ActMonDelaySettleManagerService.java b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/ActMonDelaySettleManagerService.java new file mode 100644 index 000000000..5ebfd020e --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/ActMonDelaySettleManagerService.java @@ -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 getMonDelayClientRank(JSONObject manager,MonDelayBean monDelayBean); + + List getWeekendAnalysis(JSONObject manager,MonDelayBean monDelayBea); + + JSONObject analysisCashback(JSONObject manager,MonDelayBean monDelayBean); + + PageList clientRedPackList(JSONObject manager,MonDelayBean monDelayBean,String clientMoniker); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleManagerServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleManagerServiceImpl.java new file mode 100644 index 000000000..b6ad30bc7 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleManagerServiceImpl.java @@ -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 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 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 getMonDelayClientRank(JSONObject manager,MonDelayBean monDelayBean) { + JSONObject params = monDelayBean.toJsonParam(); + return actMonDelaySettleRedPackMapper.getMonDelayRank(params,new PageBounds(monDelayBean.getPage(),monDelayBean.getLimit())); + } + + @Override + public List 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 clientRedPackList(JSONObject manager, MonDelayBean monDelayBean,String clientMoniker) { + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + PageList list = actMonDelaySettleRedPackMapper.listRedpacks(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc"))); + return list; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/web/ActMonDelayManagerController.java b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/web/ActMonDelayManagerController.java new file mode 100644 index 000000000..027c42892 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/web/ActMonDelayManagerController.java @@ -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 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 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 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); + } +} + diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActAppMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActAppMapper.java index c20d88b00..b3e23c836 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActAppMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActAppMapper.java @@ -5,6 +5,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 java.util.List; @@ -14,4 +16,16 @@ public interface ActAppMapper { @AutoSql(type = SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1") List listActs (); + + @AutoSql(type = SqlType.SELECT) + PageList 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); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java index e0415428e..eba4a60fe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java @@ -5,6 +5,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; @@ -20,4 +22,6 @@ public interface ActMonDelaySettleMapper { @AutoSql(type = SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1") List clientLog (@Param("client_id") int client_id); + + PageList listAttendClients(JSONObject params, PageBounds pagination); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java index 39fc5fc48..0d0a508d2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java @@ -9,6 +9,7 @@ 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 { @@ -19,4 +20,12 @@ public interface ActMonDelaySettleRedPackMapper { @AutoSql(type = SqlType.SELECT) PageList listRedpacks(@Param("client_id") int client_id, PageBounds pagination); + + PageList getMonDelayRank(JSONObject params, PageBounds pageBounds); + + List getMondayAmount(JSONObject params); + + JSONObject analysisCashback(JSONObject params); + + } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.xml new file mode 100644 index 000000000..622687a1d --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.xml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.xml index ac1cf8a4e..46314de86 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.xml @@ -6,4 +6,55 @@ SELECT sum(redpack_amount) FROM act_mon_delay_settle_redpack where client_id=#{client_id} + + + + + + \ No newline at end of file diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index ab8e0d12a..2307b1969 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -328,6 +328,11 @@ margin-bottom: 10%;"/> 周末费率减半活动 +
  • + + 余额增值活动 + +
  • @@ -407,6 +412,13 @@ margin-bottom: 10%;"/> 网站管理|Site Manage
  • + +
  • + + App Act + +
  • +
  • 积分商城|Integral Mall diff --git a/src/main/ui/static/actapp/app_act_list.js b/src/main/ui/static/actapp/app_act_list.js new file mode 100644 index 000000000..2ba083d6c --- /dev/null +++ b/src/main/ui/static/actapp/app_act_list.js @@ -0,0 +1,80 @@ +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', function ($scope, $state, $http,commonDialog) { + $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 = angular.copy(act); + $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', function ($rootScope, $scope, $http, commonDialog,$state) { + $scope.actDetail = {}; + $scope.submit = function (form) { + $scope.errmsg = null; + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + $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', function ($rootScope, $scope, $http, commonDialog,actDetail,$state) { + $scope.actDetail = actDetail.data; + $scope.submit = function () { + $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; +}); \ No newline at end of file diff --git a/src/main/ui/static/actapp/templates/act_app_detail.html b/src/main/ui/static/actapp/templates/act_app_detail.html new file mode 100644 index 000000000..9ab3fa610 --- /dev/null +++ b/src/main/ui/static/actapp/templates/act_app_detail.html @@ -0,0 +1,127 @@ +
    +
    +

    APP_ACTIVITY

    + +
    +
    +
    +
    +
    +
    +
    + Edit Article +
    +
    +
    +
    +
    + +
    + +
    +

    Title is required

    +
    +
    +
    +
    +
    + +
    + +
    +

    Desc is required

    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/actapp/templates/act_app_list.html b/src/main/ui/static/actapp/templates/act_app_list.html new file mode 100644 index 000000000..2c20099ed --- /dev/null +++ b/src/main/ui/static/actapp/templates/act_app_list.html @@ -0,0 +1,89 @@ +
    +
    +

    APP_ACTIVITY

    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    +

    ACT List

    +
    + +
    + + + + + + + + + + + + + + + + + + +
    TitleAdd TimePublishedOperation
    + + + + + + + Edit + +
    + +
    + +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/analysis/mondelay/mondelay.js b/src/main/ui/static/analysis/mondelay/mondelay.js new file mode 100644 index 000000000..72580cb60 --- /dev/null +++ b/src/main/ui/static/analysis/mondelay/mondelay.js @@ -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; +}); \ No newline at end of file diff --git a/src/main/ui/static/analysis/mondelay/templates/mon_delay_analysis.html b/src/main/ui/static/analysis/mondelay/templates/mon_delay_analysis.html new file mode 100644 index 000000000..d19a84c82 --- /dev/null +++ b/src/main/ui/static/analysis/mondelay/templates/mon_delay_analysis.html @@ -0,0 +1,130 @@ +
    +
    + +
    +
    +
    +
    +
    +
    +

    Settle Delay Ranking

    +
    +
    +
    +
    +

    到目前为止红包总额排名(总额:{{totalCashBack}})

    +
    + + + + + + + + + + + + + + + +
    Partner NameCashback Amount
    +
    + +
    +
    Total Records:{{total_ranking_pagination.totalCount}};Total Pages:{{total_ranking_pagination.totalPages}}
    +
    +
    +
    +

    {{event_date}} 商户延迟清算总排名 (选择上图相应的日期获取当日排名)当日总额:{{cashBack_total_daily}}

    +
    + + + + + + + + + + + + + +
    Partner NameCashback Amount
    +
    + +
    +
    Total Records:{{day_ranking_pagination.totalCount}};Total Pages:{{day_ranking_pagination.totalPages}}
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/analysis/mondelay/templates/mon_delay_merchants.html b/src/main/ui/static/analysis/mondelay/templates/mon_delay_merchants.html new file mode 100644 index 000000000..0df3ffff5 --- /dev/null +++ b/src/main/ui/static/analysis/mondelay/templates/mon_delay_merchants.html @@ -0,0 +1,105 @@ +
    +

    周一返现

    + +
    +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/src/main/ui/static/analysis/mondelay/templates/mon_delay_merchants_detail.html b/src/main/ui/static/analysis/mondelay/templates/mon_delay_merchants_detail.html new file mode 100644 index 000000000..13eb68be5 --- /dev/null +++ b/src/main/ui/static/analysis/mondelay/templates/mon_delay_merchants_detail.html @@ -0,0 +1,54 @@ +
    +
    +
    + + +
    +
    Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}} +
    +
    +
    +
    +
    + + + + + + +