package cn.superdesk.uniorder.controller._patch.accounting;

import cn.superdesk.uniorder.common.pagination.PageQueryParam;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dubbo.consumer.accounting.customer.AccountingUnifiedCustomerDubboConsumerService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/3/10 下午3:52
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/3/10 下午3:52
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/patch/accounting/unified/customer/dim/order2goods")
public class AccountingUnifiedCustomerDimOrder2DimGoodsController {

	@Autowired
	private AccountingUnifiedCustomerDubboConsumerService accountingUnifiedCustomerDubboConsumerService;

	/**
	 * 超时不用管 能正常运行
	 * http://192.168.1.223:8089/web/patch/accounting/unified/customer/dim/order2goods/run
	 *
	 * @param param
	 * @return
	 */
	@ApiOperation(value = "patch")
	@RequestMapping(value = "run", method = RequestMethod.POST)
	@ResponseBody
	public R<String> run(@RequestBody PageQueryParam param) {


		R<String> response = new R<>();

		// TODO 参数合法性判定

		String accountingOrderSn = null;

		if (null != param.getConditions().get("accountingOrderSn")) {
			accountingOrderSn = param.getConditions().get("accountingOrderSn").toString();
		}

		accountingUnifiedCustomerDubboConsumerService.patchXDimOrder2DimGoods(accountingOrderSn);

		return response;
	}

}
