| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.AppUserClient; |
| | | import com.dsh.course.feignClient.account.StudentClient; |
| | | import com.dsh.course.feignClient.account.model.TAppUser; |
| | | import com.dsh.course.feignClient.activity.HuiminCardClient; |
| | | import com.dsh.course.feignClient.activity.model.THuiminCard; |
| | | import com.dsh.guns.config.UserExt; |
| | |
| | | private TOperatorService operatorService; |
| | | @Autowired |
| | | private ITSiteService tSiteService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private StudentClient studentClient; |
| | | |
| | | |
| | | /** |
| | | * 跳转到玩湃惠民卡首页 |
| | |
| | | model.addAttribute("objectType", user.getObjectType()); |
| | | return PREFIX + "tHuiminCard_detail.html"; |
| | | } |
| | | /** |
| | | * 跳转到订单录入页面 |
| | | */ |
| | | @RequestMapping("/tHuiminCardAddOrder") |
| | | public String tHuiminCardAddOrder(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | model.addAttribute("role", objectType); |
| | | if (objectType==1){ |
| | | List<TOperator> list = operatorService.list(new LambdaQueryWrapper<TOperator>() |
| | | .eq(TOperator::getState, 1)); |
| | | model.addAttribute("operators", list); |
| | | }else if (objectType==2){ |
| | | List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>() |
| | | .eq(TStore::getOperatorId, objectId)); |
| | | model.addAttribute("stores", list); |
| | | }else{ |
| | | List<THuiminCard> cards = huiminCardClient.getCards(objectId + ""); |
| | | model.addAttribute("cards", cards); |
| | | } |
| | | return PREFIX + "tHuiminCard_addOrder.html"; |
| | | } |
| | | @RequestMapping("/addPayHuiMing") |
| | | @ResponseBody |
| | | public Object addPayHuiMing(Integer studentId,Integer cardId) { |
| | | |
| | | huiminCardClient.addPayHuiMing(studentId ,cardId); |
| | | |
| | | return 200; |
| | | } |
| | | @RequestMapping(value = "/checkUser") |
| | | @ResponseBody |
| | | public Object checkUser(String phone) { |
| | | TAppUser appUserByPhone = appUserClient.getAppUserByPhone(phone); |
| | | if (appUserByPhone==null){ |
| | | return 500; |
| | | } |
| | | List<TStudent> tStudents = studentClient.queryStudentList(appUserByPhone.getId()); |
| | | if (tStudents.isEmpty()){ |
| | | return 501; |
| | | } |
| | | return tStudents; |
| | | } |
| | | @RequestMapping(value = "/getStores") |
| | | @ResponseBody |
| | | public Object getStores(String operatorId) { |
| | | if (operatorId.isEmpty()){ |
| | | return new ArrayList<>(); |
| | | }else{ |
| | | List<TStore> list = storeService.lambdaQuery().eq(TStore::getOperatorId, operatorId).list(); |
| | | return list; |
| | | } |
| | | |
| | | } |
| | | @RequestMapping(value = "/getCards") |
| | | @ResponseBody |
| | | public Object getCards(String storeId) { |
| | | List<THuiminCard> list = huiminCardClient.getCards(storeId); |
| | | return list; |
| | | } |
| | | /** |
| | | * 获取玩湃惠民卡详情 |
| | | */ |
| | |
| | | tHuiminCard.setObjectType(objectType); |
| | | Integer objectId = user.getObjectId(); |
| | | tHuiminCard.setObjectId(objectId); |
| | | return super.packForBT(huiminCardClient.queryPage(tHuiminCard)); |
| | | Page<THuiminCard> page = huiminCardClient.queryPage(tHuiminCard); |
| | | page.getRecords().sort(Comparator |
| | | .comparing((THuiminCard card) -> parseSort(card.getSort()), Comparator.nullsLast(Comparator.reverseOrder())) |
| | | .thenComparing(THuiminCard::getId, Comparator.nullsLast(Comparator.reverseOrder()))); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | private Long parseSort(String sort) { |
| | | try { |
| | | return sort == null ? null : Long.valueOf(sort); |
| | | } catch (NumberFormatException ignored) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | .eq(!StringUtils.isEmpty(query.getProvinceCode()), TSite::getProvinceCode, query.getProvinceCode()) |
| | | .eq(operatorId != null, TSite::getOperatorId, operatorId) |
| | | .ne(TSite::getState,3) |
| | | .orderByDesc(TSite::getId) |
| | | .eq(TSite::getSign,0) |
| | | .eq(!StringUtils.isEmpty(query.getCityCode()), TSite::getCityCode, query.getCityCode()) |
| | | .in(!storeIds.isEmpty(), TSite::getStoreId, storeIds)); |