package com.xzx.gc.order.controller; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.xzx.gc.common.Result; import com.xzx.gc.common.constant.OrderEnum; import com.xzx.gc.common.request.BaseController; import com.xzx.gc.common.dto.CommonDto; import com.xzx.gc.entity.OrderClockIn; import com.xzx.gc.model.JsonResult; import com.xzx.gc.model.admin.BatchInfoModel; import com.xzx.gc.model.system.ConfigInfoReq; import com.xzx.gc.model.system.ConfigInfoVo; import com.xzx.gc.order.mapper.OrderClockInMapper; import com.xzx.gc.order.service.ConfigService; import com.xzx.gc.order.service.OrderBatchInfoService; import com.xzx.gc.order.service.OrderClockInService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; /** * @author :zz */ @RestController @Api(tags = {"地称打卡管理"}) @Validated @Slf4j public class OrderClockInController extends BaseController { @Autowired private OrderClockInService orderClockInService; @Autowired private OrderClockInMapper orderClockInMapper; @Autowired private OrderBatchInfoService orderBatchInfoService; @Autowired private ConfigService configService; @PostMapping("/orderClockIn") @ApiOperation(value = "查询用户今日是否打卡") public Result find(@RequestBody CommonDto commonDto){ Result result=new Result(); ConfigInfoReq configInfoReq=new ConfigInfoReq(); configInfoReq.setConfigTypeCode("CODE_SCAN_RK"); List configInfoVos = configService.configInfoQuery(configInfoReq); String configValue = configInfoVos.get(0).getConfigValue(); if(OrderEnum.已开放入库扫码.getValue().equals(configValue)){ return result; }else{ String userId=commonDto.getId(); if(orderClockInService.notClock(userId)){ return result; } OrderClockIn today = orderClockInMapper.findToday(userId, StrUtil.split(DateUtil.now(),"")[0]); if(today==null) { result.setCode(-1); result.setMsg("当日还未打卡"); }else{ result.setData(today); } return result; } } @PostMapping("/admin/front/orderClockIn/batchInfoApiList.do") @ApiOperation(value="运营管理-打卡管理", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "name", value = "回收员名称", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "weightError", value = "误差", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "startTime", value = "开始时间", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "endTime", value = "结束时间", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "page", value = "页码", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "limit", value = "每页条数", required = true, dataType = "String") }) public JsonResult> batchInfoApiList(@RequestBody BatchInfoModel infoModel) { Map map= orderClockInService.queryByConditionList(infoModel.getName(),infoModel.getWeightError(), infoModel.getStartTime(),infoModel.getEndTime(),infoModel.getPage(),infoModel.getLimit()); return JsonResult.success(map); } @PostMapping("/admin/front/orderClockIn/batchDetaillist.json") @ApiOperation(value="运营管理-打卡管理(详情)", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "vehicleId", value = "关联车辆Id", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "userId", value = "用户Id", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "type", value = "类型(0:全部,1:空车,2:载重)", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "weightError", value = "误差", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "startTime", value = "开始时间", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "endTime", value = "结束时间", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "page", value = "页码", required = true, dataType = "String"), @ApiImplicitParam(paramType = "query", name = "limit", value = "每页条数", required = true, dataType = "String") }) public JsonResult> batchDetaillist(@RequestBody BatchInfoModel infoModel) { String vehicleId=infoModel.getVehicleId(); String userId =infoModel.getUserId(); String weightError=infoModel.getWeightError(); String startTime=infoModel.getStartTime(); String endTime=infoModel.getEndTime(); String page=infoModel.getPage(); String limit=infoModel.getLimit(); String type=infoModel.getType(); Map map; if(null!=type&&!"".equals(type)){ if("0".equals(type)){ map = orderBatchInfoService.queryBatchInfoDetailList(weightError,startTime,endTime,userId,vehicleId,page,limit); }else if("1".equals(type)){ map= orderBatchInfoService.queryClockDetailList(weightError,startTime,endTime,userId,vehicleId,page,limit); }else{ map= orderBatchInfoService.queryBatchDetailList(weightError,startTime,endTime,userId,vehicleId,page,limit); } }else{ map = orderBatchInfoService.queryBatchInfoDetailList(weightError,startTime,endTime,userId,vehicleId,page,limit); } return JsonResult.success(map); } }