| | |
| | | package com.matrix.system.hive.action; |
| | | |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.system.hive.pojo.CzXkVo; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.shopXcx.mqTask.MQTaskRouting; |
| | | import com.matrix.system.wechart.templateMsg.UniformMsgParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | |
| | | @Resource |
| | | private SysVipInfoService vipInfoService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private MoneyCardUseFlowDao moneyCardUseFlowDao; |
| | | @Autowired |
| | | |
| | | @Resource |
| | | private MoneyCardUseDao moneyCardUseDao; |
| | | |
| | | |
| | | @Value("${evn}") |
| | | private String evn; |
| | | |
| | | @Autowired |
| | | private RabiitMqTemplate rabiitMqTemplate; |
| | | |
| | | |
| | | /** |
| | | * 跳转 充值页面 |
| | | * |
| | | * @author jyy |
| | | */ |
| | | @RequestMapping(value = "/editFormCz") |
| | | public String editFormCz() { |
| | | SysVipInfo info = |
| | | (SysVipInfo) WebUtil.getSession().getAttribute(SystemConstance.CURRENT_CUSTOMER); |
| | | MoneyCardUse cardUseInfo = cardUseService.findByVipId(info.getId()); |
| | | |
| | | public String editFormCz(Long id) { |
| | | MoneyCardUse cardUseInfo = cardUseService.findByVipId(id); |
| | | if (cardUseInfo == null) { |
| | | cardUseInfo = new MoneyCardUse(); |
| | | cardUseInfo.setVipId(info.getId()); |
| | | cardUseInfo.setCardName("储值卡"); |
| | | cardUseInfo.setIsVipCar(Dictionary.FLAG_YES_Y); |
| | | cardUseInfo.setRealMoney(0D); |
| | | cardUseInfo.setGiftMoney(0D); |
| | | cardUseInfo.setSource("-"); |
| | | cardUseInfo.setFailTime(DateUtil.stringToDate("2050-01-01 00:00",DateUtil.DATE_FORMAT_MM)); |
| | | cardUseInfo.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | moneyCardUseDao.insert(cardUseInfo); |
| | | cardUseInfo=vipInfoService.addVipDefaultCard(id); |
| | | } |
| | | |
| | | WebUtil.getRequest().setAttribute("obj", cardUseInfo); |
| | | return "admin/hive/beautySalon/cz-form"; |
| | | } |
| | |
| | | */ |
| | | @RequestMapping(value = "/cz") |
| | | public @ResponseBody |
| | | AjaxResult cz(CzXkVo czVo) { |
| | | AjaxResult cz(@RequestBody CzXkVo czVo) { |
| | | SysOrder order= orderService.updateAddCardMoney(czVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "充值成功"); |
| | | |
| | | //发送微信公众号提醒 |
| | | UniformMsgParam uniformMsgParam=new UniformMsgParam(order.getCompanyId(),UniformMsgParam.GZH_CZCG); |
| | | uniformMsgParam.put("orderId",order.getId()); |
| | | rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString()); |
| | | |
| | | result.putInMap("orderId",order.getId()); |
| | | return result; |
| | | } |
| | |
| | | * @author jyy |
| | | */ |
| | | @RequestMapping(value = "/toBj") |
| | | public String toBj(Long id, HttpServletRequest request) { |
| | | public String toBj(Long id) { |
| | | // 根据id查到对应的订单信息 |
| | | SysOrder order = orderService.findById(id); |
| | | WebUtil.getRequest().setAttribute("order", order); |
| | | |
| | | SysOrderItem item = new SysOrderItem(); |
| | | item.setOrderId(order.getId()); |
| | | item.setStatus(Dictionary.ORDER_STATU_QK); |
| | | order.setItems(orderItemService.findByModel(item)); |
| | | |
| | | |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | moneyCardUse.setVipId(order.getVipId()); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | List<MoneyCardUse> cards = cardUseService.findByModel(moneyCardUse); |
| | | |
| | | WebUtil.getRequest().setAttribute("cards", cards); |
| | | List<SysOrderItem> items = orderItemService.findByModel(item); |
| | | order.setItems(items); |
| | | WebUtil.getRequest().setAttribute("order", order); |
| | | |
| | | return "admin/hive/beautySalon/bj-form"; |
| | | } |
| | |
| | | */ |
| | | @RequestMapping(value = "/bj") |
| | | public @ResponseBody |
| | | AjaxResult bj(SysOrder order) throws GlobleException { |
| | | AjaxResult bj(@RequestBody SysOrder order) throws GlobleException { |
| | | |
| | | orderService.updateAfterMoney(order); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "补交成功"); |
| | |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "冻结失败"); |
| | | } |
| | | |
| | | /** |
| | | * 退款 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "getEffectCard") |
| | | public @ResponseBody |
| | | AjaxResult getEffectCard(MoneyCardUse moneyCardUse) { |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | //要退款的充值卡 |
| | | MoneyCardUse srcCardUse = cardUseService.findById(moneyCardUse.getId()); |
| | | if (!srcCardUse.getStatus().equals(Dictionary.TAOCAN_STATUS_YX)) { |
| | | throw new GlobleException("不是有效充值卡"); |
| | | } |
| | | //该会员是否有有效会籍卡 |
| | | MoneyCardUse targetCardUse = cardUseService.findByVipId(moneyCardUse.getVipId()); |
| | | |
| | | double money = srcCardUse.getRealMoney(); |
| | | |
| | | if (targetCardUse != null) { |
| | | targetCardUse.setRealMoney(money); |
| | | List<MoneyCardUse> list = Arrays.asList(targetCardUse); |
| | | |
| | | if (targetCardUse.getId().equals(srcCardUse.getId())) { |
| | | result.setInfo("会籍卡退款只能退现金"); |
| | | result.setRows(list); |
| | | |
| | | } else { |
| | | result.setInfo("有有效会籍卡"); |
| | | result.setRows(list); |
| | | } |
| | | } else { |
| | | //无会员卡则new一个,为了把钱传递到前台 |
| | | targetCardUse = new MoneyCardUse(); |
| | | targetCardUse.setRealMoney(money); |
| | | List<MoneyCardUse> list1 = Arrays.asList(targetCardUse); |
| | | result.setInfo("无有效会籍卡,退现金"); |
| | | result.setRows(list1); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @RequestMapping(value = "/returnMoney") |
| | | public @ResponseBody |
| | | AjaxResult returnMoney(MoneyCardUse moneyCardUse, Long hjkId, String tcRemark, Long |
| | | shopId, Double money |
| | | , String tcName) { |
| | | int i = cardUseService.returnMoney(moneyCardUse, hjkId); |
| | | if (i > 0) { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "退款成功"); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "冻结失败"); |
| | | } |
| | | } |