|
|
@@ -52,26 +52,18 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
})
|
|
|
@PostMapping("/getAlert")
|
|
|
public Object getAlertLog() throws ParseException {
|
|
|
-// String userType="";
|
|
|
ParameterObject obj = getParameterObject();
|
|
|
Long userId = Long.valueOf(obj.getString("userId"));
|
|
|
+ Set<String> userTypeSet = new HashSet<>();
|
|
|
SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
|
|
|
- String salesLevel = sysUserExt.getSalesLevel();
|
|
|
- List<String> userTypeList = new ArrayList<>();
|
|
|
List<SysUserShopExt> sysUserShopExt = sysUserShopExtService.selectSysUserShopExtById(obj.getString("userId"));
|
|
|
- Set<String> userTypeSet = new HashSet<>();
|
|
|
- for (SysUserShopExt shopExt : sysUserShopExt){
|
|
|
- userTypeSet.add(shopExt.getIsShopType());
|
|
|
- }
|
|
|
-
|
|
|
- if(("customer_level").equals(salesLevel)||("reseller_level").equals(salesLevel) ){
|
|
|
- userTypeList.add("1");
|
|
|
- }else{
|
|
|
- userTypeList.add("0");
|
|
|
+ if (sysUserShopExt != null && sysUserShopExt.size() > 0){
|
|
|
+ for (SysUserShopExt shopExt : sysUserShopExt){
|
|
|
+ userTypeSet.add(shopExt.getIsShopType());
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
//是否有启动弹窗
|
|
|
- AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(sysUserExt.getSalesLevel(),sysUserExt.getOrgCode());
|
|
|
+ AlertConfiguration alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(sysUserExt.getOrgCode());
|
|
|
|
|
|
if (alertConfiguration1!=null){
|
|
|
//有启动
|
|
|
@@ -86,36 +78,37 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
//满足时间
|
|
|
String[] split = alertConfiguration1.getUserType().split(",");
|
|
|
List<String> strings = Arrays.asList(split);
|
|
|
- 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);
|
|
|
+ if (sysUserExt != null){
|
|
|
+ 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 {
|
|
|
- return AjaxResult.warning("每日弹出次数已满");
|
|
|
+ intAlertLog(alertConfiguration1,"1",now,sdf,userId,"1");
|
|
|
+ return AjaxResult.success(alertConfiguration1);
|
|
|
}
|
|
|
- }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);
|
|
|
+ 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 {
|
|
|
- return AjaxResult.warning("每日弹出次数已满");
|
|
|
+ intAlertLog(alertConfiguration1,"1",now,sdf,userId,"0");
|
|
|
+ return AjaxResult.success(alertConfiguration1);
|
|
|
}
|
|
|
- }else {
|
|
|
- intAlertLog(alertConfiguration1,"1",now,sdf,userId,"0");
|
|
|
- return AjaxResult.success(alertConfiguration1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//判断该用户是否为金牌店或仿石漆
|
|
|
if (sysUserShopExt != null){
|
|
|
if((strings.contains("3") || strings.contains("2")) && userTypeSet.contains("0")){
|