Search in sources :

Example 1 with Ticket

use of com.ikoori.vip.common.persistence.model.Ticket in project vip by guangdada.

the class WebTicketController method getTemplate.

@ApiOperation("获得小票规格")
@RequestMapping(value = "getTemplate", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> getTemplate(@ApiParam(value = "店铺编号", required = true) @RequestParam(required = true) String storeNo, @ApiParam(value = "签名", required = true) @RequestParam(required = true) String sign) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("code", "200");
    result.put("msg", "请求成功");
    try {
        boolean isSign = true;
        if (gunsProperties.isCheckSign()) {
            Map<String, String> data = new HashMap<String, String>();
            data.put("storeNo", storeNo);
            data.put("sign", sign);
            isSign = WXPayUtil.isSignatureValid(data, gunsProperties.getSignKey());
            if (!isSign) {
                result.put("code", "500");
                result.put("msg", "签名失败");
            }
        }
        if (isSign) {
            Map<String, Object> obj = new HashMap<String, Object>();
            Store store = storeService.selectByStoreNo(storeNo);
            Ticket ticket = ticketService.selectByStoreNum(storeNo);
            if (ticket != null) {
                obj.put("logo", store.getLogo());
                obj.put("title", ticket.getTitle());
                obj.put("remark", ticket.getRemark());
                obj.put("specType", SpecType.valueOf(ticket.getSpecType()).substring(0, 2));
                obj.put("storeName", store.getName());
                obj.put("address", store.getAddress());
                obj.put("servicePhone", store.getServicePhone());
                obj.put("website", store.getWebsite());
                result.put("params", obj);
                result.put("template", ticket.getSetting());
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        result.put("code", "500");
        result.put("msg", "请求失败");
    }
    return result;
}
Also used : Ticket(com.ikoori.vip.common.persistence.model.Ticket) HashMap(java.util.HashMap) Store(com.ikoori.vip.common.persistence.model.Store) JSONObject(com.alibaba.fastjson.JSONObject) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with Ticket

use of com.ikoori.vip.common.persistence.model.Ticket in project vip by guangdada.

the class TicketController method list.

/**
 * 获取小票列表
 */
@Permission
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String ticketName, Long storeId, Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Page<Ticket> page = new PageFactory<Ticket>().defaultPage();
    List<Map<String, Object>> result = ticketService.getTicketList(page, ticketName, storeId, merchant.getId(), page.getOrderByField(), page.isAsc());
    page.setRecords((List<Ticket>) new TicketWarpper(result).warp());
    return super.packForBT(page);
}
Also used : Ticket(com.ikoori.vip.common.persistence.model.Ticket) Merchant(com.ikoori.vip.common.persistence.model.Merchant) TicketWarpper(com.ikoori.vip.server.modular.biz.warpper.TicketWarpper) HashMap(java.util.HashMap) Map(java.util.Map) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with Ticket

use of com.ikoori.vip.common.persistence.model.Ticket in project vip by guangdada.

the class TicketController method ticketUpdate.

/**
 * 跳转到修改小票
 */
@Permission
@RequestMapping("/ticket_update/{ticketId}")
public String ticketUpdate(@PathVariable Long ticketId, Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Map<String, Object> condition = new HashMap<String, Object>();
    condition.put("merchantId", merchant.getId());
    List<Store> stores = storeService.selectByCondition(condition);
    // 查询店铺
    model.addAttribute("stores", stores);
    Ticket ticket = ticketService.selectById(ticketId);
    model.addAttribute(ticket);
    model.addAttribute("specType", SpecType.values());
    return PREFIX + "ticket_edit.html";
}
Also used : Ticket(com.ikoori.vip.common.persistence.model.Ticket) Merchant(com.ikoori.vip.common.persistence.model.Merchant) HashMap(java.util.HashMap) Store(com.ikoori.vip.common.persistence.model.Store) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with Ticket

use of com.ikoori.vip.common.persistence.model.Ticket in project vip by guangdada.

the class WebTicketController method info.

@ApiOperation("获得小票规格")
@RequestMapping(value = "info", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> info(@ApiParam(value = "店铺编号", required = true) @RequestParam(required = true) String storeNo, @ApiParam(value = "签名", required = true) @RequestParam(required = true) String sign) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("code", "200");
    result.put("msg", "请求成功");
    try {
        boolean isSign = true;
        if (gunsProperties.isCheckSign()) {
            Map<String, String> data = new HashMap<String, String>();
            data.put("storeNo", storeNo);
            data.put("sign", sign);
            isSign = WXPayUtil.isSignatureValid(data, gunsProperties.getSignKey());
            if (!isSign) {
                result.put("code", "500");
                result.put("msg", "签名失败");
            }
        }
        if (isSign) {
            JSONObject obj = new JSONObject();
            Store store = storeService.selectByStoreNo(storeNo);
            Merchant merchant = memchantService.getMerchantById(store.getMerchantId());
            Ticket ticket = ticketService.selectByStoreNum(storeNo);
            if (ticket != null) {
                JSONObject logo = new JSONObject();
                logo.put("name", "店铺logo");
                logo.put("value", merchant.getHeadImg());
                obj.put("logo", logo);
                JSONObject qrcode = new JSONObject();
                qrcode.put("name", "公众号二维码");
                qrcode.put("value", merchant.getQrcode());
                obj.put("qrcode", qrcode);
                JSONObject joinTel = new JSONObject();
                joinTel.put("name", "加盟热线");
                joinTel.put("value", store.getJointel());
                obj.put("joinTel", joinTel);
                JSONObject title = new JSONObject();
                title.put("name", "标题");
                title.put("value", ticket.getTitle());
                obj.put("title", title);
                JSONObject remark = new JSONObject();
                remark.put("name", "备注");
                remark.put("value", ticket.getRemark());
                obj.put("remark", remark);
                JSONObject specType = new JSONObject();
                specType.put("name", "规格");
                specType.put("value", SpecType.valueOf(ticket.getSpecType()));
                obj.put("specType", specType);
                JSONObject storeName = new JSONObject();
                storeName.put("name", "店铺名称");
                storeName.put("value", store.getName());
                obj.put("storeName", storeName);
                JSONObject address = new JSONObject();
                address.put("name", "地址");
                address.put("value", store.getAddress());
                obj.put("address", address);
                JSONObject servicePhone = new JSONObject();
                servicePhone.put("name", "服务电话");
                servicePhone.put("value", store.getServicePhone());
                obj.put("servicePhone", servicePhone);
                JSONObject website = new JSONObject();
                website.put("name", "网址");
                website.put("value", store.getWebsite());
                obj.put("website", website);
            }
            result.put("content", obj);
        }
    } catch (Exception e) {
        e.printStackTrace();
        result.put("code", "500");
        result.put("msg", "请求失败");
    }
    return result;
}
Also used : Ticket(com.ikoori.vip.common.persistence.model.Ticket) JSONObject(com.alibaba.fastjson.JSONObject) Merchant(com.ikoori.vip.common.persistence.model.Merchant) HashMap(java.util.HashMap) Store(com.ikoori.vip.common.persistence.model.Store) JSONObject(com.alibaba.fastjson.JSONObject) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Ticket (com.ikoori.vip.common.persistence.model.Ticket)4 HashMap (java.util.HashMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 Merchant (com.ikoori.vip.common.persistence.model.Merchant)3 Store (com.ikoori.vip.common.persistence.model.Store)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 JSONObject (com.alibaba.fastjson.JSONObject)2 Permission (com.ikoori.vip.common.annotion.Permission)2 ApiOperation (io.swagger.annotations.ApiOperation)2 TicketWarpper (com.ikoori.vip.server.modular.biz.warpper.TicketWarpper)1 Map (java.util.Map)1