UcBatchSyncController.java 2.31 KB
package com.hotent.uds.controller;


import com.hotent.uds.manager.UserSync;
import org.springframework.web.bind.annotation.*;
import com.hotent.base.model.CommonResult;
import com.hotent.base.util.StringUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.hotent.base.controller.BaseController;
import com.hotent.uds.model.UcBatchSync;
import com.hotent.uds.manager.UcBatchSyncManager;

import javax.annotation.Resource;
import java.util.Map;

/**
 * UDS同步记录表 前端控制器
 *
 * @company 广州宏天软件股份有限公司
 * @author 欧阳高龙
 * @since 2022-12-29
 */
@RestController
@RequestMapping("/api/sync/v1/")
public class UcBatchSyncController extends BaseController<UcBatchSyncManager, UcBatchSync> {

	@Resource
	private UserSync userSync;
	/**
	 * 根据id获取UDS同步记录表数据详情
	 * @param id
	 * @return
	 * @throws Exception 
	 * ModelAndView
	 */
	@GetMapping(value="/getDetail")
	@ApiOperation(value="根据id获取UDS同步记录表数据详情",httpMethod = "GET",notes = "根据id获取UDS同步记录表数据详情")
	public CommonResult<UcBatchSync> getDetail(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<UcBatchSync>ok().value(baseService.getDetail(id));
	}
    /**
	 * 新增,更新UDS同步记录表
	 * @param ucBatchSync
	 * @throws Exception 
	 * @return
	 * @exception 
	 */
	@PostMapping(value="/save")
	@ApiOperation(value = "新增,更新UDS同步记录表数据", httpMethod = "POST", notes = "新增,更新UDS同步记录表数据")
	public CommonResult<String> save(@ApiParam(name="UcBatchSync",value="UDS同步记录表对象", required = true)@RequestBody UcBatchSync ucBatchSync) throws Exception{
		String msg = StringUtil.isEmpty(ucBatchSync.getId()) ? "添加UDS同步记录表成功" : "更新UDS同步记录表成功";
		baseService.createOrUpdate(ucBatchSync);
		return CommonResult.<String>ok().message(msg);
	}

	@RequestMapping(value="execute",method= RequestMethod.POST, produces = { "application/json; charset=utf-8" })
	public CommonResult<String> executeOne(@RequestBody(required = false) Map<String, Object> args) throws Exception{
		userSync.executeOne(args);
		return new CommonResult<>(true,"执行一次同步成功!");
	}
}