Merge remote-tracking branch 'origin/main'

This commit is contained in:
李贵强 2024-12-20 16:22:05 +08:00
commit fd2246ba59
8 changed files with 168 additions and 82 deletions

View File

@ -22,6 +22,7 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import shkd.utils.DobeDWUtils;
import shkd.utils.OAUtils;
import java.io.IOException;
import java.util.ArrayList;
@ -59,10 +60,14 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
log.info(String.format("人员接口异常:%s", e.getMessage()));
throw new RuntimeException(e);
}
boolean personoabid = false;
if(map != null && "yes".equals(map.get("personoabid"))){
personoabid = true;
}
JSONObject json_body = JSON.parseObject(resultData);
//接口返回的数据进行了分页
int totalNum = json_body.getIntValue("totalNum");//分页-SQL查询总数据量
handleUser(json_body);
handleUser(json_body,personoabid);
int queryCount = DobeDWUtils.getQueryCount(totalNum);
if(queryCount > 1){
//查询次数不止一次需要分页查询
@ -81,13 +86,13 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
throw new RuntimeException(e);
}
json_body = JSON.parseObject(resultData);
handleUser(json_body);
handleUser(json_body,personoabid);
}
}
}
private void handleUser(JSONObject json_body) {
private void handleUser(JSONObject json_body,boolean personoabid) {
//解析接口返回值与系统数据比较
JSONArray detailsJson = json_body.getJSONArray("data");
// String userID = null;
@ -102,6 +107,7 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
String bank_account = null;
List<UserParam> updateList = new ArrayList<>();
List<DynamicObject> userinfos = new ArrayList<>();
UserParam user = null;
DynamicObject currentUser = null;
DynamicObject deptOrg = null;
@ -137,6 +143,10 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
dataMap.put("email", email);//电子邮箱
user.setDataMap(dataMap);
updateList.add(user);
//组装要与OA绑定的人员集合
if(personoabid){
userinfos.add(currentUser);
}
//处理部门和职位
if(!DobeDWUtils.isEmpty(deptid)){
deptOrg = QueryServiceHelper.queryOne("bos_org","id,number,name",new QFilter[]{new QFilter("fyzjorgid","=",deptid)});
@ -219,6 +229,15 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
}
}
}
//调用OA人员绑定
if(userinfos.size() > 0){
String billNo = "person-first-all-bid";
//获取token
String oaToken = OAUtils.getOaToken(billNo);
if (!DobeDWUtils.isEmpty(oaToken)) {
OAUtils.thirdpartyUser(userinfos, oaToken, billNo);
}
}
}
private boolean isNeedUpdate(DynamicObject personbank,String name,String bank,String bank_branch,String bank_account){
if(!name.equals(personbank.getString("name"))){

View File

@ -0,0 +1,65 @@
package shkd.repc.recon.formplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.BasedataItem;
import kd.bos.entity.datamodel.events.QueryImportBasedataEventArgs;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 合同表单插件
*/
public class ContractMaterialImportPlugin extends AbstractFormPlugin {
private static final String BOS_ORG = "bos_org";//组织实体
private static final String BD_MATERIAL = "bd_material";//物料实体
//TODO: 生成物料逻辑迁移到导入过程中,获取excel行
@Override
public void queryImportBasedata(QueryImportBasedataEventArgs e) {
super.queryImportBasedata(e);
Map<BasedataItem, List<Object>> searchResult = e.getSearchResult();
for (Map.Entry<BasedataItem, List<Object>> entry : searchResult.entrySet()) {
List<Object> basedata = entry.getValue();
if (basedata.isEmpty()) { // 查不到基础资料数据
Long materialId = newMaterial(entry.getKey().getSearchValue());
basedata.add(materialId);
//algo.storage.redis.ip_port
// System.getProperty("algo.storage.redis.ip_port");
} else {
// 查到多个基础资料数据
// 业务场景应根据需求剔除不合法的基础资料数据最终保留一个
Iterator it = basedata.iterator();
it.next();
while (it.hasNext()) {
it.remove();
}
}
}
}
private Long newMaterial(String number){
long rootOrgId = OrgUnitServiceHelper.getRootOrgId();
DynamicObject org = BusinessDataServiceHelper.loadSingle(rootOrgId, BOS_ORG);
DynamicObject bd_material = BusinessDataServiceHelper.newDynamicObject(BD_MATERIAL);
bd_material.set("number",number);
bd_material.set("name",number);
if (null != org) {
bd_material.set("createorg",org);
}
bd_material.set("materialtype","1");//物料类型:物资
bd_material.set("enable", "1");//使用状态:可用
bd_material.set("status", "C");//数据状态:审核
bd_material.set("ctrlstrategy", "5");//控制策略:全局共享
bd_material.set("enablepur",true);//可采购
bd_material.set("enablesale",true);//可销售
bd_material.set("enableinv",true);//可库存
SaveServiceHelper.save(new DynamicObject[]{bd_material});
return bd_material.getLong("id");
}
}

View File

@ -27,6 +27,13 @@ public class PayreqProjectFormPlugin extends AbstractBillPlugIn {
if ("org".equals(name)) {
updateRenovationProject();
}
//xifu携带名称
if ("qeug_xf".equals(name)) {
String qeug_xf = (String)this.getModel().getValue("qeug_xf");
this.getModel().setValue("billname",qeug_xf);
this.getView().updateView("billname");
}
}
private void updateRenovationProject() {

View File

@ -32,6 +32,13 @@ public class ReconPayreqProjectFormPlugin extends AbstractBillPlugIn {
if ("usedepart".equals(name)) {
updateFinanceOrg();
}
//xifu携带名称
if ("qeug_xf".equals(name)) {
String qeug_xf = (String)this.getModel().getValue("qeug_xf");
this.getModel().setValue("billname",qeug_xf);
this.getView().updateView("billname");
}
}
private void updateRenovationProject() {

View File

@ -4,13 +4,18 @@ 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.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.ShowType;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import java.util.List;
public class TestFormPlugin extends AbstractFormPlugin implements Rules {
public class TestFormPlugin extends AbstractFormPlugin {
@Override
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
@ -18,69 +23,45 @@ public class TestFormPlugin extends AbstractFormPlugin implements Rules {
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);
// BillShowParameter billShowParameter = new BillShowParameter();
// billShowParameter.setFormId("recos_conplan");// 合约规划
// billShowParameter.getOpenStyle().setShowType(ShowType.Modal);
// billShowParameter.getOpenStyle().setTargetKey("tabap");
// this.getView().showForm(billShowParameter);
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});
}
List<Rule> rules = this.rules();
this.getControl("rules");
this.getView().getModel();
Rule rule = null;
rule.getNamespaceURI();
}
@Override
public Digester getDigester() {
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("");
return null;
}
@Override
public void setDigester(Digester digester) {
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("");
}
@Override
public void add(String s, Rule rule) {
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("");
}
@Override
public void clear() {
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("");
}
@Override
public List<Rule> match(String s, String s1) {
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("");
return null;
}
@Override
public List<Rule> rules() {
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("");
return null;
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

@ -347,7 +347,8 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
//外部公司22020104\应付账款\往来单位\外部单位工程类
//集团内部关联公司22020105\应付账款\往来单位\内部单位关联方
//如果费用登记中用户选择了会计科目则使用该字段编号否则还使用集团内外 yxl 20241116
if(isnotext && payrequestinfo.getDynamicObject("qeug_accountview")!=null){
//付款申请单中用户选择了会计科目则使用该字段编号否则还使用集团内外 yxl 20241220
if(payrequestinfo.getDynamicObject("qeug_accountview")!=null){
String accountview = payrequestinfo.getDynamicObject("qeug_accountview").getString("number");
items.put("pk_subjcode",accountview.replace(".",""));
}else{

View File

@ -78,8 +78,11 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
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;
//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;
//获取任务创建人
Long startUserId = messageContext.getStartUserId(); // 审批实例发起人id
@ -89,9 +92,9 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
if (null != startUser) {
startNumber = startUser.getString("number");
startName = startUser.getString("name");
if (!userIds.contains(startUserId)) {
approversLists.add(startUser);//添加发起人到审批人集合_便于后续接口调用(用户绑定接口)
}
// if (!userIds.contains(startUserId)) {
// approversLists.add(startUser);//添加发起人到审批人集合_便于后续接口调用(用户绑定接口)
// }
}
//待办创建时间格式yyyy-MM-dd HH:mm:ss
Date createDate = messageContext.getCreateDate();
@ -103,8 +106,8 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
String oaToken = OAUtils.getOaToken(billNo);
if (StringUtils.isNotEmpty(oaToken)) {
//todo OA人员绑定接口
thirdpartyUser(approversLists, oaToken, billNo);
// //todo OA人员绑定接口-->迁移到主数据人员同步时
// thirdpartyUser(approversLists, oaToken, billNo);
HashMap<String, Object> thirdPartyMap = new HashMap<>();
thirdPartyMap.put("oaToken", oaToken);
@ -117,7 +120,8 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
thirdPartyMap.put("url1", url1);
thirdPartyMap.put("billNo", billNo);
thirdPartyMap.put("startNumber", startNumber);//发起人
thirdPartyMap.put("h5url", h5url);
// thirdPartyMap.put("h5url", h5url);
thirdPartyMap.put("h5url", url);
//推送OA待办新增接口
thirdParty(thirdPartyMap);
@ -287,8 +291,11 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
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;
//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;
//获取token
String oaToken = OAUtils.getOaToken(billNo);
@ -304,7 +311,8 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
thirdPartyMap.put("url1", url1);
thirdPartyMap.put("billNo", billNo);
thirdPartyMap.put("startNumber", startNumber);//发起人
thirdPartyMap.put("h5url", h5url);
// thirdPartyMap.put("h5url", h5url);
thirdPartyMap.put("h5url", url);
//推送OA消息新增接口
thirdpartyMessage(thirdPartyMap);

View File

@ -116,11 +116,9 @@ public class OAUtils {
/**
* OA接口绑定用户
* 代办接口之前需要先(用户的绑定 你通过定时任务 增量推就行或者你们系统有人员进来推一次这个人绑定成功了 就不需要再绑定除非人员工号有变动)
* 先调OA接口绑定用户(相当于校验金蝶用户的number在OA系统是否存在不存则推送失败)
* 用户的绑定 金蝶通过定时任务 增量推就行或者金蝶系统有人员进来推一次这个人绑定成功了 就不需要再绑定除非人员工号有变动
* @param approversLists 金蝶系统的审批人集合
* @param oaToken 致远OA获取的token
* @return
*/
public static String thirdpartyUser(List<DynamicObject> approversLists, String oaToken,String billNo){
@ -139,13 +137,13 @@ public class OAUtils {
JSONObject jsonObject = new JSONObject();
jsonObject.put("registerCode", "3004");//系统注册编码:3004
jsonObject.put("thirdUserId",approver.getString("number"));//三方系统人员编码通过人员编码匹配需要和OA保持一致
// jsonObject.put("thirdUserId","jdtest");//todo 三方系统人员编码通过人员编码匹配需要和OA保持一致
jsonObject.put("thirdLoginName", approver.getString("name"));//三方系统人员登录名
// jsonObject.put("thirdLoginName", "金蝶测试");//todo 三方系统人员登录名
jsonObject.put("thirdName", approver.getString("name"));//三方系统人员姓名
// jsonObject.put("thirdName", "金蝶测试");//todo 三方系统人员姓名
jsonObject.put("thirdCode", approver.getString("number"));//三方系统人员编码
// jsonObject.put("thirdCode","jdtest");//todo 三方系统人员编码
// jsonObject.put("thirdUserId","jdtest");
// jsonObject.put("thirdLoginName", "金蝶测试");
// jsonObject.put("thirdName", "金蝶测试");
// jsonObject.put("thirdCode","jdtest");
thirdList.add(jsonObject);
}
thirdBody.put("userlist", thirdList);