add unread interface

master
wangning 7 years ago
parent 08426e8a5a
commit 74861c60f7

@ -55,6 +55,8 @@ public interface RetailAppService {
JSONObject getNoticeDetailById(JSONObject device, String noticeId);
List<JSONObject> getLatestNotice(int client_id);
void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id);
JSONObject bankAccountInfo(JSONObject device);

@ -12,6 +12,7 @@ import au.com.royalpay.payment.manage.fund.core.impls.XPlanFundConfigServiceImpl
import au.com.royalpay.payment.manage.mappers.log.AppMessageLogMapper;
import au.com.royalpay.payment.manage.mappers.log.ClearingDetailAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper;
import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
@ -140,6 +141,8 @@ public class RetailAppServiceImp implements RetailAppService {
private ClientContractService clientContractService;
@Resource
private SysConfigManager sysConfigManager;
@Resource
private NoticePartnerMapper noticePartnerMapper;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
@ -422,14 +425,14 @@ public class RetailAppServiceImp implements RetailAppService {
switch (order.getString("channel")) {
case "Alipay":
JSONObject alipayUser = customerRelationAlipayMapper.findCustomerByUserId(customer_id);
if (alipayUser!=null){
if (alipayUser != null) {
order.put("nickname", alipayUser.getString("nickname"));
order.put("headimg", alipayUser.getString("headimg"));
}
break;
case "Wechat":
JSONObject weUser = customerMapper.findCustomerByOpenId(customer_id);
if (weUser!=null){
if (weUser != null) {
order.put("nickname", weUser.getString("nickname"));
order.put("headimg", weUser.getString("headimg"));
}
@ -442,12 +445,12 @@ public class RetailAppServiceImp implements RetailAppService {
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss");
order.put("trade_date", trade_date);
order.put("trade_time", trade_time);
//todo
if ("Debit".equals(order.getString("transaction_type"))){
order.put("currency","AUD");
// todo
if ("Debit".equals(order.getString("transaction_type"))) {
order.put("currency", "AUD");
}
if ("CNY".equals(order.getString("currency"))){
order.put("clearing_amount",order.getBigDecimal("total_amount"));
if ("CNY".equals(order.getString("currency"))) {
order.put("clearing_amount", order.getBigDecimal("total_amount"));
}
if (!date_contains.contains(trade_date)) {
String re_date = trade_date.replaceAll("-", "");
@ -869,6 +872,28 @@ public class RetailAppServiceImp implements RetailAppService {
return res;
}
@Override
public List<JSONObject> getLatestNotice(int client_id) {
JSONObject notice = new JSONObject();
JSONObject lastNotice = noticeManage.getLatestWindowNotice(client_id);
if(lastNotice!=null){
lastNotice.put("id",lastNotice.getString("notice_id"));
lastNotice.remove("notice_id");
}
notice.put("data",lastNotice);
JSONObject unReadParams = new JSONObject();
unReadParams.put("client_id",client_id);
unReadParams.put("status",0);
int counts = noticePartnerMapper.countNoticePartner(unReadParams);
notice.put("unReadCounts",counts);
notice.put("type","notice");
List<JSONObject> result = new ArrayList<>();
result.add(notice);
return result;
}
@Override
public void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id) {
String clientType = device.getString("client_type");
@ -1343,8 +1368,9 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject getCheckClientInfo(JSONObject device) {
return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id"));
return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id"));
}
private static boolean mathchLetterorNum(String str) {
String regex = "[A-Za-z0-9]{8}";
return str.matches(regex);

@ -4,6 +4,7 @@ import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
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.core.RetailAppService;
import au.com.royalpay.payment.manage.apps.AppController;
import au.com.royalpay.payment.manage.bill.bean.NewBillBean;
import au.com.royalpay.payment.manage.bill.bean.QueryBillBean;
import au.com.royalpay.payment.manage.bill.bean.QueryBillOrderBean;
@ -13,7 +14,6 @@ import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.advise.AppClientController;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils;
@ -39,7 +39,7 @@ import javax.validation.Valid;
/**
* Created by yishuqian on 28/03/2017.
*/
@AppClientController
@AppController
@RequestMapping("/api/v1.0/retail/app")
public class RetailAppController {
@Resource
@ -132,6 +132,11 @@ public class RetailAppController {
public JSONObject getNoticeId(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId) {
return retailAppService.getNoticeDetailById(device, noticeId);
}
@RequestMapping(value = "/notice/unread", method = RequestMethod.GET)
public List<JSONObject> latestNotice(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getLatestNotice(device.getIntValue("client_id"));
}
/* 消息模块end */
/* 我的页面begin */
@ -347,4 +352,5 @@ public class RetailAppController {
public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
clientContractService.confirmSourceAgreement(device.getIntValue("client_id"),device.getString("account_id"),"App");
}
}

@ -1,12 +1,17 @@
package au.com.royalpay.payment.manage.mappers.notice;
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 java.util.Date;
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.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Created by yishuqian on 10/10/2016.
*/
@ -20,4 +25,6 @@ public interface NoticeManageMapper {
void createNotice(JSONObject notice);
@AutoSql(type = SqlType.UPDATE)
void updateNotice(JSONObject notice);
JSONObject getLatestWindowNotice(@Param("client_id") int client_id,@Param("end_time")Date end_time);
}

@ -24,4 +24,5 @@ public interface NoticeManage {
JSONObject listNoticeReadClients(String noticeId, int page, int limit);
JSONObject getLatestWindowNotice(int client_id);
}

@ -1,25 +1,5 @@
package au.com.royalpay.payment.manage.notice.core.impls;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
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 au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.mappers.log.NotifyErrorLogMapper;
import au.com.royalpay.payment.manage.mappers.notice.NoticeManageMapper;
@ -32,6 +12,26 @@ import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.notice.core.NoticeManage;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
/**
* Created by yishuqian on 28/09/2016.
*/
@ -201,6 +201,10 @@ public class NoticeManageImpl implements NoticeManage {
return PageListUtils.buildPageListResult(clients);
}
@Override
public JSONObject getLatestWindowNotice(int client_id) {
return noticeManageMapper.getLatestWindowNotice(client_id,new Date());
}
}

@ -14,5 +14,14 @@
</where>
</select>
<select id="getLatestWindowNotice" resultType="com.alibaba.fastjson.JSONObject">
select n.title,n.`desc`,n.notice_id
from sys_notice_client c left join sys_notice n
on c.notice_id = n.notice_id and c.`status` = 0
where c.client_id = #{client_id} and n.status = 1
and end_time &gt; #{end_time}
and n.is_app_window = 1
order by n.send_time desc
limit 1
</select>
</mapper>
Loading…
Cancel
Save