53 lines
2.0 KiB
Java
53 lines
2.0 KiB
Java
package tqq9.lc123.cloud.app.plugin.trd;
|
||
|
||
import com.alibaba.fastjson.JSONObject;
|
||
import kd.bos.dataentity.entity.DynamicObject;
|
||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
|
||
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.Date;
|
||
|
||
/**
|
||
* 泛微接口实现,用于后续单独推送的功能实现
|
||
*/
|
||
public class FWImpl {
|
||
|
||
/**
|
||
* 推送仓库
|
||
* @param dataEntity
|
||
* @return
|
||
*/
|
||
public static String syncWH(DynamicObject dataEntity) {
|
||
String number = dataEntity.getString("number");
|
||
String name = dataEntity.getString("name");
|
||
Date ceatetime = dataEntity.getDate("createtime");
|
||
DynamicObject group = dataEntity.getDynamicObject("group");//分组:实物-1,虚拟-0
|
||
String enable = dataEntity.getString("enable");//使用状态:可用-1,禁用-0
|
||
DynamicObject tqq9_dept = dataEntity.getDynamicObject("tqq9_dept");//部门
|
||
// TODO 根据部门获取泛微的部门ID
|
||
|
||
|
||
DynamicObject creator = dataEntity.getDynamicObject("creator");//创建人
|
||
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(), creator.getDynamicObjectType().getName());
|
||
String tqq9_fwuserid = creator.getString("tqq9_fwuserid");
|
||
tqq9_fwuserid = "363";
|
||
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||
String cjsj = sdf.format(ceatetime);
|
||
|
||
JSONObject mainTable = new JSONObject();
|
||
mainTable.put("ckbm", number);
|
||
mainTable.put("ckmc", name);
|
||
mainTable.put("cjsj", cjsj);
|
||
mainTable.put("zt", Integer.valueOf(enable));
|
||
mainTable.put("cclx", Integer.valueOf(group.getString("number")));
|
||
mainTable.put("bmbm", "5g5be27147e2ff9d");
|
||
|
||
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
|
||
String resultStr = fwRestfulUtils.doAction("api/cube/restful/interface/saveOrUpdateModeData/CK", mainTable, tqq9_fwuserid);
|
||
return resultStr;
|
||
}
|
||
|
||
}
|