|
@@ -45,92 +45,6 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "微信弹框",notes = "参数:{userId:1}")
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "params" , paramType = "body")
|
|
|
- })
|
|
|
- @PostMapping("/getAlertLog")
|
|
|
- public Object getAlertLog1(){
|
|
|
- ParameterObject obj = getParameterObject();
|
|
|
- Long userId = Long.valueOf(obj.getString("userId"));
|
|
|
- AlertConfiguration alertConfiguration = null;
|
|
|
-
|
|
|
- AlertConfiguration alertConfiguration1 = null;
|
|
|
- alertLogService.selectAlertLogByUserId(userId);
|
|
|
- if (alertLogService.selectAlertLogByUserId(userId)!=null){
|
|
|
- AlertLog alertLog = alertLogService.selectAlertLogByUserId(userId);
|
|
|
- Long alertId = alertLog.getAlertId();
|
|
|
- alertConfiguration = alertConfigurationService.selectAlertConfigurationById(alertId);
|
|
|
- if (alertConfiguration.getAlertStatus().equals("1")){
|
|
|
-
|
|
|
- Date date = new Date();
|
|
|
- int i = date.compareTo(alertConfiguration.getAlertStartTime());
|
|
|
- int i1 = date.compareTo(alertConfiguration.getAlertEndTime());
|
|
|
- if (i>=0&&i1<=0){
|
|
|
-
|
|
|
- if (alertLog.getAlertNum()<alertConfiguration.getAlertNum()){
|
|
|
-
|
|
|
- alertLog.setAlertNum(alertLog.getAlertNum()+1);
|
|
|
- alertLogService.updateAlertLog(alertLog);
|
|
|
- return AjaxResult.success().putKV("log", alertConfiguration);
|
|
|
- }else {
|
|
|
- return AjaxResult.success("不能弹");
|
|
|
- }
|
|
|
- }else {
|
|
|
- return AjaxResult.success("不能弹");
|
|
|
- }
|
|
|
- }else {
|
|
|
-
|
|
|
- return AjaxResult.success("不能弹");
|
|
|
- }
|
|
|
- }else {
|
|
|
-
|
|
|
- alertConfiguration1 = alertConfigurationService.selectAlertConfigurationByAlertStatus(1);
|
|
|
- SysUserExt sysUserExt = sysUserExtService.selectSysUserExtById(userId);
|
|
|
- String salesLevel = sysUserExt.getSalesLevel();
|
|
|
- if (alertConfiguration1!=null){
|
|
|
- Date date = new Date();
|
|
|
- int i = date.compareTo(alertConfiguration1.getAlertStartTime());
|
|
|
- int i1 = date.compareTo(alertConfiguration1.getAlertEndTime());
|
|
|
- if (i >= 0 && i1 <= 0) {
|
|
|
-
|
|
|
- alertConfiguration1.getAlertStatus();
|
|
|
- if (alertConfiguration1.getUserType().equals("1")&&salesLevel.equals("customer_level")){
|
|
|
-
|
|
|
- AlertLog alertLog1 = new AlertLog();
|
|
|
- alertLog1.setAlertId(alertConfiguration1.getAlertId());
|
|
|
- alertLog1.setUserId(userId);
|
|
|
- alertLog1.setUserType("1");
|
|
|
- alertLog1.setAlertNum(0L);
|
|
|
- alertLogService.insertAlertLog(alertLog1);
|
|
|
- return AjaxResult.success().putKV("log",alertConfiguration1);
|
|
|
- }else if(alertConfiguration1.getUserType().equals("0")&& !salesLevel.equals("customer_level")){
|
|
|
-
|
|
|
- AlertLog alertLog1 = new AlertLog();
|
|
|
- alertLog1.setAlertId(alertConfiguration1.getAlertId());
|
|
|
- alertLog1.setUserId(userId);
|
|
|
- alertLog1.setUserType("0");
|
|
|
- alertLog1.setAlertNum(0L);
|
|
|
- alertLogService.insertAlertLog(alertLog1);
|
|
|
- return AjaxResult.success().putKV("log",alertConfiguration1);
|
|
|
- }else {
|
|
|
- return AjaxResult.success("不能弹");
|
|
|
- }
|
|
|
- } else {
|
|
|
- return AjaxResult.success("不能弹");
|
|
|
- }
|
|
|
- }else {
|
|
|
- return AjaxResult.success("不能弹");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "微信弹框",notes = "参数:{userId:1}")
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "params" , paramType = "body")
|
|
|
})
|
|
@@ -159,7 +73,7 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
alertLog.setAlertNum(alertLog.getAlertNum()+1);
|
|
|
alertLogService.updateAlertLog(alertLog);
|
|
|
- return AjaxResult.success(alertLog);
|
|
|
+ return AjaxResult.success(alertConfiguration1);
|
|
|
}else {
|
|
|
return AjaxResult.warning("每日弹出次数已满");
|
|
|
}
|
|
@@ -175,12 +89,13 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
}
|
|
|
}
|
|
|
if(strings.contains("0")&&!sysUserExt.getSalesLevel().equals("customer_level")){
|
|
|
+ System.out.println(userId);
|
|
|
AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId());
|
|
|
if (alertLog!=null){
|
|
|
if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
alertLog.setAlertNum(alertLog.getAlertNum()+1);
|
|
|
alertLogService.updateAlertLog(alertLog);
|
|
|
- return AjaxResult.success(alertLog);
|
|
|
+ return AjaxResult.success(alertConfiguration1);
|
|
|
}else {
|
|
|
return AjaxResult.warning("每日弹出次数已满");
|
|
|
}
|