package com.bohuikeji.delivery.backstage.controller.admin;

import com.bohuikeji.delivery.backstage.entity.TComplaint;
import com.bohuikeji.delivery.backstage.service.ITComplaintService;
import com.bohuikeji.frame.module.admin.base.ControllerBase;
import com.bohuikeji.frame.module.admin.entity.back.APIEntity;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.time.LocalDateTime;

/**
 * 投诉记录
 */
@Controller
@ResponseBody
@RequiredArgsConstructor
@RequestMapping("/complaint")
public class ComplaintController extends ControllerBase {

    final ITComplaintService complaintService;
    @RequestMapping("/handling")
    public APIEntity getHandlingComplaints(Integer complaintId,String resultsDesc){
        TComplaint complaint=complaintService.getById(complaintId);
        complaint.setResultsDesc(resultsDesc);
        complaint.setHandleTime(LocalDateTime.now());
        complaint.setComplaintState("已处理");
        complaint.updateById();
        return APIEntity.success();
    }


}
