|
|
@@ -57,36 +57,9 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
public Object getAlertLog() throws ParseException {
|
|
|
ParameterObject obj = getParameterObject();
|
|
|
Long userId = Long.valueOf(obj.getString("userId"));
|
|
|
- Set<String> userTypeSet = new HashSet<>();
|
|
|
- List<String> userTypeList = new ArrayList<>();
|
|
|
- SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
|
|
|
- log.info("用户信息:{}", JSON.toJSON(sysUserExt));
|
|
|
- List<SysUserShopExt> sysUserShopExt = sysUserShopExtService.selectSysUserShopExtById(obj.getString("userId"));
|
|
|
- log.info("用户门店信息:{}", JSON.toJSON(sysUserShopExt));
|
|
|
- if (sysUserShopExt != null && sysUserShopExt.size() > 0) {
|
|
|
- for (SysUserShopExt shopExt : sysUserShopExt) {
|
|
|
- userTypeSet.add(shopExt.getIsShopType());
|
|
|
- }
|
|
|
- for (String userType : userTypeSet){
|
|
|
- if ("0".equals(userType)){
|
|
|
- userTypeList.add("3");
|
|
|
- }else {
|
|
|
- userTypeList.add("4");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- AlertConfiguration alertConfiguration1 = null;
|
|
|
- if (sysUserExt != null){
|
|
|
- String salesLevel = sysUserExt.getSalesLevel();
|
|
|
- if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
|
|
|
- userTypeList.add("1");
|
|
|
- }else{
|
|
|
- userTypeList.add("0");
|
|
|
- }
|
|
|
- alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(userTypeList,sysUserExt.getOrgCode());
|
|
|
- }else {
|
|
|
- alertConfiguration1 = alertConfigurationService. selectAlertConfiguration(userTypeList);
|
|
|
- }
|
|
|
+ String userTp = obj.getString("userType");
|
|
|
+ log.info("当前系统进来为{}",userTp);
|
|
|
+ AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlert(userTp);
|
|
|
//是否有启动弹窗
|
|
|
log.info("本次匹配的弹窗:{}",JSON.toJSON(alertConfiguration1));
|
|
|
if (alertConfiguration1 != null){
|
|
|
@@ -99,74 +72,18 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
int i = date.compareTo(alertConfiguration1.getAlertStartTime());
|
|
|
int i1 = date.compareTo(alertConfiguration1.getAlertEndTime());
|
|
|
if (i >= 0 && i1 < 0) {
|
|
|
- //满足时间
|
|
|
- String[] split = alertConfiguration1.getUserType().split(",");
|
|
|
- List<String> strings = Arrays.asList(split);
|
|
|
- if (sysUserExt != null){
|
|
|
- log.info("开始匹配用户:{}",JSON.toJSON(sysUserExt));
|
|
|
- if ((strings.contains("1") || strings.contains("2")) && sysUserExt.getSalesLevel().equals("customer_level")){
|
|
|
- //满足类型对应a
|
|
|
- AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
|
|
|
- if (alertLog!=null){
|
|
|
- if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
- updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }else {
|
|
|
- return AjaxResult.warning("每日弹出次数已满");
|
|
|
- }
|
|
|
- }else {
|
|
|
- intAlertLog(alertConfiguration1,"1",now,sdf,userId,"1");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }
|
|
|
- }
|
|
|
- if((strings.contains("0") || strings.contains("2")) && !sysUserExt.getSalesLevel().equals("customer_level")){
|
|
|
- AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
|
|
|
- if (alertLog!=null){
|
|
|
- if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
- updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }else {
|
|
|
- return AjaxResult.warning("每日弹出次数已满");
|
|
|
- }
|
|
|
- }else {
|
|
|
- intAlertLog(alertConfiguration1,"1",now,sdf,userId,"0");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //判断该用户是否为金牌店或仿石漆
|
|
|
- if (sysUserShopExt != null){
|
|
|
- log.info("开始匹配门店信息:{}",JSON.toJSON(sysUserShopExt));
|
|
|
- if((strings.contains("3") || strings.contains("2")) && userTypeSet.contains("0")){
|
|
|
- AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
|
|
|
- if (alertLog!=null){
|
|
|
- if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
- updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }else {
|
|
|
- return AjaxResult.warning("每日弹出次数已满");
|
|
|
- }
|
|
|
- }else {
|
|
|
- intAlertLog(alertConfiguration1,"1",now,sdf,userId,"3");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }
|
|
|
- }
|
|
|
- if((strings.contains("4") || strings.contains("2")) && userTypeSet.contains("1")){
|
|
|
- AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
|
|
|
- if (alertLog!=null){
|
|
|
- if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
- updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }else {
|
|
|
- return AjaxResult.warning("每日弹出次数已满");
|
|
|
- }
|
|
|
- }else {
|
|
|
- intAlertLog(alertConfiguration1,"1",now,sdf,userId,"4");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
- }
|
|
|
+ AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),userTp,userTp);
|
|
|
+ if (alertLog!=null){
|
|
|
+ if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
+ updateAlertLog(alertConfiguration1,alertLog,sdf,"1");
|
|
|
+ return AjaxResult.success(alertConfiguration1);
|
|
|
+ }else {
|
|
|
+ return AjaxResult.warning("每日弹出次数已满");
|
|
|
}
|
|
|
+ }else {
|
|
|
+ intAlertLog(alertConfiguration1,"1",now,sdf,userId,userTp);
|
|
|
+ return AjaxResult.success(alertConfiguration1);
|
|
|
}
|
|
|
- return AjaxResult.warning("没有符合的弹框");
|
|
|
} else {
|
|
|
//超时
|
|
|
return AjaxResult.warning("时间超时");
|