cgf
2025-08-23 9ec0a61f90ac2464eebc643bfe2d93ac9ba6e569
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
package com.java110.job.cmd.importCarInout;
 
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.machine.CarInoutDto;
import com.java110.dto.user.UserDownloadFileDto;
import com.java110.intf.common.ICarInoutInnerServiceSMO;
import com.java110.intf.common.ICarInoutV1InnerServiceSMO;
import com.java110.po.car.CarInoutFeeHistoryPo;
import com.java110.po.car.CarInoutPo;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.vo.api.carInout.ApiCarInoutDataVo;
import com.java110.vo.api.carInout.ApiCarInoutVo;
import com.java110.vo.api.parkingArea.ApiParkingAreaVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
 
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
 
@Java110Cmd(serviceCode = "import.QueryCarInout")
public class QueryCarInout extends Cmd {
 
    @Autowired
    private ICarInoutInnerServiceSMO iCarInoutInnerServiceSMOImpl;
    @Resource
    private ICarInoutV1InnerServiceSMO carInoutV1InnerServiceSMOImpl;
 
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
 
    }
 
    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException, ParseException {
        CarInoutDto carInoutDto = BeanConvertUtil.covertBean(reqJson, CarInoutDto.class);
        int i = iCarInoutInnerServiceSMOImpl.queryCarInoutsCount(carInoutDto);
        if(i > 0){
            carInoutDto.setTotal(i);
            carInoutDto.setRecords((int) Math.ceil((double) i / (double) reqJson.getInteger("row")));
            List<ApiCarInoutDataVo> carInoutDtos = iCarInoutInnerServiceSMOImpl.queryCarInouts2(carInoutDto);
            for(ApiCarInoutDataVo apiCarInoutDataVo : carInoutDtos){
                CarInoutFeeHistoryPo carInoutFeeHistoryPo = new CarInoutFeeHistoryPo();
                carInoutFeeHistoryPo.setInoutId(apiCarInoutDataVo.getInoutId());
                List<CarInoutFeeHistoryPo> list = carInoutV1InnerServiceSMOImpl.queryCarInoutFeeHistoryList(carInoutFeeHistoryPo);
                if(!CollectionUtils.isEmpty(list)){
                    apiCarInoutDataVo.setCarInoutFeeHistory(list.get(0));
                }
            }
            i = carInoutDtos.size();
            ApiCarInoutVo carInoutVo = new ApiCarInoutVo();
 
            carInoutVo.setTotal(i);
            carInoutVo.setRecords((int) Math.ceil((double) i / (double) reqJson.getInteger("row")));
            carInoutVo.setCarInouts(carInoutDtos);
 
            ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(carInoutVo), HttpStatus.OK);
            cmdDataFlowContext.setResponseEntity(responseEntity);
        }
    }
}