package com.changhong.epc.tenant.controller.sunCloud;
|
|
import com.changhong.epc.bean.tenant.sunCloud.PushMasDataValue;
|
import com.changhong.epc.bean.tenant.sunCloud.PushOrderBill;
|
import com.changhong.epc.bean.tenant.sunCloud.UpdataBusType;
|
import com.changhong.epc.bean.tenant.sunCloud.UpdateBillStatus;
|
import com.changhong.epc.constter.tenant.TenantUrlConst;
|
import com.changhong.epc.rely.api.service.CscApiService;
|
import com.changhong.epc.tenant.service.cost.impl.CostTypeServiceImpl;
|
import com.changhong.epc.tenant.service.sunCloud.SunCloudService;
|
import com.iemsoft.framework.cloud.core.tools.JSONTool;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Objects;
|
|
|
|
|
/**
|
* 提供给云尚行接口
|
* @author yuezhw
|
* @date 2018-1-9
|
*/
|
@RestController
|
public class SunCloudController implements TenantUrlConst{
|
|
@Resource
|
SunCloudService sunCloudService;
|
|
@Resource
|
CostTypeServiceImpl costTypeServiceImpl;
|
|
@Autowired
|
CscApiService cscApiService;
|
|
/**
|
* 规则检查结果推送接口
|
*/
|
@RequestMapping(path=REST_TENANT_JSON_CHECKRESULT,method=RequestMethod.POST)
|
public int checkResult(@RequestParam("data") String data){
|
return data != null ?sunCloudService.addCheckResult(data) : -1;
|
}
|
|
/**
|
* 订单状态更新至费用云订单
|
*/
|
@RequestMapping(path=REST_TENANT_JSON_UPDATEBILLSTATUS,method=RequestMethod.POST)
|
public int updateBillStatus(@RequestParam("data") String data){
|
UpdateBillStatus updateBillStatus =JSONTool.toObj(data, UpdateBillStatus.class);
|
return updateBillStatus != null ?sunCloudService.updateBillStatus(updateBillStatus) : -1;
|
|
}
|
|
/**
|
*返回OCR识别票据数据信息
|
*/
|
@RequestMapping(path=REST_TENANT_JSON_PUSHORDERBILL_ORIGINAL,method=RequestMethod.POST)
|
public int pushOrderBill(@RequestParam("data") String data){
|
PushOrderBill pushOrderBill = JSONTool.toObj(data,PushOrderBill.class);
|
if(pushOrderBill == null){
|
return -1;
|
}
|
pushOrderBill.setBillDatas(data);
|
return sunCloudService.pushOrderBill(pushOrderBill);
|
}
|
|
/**
|
* 租户主数据值同步接口
|
*/
|
@RequestMapping(path=REST_TENANT_JSON_PUSHMASDATAVALUE,method=RequestMethod.POST)
|
public int pushMasDataValue(@RequestParam("data") String data){
|
PushMasDataValue pushMasDataValue =JSONTool.toObj(data, PushMasDataValue.class);
|
sunCloudService.pushMasDataValue(pushMasDataValue);
|
return 1;
|
}
|
|
/**
|
* 指定公司业务类型增量同步接口
|
* @throws Exception
|
*/
|
//@RequestMapping(path=REST_TENANT_JSON_UPDATEBUSTYPE,method=RequestMethod.POST)
|
// @SuppressWarnings("unchecked")
|
// @RequestMapping(path="旧接口,暂时不用,用下面的",method=RequestMethod.POST)
|
// public int updateBusType(@RequestParam("data") String reqData) throws Exception{
|
// Map<String,Object> map = JSONTool.toObj(reqData,Map.class);
|
// Object o = map.get("busType");
|
// List<UpdataBusType> us =JSONTool.toList(JSONTool.toJson(o), UpdataBusType.class);
|
// if(us == null || us.size()<=0){
|
// return 0;
|
// }
|
// sunCloudService.updateBusType(us);
|
// return 1;
|
// }
|
|
|
|
|
/**
|
* 订单图片数据接口
|
*/
|
@PostMapping(path=GET_ORDER_PIC)
|
public Object getOrderPicData(@RequestBody Map<String,String> reqData){
|
return cscApiService.getOrderPic(reqData.get("orderCode"));
|
}
|
|
/**
|
* 费用云订单电子数据记账接口
|
*/
|
@PostMapping(GET_ORDER_ACCOUNT)
|
public Object getOrderAccount(@RequestBody Map<String,Object> reqData){
|
// System.out.println("记账参数:"+JSONTool.toJson(reqData));
|
Map<String,Object> respData = cscApiService.orderAccount(reqData);
|
// System.out.println("记账返回值:"+respData);
|
return respData;
|
}
|
|
/**
|
* 订单规则检查接口
|
*/
|
@PostMapping(GET_ORDER_RULE_CHECK)
|
public Object getOrderRuleCheck(@RequestBody Map<String,String> reqData){
|
Object obj = cscApiService.orderRuleCheck(reqData.get("orderCode"));
|
return obj;
|
}
|
|
/**
|
* 获取云尚行管理中心的业务类型数据
|
*/
|
@PostMapping(path = GET_ORDER_TYPEDEFINELIST)
|
public Map<String,Object> getOrderTypeDefineList(@RequestBody Map<String,Object> reqData){
|
return cscApiService.orderTypeDefineList(reqData);
|
}
|
|
/**
|
* 获取云尚行指定公司的业务类型数据
|
*/
|
@PostMapping(path = GET_BUS_TYPEBYCOMP)
|
public Map<String,Object> getBusTypeByComp(@RequestBody Map<String,Object> reqData){
|
return cscApiService.busTypeByComp(reqData);
|
}
|
|
|
/**
|
* 初始化通用主数据,租户主数据,同步接口(共通接口)
|
*/
|
@PostMapping(path = JSON_ELE_GETMASTER)
|
public boolean getMaster(@RequestBody Map<String,Object> data){
|
return sunCloudService.getMaster(data);
|
}
|
|
/**
|
*同步公司业务类型
|
* zz
|
*/
|
// @PostMapping(path = SYNCH_COMPANY_COSTTYPE)
|
// public boolean addCostType(){
|
// return costTypeServiceImpl.addCostTypeList();
|
// }
|
|
/**
|
* 指定公司业务类型增量同步接口
|
* @throws Exception
|
*/
|
@SuppressWarnings("unchecked")
|
@RequestMapping(path = REST_TENANT_JSON_UPDATEBUSTYPE,method = RequestMethod.POST)
|
public int updateBusTypes(@RequestParam("data") String reqData) throws Exception{
|
// System.out.println(reqData);
|
Map<String,Object> map = JSONTool.toObj(reqData,Map.class);
|
|
String type = Objects.toString( map.get("type"),"");
|
// System.out.println("类型"+type);
|
|
String compId = Objects.toString( map.get("compId"),"");
|
// System.out.println("公司id" + compId);
|
|
String tenantId = Objects.toString(map.get("tenantId"),"");
|
// System.out.println("租户id" + tenantId);
|
|
Object o = map.get("busType");
|
// System.out.println(o);
|
List<UpdataBusType> us = JSONTool.toList(Objects.toString(o), UpdataBusType.class);
|
if(us == null || us.size() <= 0){
|
return 0;
|
}
|
return sunCloudService.updateBusTypes(compId,tenantId,type,us);
|
|
}
|
|
|
/**
|
* 重新审单
|
*/
|
@PostMapping(REST_ORDER_BACKRULE)
|
public Map<String,Object> backRule(@RequestBody Map<String,Object> billInfo){
|
return sunCloudService.backRule(billInfo);
|
}
|
|
|
|
}
|