| | |
| | | import com.jilongda.optometrist.authority.service.SecUserService; |
| | | import com.jilongda.optometrist.model.*; |
| | | import com.jilongda.optometrist.query.TOptometristQuery; |
| | | import com.jilongda.optometrist.query.TOptometryQuery; |
| | | import com.jilongda.optometrist.query.TicketQuery; |
| | | import com.jilongda.optometrist.service.*; |
| | | import com.jilongda.optometrist.utils.LoginInfoUtil; |
| | | import com.jilongda.optometrist.vo.TAddOptometryVO; |
| | | import com.jilongda.optometrist.vo.TLineUpDetailVO; |
| | | import com.jilongda.optometrist.vo.TOptometristVO; |
| | | import com.jilongda.optometrist.vo.TOptometryDetailVO; |
| | | import com.jilongda.optometrist.vo.*; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | private TOrderService orderService; |
| | | @Autowired |
| | | private TOptometryDetailService optometryDetailService; |
| | | @ApiOperation(value = "获取验光单分页列表",tags = "验光单") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TOptometryVO>> pageList(@RequestBody TOptometryQuery query) { |
| | | String startTime = null; |
| | | String endTime = null; |
| | | if (StringUtils.hasLength(query.getTime())){ |
| | | startTime = query.getTime()+" 00:00:00"; |
| | | endTime = query.getTime()+" 23:59:59"; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | PageInfo<TOptometryVO> tOptometryVOPageInfo = optometristService.pageList(query); |
| | | return ApiResult.success(tOptometryVOPageInfo); |
| | | } |
| | | @ApiOperation(value = "首页") |
| | | @PostMapping(value = "/index") |
| | | public ApiResult<TOptometristVO> index() { |
| | | TOptometristVO tOptometristVO = new TOptometristVO(); |
| | | |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | SecUser byId = secUserService.getById(userId); |
| | | Integer userId = loginInfoUtil.getUserId(); |
| | | TOptometrist byId = optometristService.getById(userId); |
| | | TStore byId1 = storeService.getById(byId.getStoreId()); |
| | | tOptometristVO.setStoreName(byId1.getName()); |
| | | tOptometristVO.setName(byId.getName()); |
| | | tOptometristVO.setPhone(byId.getPhone()); |
| | | int size = optometryService.lambdaQuery().eq(TOptometry::getOptometristId, userId) |
| | | .eq(TOptometry::getStatus, 3).list().size(); |
| | | tOptometristVO.setOptometryCount(size); |
| | |
| | | @ApiOperation(value = "开始验光") |
| | | @GetMapping(value = "/startOptometry") |
| | | public ApiResult startOptometry(Integer id) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | Integer userId = loginInfoUtil.getUserId(); |
| | | List<TLineUp> list = tLineUpService.lambdaQuery().eq(TLineUp::getStatus, 2) |
| | | .eq(TLineUp::getOptometristId, userId).list(); |
| | | if (!list.isEmpty())return ApiResult.failed("当前还有未结束的验光单"); |
| | |
| | | tLineUpService.updateById(lineUp); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "取消排号") |
| | | @GetMapping(value = "/cancelLineUp") |
| | | public ApiResult cancelLineUp(Integer id) { |
| | | TLineUp lineUp = tLineUpService.getById(id); |
| | | lineUp.setStatus(5); |
| | | tLineUpService.updateById(lineUp); |
| | | TOptometry one = optometryService.lambdaQuery().eq(TOptometry::getLineUpId, lineUp.getId()).one(); |
| | | if (one!=null){ |
| | | one.setStatus(5); |
| | | } |
| | | optometryService.updateById(one); |
| | | return ApiResult.success(); |
| | | } |
| | | @ApiOperation(value = "填写验光信息完成") |
| | |
| | | if (byId1!=null){ |
| | | tOptometry.setPhone(byId1.getPhone()); |
| | | } |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | SecUser byId2 = secUserService.getById(userId); |
| | | tOptometry.setLineUpId(dto.getId()); |
| | | Integer userId = loginInfoUtil.getUserId(); |
| | | TOptometrist byId2 = optometristService.getById(userId); |
| | | tOptometry.setRealName(byId.getUserName()); |
| | | tOptometry.setOptometristId(userId.intValue()); |
| | | tOptometry.setLineUpId(dto.getId()); |
| | | tOptometry.setOptometristId(userId); |
| | | tOptometry.setStoreId(byId2.getStoreId()); |
| | | tOptometry.setStatus(3); |
| | | optometryService.save(tOptometry); |
| | | List<TOptometryDetail> tOptometryDetails = new ArrayList<>(); |
| | | |
| | |
| | | tOptometryDetail.setBallMirror(optometryDetailVO.getBallMirror()); |
| | | tOptometryDetail.setColumnMirror(optometryDetailVO.getColumnMirror()); |
| | | tOptometryDetail.setAxis(optometryDetailVO.getAxis()); |
| | | tOptometryDetail.setAdd(optometryDetailVO.getAdd()); |
| | | tOptometryDetail.setAddS(optometryDetailVO.getAddS()); |
| | | tOptometryDetail.setPupilHeight(optometryDetailVO.getPupilHeight()); |
| | | tOptometryDetail.setPupilDistance(optometryDetailVO.getPupilDistance()); |
| | | tOptometryDetail.setCorrect(optometryDetailVO.getCorrect()); |
| | |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "验光师编辑") |
| | | @PostMapping(value = "/update") |
| | | public ApiResult<String> update(@RequestBody TOptometrist dto) { |
| | | optometristService.updateById(dto); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "验光师上下架") |
| | | @GetMapping(value = "/upAndDown") |
| | | public ApiResult<Boolean> upAndDown(@RequestParam Integer id, |
| | | @RequestParam Integer status) { |
| | | return ApiResult.success(optometristService.upAndDown(id,status)); |
| | | } |
| | | } |
| | | |