Pu Zhibing
2 天以前 5dacdee9b54c78372b68140e2b068d03a620eab9
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponRecordController.java
@@ -6,24 +6,21 @@
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.beetl.ShiroExtUtil;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.SinataUtil;
import com.stylefeng.guns.modular.system.model.SysRedPacketRecord;
import com.stylefeng.guns.modular.system.util.DateUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.core.util.SinataUtil;
import com.stylefeng.guns.modular.system.model.SysCouponRecord;
import com.stylefeng.guns.modular.system.service.ISysCouponRecordService;
import com.stylefeng.guns.modular.system.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;
/**
 * 控制器
@@ -34,21 +31,24 @@
@Controller
@RequestMapping("/sysCouponRecord")
public class SysCouponRecordController extends BaseController {
    private String PREFIX = "/system/sysCouponRecord/";
    @Autowired
    private ISysCouponRecordService sysCouponRecordService;
    /**
     * 跳转到首页
     */
    @RequestMapping("")
    public String index(Model model) {
        model.addAttribute("jumpType",1);
        model.addAttribute("num",0);
        return PREFIX + "sysCouponRecord.html";
    }
   private String PREFIX = "/system/sysCouponRecord/";
   @Autowired
   private ISysCouponRecordService sysCouponRecordService;
   @Resource
   private ShiroExtUtil shiroExtUtil;
   /**
    * 跳转到首页
    */
   @RequestMapping("")
   public String index(Model model) {
      model.addAttribute("jumpType", 1);
      model.addAttribute("num", 0);
      return PREFIX + "sysCouponRecord.html";
   }
    /**
     * 跳转到添加
@@ -75,29 +75,29 @@
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String createTime,Integer couponUseType,Integer couponType) {
        Date startTimes = null;
        Date endTimes = null;
        if (SinataUtil.isNotEmpty(createTime)){
            String[] timeArray = createTime.split(" - ");
            startTimes = DateUtil.getDate_str3(timeArray[0]+" 00:00:00");
            endTimes = DateUtil.getDate_str3(timeArray[1]+" 23:59:59");
        }
        Page<SysCouponRecord> page = new PageFactory<SysCouponRecord>().defaultPage();
        Wrapper wrapper = new EntityWrapper<SysCouponRecord>();
        if (SinataUtil.isNotEmpty(createTime)) {
            wrapper.between("insertTime", startTimes, endTimes);
        }
        if (SinataUtil.isNotEmpty(couponUseType)) {
            wrapper.eq("couponUseType", couponUseType);
        }
        if (SinataUtil.isNotEmpty(couponType)) {
            wrapper.eq("couponType", couponType);
        }
        wrapper.eq("companyId", ShiroExtUtil.getUser().getObjectId());
        wrapper.eq("companyType", ShiroExtUtil.getUser().getRoleType());
        wrapper.orderBy("id", false);
        return super.packForBT(sysCouponRecordService.selectPage(page, wrapper));
       Date startTimes = null;
       Date endTimes = null;
       if (SinataUtil.isNotEmpty(createTime)) {
          String[] timeArray = createTime.split(" - ");
          startTimes = DateUtil.getDate_str3(timeArray[0] + " 00:00:00");
          endTimes = DateUtil.getDate_str3(timeArray[1] + " 23:59:59");
       }
       Page<SysCouponRecord> page = new PageFactory<SysCouponRecord>().defaultPage();
       Wrapper wrapper = new EntityWrapper<SysCouponRecord>();
       if (SinataUtil.isNotEmpty(createTime)) {
          wrapper.between("insertTime", startTimes, endTimes);
       }
       if (SinataUtil.isNotEmpty(couponUseType)) {
          wrapper.eq("couponUseType", couponUseType);
       }
       if (SinataUtil.isNotEmpty(couponType)) {
          wrapper.eq("couponType", couponType);
       }
       wrapper.eq("companyId", shiroExtUtil.getUser().getObjectId());
       wrapper.eq("companyType", shiroExtUtil.getUser().getRoleType());
       wrapper.orderBy("id", false);
       return super.packForBT(sysCouponRecordService.selectPage(page, wrapper));
    }
    /**
@@ -106,11 +106,11 @@
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(SysCouponRecord sysCouponRecord) {
        sysCouponRecord.setInsertTime(new Date());
        sysCouponRecord.setCompanyId(ShiroExtUtil.getUser().getObjectId());
        sysCouponRecord.setCompanyType(ShiroExtUtil.getUser().getRoleType());
        sysCouponRecordService.insert(sysCouponRecord);
        return SUCCESS_TIP;
       sysCouponRecord.setInsertTime(new Date());
       sysCouponRecord.setCompanyId(shiroExtUtil.getUser().getObjectId());
       sysCouponRecord.setCompanyType(shiroExtUtil.getUser().getRoleType());
       sysCouponRecordService.insert(sysCouponRecord);
       return SUCCESS_TIP;
    }
    /**