1.门户优化

2.待办url优化
3.天眼查批量任务

S
This commit is contained in:
weiyunlong 2024-12-27 18:30:59 +08:00
parent 847690de70
commit 43c427a040
3 changed files with 395 additions and 48 deletions

View File

@ -1,67 +1,231 @@
package shkd.repc.recon.formplugin;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.apusic.aas.util.digester.Digester;
import com.apusic.aas.util.digester.Rule;
import com.apusic.aas.util.digester.Rules;
import kd.bos.bill.BillShowParameter;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.ShowType;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import shkd.utils.DobeDWUtils;
import shkd.utils.TycUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static shkd.utils.TycUtils.convertTimestampToDate;
import static shkd.utils.TycUtils.getProvinceName;
public class TestFormPlugin extends AbstractFormPlugin {
@Override
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
super.afterDoOperation(afterDoOperationEventArgs);
Integer type = new Integer(1);
String operateKey = afterDoOperationEventArgs.getOperateKey();
if ("save".equals(operateKey)) {
// BillShowParameter billShowParameter = new BillShowParameter();
// billShowParameter.setFormId("recos_conplan");// 合约规划
// billShowParameter.getOpenStyle().setShowType(ShowType.Modal);
// billShowParameter.getOpenStyle().setTargetKey("tabap");
// this.getView().showForm(billShowParameter);
if ("test".equals(operateKey)) {
// QFilter q1 = new QFilter("name", "=", "北京浩泽创富科技有限公司");
DynamicObject[] load = BusinessDataServiceHelper.load("resm_official_supplier",
"id", new QFilter[]{new QFilter("status", QCP.equals, "C")});
for (DynamicObject supplier : load) {
supplier = BusinessDataServiceHelper.loadSingle(supplier.getPkValue(),"resm_official_supplier");
String tyc_Test_keyword = supplier.getString("name");
try {
/**
* 1.企业基本信息含主要人员_819
*/
String tyc_Baseinfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Baseinfo
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "企业基本信息含主要人员_819",type);
JSONObject tyc_Baseinfo_results = JSONObject.parseObject(tyc_Baseinfo);
if (null != tyc_Baseinfo_results) {
JSONObject tyc_Baseinfo_result = (JSONObject) tyc_Baseinfo_results.get("result");
if (null != tyc_Baseinfo_result) {
//法人
String legalPersonName = (String) tyc_Baseinfo_result.get("legalPersonName");
//注册号
String regNumber = (String) tyc_Baseinfo_result.get("regNumber");
//组织机构代码
String orgNumber = (String) tyc_Baseinfo_result.get("orgNumber");
//营业期限(逻辑待定)--经营开始时间-经营结束时间
String businessduration = "";
Long fromTime = (Long) tyc_Baseinfo_result.get("fromTime");//开始时间
Long toTime = (Long) tyc_Baseinfo_result.get("toTime");//结束时间
if (null != fromTime && null != toTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
businessduration = sdf.format(new Date(fromTime)) + "" + sdf.format(new Date(toTime));//营业期限
}
//注册地址
String regLocation = (String) tyc_Baseinfo_result.get("regLocation");
//登记机关
String regInstitute = (String) tyc_Baseinfo_result.get("regInstitute");
//经营范围(2000 文本)
String businessScope = (String) tyc_Baseinfo_result.get("businessScope");
//企业状态经营状态
String regStatus = (String) tyc_Baseinfo_result.get("regStatus");
//网址
String websiteList = (String) tyc_Baseinfo_result.get("websiteList");
//todo 发照日期
//统一社会信用代码
String creditCode = (String) tyc_Baseinfo_result.get("creditCode");
//行业
String industry = (String) tyc_Baseinfo_result.get("industry");
//省份简称
String base = (String) tyc_Baseinfo_result.get("base");
String provinceName = getProvinceName(base);
//注册资本
String regCapital = (String) tyc_Baseinfo_result.get("regCapital");
//企业联系电话
//企业联系方式
String phoneNumber = (String) tyc_Baseinfo_result.get("phoneNumber");
//企业类型
String companyOrgType = (String) tyc_Baseinfo_result.get("companyOrgType");
//成立日期
String estiblishtime = "";
Long estiblishTime = (Long) tyc_Baseinfo_result.get("estiblishTime");
if (null != estiblishTime) {
estiblishtime = convertTimestampToDate(estiblishTime);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//注销日期
String canceldate = "";
Long cancelDate = (Long) tyc_Baseinfo_result.get("cancelDate");
if (null != cancelDate) {
canceldate = convertTimestampToDate(cancelDate);
}
//
String city = (String) tyc_Baseinfo_result.get("city");
//曾用名
String historyNames = (String) tyc_Baseinfo_result.get("historyNames");
//参保人数
Integer socialStaffNum = (Integer) tyc_Baseinfo_result.get("socialStaffNum");
//主要人员列表
DynamicObjectCollection qeugEntryentity = supplier.getDynamicObjectCollection("qeug_entryentity");
qeugEntryentity.clear();
JSONObject staffListS = tyc_Baseinfo_result.getJSONObject("staffList");
if (null != staffListS) {
JSONArray staffLists = staffListS.getJSONArray("result");
if (null != staffLists) {
for (int i = 0; i < staffLists.size(); i++) {
DynamicObject add = qeugEntryentity.addNew();
JSONObject staffList = (JSONObject) staffLists.get(i);
String name = staffList.getString("name");//主要人员姓名
String typeJoin = "";//主要人员职位
JSONArray typeJoins = staffList.getJSONArray("typeJoin");
if (null != typeJoins) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < typeJoins.size(); j++) {
sb.append((String) typeJoins.get(j));
if (j < typeJoins.size() - 1) {
sb.append(",");
}
}
typeJoin = sb.toString();
}
add.set("seq", i);
add.set("qeug_personnelname", name);//主要人员姓名
add.set("qeug_position", typeJoin);//主要人员职位
}
}
}
//设置到供应商中
supplier.set("qeug_legalpersonn", legalPersonName);//法人代表
supplier.set("qeug_regnumber", regNumber);//企业注册号
supplier.set("qeug_orgnumber", orgNumber);//组织机构代码
supplier.set("qeug_businessduration", businessduration);//营业期限
supplier.set("qeug_reglocation", regLocation);//公司地址
supplier.set("qeug_reginstitute", regInstitute);//登记机关
supplier.set("qeug_regstatus", regStatus);//经营状态
supplier.set("qeug_websitelist", websiteList);//企业网站
Date parse = null;
try {
parse = sdf.parse(estiblishtime);
supplier.set("qeug_photodate", parse);//发照日期
supplier.set("qeug_estiblishtime", parse);//成立日期
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
supplier.set("qeug_creditcode", creditCode);//统一社会信用代码
supplier.set("qeug_industry", industry);//所属行业
supplier.set("qeug_bases", provinceName);//
supplier.set("qeug_regcapital", regCapital);//注册资本
supplier.set("qeug_companyorgtype", companyOrgType);//企业类型
supplier.set("qeug_canceldate", canceldate);//注销日期
supplier.set("qeug_city", city);//城市
supplier.set("qeug_phonenumber", phoneNumber);//联系电话
supplier.set("qeug_historynames", historyNames);//曾用名
supplier.set("qeug_socialstaffnum", socialStaffNum);//参保人数
supplier.set("qeug_businessscopes", businessScope);//经营范围
//系统字段
supplier.set("bizregisterdate", parse);//成立日期
supplier.set("artificialperson", legalPersonName);//法人代表
supplier.set("societycreditcode", creditCode);//统一社会信用代码
supplier.set("tx_register_no", creditCode);//纳税人识别号
supplier.set("industry", industry);//所属行业
supplier.set("regcapital", regCapital);//注册资本
supplier.set("businessduration", businessduration);//营业期限
supplier.set("phone", phoneNumber);//联系电话
supplier.set("company_address", regLocation);//公司地址
supplier.set("url", websiteList);//企业网站
supplier.set("qeug_regnumberes", regNumber);//企业注册号
supplier.set("qeug_orgnumberes", orgNumber);//组织机构代码
supplier.set("qeug_regstatuses", regStatus);//经营状态
supplier.set("scopebusiness", businessScope);//经营范围
if (null != fromTime) {
supplier.set("qeug_begin",new Date(fromTime));//营业期限(起始)
}
if (null != toTime) {
supplier.set("qeug_end", new Date(toTime));//营业期限(终止)
}
if (null != cancelDate) {
supplier.set("qeug_logoff", new Date(cancelDate));//注销日期
}
SaveServiceHelper.save(new DynamicObject[]{supplier});
}
}
}catch (Exception ex) {
String logType = (type == 1) ? "正式" : "潜在";
DobeDWUtils.saveLog(tyc_Test_keyword + "_" + logType,
"天眼查", tyc_Test_keyword, ex.getMessage() + "\n" +
ex.getStackTrace()[0].getClassName() + "\n" +
ex.getStackTrace()[0].getMethodName() + "\n" +
ex.getStackTrace()[0].getLineNumber(),
false, "query_tyc");
}
long rootOrgId = OrgUnitServiceHelper.getRootOrgId();
DynamicObject org = BusinessDataServiceHelper.loadSingle(rootOrgId, "bos_org");
DynamicObject bd_material = BusinessDataServiceHelper.newDynamicObject("bd_material");
bd_material.set("enable", "1");//使用状态
bd_material.set("status", "C");//数据状态
bd_material.set("ctrlstrategy", "5");//控制策略
bd_material.set("number","001");
bd_material.set("name","001");
if (null != org) {
bd_material.set("createorg",org);
}
bd_material.set("materialtype","1");
bd_material.set("enablepur",true);//可采购
bd_material.set("enablesale",true);//可销售
bd_material.set("enableinv",true);//可库存
SaveServiceHelper.save(new DynamicObject[]{bd_material});
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
//根据组织携带项目
if ("billname".equals(name)) {
String billname = (String)this.getModel().getValue("billname");
this.getModel().setValue("qeug_xf",billname);
this.getView().updateView("qeug_xf");
}
}
// @Override
// public void propertyChanged(PropertyChangedArgs e) {
// super.propertyChanged(e);
// String name = e.getProperty().getName();
// //根据组织携带项目
// if ("billname".equals(name)) {
// String billname = (String)this.getModel().getValue("billname");
// this.getModel().setValue("qeug_xf",billname);
// this.getView().updateView("qeug_xf");
// }
// }
}

View File

@ -0,0 +1,173 @@
package shkd.repc.resp.formplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.form.FormShowParameter;
import kd.bos.form.IFormView;
import kd.bos.form.OpenStyle;
import kd.bos.form.ShowType;
import kd.bos.form.container.Container;
import kd.bos.form.control.Control;
import kd.bos.form.control.Label;
import kd.bos.form.control.Search;
import kd.bos.form.control.events.SearchEnterEvent;
import kd.bos.form.control.events.SearchEnterListener;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.operate.FormOperate;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.orm.query.QFilter;
import kd.bos.orm.util.CollectionUtils;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.repc.resp.formplugin.portal.IndexEditNew;
import kd.repc.resp.formplugin.portal.PortalLableStyleChangeUtil;
import java.util.EventObject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PortalFormPlugin extends AbstractFormPlugin implements SearchEnterListener {
public static String SEARCHAP = "";
public void initialize() {
super.initialize();
}
static String getTip() {
return ResManager.loadKDString("门户模块配置为空,请在供应商管理里配置并发布。", "IndexEditNew_0", "repc-resp-formplugin", new Object[0]);
}
public void registerListener(EventObject eventobject) {
this.addClickListeners(new String[]{"qeug_buttonap"});
// 注册监听
Search search = this.getControl("qeug_searchap");
search.addEnterListener(this);
}
@Override
public void search(SearchEnterEvent searchEnterEvent) {
List<String> fieldNames = searchEnterEvent.getFieldNames();
String string = fieldNames.get(0);
SEARCHAP = string;
}
public void click(EventObject eventobject) {
super.click(eventobject);
Control source = (Control)eventobject.getSource();
String portalConfigId = getPortalConfigId();
String key = source.getKey();
IFormView view = this.getView();
this.setHeadflexpanelBackgroundImg(false);
switch (key) {
case "qeug_buttonap":
this.getControl("");
// (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "qeug_buttonap", ResManager.loadKDString("查询", "IndexEditNew_4", "repc-resp-formplugin", new Object[0]));
String str = SEARCHAP;
Search search = this.getView().getControl("qeug_searchap");
String searchKey = search.getSearchKey();
this.loadCards(portalConfigId, this.getCardInfoQeug("summary"), (Map)null);
this.getView().getModel().setValue("showcontrol", "query");
search.setSearchKey("");
break;
}
}
static String getBrowsertabname() {
return ResManager.loadKDString("金蝶云苍穹", "IndexEditNew_1", "repc-resp-formplugin", new Object[0]);
}
protected HashMap<String, String> getCardInfo(String formKey) {
HashMap<String, String> cardInfo = new HashMap();
cardInfo.put("formId", "resp_" + formKey + "_new");
cardInfo.put("container", "gc_" + formKey + "_new");
cardInfo.put("cardId", "card_" + formKey + "_new");
return cardInfo;
}
protected HashMap<String, String> getCardInfoQeug(String formKey) {
HashMap<String, String> cardInfo = new HashMap();
cardInfo.put("formId", "qeug_card_" + formKey + "_new");
cardInfo.put("container", "qeug_gc_" + formKey + "_new");
cardInfo.put("cardId", "qeug_card_" + formKey + "_new");
return cardInfo;
}
protected void loadCards(String portalConfigId, HashMap<String, String> cardInfo, Map<String, Object> customParams) {
FormShowParameter parameter = new FormShowParameter();
String ispreviewprotal = (String)this.getView().getFormShowParameter().getCustomParam("ispreviewprotal");
if (!"true".equalsIgnoreCase(ispreviewprotal)) {
parameter.setCustomParam("browsertabname", getBrowsertabname());
}
parameter.setFormId((String)cardInfo.get("formId"));
parameter.setCustomParam("portalConfigId", portalConfigId);
parameter.setCustomParam("parentPageId", this.getView().getPageId());
if (customParams != null) {
parameter.getCustomParams().putAll(customParams);
}
OpenStyle openStyle = parameter.getOpenStyle();
openStyle.setShowType(ShowType.InContainer);
openStyle.setTargetKey((String)cardInfo.get("container"));
openStyle.setCustParam(new HashMap());
openStyle.getCustParam().put("cardId", cardInfo.get("cardId"));
openStyle.getCustParam().put("ifDesignMode", "1");
this.getView().showForm(parameter);
}
protected String getPortalConfigId() {
String portalConfigId = (String)this.getView().getFormShowParameter().getCustomParam("portalConfigId");
if (portalConfigId == null || portalConfigId.trim().length() == 0 || portalConfigId.equals("0")) {
QFilter[] filters = new QFilter[]{new QFilter("isenable", "=", true)};
DynamicObject[] portalConfigs = BusinessDataServiceHelper.load("resm_portalconfig", "id", filters, "modifytime desc");
if (portalConfigs.length > 0) {
portalConfigId = portalConfigs[0].getPkValue().toString();
}
if (portalConfigId == null) {
this.getView().showErrorNotification(getTip());
}
}
return portalConfigId;
}
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
super.beforeDoOperation(args);
FormOperate operate = (FormOperate) args.getSource();
String key = operate.getOperateKey();
String[] switchKeys = new String[]{"query"};
List<String> switchKeyList = CollectionUtils.arrayToList(switchKeys);
String globalSessionId;
if (switchKeyList.contains(key)) {
// this.setHeadflexpanelBackgroundImg(true);
// globalSessionId = this.getPageCache().get("registeredid");
// if (!StringUtils.isEmpty(globalSessionId)) {
// this.getView().setVisible(Boolean.FALSE, new String[]{"btn_templogin", "link_login", "label_regist"});
// this.getView().setVisible(Boolean.TRUE, new String[]{"label_logintip", "btn_exit"});
// } else {
// this.getView().setVisible(Boolean.TRUE, new String[]{"btn_templogin", "link_login", "label_regist"});
// this.getView().setVisible(Boolean.FALSE, new String[]{"label_logintip", "btn_exit"});
// }
}
}
public void setHeadflexpanelBackgroundImg(boolean flag) {
Container flexPanel = (Container)this.getView().getControl("flexpanelap1");
if (flag) {
flexPanel.setBackgroundImg("/images/pc/other/AI_bg_108_110.png");
} else {
flexPanel.setBackgroundImg((String)null);
}
}
}

