diff --git a/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java b/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java index f44e87a..2ea9d25 100644 --- a/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java +++ b/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java @@ -1,20 +1,16 @@ package shkd.repc.recon.formplugin; import com.google.common.collect.Lists; -import kd.bos.bill.OperationStatus; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.ILocaleString; import kd.bos.dataentity.metadata.IDataEntityProperty; import kd.bos.entity.BasedataEntityType; import kd.bos.entity.datamodel.IDataModel; -import kd.bos.entity.datamodel.events.BeforeDeleteEntryEventArgs; import kd.bos.entity.datamodel.events.IDataModelChangeListener; import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.property.BasedataProp; -import kd.bos.entity.property.EntryProp; import kd.bos.entity.property.MulBasedataProp; -import kd.bos.fileservice.FileServiceFactory; import kd.bos.form.*; import kd.bos.form.control.AttachmentPanel; import kd.bos.form.control.EntryGrid; @@ -33,30 +29,24 @@ 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.AttachmentDto; import kd.bos.servicehelper.AttachmentServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.DeleteServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.util.StringUtils; import org.apache.poi.ss.usermodel.*; -import shkd.utils.DobeDWUtils; -import shkd.utils.OAUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.net.URL; import java.net.URLConnection; import java.util.*; -import java.util.function.Predicate; import java.util.regex.Pattern; /** @@ -226,6 +216,19 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis this.getView().updateView("qeug_invoiceentryinfo"); } } + }else if("qeug_marginlevel".equals(name)){ + int qeug_bondentry = this.getModel().getEntryCurrentRowIndex("qeug_bondentry"); + BigDecimal qeug_marginlevel = (BigDecimal)this.getModel().getValue("qeug_marginlevel", qeug_bondentry); + DynamicObjectCollection qeugBondentrys = this.getModel().getEntryEntity("qeug_bondentry");//保证金明细 + BigDecimal qeugMarginlevel = BigDecimal.ZERO; + if (qeugBondentrys.size() > 0) { + for (DynamicObject qeugBondentry : qeugBondentrys) { + qeugMarginlevel = qeugMarginlevel.add(qeugBondentry.getBigDecimal("qeug_marginlevel")) ; + } + } + if (qeugMarginlevel.compareTo(BigDecimal.valueOf(100)) > 0) { + this.getView().showMessage("保证金比例(%)之和不能大于100"); + } } } @@ -245,7 +248,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis case "deleteentry1": //明细删除行后进行保存 SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()}); - this.getView().showSuccessNotification("已同步删除明细数据"); +// this.getView().showSuccessNotification("已同步删除明细数据"); break; //识别清单附件 case "qeug_distinguishsumstta": diff --git a/main/java/shkd/repc/recon/formplugin/SupplierChangeServicePlugin.java b/main/java/shkd/repc/recon/formplugin/SupplierChangeServicePlugin.java new file mode 100644 index 0000000..16520cd --- /dev/null +++ b/main/java/shkd/repc/recon/formplugin/SupplierChangeServicePlugin.java @@ -0,0 +1,60 @@ +package shkd.repc.recon.formplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.resource.ResManager; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.repc.resm.formplugin.changesupplier.bussiness.ChangeSupplierServiceImpl; + + +public class SupplierChangeServicePlugin extends ChangeSupplierServiceImpl { + + @Override + public void buildChangeInfo(DynamicObject dataEntity, String entityName) { + Object pkvalue = dataEntity.getPkValue(); + DynamicObject dataEntityOld; + if ("resm_official_supplier".equals(entityName)) { + dataEntityOld = dataEntity.getDynamicObject("supplier"); + pkvalue = dataEntityOld.getPkValue(); + } + + dataEntityOld = BusinessDataServiceHelper.loadSingle(pkvalue, entityName); + this.compareBasicInfo(dataEntity, dataEntityOld); + this.compareAptTabInfo(dataEntity, dataEntityOld); + this.compareEvaluateTabInfo(dataEntity, dataEntityOld); + this.compareLinkManTabInfo(dataEntity, dataEntityOld); + this.compareBankTabInfo(dataEntity, dataEntityOld); + this.compareAssTabInfo(dataEntity, dataEntityOld); + this.compareEKInfo(dataEntity, dataEntityOld); + } + + protected void compareEKInfo(DynamicObject dataEntity, DynamicObject dataEntityOld) { + Object newValueCh = dataEntity.getString("qeug_controllingperses"); + Object oldValue = dataEntityOld.getString("qeug_controllingperses"); + String text; + if (!newValueCh.equals(oldValue)) { + text = this.buildText(ResManager.loadKDString("公司实际控制人/权(股份公司)", "ChangeSupplierServiceImpl_69", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue); + this.addNewChangeEntry(dataEntity, text, "qeug_controllingperses", true); + } + + newValueCh = dataEntity.getString("qeug_regnumberes"); + oldValue = dataEntityOld.getString("qeug_regnumberes"); + if (!newValueCh.equals(oldValue)) { + text = this.buildText(ResManager.loadKDString("企业注册号", "ChangeSupplierServiceImpl_70", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue); + this.addNewChangeEntry(dataEntity, text, "qeug_regnumberes", true); + } + + newValueCh = dataEntity.getString("qeug_orgnumberes"); + oldValue = dataEntityOld.getString("qeug_orgnumberes"); + if (!newValueCh.equals(oldValue)) { + text = this.buildText(ResManager.loadKDString("组织机构代码", "ChangeSupplierServiceImpl_71", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue); + this.addNewChangeEntry(dataEntity, text, "qeug_orgnumberes", true); + } + + newValueCh = dataEntity.getString("qeug_regstatuses"); + oldValue = dataEntityOld.getString("qeug_regstatuses"); + if (!newValueCh.equals(oldValue)) { + text = this.buildText(ResManager.loadKDString("经营状态", "ChangeSupplierServiceImpl_71", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue); + this.addNewChangeEntry(dataEntity, text, "qeug_regstatuses", true); + } + } +} diff --git a/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java b/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java new file mode 100644 index 0000000..7b72a58 --- /dev/null +++ b/main/java/shkd/repc/recon/opplugin/ContractOPPlugin.java @@ -0,0 +1,49 @@ +package shkd.repc.recon.opplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.validate.AbstractValidator; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; + +import java.math.BigDecimal; + +public class ContractOPPlugin extends AbstractOperationServicePlugIn { + private static final Log logger = LogFactory.getLog(ContractOPPlugin.class); + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + e.addValidator(new AbstractValidator() { + @Override + public void validate() { + String operateKey = this.getOperateKey(); + ExtendedDataEntity[] dataEntities1 = this.getDataEntities(); + switch (operateKey) { + case "submit": + for (ExtendedDataEntity extendedDataEntity : dataEntities1) { + //保证金明细 + DynamicObject dataEntity = extendedDataEntity.getDataEntity(); + DynamicObjectCollection qeugBondentrys = dataEntity.getDynamicObjectCollection("qeug_bondentry"); + BigDecimal qeugMarginlevel = BigDecimal.ZERO; + if (qeugBondentrys.size() > 0) { + for (DynamicObject qeugBondentry : qeugBondentrys) { + qeugMarginlevel = qeugMarginlevel.add(qeugBondentry.getBigDecimal("qeug_marginlevel")); + } + } + if (qeugMarginlevel.compareTo(BigDecimal.valueOf(100)) > 0) { + this.addErrorMessage(extendedDataEntity, "保证金明细:保证金比例(%)之和不能大于100"); + } + } + break; + default: + break; + + } + } + }); + } +} diff --git a/main/java/shkd/repc/recon/opplugin/SupplierChangeOpPlugin.java b/main/java/shkd/repc/recon/opplugin/SupplierChangeOpPlugin.java new file mode 100644 index 0000000..d856977 --- /dev/null +++ b/main/java/shkd/repc/recon/opplugin/SupplierChangeOpPlugin.java @@ -0,0 +1,27 @@ +package shkd.repc.recon.opplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.repc.resm.formplugin.changesupplier.ChangeSupplierOp; +import shkd.repc.recon.formplugin.SupplierChangeServicePlugin; +import shkd.repc.recon.validator.SupplierChangeValidator; + +/** + * 生成变更记录(二开) + *qeug_resm_change_supp_ext + */ +public class SupplierChangeOpPlugin extends ChangeSupplierOp { + + protected SupplierChangeServicePlugin changeSupplierService = new SupplierChangeServicePlugin(); + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + e.addValidator(new SupplierChangeValidator()); + } + + @Override + protected void syncRegSupplierAndRegiestSupplier(DynamicObject officialSupplier) { + this.changeSupplierService.syncRegSupplier(officialSupplier); + this.changeSupplierService.syncRegiestSupplier(officialSupplier); + } +} diff --git a/main/java/shkd/repc/recon/validator/SupplierChangeValidator.java b/main/java/shkd/repc/recon/validator/SupplierChangeValidator.java new file mode 100644 index 0000000..2aa2b24 --- /dev/null +++ b/main/java/shkd/repc/recon/validator/SupplierChangeValidator.java @@ -0,0 +1,82 @@ +package shkd.repc.recon.validator; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.QueryServiceHelper; +import kd.repc.resm.formplugin.changesupplier.ChangeSupplierValidators; +import shkd.repc.recon.formplugin.SupplierChangeServicePlugin; + +import java.util.Arrays; + +public class SupplierChangeValidator extends ChangeSupplierValidators { + protected SupplierChangeServicePlugin changeSupplierService = new SupplierChangeServicePlugin(); + + @Override + public void validate() { + + this.getValidation(); + String isList = this.getOption().getVariableValue("is_list", "0"); + if (null != isList && isList.equals("1")) { + Arrays.stream(this.dataEntities).forEach((eDataEntity) -> { + DynamicObject dataEntity = eDataEntity.getDataEntity(); + DynamicObject dataEntityNew = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(), dataEntity.getDynamicObjectType().getName()); + eDataEntity.setDataEntity(dataEntityNew); + }); + } + + switch (this.getOperateKey()) { + case "save": + case "save1": + case "submit": + case "submit1": + case "audit": + this.checkBaseInfo(); + this.checkOrgEntry(); + this.checkAptEntry(); + this.checkLinkEntry(); + this.checkProjectEntry(); + this.checkBankEntry(); + this.buildChangeEntry(); + default: + } + } + + @Override + protected void buildChangeEntry() { + switch (this.getOperateKey()) { + + case "save": + case "save1": + case "submit": + case "submit1": + this.doSaveAndSubmit(this.getOperateKey()); + default: + } + } + + @Override + protected void setChangeInfo(String operateKey, DynamicObject dataEntity) { + + String entityName = dataEntity.getDataEntityType().getName(); + if ("submit".equals(operateKey) || "submit1".equals(operateKey)) { + DynamicObjectCollection changeEntry = dataEntity.getDynamicObjectCollection("change_entry"); + changeEntry.removeIf((item) -> { + return !item.getString("field_name").equals("attachmentpanel"); + }); + entityName = "resm_official_supplier"; + } else { + boolean exists = QueryServiceHelper.exists("resm_change_supplier", dataEntity.getPkValue()); + if (!exists) { + entityName = "resm_official_supplier"; + } + } + + this.changeSupplierService.buildChangeInfo(dataEntity, entityName); +// super.setChangeInfo(operateKey, dataEntity); + } +} + + + + diff --git a/main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java b/main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java index d9bb003..854921b 100644 --- a/main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java +++ b/main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java @@ -146,6 +146,9 @@ public class SupplierChangeFormPlugin extends AbstractFormPlugin { } } + if ("submit1".equals(operateKey) || "save1".equals(operateKey)) { + this.getView().invokeOperation("refresh"); + } } /** @@ -224,35 +227,6 @@ public class SupplierChangeFormPlugin extends AbstractFormPlugin { 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);//法人代表 @@ -286,6 +260,33 @@ public class SupplierChangeFormPlugin extends AbstractFormPlugin { } } + /** + * 20.疑似实际控制人_1123 ?keyword=北京百度网讯科技有限公司 + */ + String tyc_ActualControl = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_ActualControl + + "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "疑似实际控制人_1123",type); + JSONObject tyc_ActualControl_results = JSONObject.parseObject(tyc_ActualControl); + if (null != tyc_ActualControl_results) { + JSONObject tyc_ActualControl_result = (JSONObject) tyc_ActualControl_results.get("result"); + if (null != tyc_ActualControl_result) { + JSONArray actualControllerLists = tyc_ActualControl_result.getJSONArray("actualControllerList"); + String name = ""; + if (null != actualControllerLists) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < actualControllerLists.size(); i++) { + JSONObject actualControllerList = (JSONObject) actualControllerLists.get(i); + sb.append((String) actualControllerList.get("name"));//控制人姓名 + if (i < actualControllerLists.size() - 1) { + sb.append(","); + } + } + name = sb.toString(); + } + supplier.set("qeug_controllingperson", name);//控制人姓名 + SaveServiceHelper.save(new DynamicObject[]{supplier}); + } + } + // if (type == 1) { // supplier.set("qeug_istyccheck",true);//是否查询天眼查(正式供应商) // SaveServiceHelper.save(new DynamicObject[]{supplier});