| | |
| | | package com.matrix.system.padApi.action; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.RSAUtils; |
| | | import com.matrix.core.tools.UUIDUtil; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.app.vo.UserInfoVo; |
| | | import com.matrix.system.common.authority.DefaultAuthorityManager; |
| | | import com.matrix.system.common.authority.strategy.AccountPasswordLogin; |
| | |
| | | import com.matrix.system.common.dao.SysCompanyDao; |
| | | import com.matrix.system.common.init.LocalCache; |
| | | import com.matrix.system.common.service.SysUsersService; |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.SysBeauticianState; |
| | | import com.matrix.system.hive.bean.SysBedInfo; |
| | | import com.matrix.system.hive.bean.SysProjServices; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.service.SysBedInfoService; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | | import com.matrix.system.hive.service.SysShopInfoService; |
| | | import com.matrix.system.hive.service.SysWorktimeService; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.dto.WebPadLoginDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @CrossOrigin(origins = "*") |
| | | @Api(value = "PadApiCommonAction", tags = "pad端公共请求类(含登陆)") |
| | | @RestController |
| | | @RequestMapping(value = "/api/common/pad") |
| | | public class PadApiCommonAction { |
| | | public class PadApiCommonAction extends BaseController { |
| | | |
| | | @Autowired |
| | | private SysUsersService sysUsersService; |
| | |
| | | |
| | | @Autowired |
| | | private SysShopInfoService sysShopInfoService; |
| | | |
| | | @Resource |
| | | private SysOrderService sysOrderService; |
| | | |
| | | @Resource |
| | | private SysBedInfoService bedInfoService; |
| | | |
| | | @Resource |
| | | private SysWorktimeService sysWorkTimeService; |
| | | |
| | | @Value("${login_public_key}") |
| | | private String publicKey; |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private SysUsersService usersService; |
| | | |
| | | @ApiOperation(value = "首页", notes = "首页") |
| | | @GetMapping(value = "/frist") |
| | | public AjaxResult frist() { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | PadOrderListDto orderListDto = new PadOrderListDto(); |
| | | orderListDto.setPageNum(1); |
| | | orderListDto.setPageSize(5); |
| | | int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize(); |
| | | int limit = orderListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | if (!DataAuthUtil.hasAllShopAuth()) { |
| | | orderListDto.setShopId(user.getShopId()); |
| | | } |
| | | QueryUtil.setQueryLimitCom(orderListDto); |
| | | List<PadOrderDetailVo> padApiOrderListInPage = sysOrderService.findPadApiOrderListInPage(orderListDto, pageVo); |
| | | |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | result.putInMap("orderList",padApiOrderListInPage); |
| | | |
| | | List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS); |
| | | if(CollUtil.isNotEmpty(mls)){ |
| | | SysBeauticianState sysBeauticianState = new SysBeauticianState(); |
| | | Date date = new Date(); |
| | | sysBeauticianState.setBeginTime(DateUtil.getStartDate(date)); |
| | | sysBeauticianState.setEndTime(DateUtil.getStartDate(date)); |
| | | String panBanCodes = DateUtil.dateToString(sysBeauticianState.getBeginTime(),DateUtil.DATE_FORMAT_NO_SPLITE_DD); |
| | | List<SysUsers> staffs=new ArrayList<>(); |
| | | if(sysWorkTimeService.isInWorkTime(user.getShopId(),sysBeauticianState.getBeginTime(),sysBeauticianState.getEndTime())){ |
| | | staffs= sysUsersService.findByCodeBeaStateShop(user.getShopId(), |
| | | sysBeauticianState, panBanCodes); |
| | | if(CollUtil.isNotEmpty(staffs)){ |
| | | result.putInMap("usedMls", mls.size() - staffs.size()); |
| | | result.putInMap("freeMls", staffs.size()); |
| | | }else{ |
| | | result.putInMap("usedMls", mls.size()); |
| | | result.putInMap("freeMls", 0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | SysBedInfo bedInfo = new SysBedInfo(); |
| | | bedInfo.setShopId(getMe().getShopId()); |
| | | List<SysBedInfo> totalBed = bedInfoService.findByModel(bedInfo); |
| | | if(CollUtil.isNotEmpty(totalBed)){ |
| | | SysProjServices sysProjServices = new SysProjServices(); |
| | | sysProjServices.setShopId(getMe().getShopId()); |
| | | List<SysBedInfo> freeBed = bedInfoService.findFreeBed(sysProjServices); |
| | | if(CollUtil.isNotEmpty(freeBed)){ |
| | | result.putInMap("usedBed", totalBed.size() - freeBed.size()); |
| | | result.putInMap("freeBed", freeBed); |
| | | }else{ |
| | | result.putInMap("usedBed", totalBed); |
| | | result.putInMap("freeBed", 0); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "用户退出系统", notes = "用户退出系统") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = AjaxResult.class) |