View File

@ -79,10 +79,16 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
e.printStackTrace();
}
//https://newoa.dobechina.com
// url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
// h5url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
url = "https://newoa.dobechina.com/seeyon/isc.do?method=ssoISC&toUrl=" + url;
h5url = "https://newoa.dobechina.com/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
String property = System.getProperty("domain.contextUrl");
//测试环境
if ("http://isctest.dobechina.com:8022/ierp".equals(property)) {
url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
h5url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
}else {
url = "https://newoa.dobechina.com:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
h5url = "https://newoa.dobechina.com:9090/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
}
//获取任务创建人
Long startUserId = messageContext.getStartUserId(); // 审批实例发起人id
@ -282,8 +288,8 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
// url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
//获取Url
String url = message.getContentUrl(); // 链接
String url1 = message.getContentUrl(); // pc链接
String url = message.getContentUrl(); // 链接
String url1 = message.getContentUrl(); // pc链接
String h5url = url + "&device=mob&ado=view";
try {
url = URLEncoder.encode(url, "UTF-8");
@ -292,11 +298,15 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
e.printStackTrace();
}
//https://newoa.dobechina.com
// url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
// h5url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
url = "https://newoa.dobechina.com/seeyon/isc.do?method=ssoISC&toUrl=" + url;
h5url = "https://newoa.dobechina.com/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
String property = System.getProperty("domain.contextUrl");
//测试环境
if ("http://isctest.dobechina.com:8022/ierp".equals(property)) {
url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
h5url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
}else {
url = "https://newoa.dobechina.com:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
h5url = "https://newoa.dobechina.com:9090/seeyon/isc.do?method=ssoISC&toUrl=" + h5url;
}
//获取token
String oaToken = OAUtils.getOaToken(billNo);
if (StringUtils.isNotEmpty(oaToken)) {