Search in sources :

Example 1 with CouponCodeWarpper

use of com.ikoori.vip.server.modular.biz.warpper.CouponCodeWarpper in project vip by guangdada.

the class CouponCodeController method export.

/**
 * 导出
 *
 * @Title: queryExcel
 * @param request
 * @param response
 * @param batchNo
 * @param verifyCode
 * @param verifyNo
 * @param couponId
 * @param useStatus
 * @return
 * @throws IOException
 * @date: 2017年10月15日 下午4:03:52
 * @author: chengxg
 */
@Permission
@RequestMapping(value = "/export", method = RequestMethod.GET)
public void export(HttpServletRequest request, HttpServletResponse response, String batchNo, String verifyCode, String verifyNo, Long couponId, Integer useStatus) throws IOException {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().bigPage();
    List<Map<String, Object>> result = couponCodeService.getCouponCodeList(page, batchNo, verifyCode, verifyNo, useStatus, couponId, merchant.getId(), page.getOrderByField(), page.isAsc());
    List<Map<String, Object>> couponCodeList = (List<Map<String, Object>>) (new CouponCodeWarpper(result).warp());
    // 定义导出excel的名字
    String excelName = "券号批量导出表";
    if (StringUtils.isNotBlank(batchNo)) {
        excelName = excelName + "-" + batchNo;
    }
    // 获取需要转出的excle表头的map字段
    LinkedHashMap<String, String> fieldMap = new LinkedHashMap<String, String>();
    fieldMap.put("batchNo", "批次号");
    if (couponId != null) {
        fieldMap.put("couponName", "现金券名称");
    }
    fieldMap.put("verifyNo", "卡号");
    fieldMap.put("verifyCode", "券码");
    // 导出
    PoiExcelUtil.export(excelName, couponCodeList, fieldMap, response);
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) List(java.util.List) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) CouponCodeWarpper(com.ikoori.vip.server.modular.biz.warpper.CouponCodeWarpper) LinkedHashMap(java.util.LinkedHashMap) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with CouponCodeWarpper

use of com.ikoori.vip.server.modular.biz.warpper.CouponCodeWarpper in project vip by guangdada.

the class CouponCodeController method list.

/**
 * 获取券码管理列表
 */
@Permission
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String batchNo, String verifyCode, String verifyNo, Long couponId, Integer useStatus, Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
    List<Map<String, Object>> result = couponCodeService.getCouponCodeList(page, batchNo, verifyCode, verifyNo, useStatus, couponId, merchant.getId(), page.getOrderByField(), page.isAsc());
    page.setRecords((List<Map<String, Object>>) new CouponCodeWarpper(result).warp());
    return super.packForBT(page);
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) CouponCodeWarpper(com.ikoori.vip.server.modular.biz.warpper.CouponCodeWarpper) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Permission (com.ikoori.vip.common.annotion.Permission)2 Merchant (com.ikoori.vip.common.persistence.model.Merchant)2 CouponCodeWarpper (com.ikoori.vip.server.modular.biz.warpper.CouponCodeWarpper)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 List (java.util.List)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1