unread add act info

master
wangning 7 years ago
parent c4f482af8e
commit e319db47ef

@ -18,4 +18,6 @@ public interface AppActService {
JSONObject getActDetail(JSONObject manager,String act_id); JSONObject getActDetail(JSONObject manager,String act_id);
void updateAct(JSONObject manager,String act_id,AppActBean appActBean); void updateAct(JSONObject manager,String act_id,AppActBean appActBean);
JSONObject getLatestWindowNotice();
} }

@ -4,17 +4,20 @@ 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.beans.AppActQueryBean;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService; import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.mappers.act.ActAppMapper; import au.com.royalpay.payment.manage.mappers.act.ActAppMapper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
@Service @Service
public class AppActServiceImp implements AppActService { public class AppActServiceImp implements AppActService {
@ -52,6 +55,11 @@ public class AppActServiceImp implements AppActService {
actAppMapper.updateAct(params); actAppMapper.updateAct(params);
} }
@Override
public JSONObject getLatestWindowNotice() {
return actAppMapper.getLatestWindowNotice(new Date());
}
@Override @Override
public JSONObject newAppAct(JSONObject manager, AppActBean appActBean) { public JSONObject newAppAct(JSONObject manager, AppActBean appActBean) {
JSONObject params = appActBean.toJsonParam(); JSONObject params = appActBean.toJsonParam();

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.appclient.core.impls; package au.com.royalpay.payment.manage.appclient.core.impls;
import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper; import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
@ -29,7 +30,6 @@ import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService; import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.signin.core.impls.SignInAccountServiceImpl; import au.com.royalpay.payment.manage.signin.core.impls.SignInAccountServiceImpl;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.cms.RoyalPayCMSSupport; import au.com.royalpay.payment.tools.cms.RoyalPayCMSSupport;
import au.com.royalpay.payment.tools.device.DeviceSupport; import au.com.royalpay.payment.tools.device.DeviceSupport;
@ -37,7 +37,6 @@ import au.com.royalpay.payment.tools.device.message.AppMessage;
import au.com.royalpay.payment.tools.device.message.AppMsgSender; import au.com.royalpay.payment.tools.device.message.AppMsgSender;
import au.com.royalpay.payment.tools.device.support.DeviceRegister; import au.com.royalpay.payment.tools.device.support.DeviceRegister;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
@ -138,11 +137,9 @@ public class RetailAppServiceImp implements RetailAppService {
@Resource @Resource
private ClientDeviceTokenMapper clientDeviceTokenMapper; private ClientDeviceTokenMapper clientDeviceTokenMapper;
@Resource @Resource
private ClientContractService clientContractService;
@Resource
private SysConfigManager sysConfigManager;
@Resource
private NoticePartnerMapper noticePartnerMapper; private NoticePartnerMapper noticePartnerMapper;
@Resource
private AppActService appActService;
private Map<String, AppMsgSender> senderMap = new HashMap<>(); private Map<String, AppMsgSender> senderMap = new HashMap<>();
@ -875,24 +872,41 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public List<JSONObject> getLatestNotice(int client_id) { public List<JSONObject> getLatestNotice(int client_id) {
JSONObject notice = new JSONObject(); JSONObject notice = new JSONObject();
JSONObject lastNotice = noticeManage.getLatestWindowNotice(client_id); JSONObject latestNotice = noticeManage.getLatestWindowNotice(client_id);
if(lastNotice!=null){ if (latestNotice != null) {
lastNotice.put("id",lastNotice.getString("notice_id")); latestNotice.put("id", latestNotice.getString("notice_id"));
lastNotice.remove("notice_id"); latestNotice.remove("notice_id");
} }
notice.put("data",lastNotice); notice.put("data", latestNotice);
JSONObject unReadParams = new JSONObject(); JSONObject unReadParams = new JSONObject();
unReadParams.put("client_id",client_id); unReadParams.put("client_id", client_id);
unReadParams.put("status",0); unReadParams.put("status", 0);
int counts = noticePartnerMapper.countNoticePartner(unReadParams); int counts = noticePartnerMapper.countNoticePartner(unReadParams);
notice.put("unReadCounts",counts); notice.put("unReadCounts", counts);
notice.put("type","notice"); notice.put("type", "notice");
List<JSONObject> result = new ArrayList<>(); List<JSONObject> result = new ArrayList<>();
result.add(notice); result.add(notice);
return result; JSONObject latestAct = appActService.getLatestWindowNotice();
} if (latestAct != null) {
latestAct.put("id", latestAct.getString("act_id"));
if (latestAct.getIntValue("show_type") == 0) {
latestAct.put("url", latestAct.getString("act_url"));
}
latestAct.put("title", latestAct.getString("act_name"));
latestAct.put("img", latestAct.getString("window_img"));
latestAct.remove("act_id");
latestAct.remove("act_name");
latestAct.remove("window_img");
latestAct.remove("act_url");
JSONObject act = new JSONObject();
act.put("data", latestAct);
act.put("type", "act");
result.add(act);
}
return result;
}
@Override @Override
public void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id) { public void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id) {

@ -15,8 +15,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.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService; import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.CommonConsts; 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.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
@ -30,6 +28,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.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -42,7 +41,7 @@ import javax.validation.Valid;
/** /**
* Created by yishuqian on 28/03/2017. * Created by yishuqian on 28/03/2017.
*/ */
@AppClientController @RestController
@RequestMapping("/api/v1.0/retail/app") @RequestMapping("/api/v1.0/retail/app")
public class RetailAppController { public class RetailAppController {
@Resource @Resource
@ -59,8 +58,6 @@ public class RetailAppController {
private AppActService appActService; private AppActService appActService;
@Resource @Resource
private ClientContractService clientContractService; private ClientContractService clientContractService;
@Resource
private SysConfigManager sysConfigManager;
@RequestMapping(value = "/token", method = RequestMethod.PUT) @RequestMapping(value = "/token", method = RequestMethod.PUT)
public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) { public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) {

@ -8,6 +8,9 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
@AutoMapper(tablename = "act_app_list", pkName = "act_id") @AutoMapper(tablename = "act_app_list", pkName = "act_id")
@ -28,4 +31,6 @@ public interface ActAppMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void newAppAct(JSONObject params); void newAppAct(JSONObject params);
JSONObject getLatestWindowNotice(@Param("now") Date now);
} }

@ -0,0 +1,15 @@
<?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.ActAppMapper">
<select id="getLatestWindowNotice" resultType="com.alibaba.fastjson.JSONObject">
select act_id,act_url,`desc`,act_name,window_img,show_type
from act_app_list l
where is_valid = 1
and expire_date &gt; #{now}
and is_show_window = 1
and msg_start_date &lt;= #{now}
and msg_end_date &gt;= #{now}
order by active_date desc
limit 1
</select>
</mapper>
Loading…
Cancel
Save