CarConditionController.java 4.05 KB
package cn.com.glsx.stoassistant.controller.carcondition;

import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.scrm.system.model.wechatapplets.LoginUserInfoResponse;
import cn.com.glsx.stoassistant.request.carcondition.CarConditionPadPageRequest;
import cn.com.glsx.stoassistant.response.carcondition.CarConditionPageVO;
import cn.com.glsx.stoassistant.service.cardition.CarConditionService;
import cn.com.glsx.stoassistant.utils.Pagination;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.oreframework.boot.autoconfigure.rop.util.RopThreadLocal;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
@Api("车况管理")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
//@RestController
public class CarConditionController {

    @Autowired
    private CarConditionService carConditionService;

    @ApiOperation("PAD端车况分页查询")
    @ServiceMethod(method = "scrm.api.stoassistant.carCondition.page", needInSession = NeedInSessionType.YES)
//    @PostMapping("/scrm.api.stoassistant.carCondition.page/1.0.0")
    public RopResponse<Pagination<CarConditionPageVO>> page(CarConditionPadPageRequest request) {
        try {
            if (request == null) {
                return RopResponse.error("参数不能为空");
            }
            if (StringUtils.isBlank(request.getOperatorId())) {
                LoginUserInfoResponse loginUser = RopThreadLocal.getLoginUser(LoginUserInfoResponse.class);
                request.setOperatorId(loginUser.getUuid());
            }
            return carConditionService.page(request);
        } catch (Exception e) {
            log.error("PAD端车况分页查询失败", e);
            return RopResponse.error(e.getMessage());
        }
    }


//    @ApiOperation("PAD端车况详情接口")
//    @ServiceMethod(method = "scrm.api.stoassistant.carCondition.detail", needInSession = NeedInSessionType.YES)
//    @PostMapping("/scrm.api.stoassistant.carCondition.detail/1.0.0")
//    public RopResponse<CarConditionPadDetailVO> detail(CarConditionDetailRequest request) {
//        try {
//            if (request == null || request.getId() == null) {
//                return RopResponse.error("车况唯一ID不能为空");
//            }
//            return carConditionService.detail(request);
//        } catch (Exception e) {
//            log.error("PAD端车况详情接口失败", e);
//            return RopResponse.error(e.getMessage());
//        }
//    }
//
//
//    @ApiOperation("新增车况录入")
//    @ServiceMethod(method = "scrm.api.stoassistant.carCondition.add", needInSession = NeedInSessionType.YES)
//    public RopResponse<Integer> add(CarConditionAddRequest request) {
//        try {
//            if (request == null || request.getSource() == null) {
//                return RopResponse.error("车况来源不能为空");
//            }
//            return carConditionService.add(request);
//        } catch (Exception e) {
//            log.error("新增车况录入失败", e);
//            return RopResponse.error(e.getMessage());
//        }
//
//    }
//
//    @ApiOperation("编辑车况录入")
//    @ServiceMethod(method = "scrm.api.stoassistant.carCondition.edit", needInSession = NeedInSessionType.YES)
//    public RopResponse<Integer> edit(CarConditionEditRequest request) {
//        try {
//            if (request == null || request.getId() == null) {
//                return RopResponse.error("车况唯一ID不能为空");
//            }
//            if (request.getSource() == null) {
//                return RopResponse.error("车况来源不能为空");
//            }
//            return carConditionService.edit(request);
//        } catch (Exception e) {
//            log.error("编辑车况录入失败", e);
//            return RopResponse.error(e.getMessage());
//        }
//    }

}