Search in sources :

Example 61 with Merchant

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

the class RedpackController method list.

/**
 * 获取红包列表
 */
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String redpackName, Integer packType, Integer sendType) {
    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 = redpackService.getRedpackList(page, redpackName, packType, sendType, merchant.getId(), page.getOrderByField(), page.isAsc());
    page.setRecords((List<Map<String, Object>>) new RedpackWarpper(result).warp());
    return super.packForBT(page);
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) Map(java.util.Map) RedpackWarpper(com.ikoori.vip.server.modular.biz.warpper.RedpackWarpper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 62 with Merchant

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

the class ShareController method list.

/**
 * 获取分享规则列表
 */
@Permission
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String condition) {
    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 = shareService.getShareList(page, merchant.getId(), page.getOrderByField(), page.isAsc());
    page.setRecords(result);
    return super.packForBT(page);
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) 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 63 with Merchant

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

the class SignController method list.

/**
 * 获取签到规则列表
 */
@Permission
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String condition) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Page<Sign> page = new PageFactory<Sign>().defaultPage();
    List<Map<String, Object>> result = signService.getSignList(page, null, page.getOrderByField(), page.isAsc(), merchant.getId());
    page.setRecords((List<Sign>) new SignWarpper(result).warp());
    return super.packForBT(page);
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) SignWarpper(com.ikoori.vip.server.modular.biz.warpper.SignWarpper) Sign(com.ikoori.vip.common.persistence.model.Sign) 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 64 with Merchant

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

the class MerchantServiceImpl method saveMerchant.

@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void saveMerchant(Merchant merchant) {
    if (merchant.getId() == null) {
        User theUser = managerDao.getByAccount(merchant.getMobile());
        if (theUser != null) {
            throw new BussinessException(BizExceptionEnum.USER_ALREADY_REG);
        }
        User user = new User();
        // 完善账号信息
        user.setAccount(merchant.getMobile());
        user.setName(merchant.getName());
        user.setSalt(ShiroKit.getRandomSalt(5));
        user.setPassword(ShiroKit.md5(ShiroKit.DEFAULTPWD, user.getSalt()));
        user.setStatus(ManagerStatus.OK.getCode());
        user.setPhone(merchant.getMobile());
        user.setCreatetime(new Date());
        user.setRoleid(gunsProperties.getMerchantRoleId());
        // user.setAvatar(merchant.getHeadImg());
        user.insert();
        merchant.setUserId(Long.valueOf(user.getId()));
        merchant.setState(MerchantState.YES.getCode());
        merchantMapper.insert(merchant);
    } else {
        Merchant dbMerchant = merchantMapper.selectById(merchant.getId());
        User dbUser = userMapper.selectById(dbMerchant.getUserId());
        if (!checkMobile(dbUser.getId(), merchant.getMobile())) {
            throw new BussinessException(BizExceptionEnum.USER_ALREADY_REG);
        }
        dbUser.setName(merchant.getName());
        // dbUser.setAvatar(merchant.getHeadImg());
        dbUser.updateById();
        merchantMapper.updateById(merchant);
    }
}
Also used : User(com.ikoori.vip.common.persistence.model.User) Merchant(com.ikoori.vip.common.persistence.model.Merchant) BussinessException(com.ikoori.vip.common.exception.BussinessException) Date(java.util.Date) Transactional(org.springframework.transaction.annotation.Transactional)

Example 65 with Merchant

use of com.ikoori.vip.common.persistence.model.Merchant 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

Merchant (com.ikoori.vip.common.persistence.model.Merchant)66 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)59 Permission (com.ikoori.vip.common.annotion.Permission)55 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)35 HashMap (java.util.HashMap)29 Map (java.util.Map)20 Store (com.ikoori.vip.common.persistence.model.Store)12 Card (com.ikoori.vip.common.persistence.model.Card)11 BussinessException (com.ikoori.vip.common.exception.BussinessException)8 Coupon (com.ikoori.vip.common.persistence.model.Coupon)7 MemberCard (com.ikoori.vip.common.persistence.model.MemberCard)7 LinkedHashMap (java.util.LinkedHashMap)4 JSONObject (com.alibaba.fastjson.JSONObject)3 Ticket (com.ikoori.vip.common.persistence.model.Ticket)3 User (com.ikoori.vip.common.persistence.model.User)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Member (com.ikoori.vip.common.persistence.model.Member)2 Picture (com.ikoori.vip.common.persistence.model.Picture)2 StoreCoupon (com.ikoori.vip.common.persistence.model.StoreCoupon)2 CouponCodeWarpper (com.ikoori.vip.server.modular.biz.warpper.CouponCodeWarpper)2