CyclecountAPIService.java 1.45 KB
package com.huaheng.api.general.service;

import com.alibaba.fastjson.JSON;
import com.huaheng.common.utils.http.HttpUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.inventory.cyclecountAdjust.domain.CyclecountAdjust;
import com.huaheng.pc.inventory.cyclecountAdjust.mapper.CyclecountAdjustMapperAuto;
import com.huaheng.pc.inventory.cyclecountAdjust.service.ICycleconutAdjustService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *  盘点差异接口服务层
 *    @author huaheng
 *    @date 2019-1-8
 *
 *
 *
 */

@Service
public class CyclecountAPIService {

    @Resource
    private CyclecountAdjustMapperAuto cyclecountAdjustMapperAuto;
    @Resource
    private ICycleconutAdjustService cycleconutAdjustService;

    public AjaxResult confirm(String url) {
        CyclecountAdjust cyclecountAdjust=new CyclecountAdjust();
        cyclecountAdjust.setStatus(10);
        cyclecountAdjust=cyclecountAdjustMapperAuto.selectFirstEntity(cyclecountAdjust);
        if(cyclecountAdjust==null){
            return AjaxResult.error("没有盘点差异上传");
        }
        String JsonParam = JSON.toJSONString(cyclecountAdjust);
        String result = HttpUtils.sendPost(url, JsonParam);
        AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
        cyclecountAdjust.setStatus(20);
        cycleconutAdjustService.updateByModel(cyclecountAdjust);
        return ajaxResult;
    }

}