|
@@ -1,26 +1,74 @@
|
|
|
package com.lemon.lifecenter.controller;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import com.lemon.lifecenter.common.LifeCenterConfigVO;
|
|
|
import com.lemon.lifecenter.common.LifeCenterController;
|
|
|
+import com.lemon.lifecenter.common.LifeCenterFunction;
|
|
|
+import com.lemon.lifecenter.common.LifeCenterSessionController;
|
|
|
+import com.lemon.lifecenter.dto.PushDTO;
|
|
|
+import com.lemon.lifecenter.service.PushService;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/mobile")
|
|
|
public class MobilePushController extends LifeCenterController {
|
|
|
+
|
|
|
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+
|
|
|
@Autowired
|
|
|
private LifeCenterConfigVO config;
|
|
|
|
|
|
- @RequestMapping( "/push/list" )
|
|
|
- public ModelAndView pushList() {
|
|
|
+ @Autowired
|
|
|
+ private PushService pushService;
|
|
|
+
|
|
|
+ @RequestMapping("/push/list")
|
|
|
+ public ModelAndView pushList(@RequestParam(value="ym", required=false, defaultValue="") String ym,
|
|
|
+ HttpServletRequest request, HttpServletResponse response) throws ParseException {
|
|
|
+
|
|
|
+ String sesMpIdx = LifeCenterSessionController.getSession(request, "sesMpIdx");
|
|
|
+
|
|
|
+ if(ym.equals("")){
|
|
|
+ ym = LifeCenterFunction.getNow("yyyy-MM");
|
|
|
+ }
|
|
|
|
|
|
+ PushDTO dto = new PushDTO();
|
|
|
+ logger.error("date -- > " + ym);
|
|
|
+ logger.error("prevMonth -- > " + LifeCenterFunction.getPrevMonth(ym));
|
|
|
+ logger.error("nextMonth -- > " + LifeCenterFunction.getNextMonth(ym));
|
|
|
|
|
|
+ String ym2 = ym.replace("-", "");
|
|
|
+ dto.setYm(ym2);
|
|
|
+ dto.setPatientIdx(Integer.parseInt(sesMpIdx));
|
|
|
+ int total = pushService.selectPushResultTableCount(dto);
|
|
|
|
|
|
- ModelAndView mv = setMobileMV( "push/list" );
|
|
|
+ int listCount = 0;
|
|
|
+ List<PushDTO> pushList = new ArrayList<PushDTO>();
|
|
|
+ if (total > 0) {
|
|
|
+ listCount = pushService.mobilePushMessageBoxCount(dto);
|
|
|
+ pushList = pushService.mobilePushMessageBox(dto);
|
|
|
+ }
|
|
|
|
|
|
+ ModelAndView mv = setMobileMV("push/list");
|
|
|
+ mv.addObject("total", total);
|
|
|
+ mv.addObject("date", ym);
|
|
|
+ mv.addObject("prevMonth", LifeCenterFunction.getPrevMonth( ym ));
|
|
|
+ mv.addObject("nextMonth", LifeCenterFunction.getNextMonth( ym ));
|
|
|
+ mv.addObject("nowMonth", LifeCenterFunction.getNow( "yyyy-MM" ));
|
|
|
+ mv.addObject("listCount", listCount);
|
|
|
+ mv.addObject("pushList", pushList);
|
|
|
return mv;
|
|
|
}
|
|
|
}
|