package com.changhong.epc.tenant.service.accounting.impl;
|
|
import com.changhong.epc.bean.form.FormDataEntity;
|
import com.changhong.epc.bean.form.ProcessBudget;
|
import com.changhong.epc.constter.form.utf.FormUrlConst;
|
import com.changhong.epc.constter.system.SystemClients;
|
import com.changhong.epc.constter.system.run.EpcRestInterface;
|
import com.changhong.epc.rely.api.service.CscApiService;
|
import com.changhong.epc.tenant.service.accounting.AccountingService;
|
import com.iemsoft.framework.cloud.core.base.ResMsg;
|
import com.iemsoft.framework.cloud.core.tools.JSONTool;
|
import com.iemsoft.framework.cloud.core.tools.SpringUtil;
|
import com.iemsoft.framework.cloud.ribbon.RestInterface;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Map;
|
|
|
@Service("accountingServiceImpl")
|
public class AccountingServiceImpl implements SystemClients,AccountingService {
|
|
@Autowired
|
private CscApiService cscApiService;
|
|
/**
|
* 进入记账方法
|
*/
|
@Override
|
public int record(ProcessBudget processBudget) {
|
return orderAccount(selectFormData(processBudget)) == true ? 1 : -1;
|
}
|
|
/**
|
* 发送记账请求
|
* @param selectFormData
|
*/
|
private boolean orderAccount(Map<String, Object> selectFormData) {
|
return cscApiService.orderAccount(selectFormData) != null ? true : false;
|
}
|
|
/**
|
* 查询表单数据
|
* @param processBudget
|
*/
|
private Map<String,Object> selectFormData(ProcessBudget processBudget){
|
RestInterface restInterface = SpringUtil.getBean(SERVER_FORM.getBeanName(), RestInterface.class);
|
FormDataEntity formData = new FormDataEntity();
|
formData.setFormId(processBudget.getFormID());
|
formData.setTenantId(processBudget.getTenantId());
|
formData.setDataRowNum(processBudget.getDataRowNUm());
|
// Map<String,Object> map = new HashMap<String,Object>();
|
// map.put("companyId",processBudget.getCompanyId());
|
// Map<String,Object> map1 = new HashMap<String,Object>();
|
// map1.put("openId",processBudget.getOpenId());
|
// formData.setMap(map);
|
// formData.setMap(map1);
|
Object data = restInterface.post(FormUrlConst.FORM_DATA_SEARCH,formData ,ResMsg.class, EpcRestInterface.getEpcHeads()).getData();
|
// System.err.println(JSONTool.toJson(data));
|
Map<String,Object> Co = JSONTool.toObj(JSONTool.toJson(data),Map.class);
|
// Map<String,Object> map = new HashMap<String,Object>();
|
// map.put("processBudget", data);
|
// System.err.println(JSONTool.toJson(Co));
|
|
return Co;
|
}
|
|
|
}
|