项目接口增加字段
This commit is contained in:
parent
663dddcaf4
commit
6bf6c764c0
|
@ -5,13 +5,11 @@ import kd.bos.context.RequestContext;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.db.DB;
|
import kd.bos.db.DB;
|
||||||
import kd.bos.db.DBRoute;
|
import kd.bos.db.DBRoute;
|
||||||
import kd.bos.entity.MainEntityType;
|
|
||||||
import kd.bos.exception.KDException;
|
import kd.bos.exception.KDException;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.schedule.executor.AbstractTask;
|
import kd.bos.schedule.executor.AbstractTask;
|
||||||
import kd.bos.servicehelper.AttachmentServiceHelper;
|
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.MetadataServiceHelper;
|
import kd.bos.servicehelper.MetadataServiceHelper;
|
||||||
import kd.bos.util.HttpClientUtils;
|
import kd.bos.util.HttpClientUtils;
|
||||||
|
@ -46,7 +44,7 @@ public class DobeContractAttachmentTask extends AbstractTask implements Plugin {
|
||||||
DynamicObject contractinfo;
|
DynamicObject contractinfo;
|
||||||
//先查出合同有附件oa id但是在金蝶中没有附件的记录
|
//先查出合同有附件oa id但是在金蝶中没有附件的记录
|
||||||
QFilter oaidFtr = QFilter.isNotNull("qeug_fjoaid");//合同的附件OAID不为空
|
QFilter oaidFtr = QFilter.isNotNull("qeug_fjoaid");//合同的附件OAID不为空
|
||||||
QFilter nofjFtr = new QFilter("qeug_nofj","=","1");//合同未上传附件的标记为true
|
QFilter nofjFtr = new QFilter("qeug_nofj","=","1");//合同未上传OA附件的标记为true
|
||||||
String selectStr = "id,billno,qeug_fjoaid,qeug_fjzwid,qeug_nofj";
|
String selectStr = "id,billno,qeug_fjoaid,qeug_fjzwid,qeug_nofj";
|
||||||
DynamicObject[] cons = BusinessDataServiceHelper.load(entityName,selectStr,new QFilter[]{oaidFtr.and(nofjFtr)});
|
DynamicObject[] cons = BusinessDataServiceHelper.load(entityName,selectStr,new QFilter[]{oaidFtr.and(nofjFtr)});
|
||||||
if(cons.length == 0){
|
if(cons.length == 0){
|
||||||
|
@ -98,7 +96,6 @@ public class DobeContractAttachmentTask extends AbstractTask implements Plugin {
|
||||||
DobeDWUtils.saveLog(contractno,"致远附件",requrl,e.getMessage(), false,"调用OA附件接口");
|
DobeDWUtils.saveLog(contractno,"致远附件",requrl,e.getMessage(), false,"调用OA附件接口");
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
//访问NAS文件指定存放路径,拿到当前附件和正文目录下的所有文件对象,记录日志
|
//访问NAS文件指定存放路径,拿到当前附件和正文目录下的所有文件对象,记录日志
|
||||||
//在nas路径里,需要供应链系统在/isc/prod/{code}/下继续组装相对地址:
|
//在nas路径里,需要供应链系统在/isc/prod/{code}/下继续组装相对地址:
|
||||||
// /isc/prod/{code}/{summaryId}/下文件夹内为表单附件,/isc/prod/{code}/{subReference}/为合同正文附件
|
// /isc/prod/{code}/{summaryId}/下文件夹内为表单附件,/isc/prod/{code}/{subReference}/为合同正文附件
|
||||||
|
|
|
@ -172,11 +172,11 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
|
||||||
if(projectinfo.getDynamicObject("account") == null){
|
if(projectinfo.getDynamicObject("account") == null){
|
||||||
projectinfo.set("account", accttableid);//会计科目表默认新准则会计科目表
|
projectinfo.set("account", accttableid);//会计科目表默认新准则会计科目表
|
||||||
}
|
}
|
||||||
//TODO 数仓新增两个面积字段 20250221
|
//数仓新增两个面积字段 20250221
|
||||||
// projectinfo.set("qeug_decimalfield1", json_body.getBigDecimal("addr"));//原始可出租面积
|
projectinfo.set("qeug_decimalfield1", json_body.getBigDecimal("rentale_area"));//原始可出租面积
|
||||||
// projectinfo.set("qeug_decimalfield3", json_body.getBigDecimal("addr"));//原始建筑面积
|
projectinfo.set("qeug_decimalfield3", json_body.getBigDecimal("building_area"));//原始建筑面积
|
||||||
// projectinfo.set("qeug_textfield2", calcDFL(json_body.getBigDecimal("addr"),
|
projectinfo.set("qeug_textfield2", calcDFL(json_body.getBigDecimal("rentale_area"),
|
||||||
// json_body.getBigDecimal("addr")).toString());//原始得房率=可出租/建筑面积*100%
|
json_body.getBigDecimal("building_area")).toString());//原始得房率=可出租/建筑面积*100%
|
||||||
projectinfo.set("qeug_textfield1", json_body.getString("project_oriname"));//项目原名称
|
projectinfo.set("qeug_textfield1", json_body.getString("project_oriname"));//项目原名称
|
||||||
projectinfo.set("manageway", getManageway(json_body.getString("investment_model")));//投资模式
|
projectinfo.set("manageway", getManageway(json_body.getString("investment_model")));//投资模式
|
||||||
projectinfo.set("landusage", getLandusage(json_body.getString("land_usage")));//用地性质
|
projectinfo.set("landusage", getLandusage(json_body.getString("land_usage")));//用地性质
|
||||||
|
@ -226,11 +226,11 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
|
||||||
projectinfo.set("qeug_combofield", "CSYQ");
|
projectinfo.set("qeug_combofield", "CSYQ");
|
||||||
}
|
}
|
||||||
projectinfo.set("qeug_ywlx", ywlx);
|
projectinfo.set("qeug_ywlx", ywlx);
|
||||||
//TODO 数仓新增两个面积字段 20250221
|
//数仓新增两个面积字段 20250221
|
||||||
// projectinfo.set("qeug_decimalfield1", json_body.getBigDecimal("addr"));//原始可出租面积
|
projectinfo.set("qeug_decimalfield1", json_body.getBigDecimal("rentale_area"));//原始可出租面积
|
||||||
// projectinfo.set("qeug_decimalfield3", json_body.getBigDecimal("addr"));//原始建筑面积
|
projectinfo.set("qeug_decimalfield3", json_body.getBigDecimal("building_area"));//原始建筑面积
|
||||||
// projectinfo.set("qeug_textfield2", calcDFL(json_body.getBigDecimal("addr"),
|
projectinfo.set("qeug_textfield2", calcDFL(json_body.getBigDecimal("rentale_area"),
|
||||||
// json_body.getBigDecimal("addr")).toString());//原始得房率=可出租/建筑面积*100%
|
json_body.getBigDecimal("building_area")).toString());//原始得房率=可出租/建筑面积*100%
|
||||||
projectinfo.set("qeug_textfield1", json_body.getString("project_oriname"));//项目原名称
|
projectinfo.set("qeug_textfield1", json_body.getString("project_oriname"));//项目原名称
|
||||||
projectinfo.set("manageway", getManageway(json_body.getString("investment_model")));//投资模式
|
projectinfo.set("manageway", getManageway(json_body.getString("investment_model")));//投资模式
|
||||||
projectinfo.set("landusage", getLandusage(json_body.getString("land_usage")));//用地性质
|
projectinfo.set("landusage", getLandusage(json_body.getString("land_usage")));//用地性质
|
||||||
|
|
|
@ -163,4 +163,67 @@ public class AttachmentFileUtil {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**将第三方提供的某个在线文件上传至星瀚对应单据附件上
|
||||||
|
* @param entity 目标单据实体标识
|
||||||
|
* @param pk 目标数据id
|
||||||
|
* @param fileUrl 待存入文件的url
|
||||||
|
* @param fileName 待存入文件名称
|
||||||
|
* @param fileSize 待存入文件大小
|
||||||
|
* @param attachKey 附件面板标识
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static boolean saveUrlFile2Attch(String entity,Object pk,String fileUrl,String fileName,String fileSize,String attachKey) throws IOException{
|
||||||
|
List<Map<String, Object>> attachments = new ArrayList<>();
|
||||||
|
Map<String, Object> attachItem = new HashMap<>();
|
||||||
|
//文件名称
|
||||||
|
attachItem.put("name", fileName);
|
||||||
|
//将url文件转换成输入流
|
||||||
|
InputStream inputStream = null;
|
||||||
|
HttpURLConnection conn = null;
|
||||||
|
String tempUrl = null;
|
||||||
|
try {
|
||||||
|
URL url = new URL(fileUrl);
|
||||||
|
conn = (HttpURLConnection)url.openConnection();
|
||||||
|
//设置超时间为30秒
|
||||||
|
conn.setConnectTimeout(30000);
|
||||||
|
//防止屏蔽程序抓取而返回403错误
|
||||||
|
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
||||||
|
//得到输入流
|
||||||
|
inputStream = conn.getInputStream();
|
||||||
|
//文件大小
|
||||||
|
attachItem.put("size", fileSize);
|
||||||
|
//获取临时文件缓存
|
||||||
|
TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
|
||||||
|
//将文件流存入临时文件缓存(拷贝完成)(最后一个参数为缓存有效期,600秒)
|
||||||
|
tempUrl = cache.saveAsFullUrl(fileName, inputStream, 600);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
//关闭流
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
//关闭连接
|
||||||
|
conn.disconnect();
|
||||||
|
}
|
||||||
|
//修改时间
|
||||||
|
attachItem.put("lastModified",System.currentTimeMillis());
|
||||||
|
//获取appId
|
||||||
|
MainEntityType dataEntityType = MetadataServiceHelper.getDataEntityType(entity);
|
||||||
|
String appId = dataEntityType.getAppId();
|
||||||
|
//将文件缓存中的附件文件上传到正式文件服务器
|
||||||
|
String actUrl = AttachmentServiceHelper.saveTempToFileService(tempUrl,appId,entity,pk,fileName);
|
||||||
|
//将新文件的物理路径存入map
|
||||||
|
attachItem.put("url", actUrl);
|
||||||
|
attachments.add(attachItem);
|
||||||
|
//维护单据和附件的关系(非文件上传)
|
||||||
|
AttachmentServiceHelper.upload(entity, pk, attachKey, attachments);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue