Helius
2021-07-20 56968f6f02f691397eac17d8fb8f8b34f440ab90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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<ConfigInfoVo> 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<Map<String, Object>> batchInfoApiList(@RequestBody BatchInfoModel infoModel)
    {
        Map<String, Object> 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<Map<String, Object>> 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<String,Object> 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);
 
    }
}