add unsub mail list

master
wangning 6 years ago
parent 4cb5afca1a
commit b7386bc81b

@ -3,8 +3,9 @@ package au.com.royalpay.payment.manage.mappers.system;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
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;
@ -23,4 +24,6 @@ public interface MailUnsubMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject getById(@Param("id") Long id);
PageList<JSONObject> queryPageable(JSONObject params, PageBounds pagination);
}

@ -21,5 +21,7 @@ public interface MailService {
void removeUnsub(Long id);
void addUnsub(int clientId);
JSONObject queryUnsubPageable(JSONObject params, int limit, int page);
void addUnsub(String ClientMoniker);
}

@ -6,11 +6,13 @@ import au.com.royalpay.payment.manage.notice.beans.NoticeBean;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomStringUtils;
@ -186,16 +188,18 @@ public class MailServiceImp implements MailService {
@Override
public void removeUnsub(Long id) {
JSONObject record = mailUnsubMapper.getById(id);
if(record == null){
return;
}
mailUnsubMapper.delete(id);
}
@Override
public void addUnsub(int clientId) {
JSONObject client = clientManager.getClientInfo(clientId);
public JSONObject queryUnsubPageable(JSONObject params, int limit, int page) {
return PageListUtils.buildPageListResult(mailUnsubMapper.queryPageable(params,new PageBounds(page, limit)));
}
@Override
public void addUnsub(String ClientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(ClientMoniker);
if(client==null){
throw new NotFoundException("Merchant not Found");
}

@ -1,13 +1,17 @@
package au.com.royalpay.payment.manage.system.web;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.notice.core.MailService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author kira
* @date 2018/6/12
@ -16,11 +20,27 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/sys/mail")
public class MailController {
@Resource
private MailService mailService;
@RequestMapping(value = "/sub/{id}",method = RequestMethod.DELETE)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT})
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT})
public void removeSub(@PathVariable Long id) {
mailService.removeUnsub(id);
}
// return clientApply.listPartnerApply(manager,apply);
@RequestMapping(value = "/sub",method = RequestMethod.POST)
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT})
public void removeSub(@RequestParam String client_moniker) {
mailService.addUnsub(client_moniker);
}
@RequestMapping(value = "/sub/query",method = RequestMethod.GET)
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT})
public JSONObject list(@RequestParam String client_moniker,@RequestParam String address,@RequestParam int limit ,@RequestParam int page) {
JSONObject params = new JSONObject();
params.put("client_moinker",client_moniker);
params.put("address",address);
return mailService.queryUnsubPageable(params,limit,page);
}
}

@ -1,6 +1,6 @@
server.port=5000
spring.profiles.active=proxy,alipay,bestpay,jd,wechat
spring.profiles.active=dev,alipay,bestpay,jd,wechat
env.company=RoyalPay
@ -18,11 +18,11 @@ spring.datasource.max-idle=150
spring.datasource.max-wait=3000
spring.datasource.filters=stat,wall,log4j
spring.redis.host=192.168.99.100
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.database=1
spring.data.mongodb.host=192.168.99.100
spring.data.mongodb.host=10.30.0.8
spring.data.mongodb.port=27017
spring.data.mongodb.database=admin
spring.data.mongodb.username=mongouser

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.MailUnsubMapper">
<select id="queryPageable" resultType="com.alibaba.fastjson.JSONObject">
select * from sys_mail_unsub
<where>
<if test="client_moniker!=null">
client_moniker = #{client_moniker}
</if>
<if test="client_id != 0">
client_id = #{client_id}
</if>
<if test="address != null">
address = #{address}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save