| package com.matrix.system.shopXcx.action; | 
|   | 
| import com.matrix.core.pojo.AjaxResult; | 
| import com.matrix.core.pojo.PaginationVO; | 
| import com.matrix.system.common.bean.SysUsers; | 
| import com.matrix.system.constance.Dictionary; | 
| import com.matrix.system.hive.action.BaseController; | 
| import com.matrix.system.hive.plugin.util.CollectionUtils; | 
| import com.matrix.system.shopXcx.bean.ShopOrder; | 
| import com.matrix.system.shopXcx.bean.WxWithdrawApply; | 
| import com.matrix.system.shopXcx.dao.ShopOrderDao; | 
| import com.matrix.system.shopXcx.dao.WxApplyOrderRelateDao; | 
| import com.matrix.system.shopXcx.dao.WxWithdrawApplyDao; | 
| import com.matrix.system.shopXcx.pojo.ApplyOrderQueryPOJO; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Controller; | 
| import org.springframework.web.bind.annotation.PathVariable; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.ResponseBody; | 
| import org.springframework.web.servlet.ModelAndView; | 
|   | 
| import java.util.List; | 
|   | 
|   | 
| @Controller | 
| @RequestMapping(value = "/admin/withdramApply") | 
| public class WxWithdramApplyAction extends BaseController { | 
|   | 
|     @Autowired | 
|     private WxWithdrawApplyDao wxWithdrawApplyDao; | 
|     @Autowired | 
|     private WxApplyOrderRelateDao wxApplyOrderRelateDao; | 
|     @Autowired | 
|     private ShopOrderDao shopOrderDao; | 
|   | 
|     @RequestMapping(value = "/showList") | 
|     @ResponseBody | 
|     public AjaxResult showList(ApplyOrderQueryPOJO queryPOJO, PaginationVO pageVo) { | 
|         SysUsers sysUsers = getMe(); | 
|   | 
|         pageVo.setSort("create_time"); | 
|         pageVo.setOrder("desc"); | 
|   | 
|         if (!Dictionary.FLAG_YES_Y.equals(sysUsers.getShopRole())) { | 
|             queryPOJO.setShopId(sysUsers.getShopId()); | 
|         } | 
|   | 
|         List<WxWithdrawApply> list = wxWithdrawApplyDao.selectInPageByQuery(queryPOJO, pageVo); | 
|         int total = wxWithdrawApplyDao.selectTotalByQuery(queryPOJO); | 
|         return new AjaxResult(AjaxResult.STATUS_SUCCESS, list, total); | 
|     } | 
|   | 
|   | 
|     @RequestMapping(value = "/agreeApply/{id}") | 
|     @ResponseBody | 
|     public AjaxResult agreeApply(@PathVariable("id") String id) { | 
|         SysUsers sysUsers = getMe(); | 
|         // TODO 检查接口权限 | 
|         Long idl = Long.parseLong(id); | 
|   | 
|         WxWithdrawApply apply = wxWithdrawApplyDao.selectById(idl); | 
|         if (apply == null) { | 
|             return new AjaxResult(AjaxResult.STATUS_FAIL, "提现申请不存在"); | 
|         } | 
|         apply.setApplyStatus(WxWithdrawApply.ORDER_APPLY_STATUS_AGREE); | 
|         apply.setUserId(sysUsers.getSuId()); | 
|   | 
|         int i = wxWithdrawApplyDao.updateApplyStatus(apply); | 
|         if (i > 0) { | 
|             return new AjaxResult(AjaxResult.STATUS_SUCCESS, "审核成功"); | 
|         } | 
|         return new AjaxResult(AjaxResult.STATUS_FAIL, "审核失败"); | 
|     } | 
|   | 
|     @RequestMapping(value = "/disagreeApply/{id}") | 
|     @ResponseBody | 
|     public AjaxResult disagreeApply(@PathVariable("id") String id) { | 
|         SysUsers sysUsers = getMe(); | 
|         // TODO 检查接口权限 | 
|         Long idl = Long.parseLong(id); | 
|   | 
|         WxWithdrawApply apply = wxWithdrawApplyDao.selectById(idl); | 
|         if (apply == null) { | 
|             return new AjaxResult(AjaxResult.STATUS_FAIL, "提现申请不存在"); | 
|         } | 
|         apply.setApplyStatus(WxWithdrawApply.ORDER_APPLY_STATUS_DISAGREE); | 
|         apply.setUserId(sysUsers.getSuId()); | 
|         List<ShopOrder> orders = shopOrderDao.selectShopOrderByApplyId(idl); | 
|         if (CollectionUtils.isEmpty(orders)) { | 
|             return new AjaxResult(AjaxResult.STATUS_FAIL, "数据异常"); | 
|         } | 
|   | 
|         for (ShopOrder shopOrder : orders) { | 
|             shopOrder.setApplyStatus(ShopOrder.ORDER_APPLY_STATUS_N); | 
|         } | 
|         shopOrderDao.updateOrderApplyStatus(orders); | 
|         int i = wxWithdrawApplyDao.updateApplyStatus(apply); | 
|         if (i > 0) { | 
|             return new AjaxResult(AjaxResult.STATUS_SUCCESS, "审核成功"); | 
|         } | 
|         return new AjaxResult(AjaxResult.STATUS_FAIL, "审核失败"); | 
|     } | 
|   | 
|     @RequestMapping(value = "/toOrderList") | 
|     public ModelAndView toOrderList(String id) { | 
|         ModelAndView modelAndView = new ModelAndView("admin/shop/order-list"); | 
|         modelAndView.addObject("applyId", id); | 
|         return modelAndView; | 
|     } | 
|   | 
|     @RequestMapping(value = "/hasPay") | 
|     @ResponseBody | 
|     public AjaxResult hasPay(String id) { | 
|         WxWithdrawApply apply = new WxWithdrawApply(); | 
|         apply.setId(Long.parseLong(id)); | 
|         apply.setIsHasPay(WxWithdrawApply.HAS_PAY_Y); | 
|         int i = wxWithdrawApplyDao.updateByModel(apply); | 
|         if (i > 0) { | 
|             return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功"); | 
|         } | 
|         return new AjaxResult(AjaxResult.STATUS_FAIL, "修改失败"); | 
|     } | 
| } |