Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
6540f2dad0
|
@ -48,6 +48,9 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
|||
//更新启用状态分配规则专用为禁用
|
||||
private static final String updateDisable = "update t_sec_user set fk_qeug_disable=2179899908641806336 where fenable='0' and fk_qeug_disable=0;";
|
||||
|
||||
//更新人员绑定OA成功的标记
|
||||
private static final String updateFlag = "update t_sec_user set fk_qeug_flag='1' where fnumber=?;";
|
||||
|
||||
@Override
|
||||
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
@ -242,8 +245,12 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
|||
}
|
||||
if(addList.size() > 0){
|
||||
UserServiceHelper.add(addList);
|
||||
List<DynamicObject> userinfos = new ArrayList<>();
|
||||
List<DynamicObject> userinfos = new ArrayList<>(1);
|
||||
DynamicObject userinfo = null;
|
||||
String billNo = "person-new-bid";
|
||||
String thirdPostjson;//OA绑定返回结果
|
||||
JSONObject jsonObject;//OA绑定返回结果json对象
|
||||
String oaToken = OAUtils.getOaToken(billNo);
|
||||
//判断执行结果
|
||||
for (UserParam result : addList) {
|
||||
if (!result.isSuccess()) {
|
||||
|
@ -252,27 +259,30 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
|||
userinfo = BusinessDataServiceHelper.newDynamicObject(entityName);;
|
||||
userinfo.set("number",result.getDataMap().get("number"));//人员编号
|
||||
userinfo.set("name",result.getDataMap().get("name"));//人员姓名
|
||||
userinfos.clear();
|
||||
userinfos.add(userinfo);
|
||||
}
|
||||
}
|
||||
//处理OA人员绑定
|
||||
if(userinfos.size() > 0){
|
||||
String billNo = "person-new-bid";
|
||||
//获取token
|
||||
String oaToken = OAUtils.getOaToken(billNo);
|
||||
if (!DobeDWUtils.isEmpty(oaToken)) {
|
||||
OAUtils.thirdpartyUser(userinfos, oaToken, billNo);
|
||||
thirdPostjson = OAUtils.thirdpartyUser(userinfos, oaToken, billNo);
|
||||
//处理OA绑定结果,将处理成功的人员打上标记
|
||||
if (!DobeDWUtils.isEmpty(thirdPostjson)) {
|
||||
jsonObject = JSONObject.parseObject(thirdPostjson);
|
||||
if(jsonObject.getBoolean("success")){
|
||||
DB.update(DBRoute.of("sys"), updateFlag, new Object[]{userinfo.getString("number")});
|
||||
}
|
||||
}else{
|
||||
log.info("OA绑定返回值为空,人员编号"+userinfo.getString("number"));
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(updateList.size() > 0){
|
||||
// UserServiceHelper.update(updateList);
|
||||
// //判断执行结果
|
||||
// for (UserParam result : updateList) {
|
||||
// if (!result.isSuccess()) {
|
||||
// log.info(String.format("人员修改异常:%s", result.getMsg()));
|
||||
// }
|
||||
}
|
||||
//批量处理OA人员绑定
|
||||
// if(userinfos.size() > 0){
|
||||
// //获取token
|
||||
// String oaToken = OAUtils.getOaToken(billNo);
|
||||
// if (!DobeDWUtils.isEmpty(oaToken)) {
|
||||
// OAUtils.thirdpartyUser(userinfos, oaToken, billNo);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,11 +39,18 @@ public class PurPlanSubmitOPPlugin extends AbstractOperationServicePlugIn {
|
|||
}
|
||||
//合约规划金额 entryentity
|
||||
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entryentity");
|
||||
boolean isCheckAmount = false;
|
||||
BigDecimal cgxuentry_b = BigDecimal.ZERO;
|
||||
for (DynamicObject dynamicObject : entryentity) {
|
||||
DynamicObject contract = dynamicObject.getDynamicObject("contract");
|
||||
if(contract==null||contract.getPkValue()==null){
|
||||
continue;
|
||||
}else{
|
||||
isCheckAmount = true;
|
||||
}
|
||||
cgxuentry_b = cgxuentry_b.add(dynamicObject.getBigDecimal("planamount"));
|
||||
}
|
||||
if (cgxuentry_a.compareTo(cgxuentry_b) > 0) { // 如果 cgxuentry_a 大于 cgxuentry_b
|
||||
if (isCheckAmount && cgxuentry_a.compareTo(cgxuentry_b) > 0) { // 如果 cgxuentry_a 大于 cgxuentry_b
|
||||
this.addErrorMessage(extendedDataEntity, "采购计划明细中的申请金额大于合约规划金额,不允许提交。");
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,12 @@ import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
|||
import kd.bos.entity.validate.AbstractValidator;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
public class ContractOPPlugin extends AbstractOperationServicePlugIn {
|
||||
private static final Log logger = LogFactory.getLog(ContractOPPlugin.class);
|
||||
|
@ -49,6 +52,11 @@ public class ContractOPPlugin extends AbstractOperationServicePlugIn {
|
|||
try {
|
||||
//合同监控列表点击提交会提示找不到:qeug_invoiceentryinfo属性
|
||||
invoiceentryinfos = dataEntity.getDynamicObjectCollection("qeug_invoiceentryinfo");
|
||||
if (!invoiceentryinfos.isEmpty()) {
|
||||
for (DynamicObject invoiceentryinfo : invoiceentryinfos) {
|
||||
BigDecimal qeug_amount = invoiceentryinfo.getBigDecimal("qeug_amount");
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(),"recon_contractbill");
|
||||
invoiceentryinfos = dataEntity.getDynamicObjectCollection("qeug_invoiceentryinfo");
|
||||
|
@ -61,9 +69,28 @@ public class ContractOPPlugin extends AbstractOperationServicePlugIn {
|
|||
}
|
||||
BigDecimal amount = dataEntity.getBigDecimal("amount");//合同金额
|
||||
// 检查 qeug_amounts 是否大于 amount
|
||||
if (qeug_amounts.compareTo(amount) > 0) {
|
||||
if (qeug_amounts.setScale(2, RoundingMode.HALF_UP).compareTo(amount) > 0) {
|
||||
this.addErrorMessage(extendedDataEntity, "合同清单(定额)的金额之和不能大于合同金额");
|
||||
}
|
||||
DynamicObjectCollection qeug_orderformentry1 = dataEntity.getDynamicObjectCollection("qeug_orderformentry");
|
||||
int qeug_orderformentry = qeug_orderformentry1==null?0:qeug_orderformentry1.size();
|
||||
DynamicObjectCollection qeug_invoiceentryinfo1 = dataEntity.getDynamicObjectCollection("qeug_invoiceentryinfo");
|
||||
int qeug_invoiceentryinfo = qeug_invoiceentryinfo1==null?0:qeug_invoiceentryinfo1.size();
|
||||
if(qeug_orderformentry+qeug_invoiceentryinfo<1){
|
||||
this.addErrorMessage(extendedDataEntity, "合同清单不允许为空!");
|
||||
}
|
||||
QFilter qFilter = new QFilter("billno", QCP.equals, dataEntity.getString("billno"));
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("recon_conpayplan", "contractbill", qFilter.toArray());
|
||||
if (load.length!=0) {
|
||||
Object pkValue = load[0].getPkValue();
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(pkValue, "recon_conpayplan");
|
||||
DynamicObjectCollection conpayplanschedule = dynamicObject.getDynamicObjectCollection("conpayplanschedule");
|
||||
if(conpayplanschedule==null||conpayplanschedule.size()<1){
|
||||
this.addErrorMessage(extendedDataEntity, "付款计划不能为空,若已存在付款计划,请先保存");
|
||||
}
|
||||
}else{
|
||||
this.addErrorMessage(extendedDataEntity, "付款计划不能为空,若已存在付款计划,请先保存");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "qeug_attatchment":
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package shkd.repc.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.db.DB;
|
||||
import kd.bos.db.DBRoute;
|
||||
import kd.bos.exception.KDException;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.schedule.executor.AbstractTask;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import shkd.utils.DobeDWUtils;
|
||||
import shkd.utils.OAUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 金蝶人员与OA用户绑定后台任务插件 yxl 20250409
|
||||
*/
|
||||
public class DobePersonOARealtionTask extends AbstractTask implements Plugin {
|
||||
|
||||
private static final String entityName = "bos_user";//系统库 表名 t_sec_user
|
||||
|
||||
private static Log logger = LogFactory.getLog(DobePersonOARealtionTask.class);
|
||||
//更新人员绑定OA成功的标记
|
||||
private static final String updateFlag = "update t_sec_user set fk_qeug_flag='1' where fnumber=?;";
|
||||
|
||||
@Override
|
||||
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||
//查找未绑定成功的人员
|
||||
QFilter dwFilter = new QFilter("source", QCP.equals, "dw");//来自数仓
|
||||
QFilter flagFilter = new QFilter("qeug_flag", QCP.equals, "0");//未与OA绑定
|
||||
QFilter enableFilter = new QFilter("enable", QCP.equals, "1");//用户未禁用
|
||||
DynamicObject[] dos = BusinessDataServiceHelper.load(entityName,"id,number,name",new QFilter[]{dwFilter,enableFilter,flagFilter});
|
||||
if(dos.length > 0){
|
||||
logger.info("本次需要绑定用户个数"+dos.length);
|
||||
DynamicObject userinfo;
|
||||
List<DynamicObject> userinfos = new ArrayList<>(1);
|
||||
String thirdPostjson;//OA绑定返回结果
|
||||
JSONObject jsonObject;//OA绑定返回结果json对象
|
||||
String billNo = "person-task-bid";
|
||||
//获取token,调用OA人员绑定接口
|
||||
String oaToken = OAUtils.getOaToken(billNo);
|
||||
for (int i = 0; i < dos.length; i++) {
|
||||
userinfo = dos[i];
|
||||
userinfos.clear();
|
||||
userinfos.add(userinfo);
|
||||
if (!DobeDWUtils.isEmpty(oaToken)) {
|
||||
thirdPostjson = OAUtils.thirdpartyUser(userinfos, oaToken, billNo);
|
||||
//处理OA绑定结果,将处理成功的人员打上标记
|
||||
if (!DobeDWUtils.isEmpty(thirdPostjson)) {
|
||||
jsonObject = JSONObject.parseObject(thirdPostjson);
|
||||
if(jsonObject.getBoolean("success")){
|
||||
DB.update(DBRoute.of("sys"), updateFlag, new Object[]{userinfo.getString("number")});
|
||||
}
|
||||
}else{
|
||||
logger.info("OA绑定返回值为空,人员编号"+userinfo.getString("number"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.info("现有用户已全部绑定,无需处理");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package shkd.wfs.wf.plugin.form;
|
||||
|
||||
import kd.bos.workflow.taskcenter.plugin.ApprovalPagePluginNew;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import java.util.EventObject;
|
||||
|
||||
public class ApprovalPagePluginNewDemo extends ApprovalPagePluginNew implements Plugin{
|
||||
@Override
|
||||
public void afterCreateNewData(EventObject evt) {
|
||||
super.showApprovalRecord(this.ISPCSHOWVALUE,Boolean.FALSE,super.isHideYzj(),Boolean.FALSE);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue