|
@@ -19,7 +19,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -49,7 +52,7 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
@ApiImplicitParam(name = "params" , paramType = "body")
|
|
|
})
|
|
|
@PostMapping("/getAlert")
|
|
|
- public Object getAlertLog(){
|
|
|
+ public Object getAlertLog() throws ParseException {
|
|
|
String userType="";
|
|
|
ParameterObject obj = getParameterObject();
|
|
|
Long userId = Long.valueOf(obj.getString("userId"));
|
|
@@ -77,13 +80,37 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
if ((strings.contains("1") || strings.contains("2")) &&sysUserExt.getSalesLevel().equals("customer_level")){
|
|
|
//满足类型对应a
|
|
|
AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
|
|
|
- AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
|
|
|
- if(log == null){
|
|
|
+ //AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
|
|
|
+ /* if(log == null){
|
|
|
alertConfiguration1.setIsClearCache(true);
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (alertLog!=null){
|
|
|
if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
- alertLog.setAlertNum(alertLog.getAlertNum()+1);
|
|
|
+ Long count =alertLog.getAlertNum()+1;
|
|
|
+ // 创建两个日期对象
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date1 = dateFormat.parse(alertLog.getCreateTime().toString());
|
|
|
+ Date date2 = dateFormat.parse(alertConfiguration1.getAlertEndTime().toString());
|
|
|
+ // 设置时间部分为零点
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date1 = calendar.getTime();
|
|
|
+ calendar.setTime(date2);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date2 = calendar.getTime();
|
|
|
+ int clearT = date1.compareTo(date2);
|
|
|
+ if(count == alertConfiguration1.getAlertNum() && clearT==0){
|
|
|
+ alertConfiguration1.setIsClearCache(true);
|
|
|
+ alertLog.setIsClearCache("1");
|
|
|
+ }
|
|
|
+ alertLog.setAlertNum(count);
|
|
|
alertLogService.updateAlertLog(alertLog);
|
|
|
return AjaxResult.success(alertConfiguration1);
|
|
|
}else {
|
|
@@ -96,19 +123,67 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
alertLog1.setUserId(userId);
|
|
|
alertLog1.setUserType("1");
|
|
|
alertLog1.setAlertNum(1L);
|
|
|
+ // 创建两个日期对象
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date1 = dateFormat.parse(date.toString());
|
|
|
+ Date date2 = dateFormat.parse(alertConfiguration1.getAlertEndTime().toString());
|
|
|
+ // 设置时间部分为零点
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date1 = calendar.getTime();
|
|
|
+ calendar.setTime(date2);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date2 = calendar.getTime();
|
|
|
+ int clearT = date1.compareTo(date2);
|
|
|
+ if(clearT==0 && alertConfiguration1.getAlertNum()==1){
|
|
|
+ alertConfiguration1.setIsClearCache(true);
|
|
|
+ alertLog1.setIsClearCache("1");
|
|
|
+ }
|
|
|
alertLogService.insertAlertLog(alertLog1);
|
|
|
return AjaxResult.success(alertConfiguration1);
|
|
|
}
|
|
|
}
|
|
|
if((strings.contains("0") || strings.contains("2")) && !sysUserExt.getSalesLevel().equals("customer_level")){
|
|
|
AlertLog alertLog = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),"0");
|
|
|
- AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
|
|
|
+ /* AlertLog log = alertLogService.selectAlertLogByUserIdAndAlertId(userId, alertConfiguration1.getAlertId(),null);
|
|
|
if(log == null){
|
|
|
alertConfiguration1.setIsClearCache(true);
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (alertLog!=null){
|
|
|
if (alertLog.getAlertNum()<alertConfiguration1.getAlertNum()){
|
|
|
- alertLog.setAlertNum(alertLog.getAlertNum()+1);
|
|
|
+ Long count =alertLog.getAlertNum()+1;
|
|
|
+ // 创建两个日期对象
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date1 = dateFormat.parse(alertLog.getCreateTime().toString());
|
|
|
+ Date date2 = dateFormat.parse(alertConfiguration1.getAlertEndTime().toString());
|
|
|
+ // 设置时间部分为零点
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date1 = calendar.getTime();
|
|
|
+
|
|
|
+ calendar.setTime(date2);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date2 = calendar.getTime();
|
|
|
+ int clearT = date1.compareTo(date2);
|
|
|
+ if(count == alertConfiguration1.getAlertNum() && clearT==0){
|
|
|
+ alertConfiguration1.setIsClearCache(true);
|
|
|
+ alertLog.setIsClearCache("1");
|
|
|
+ }
|
|
|
+ alertLog.setAlertNum(count);
|
|
|
alertLogService.updateAlertLog(alertLog);
|
|
|
return AjaxResult.success(alertConfiguration1);
|
|
|
}else {
|
|
@@ -121,6 +196,29 @@ public class WxAlertLogController extends ApiBaseController {
|
|
|
alertLog1.setUserId(userId);
|
|
|
alertLog1.setUserType("0");
|
|
|
alertLog1.setAlertNum(1L);
|
|
|
+ // 创建两个日期对象
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date1 = dateFormat.parse(date.toString());
|
|
|
+ Date date2 = dateFormat.parse(alertConfiguration1.getAlertEndTime().toString());
|
|
|
+ // 设置时间部分为零点
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date1);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date1 = calendar.getTime();
|
|
|
+ calendar.setTime(date2);
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
+ date2 = calendar.getTime();
|
|
|
+ int clearT = date1.compareTo(date2);
|
|
|
+ if(clearT==0 && alertConfiguration1.getAlertNum()==1){
|
|
|
+ alertConfiguration1.setIsClearCache(true);
|
|
|
+ alertLog1.setIsClearCache("1");
|
|
|
+ }
|
|
|
alertLogService.insertAlertLog(alertLog1);
|
|
|
return AjaxResult.success(alertConfiguration1);
|
|
|
}
|