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);
}
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);
}
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);
}
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);
}
}
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;
}
Aggregations