package cn.com.goldenwater.dcproj.controller.tac; import cn.com.goldenwater.dcproj.dto.TacExprRcmmRcrdDto; import cn.com.goldenwater.dcproj.model.TacExprRcmmRcrd; import cn.com.goldenwater.dcproj.param.TacExprRcmmRcrdParam; import cn.com.goldenwater.dcproj.service.TacExprRcmmRcrdService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.text.ParseException; import java.util.List; /** * @author lune * @date 2019-11-13 */ @Api(value = "TAC 专家推荐记录管理", tags = "TAC 专家推荐记录管理") @RestController @RequestMapping("/tac/expr/rcmm/rcrd") public class TacExprRcmmRcrdController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacExprRcmmRcrdService tacExprRcmmRcrdService; @ApiOperation(value = "添加/修改专家推荐记录") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacExprRcmmRcrd", value = "TacExprRcmmRcrd", required = true) @RequestBody TacExprRcmmRcrd tacExprRcmmRcrd) { if (StringUtils.isBlank(tacExprRcmmRcrd.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid tacExprRcmmRcrd.setId(uuid); tacExprRcmmRcrdService.insert(tacExprRcmmRcrd); } else { tacExprRcmmRcrdService.update(tacExprRcmmRcrd); } return buildSuccessResponse(tacExprRcmmRcrd); } @ApiOperation(value = "根据ID删除专家推荐记录") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = tacExprRcmmRcrdService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取专家推荐记录(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { TacExprRcmmRcrd tacExprRcmmRcrd = tacExprRcmmRcrdService.get(id); return buildSuccessResponse(tacExprRcmmRcrd); } @ApiOperation(value = "获取专家推荐记录(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "tacExprRcmmRcrdParam", value = "tacExprRcmmRcrdParam", required = true) @RequestBody TacExprRcmmRcrdParam tacExprRcmmRcrdParam) { List tacExprRcmmRcrdList = tacExprRcmmRcrdService.findList(tacExprRcmmRcrdParam); return buildSuccessResponse(tacExprRcmmRcrdList); } @ApiOperation(value = "获取专家推荐记录(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "tacExprRcmmRcrdParam", value = "tacExprRcmmRcrdParam", required = true) @RequestBody TacExprRcmmRcrdParam tacExprRcmmRcrdParam) { PageInfo tacExprRcmmRcrdList = tacExprRcmmRcrdService.findPageInfo(tacExprRcmmRcrdParam); return buildSuccessResponse(tacExprRcmmRcrdList); } @ApiOperation(value = "获取推荐记录列表(年度时间去重)") @RequestMapping(value = "/getRcrdDtoList", method = RequestMethod.POST) public BaseResponse> getRcrdDtoList(@RequestBody TacExprRcmmRcrdParam tacExprRcmmRcrdParam) { List list = tacExprRcmmRcrdService.getRcrdDtoList(tacExprRcmmRcrdParam); return buildSuccessResponse(list); } @ApiOperation(value = "根据推荐记录时间删除推荐记录") @RequestMapping(value = "/cleanRcrdByExprTime", method = RequestMethod.POST) public BaseResponse cleanRcrdByExprTime(@RequestBody TacExprRcmmRcrdDto dto) { int a = tacExprRcmmRcrdService.cleanRcrdByExprTime(dto); return buildSuccessResponse(); } @ApiOperation(value = "人员推荐保存接口") @RequestMapping(value = "/saveRcrdDto", method = RequestMethod.POST) public BaseResponse saveRcrdDto(@RequestBody TacExprRcmmRcrdDto dto) { boolean flag = false; try { flag = tacExprRcmmRcrdService.saveRcrdDto(dto); } catch (ParseException e) { return buildFailResponse(); } if (!flag) { return buildFailResponse(); } return buildSuccessResponse(); } @ApiOperation(value = "推荐功能") @RequestMapping(value = "/updateRcmmListByExprTime", method = RequestMethod.POST) public BaseResponse updateRcmmListByExprTime(@RequestBody TacExprRcmmRcrdDto dto) { int a = tacExprRcmmRcrdService.updateRcmmListByExprTime(dto); return buildSuccessResponse(); } }