Compare commits
7 Commits
a4dc2091a3
...
5bf3fff630
Author | SHA1 | Date |
---|---|---|
|
5bf3fff630 | |
|
a87f8845cf | |
|
144947a518 | |
|
3e3791e03f | |
|
2e452c2ccf | |
|
8bc8da8cf1 | |
|
5cb700ebfa |
|
@ -10,6 +10,7 @@ import kd.bos.openapi.common.util.OpenApiSdkUtil;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import zcgj.zcdev.zcdev.fs.utils.AccountRecord;
|
||||
import zcgj.zcdev.zcdev.fs.utils.BalanceQueryParamApi;
|
||||
|
@ -171,6 +172,14 @@ public class AssistbalanceAutoData {
|
|||
|
||||
if (!addEntities.isEmpty()) {
|
||||
try {
|
||||
|
||||
// ✅ 删除旧数据(保证每个组织、每个期间只保留一份最新的)
|
||||
Long orgId = orgObj.getLong("id");
|
||||
Long periodId = curperiod.getLong("id");
|
||||
QFilter orgFilter = new QFilter("zcgj_org", QCP.equals, orgId);
|
||||
QFilter periodFilter = new QFilter("zcgj_period", QCP.equals, periodId);
|
||||
DeleteServiceHelper.delete("zcgj_rpt_assistbalance", new QFilter[]{orgFilter.and(periodFilter)});
|
||||
|
||||
SaveServiceHelper.save(addEntities.toArray(new DynamicObject[0]));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
|
|
@ -11,6 +11,7 @@ import kd.bos.openapi.common.util.OpenApiSdkUtil;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.bos.util.StringUtils;
|
||||
import zcgj.zcdev.zcdev.fs.utils.AccountRecord;
|
||||
|
@ -23,27 +24,26 @@ public class SubjectbalanceAutoData {
|
|||
|
||||
private static final String[] asseestypeArrays = new String[]{"0032","0017",""};
|
||||
|
||||
public static void getData(){
|
||||
String[] selectorsArray = new String[]{"beginlocal", "endlocal", "yeardebitfor","yearcreditfor","debitlocal","creditlocal"};
|
||||
public static void getData() {
|
||||
String[] selectorsArray = new String[]{"beginlocal", "endlocal", "yeardebitfor", "yearcreditfor", "debitlocal", "creditlocal"};
|
||||
|
||||
QFilter filteraccountTable = new QFilter("number", QCP.equals, "0003");
|
||||
DynamicObject accountTableLoad = BusinessDataServiceHelper.loadSingle("bd_accounttable", "id", new QFilter[]{filteraccountTable});
|
||||
|
||||
//查询核算组织
|
||||
// 查询核算组织
|
||||
QFilter number = new QFilter("fisaccounting", "=", "1");
|
||||
QFilter structure = new QFilter("structure.longnumber", QCP.like, "10000000!10006431%");
|
||||
QFilter isleaf = new QFilter("structure.isleaf", QCP.equals, true);
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("bos_org", "id,structure.longnumber,structure.view", new QFilter[]{number, structure,isleaf});
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("bos_org", "id,structure.longnumber,structure.view", new QFilter[]{number, structure, isleaf});
|
||||
List<Long> orgIds = new ArrayList<>();
|
||||
Map<String,DynamicObject> orgNumberMap = new HashMap<>();
|
||||
for (int i = 0; i < load.length; i++) {
|
||||
DynamicObject dynamicObject = load[i];
|
||||
Map<String, DynamicObject> orgNumberMap = new HashMap<>();
|
||||
for (DynamicObject dynamicObject : load) {
|
||||
orgNumberMap.put(dynamicObject.getString("number"), dynamicObject);
|
||||
orgIds.add(dynamicObject.getLong("id"));
|
||||
}
|
||||
|
||||
DynamicObject[] costcompany = BusinessDataServiceHelper.load("zcgj_minecompany", "zcgj_costcompany", new QFilter[]{});
|
||||
if(costcompany != null){
|
||||
if (costcompany != null) {
|
||||
List<Long> ids = new ArrayList<>();
|
||||
for (DynamicObject dynamicObject : costcompany) {
|
||||
DynamicObject minecompany = dynamicObject.getDynamicObject("zcgj_costcompany");
|
||||
|
@ -57,7 +57,8 @@ public class SubjectbalanceAutoData {
|
|||
orgIds.add(dynamicObject.getLong("id"));
|
||||
}
|
||||
}
|
||||
//查询组织下对应的当前期间数据
|
||||
|
||||
// 查询组织下对应的当前期间数据
|
||||
DynamicObject[] orgByCurperiod = BusinessDataServiceHelper.load("gl_accountbook",
|
||||
"org,curperiod",
|
||||
new QFilter[]{new QFilter("enable", QCP.equals, Boolean.TRUE).
|
||||
|
@ -67,23 +68,22 @@ public class SubjectbalanceAutoData {
|
|||
orgByCurperiodMap.put(dynamicObject.getLong("org.id"), dynamicObject);
|
||||
}
|
||||
|
||||
//清除数据
|
||||
//DeleteServiceHelper.delete("zcgj_rpt_assistbalance",new QFilter[]{});
|
||||
// 标记旧数据为非最新
|
||||
List<Object[]> sqlparams = new ArrayList<>();
|
||||
Object[] sqlparam = new Object[] { false };
|
||||
Object[] sqlparam = new Object[]{false};
|
||||
sqlparams.add(sqlparam);
|
||||
DB.executeBatch(DBRoute.of("fi"),
|
||||
"update tk_zcgj_rpt_assistbalangx set fk_zcgj_isnew = ? ", sqlparams);
|
||||
|
||||
for (String asseestype : asseestypeArrays) {
|
||||
//查询科目余额配置表
|
||||
// 查询科目余额配置表
|
||||
DynamicObject[] accountConf = BusinessDataServiceHelper.load("zcgj_conf_balanceaccoungx", "zcgj_entryentity.zcgj_account,zcgj_entryentity.zcgj_asseestype", new QFilter[]{});
|
||||
Set<String> accountNumber = new HashSet<>();
|
||||
for (DynamicObject dynamicObject : accountConf) {
|
||||
DynamicObjectCollection zcgjEntryentity = dynamicObject.getDynamicObjectCollection("zcgj_entryentity");
|
||||
for (DynamicObject object : zcgjEntryentity) {
|
||||
String zcgjAsseestype = object.getString("zcgj_asseestype");
|
||||
if(asseestype.equals(zcgjAsseestype)){
|
||||
if (asseestype.equals(zcgjAsseestype)) {
|
||||
accountNumber.add(object.getDynamicObject("zcgj_account").getString("number"));
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,6 @@ public class SubjectbalanceAutoData {
|
|||
for (String orgNumber : orgNumberMap.keySet()) {
|
||||
BalanceQueryParamApi balanceQueryParamApi = new BalanceQueryParamApi();
|
||||
balanceQueryParamApi.setSelectors(Arrays.asList(selectorsArray));
|
||||
// balanceQueryParamApi.setOrgNumber("cw000102");
|
||||
balanceQueryParamApi.setOrgNumber(orgNumber);
|
||||
balanceQueryParamApi.setBookTypeNumber("100002"); //账簿类型
|
||||
balanceQueryParamApi.setAccountTableNumber("0003");//科目表
|
||||
|
@ -100,30 +99,28 @@ public class SubjectbalanceAutoData {
|
|||
DynamicObject orgObj = orgNumberMap.get(orgNumber);
|
||||
DynamicObject periodObj = orgByCurperiodMap.get(orgObj.getLong("id"));
|
||||
DynamicObject curperiod = null;
|
||||
if(periodObj != null) {
|
||||
if (periodObj != null) {
|
||||
curperiod = periodObj.getDynamicObject("curperiod");
|
||||
if( curperiod!= null) {
|
||||
if (curperiod != null) {
|
||||
balanceQueryParamApi.setPeriodNumber(curperiod.getString("number")); //
|
||||
}else{
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
List<String> groupBy = new ArrayList<>();
|
||||
if(!StringUtils.isEmpty(asseestype)){
|
||||
if (!StringUtils.isEmpty(asseestype)) {
|
||||
Map<String, List<Map<String, String>>> accountAssgrp = new HashMap<>();
|
||||
List<Map<String, String>> li = new ArrayList<>();
|
||||
Map<String, String> map1 = new HashMap<>();
|
||||
map1.put(asseestype,"");
|
||||
map1.put(asseestype, "");
|
||||
li.add(map1);
|
||||
for (String accNum : accountNumber) {
|
||||
accountAssgrp.put(accNum,li);
|
||||
accountAssgrp.put(accNum, li);
|
||||
}
|
||||
balanceQueryParamApi.setAccountAssgrp(accountAssgrp);
|
||||
|
||||
groupBy.add(asseestype);
|
||||
}
|
||||
groupBy.add("account");
|
||||
|
@ -131,50 +128,56 @@ public class SubjectbalanceAutoData {
|
|||
Gson gson = new Gson();
|
||||
String json = gson.toJson(balanceQueryParamApi);
|
||||
Map<String, Object> params = gson.fromJson(json,
|
||||
new TypeToken<Map<String, Object>>(){}.getType());
|
||||
new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
OpenApiResult balanceData = OpenApiSdkUtil.invoke("/v2/gl/getBalanceApi", params);
|
||||
|
||||
List<DynamicObject> addEntities = new ArrayList<>();
|
||||
if(balanceData.isStatus()){
|
||||
if (balanceData.isStatus()) {
|
||||
String data = (String) balanceData.getData();
|
||||
Type listType = new TypeToken<List<AccountRecord>>() {}.getType();
|
||||
Type listType = new TypeToken<List<AccountRecord>>() {
|
||||
}.getType();
|
||||
List<AccountRecord> records = gson.fromJson(data, listType);
|
||||
// 示例输出
|
||||
for (AccountRecord record : records) {
|
||||
DynamicObject assistbalance
|
||||
=BusinessDataServiceHelper.newDynamicObject("zcgj_rpt_assistbalancegx");
|
||||
DynamicObject assistbalance = BusinessDataServiceHelper.newDynamicObject("zcgj_rpt_assistbalancegx");
|
||||
assistbalance.set("zcgj_debitlocal", record.getDebitlocal());
|
||||
assistbalance.set("zcgj_beginlocal", record.getBeginlocal());
|
||||
assistbalance.set("zcgj_creditlocal", record.getCreditlocal());
|
||||
assistbalance.set("zcgj_yeardebitfor", record.getYeardebitfor());
|
||||
assistbalance.set("zcgj_yearcreditfor", record.getYearcreditfor());
|
||||
assistbalance.set("zcgj_endlocal", record.getEndlocal());
|
||||
assistbalance.set("zcgj_org",orgNumberMap.get(orgNumber));
|
||||
assistbalance.set("zcgj_accounttable",accountTableLoad);
|
||||
assistbalance.set("zcgj_org", orgNumberMap.get(orgNumber));
|
||||
assistbalance.set("zcgj_accounttable", accountTableLoad);
|
||||
assistbalance.set("zcgj_account", record.getAccount());
|
||||
assistbalance.set("zcgj_period",curperiod);
|
||||
assistbalance.set("zcgj_isnew",true);
|
||||
//assistbalance.set("zcgj_pm",projectMap.get(orgNumber));
|
||||
assistbalance.set("zcgj_period", curperiod);
|
||||
assistbalance.set("zcgj_isnew", true);
|
||||
|
||||
Map<String, AccountRecord.AssGrpItem> assgrp = record.getAssgrp();
|
||||
if (assgrp.containsKey("0032")) {
|
||||
if(assgrp.get("0032")!=null){
|
||||
assistbalance.set("zcgj_processnumber",assgrp.get("0032").getNumber());
|
||||
assistbalance.set("zcgj_processname",assgrp.get("0032").getName());
|
||||
if (assgrp.get("0032") != null) {
|
||||
assistbalance.set("zcgj_processnumber", assgrp.get("0032").getNumber());
|
||||
assistbalance.set("zcgj_processname", assgrp.get("0032").getName());
|
||||
}
|
||||
}else if(assgrp.containsKey("0017")){
|
||||
if(assgrp.get("0017")!=null){
|
||||
assistbalance.set("zcgj_costcompanynumber",assgrp.get("0017").getNumber());
|
||||
assistbalance.set("zcgj_costcompanyname",assgrp.get("0017").getName());
|
||||
} else if (assgrp.containsKey("0017")) {
|
||||
if (assgrp.get("0017") != null) {
|
||||
assistbalance.set("zcgj_costcompanynumber", assgrp.get("0017").getNumber());
|
||||
assistbalance.set("zcgj_costcompanyname", assgrp.get("0017").getName());
|
||||
}
|
||||
}
|
||||
addEntities.add(assistbalance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!addEntities.isEmpty()) {
|
||||
try {
|
||||
// ✅ 删除旧数据(保证每个组织、每个期间只保留一份最新的)
|
||||
Long orgId = orgObj.getLong("id");
|
||||
Long periodId = curperiod.getLong("id");
|
||||
QFilter orgFilter = new QFilter("zcgj_org", QCP.equals, orgId);
|
||||
QFilter periodFilter = new QFilter("zcgj_period", QCP.equals, periodId);
|
||||
DeleteServiceHelper.delete("zcgj_rpt_assistbalancegx", new QFilter[]{orgFilter.and(periodFilter)});
|
||||
// 保存新数据
|
||||
SaveServiceHelper.save(addEntities.toArray(new DynamicObject[0]));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
@ -183,4 +186,5 @@ public class SubjectbalanceAutoData {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import kd.bos.openapi.common.util.OpenApiSdkUtil;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import zcgj.zcdev.zcdev.fs.utils.AccountRecord;
|
||||
import zcgj.zcdev.zcdev.fs.utils.BalanceQueryParamApi;
|
||||
|
@ -189,6 +190,18 @@ public class SuppliertbalanceAutoData {
|
|||
|
||||
if (!addEntities.isEmpty()) {
|
||||
try {
|
||||
|
||||
// ✅ 删除旧数据(保证每个组织、每个期间只保留一份最新的)
|
||||
Long orgId = orgObj.getLong("id");
|
||||
Long periodId = curperiod.getLong("id");
|
||||
QFilter orgFilter = new QFilter("zcgj_org", QCP.equals, orgId);
|
||||
QFilter periodFilter = new QFilter("zcgj_period", QCP.equals, periodId);
|
||||
if("YUFZK".equals(type)){//预付账款
|
||||
DeleteServiceHelper.delete("zcgj_rpt_assibalancegysyu", new QFilter[]{orgFilter.and(periodFilter)});
|
||||
}else if("YIFZK".equals(type)){//应付账款
|
||||
DeleteServiceHelper.delete("zcgj_rpt_assibalancegysyi", new QFilter[]{orgFilter.and(periodFilter)});
|
||||
}
|
||||
|
||||
SaveServiceHelper.save(addEntities.toArray(new DynamicObject[0]));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
|
|
@ -29,7 +29,7 @@ public class DailyapplybillPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
if(costcompany != null) {
|
||||
List<ComboItem> comboList = new ArrayList<>();
|
||||
if("10007186".equals(costcompany.getString("number"))){
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请(非工程物资)"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("固定资产采购申请"), "gdzc_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("车辆维修保养申请"), "vehicle_maintain"));
|
||||
comboList.add(new ComboItem(new LocaleString("维修保养申请-非车辆"), "maintain_apply"));
|
||||
|
@ -38,7 +38,7 @@ public class DailyapplybillPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
comboList.add(new ComboItem(new LocaleString("费用申请单(兖州机关)"), "zc_morren"));
|
||||
comboList.add(new ComboItem(new LocaleString("工会经费申请"), "union_funding"));
|
||||
}else{
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请(非工程物资)"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("固定资产采购申请"), "gdzc_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("车辆维修保养申请"), "vehicle_maintain"));
|
||||
comboList.add(new ComboItem(new LocaleString("维修保养申请-非车辆"), "maintain_apply"));
|
||||
|
@ -62,7 +62,7 @@ public class DailyapplybillPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
List<ComboItem> comboList = new ArrayList<>();
|
||||
|
||||
if("10007186".equals(newValue.getString("number"))){
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请(非工程物资)"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("固定资产采购申请"), "gdzc_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("车辆维修保养申请"), "vehicle_maintain"));
|
||||
comboList.add(new ComboItem(new LocaleString("维修保养申请-非车辆"), "maintain_apply"));
|
||||
|
@ -72,7 +72,7 @@ public class DailyapplybillPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
comboList.add(new ComboItem(new LocaleString("工会经费申请"), "union_funding"));
|
||||
|
||||
}else{
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("采购申请(非工程物资)"), "purchase_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("固定资产采购申请"), "gdzc_apply"));
|
||||
comboList.add(new ComboItem(new LocaleString("车辆维修保养申请"), "vehicle_maintain"));
|
||||
comboList.add(new ComboItem(new LocaleString("维修保养申请-非车辆"), "maintain_apply"));
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SubjectbalancePlugin extends AbstractListPlugin implements Plugin
|
|||
String itemKey = evt.getItemKey();
|
||||
if("zcgj_gatdata".equals(itemKey)) {
|
||||
//科目余额表自动取数
|
||||
SubjectbalanceAutoData.getData();
|
||||
SubjectbalanceAutoData.getData();//其他
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public class DailyreimbursHomeCheckOp extends AbstractOperationServicePlugIn {
|
|||
e.getFieldKeys().add("zcgj_is_home");
|
||||
e.getFieldKeys().add("applier");
|
||||
e.getFieldKeys().add("zcgj_homeentity");
|
||||
e.getFieldKeys().add("costcompany");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,9 +47,9 @@ public class DailyreimbursHomeCheckOp extends AbstractOperationServicePlugIn {
|
|||
//当前切换选择的组织
|
||||
Long currentOrgId = RequestContext.get().getOrgId();
|
||||
//当前所在的组织是属于矿山下的
|
||||
if(OrgCheckUtils.isKS(currentOrgId)){
|
||||
//if(OrgCheckUtils.isKS(currentOrgId)){
|
||||
e.getValidators().add(new ValidatorExt());
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
class ValidatorExt extends AbstractValidator {
|
||||
|
@ -59,104 +60,112 @@ public class DailyreimbursHomeCheckOp extends AbstractOperationServicePlugIn {
|
|||
Map<Long,Map<String,Object>> allMap = new HashMap<>();
|
||||
//当前提交的探亲单据id集合
|
||||
Map<Long,List<Long>> currentBillIdListMap = new HashMap<>();
|
||||
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||
long aLong = dataEntity.getLong("id");
|
||||
//获取报销人
|
||||
DynamicObject applier = dataEntity.getDynamicObject("applier");
|
||||
long applierId = applier.getLong("id");
|
||||
//获取申请日期
|
||||
//Date bizdate = dataEntity.getDate( "bizdate");
|
||||
//获取是否探亲
|
||||
//如果是探亲,则进行逻辑判断
|
||||
boolean isHome = dataEntity.getBoolean(prefix + "_is_home");
|
||||
DynamicObject companyObj = (DynamicObject) dataEntity.get("costcompany");//核算组织(费用承担公司)
|
||||
if (companyObj != null) {
|
||||
Long companyId = companyObj.getLong("id");
|
||||
if (OrgCheckUtils.isKS(companyId)) {
|
||||
//获取报销人
|
||||
DynamicObject applier = dataEntity.getDynamicObject("applier");
|
||||
long applierId = applier.getLong("id");
|
||||
//获取申请日期
|
||||
//Date bizdate = dataEntity.getDate( "bizdate");
|
||||
//获取是否探亲
|
||||
//如果是探亲,则进行逻辑判断
|
||||
boolean isHome = dataEntity.getBoolean(prefix + "_is_home");
|
||||
|
||||
//判断是否来往家居地
|
||||
if(isHome){
|
||||
//获取当前人的往来家居地配置
|
||||
QFilter[] visitSetFilterArray = new QFilter[1];
|
||||
visitSetFilterArray[0] = new QFilter(prefix+"_user", QCP.equals, applierId);
|
||||
DataSet homeDataSet = QueryServiceHelper.queryDataSet(
|
||||
this.getClass().getName(),
|
||||
prefix+"_user_home_conf",
|
||||
"id,zcgj_month_times as monthTime",
|
||||
visitSetFilterArray, null
|
||||
);
|
||||
if(homeDataSet == null || homeDataSet.isEmpty()){
|
||||
String message = String.format("提交人没有往来居家配置。");
|
||||
this.addFatalErrorMessage(extendedDataEntity, message);
|
||||
}
|
||||
int monthTime = 0;
|
||||
for (Row row : homeDataSet) {
|
||||
monthTime = row.getInteger("monthTime");
|
||||
}
|
||||
if(monthTime != 0){
|
||||
DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("zcgj_homeentity");//oa流程分录
|
||||
Map<String,Integer> homeentityCountMap = new HashMap<>();
|
||||
int i = 1;
|
||||
boolean isOk=true;
|
||||
for (DynamicObject dynamicObject : tripentry) {
|
||||
Date bxmonth = dynamicObject.getDate("zcgj_bxmonth");
|
||||
String yearMonth = dateFormat.format(bxmonth);
|
||||
|
||||
String bxmonthStr = dateFormat.format(bxmonth);
|
||||
String startdateStr = dateFormat.format(dynamicObject.getDate("zcgj_startdate"));
|
||||
String enddateStr = dateFormat.format(dynamicObject.getDate("zcgj_enddate"));
|
||||
isOk = checkBelongMonth(bxmonthStr, startdateStr, enddateStr);
|
||||
if(!isOk){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("当前单据中往来居家明细的第%d行,往返日期不在报销归属月中!",i));
|
||||
}
|
||||
// 更新统计次数
|
||||
homeentityCountMap.put(yearMonth, homeentityCountMap.getOrDefault(yearMonth, 0) + 1);
|
||||
i++;
|
||||
}
|
||||
// 输出结果
|
||||
for (Map.Entry<String, Integer> entry : homeentityCountMap.entrySet()) {
|
||||
if(entry.getValue() > monthTime){
|
||||
String message = String.format("当前单据在%s月中提交了%d次往来居家,往来居家次数超限,限制每月%d次!",entry.getKey(),entry.getValue() ,monthTime);
|
||||
isOk= false;
|
||||
//判断是否来往家居地
|
||||
if(isHome){
|
||||
//获取当前人的往来家居地配置
|
||||
QFilter[] visitSetFilterArray = new QFilter[1];
|
||||
visitSetFilterArray[0] = new QFilter(prefix+"_user", QCP.equals, applierId);
|
||||
DataSet homeDataSet = QueryServiceHelper.queryDataSet(
|
||||
this.getClass().getName(),
|
||||
prefix+"_user_home_conf",
|
||||
"id,zcgj_month_times as monthTime",
|
||||
visitSetFilterArray, null
|
||||
);
|
||||
if(homeDataSet == null || homeDataSet.isEmpty()){
|
||||
String message = String.format("提交人没有往来居家配置。");
|
||||
this.addFatalErrorMessage(extendedDataEntity, message);
|
||||
}
|
||||
}
|
||||
if(isOk){
|
||||
for (DynamicObject dynamicObject : tripentry) {
|
||||
Date bxmonth = dynamicObject.getDate("zcgj_bxmonth");
|
||||
DataSet tripreimbursebill = getTripreimbursebill(bxmonth, applierId);
|
||||
//已用次数
|
||||
int goHomeCount = 0;
|
||||
StringBuilder trSb = new StringBuilder();
|
||||
for (Row row : tripreimbursebill) {
|
||||
goHomeCount++;
|
||||
String billno = row.getString("billno");
|
||||
int monthTime = 0;
|
||||
for (Row row : homeDataSet) {
|
||||
monthTime = row.getInteger("monthTime");
|
||||
}
|
||||
if(monthTime != 0){
|
||||
DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("zcgj_homeentity");//
|
||||
if(tripentry==null || tripentry.isEmpty()){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("请录入往来居家明细!"));
|
||||
}
|
||||
Map<String,Integer> homeentityCountMap = new HashMap<>();
|
||||
int i = 1;
|
||||
boolean isOk=true;
|
||||
for (DynamicObject dynamicObject : tripentry) {
|
||||
Date bxmonth = dynamicObject.getDate("zcgj_bxmonth");
|
||||
String yearMonth = dateFormat.format(bxmonth);
|
||||
|
||||
String bxmonthStr = dateFormat.format(bxmonth);
|
||||
String startdateStr = dateFormat.format(dynamicObject.getDate("zcgj_startdate"));
|
||||
String enddateStr = dateFormat.format(dynamicObject.getDate("zcgj_enddate"));
|
||||
isOk = checkBelongMonth(bxmonthStr, startdateStr, enddateStr);
|
||||
if(!isOk){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("当前单据中往来居家明细的第%d行,往返日期不在报销归属月中!",i));
|
||||
}
|
||||
// 更新统计次数
|
||||
homeentityCountMap.put(yearMonth, homeentityCountMap.getOrDefault(yearMonth, 0) + 1);
|
||||
i++;
|
||||
}
|
||||
// 输出结果
|
||||
for (Map.Entry<String, Integer> entry : homeentityCountMap.entrySet()) {
|
||||
if(entry.getValue() > monthTime){
|
||||
String message = String.format("当前单据在%s月中提交了%d次往来居家,往来居家次数超限,限制每月%d次!",entry.getKey(),entry.getValue() ,monthTime);
|
||||
isOk= false;
|
||||
this.addFatalErrorMessage(extendedDataEntity, message);
|
||||
}
|
||||
}
|
||||
if(isOk){
|
||||
for (DynamicObject dynamicObject : tripentry) {
|
||||
Date bxmonth = dynamicObject.getDate("zcgj_bxmonth");
|
||||
DataSet tripreimbursebill = getTripreimbursebill(bxmonth, applierId);
|
||||
//已用次数
|
||||
int goHomeCount = 0;
|
||||
StringBuilder trSb = new StringBuilder();
|
||||
for (Row row : tripreimbursebill) {
|
||||
goHomeCount++;
|
||||
String billno = row.getString("billno");
|
||||
/*String bxmonthStr = dateFormat.format(row.getDate("bxmonth"));
|
||||
String startdateStr = dateFormat.format(row.getDate("startdate"));
|
||||
String enddateStr = dateFormat.format(row.getDate("enddate"));
|
||||
boolean b = checkBelongMonth(bxmonthStr, startdateStr, enddateStr);*/
|
||||
trSb.append(billno).append(";");
|
||||
}
|
||||
DataSet dailyreimbursebill = getDailyreimbursebill(bxmonth, applierId);
|
||||
StringBuilder daSb = new StringBuilder();
|
||||
for (Row row : dailyreimbursebill) {
|
||||
goHomeCount++;
|
||||
String billno = row.getString("billno");
|
||||
trSb.append(billno).append(";");
|
||||
}
|
||||
DataSet dailyreimbursebill = getDailyreimbursebill(bxmonth, applierId);
|
||||
StringBuilder daSb = new StringBuilder();
|
||||
for (Row row : dailyreimbursebill) {
|
||||
goHomeCount++;
|
||||
String billno = row.getString("billno");
|
||||
/* String bxmonthStr = dateFormat.format(row.getDate("bxmonth"));
|
||||
String startdateStr = dateFormat.format(row.getDate("startdate"));
|
||||
String enddateStr = dateFormat.format(row.getDate("enddate"));
|
||||
boolean b = checkBelongMonth(bxmonthStr, startdateStr, enddateStr);*/
|
||||
daSb.append(billno).append(";");
|
||||
}
|
||||
daSb.append(billno).append(";");
|
||||
}
|
||||
|
||||
if(goHomeCount >= monthTime){
|
||||
int monthVal = getFirstDayOfMonth(bxmonth).getMonth().getValue();
|
||||
String message = String.format("请知悉:您每月共有%d次往来家居地报销次数,在%d月中已进行过%d次来往家居地报销。",monthTime,monthVal,goHomeCount);
|
||||
if(!StringUtils.isBlank(trSb.toString())){
|
||||
message+="已提交的差旅报销单:【"+trSb.toString()+"】 ";
|
||||
if(goHomeCount >= monthTime){
|
||||
int monthVal = getFirstDayOfMonth(bxmonth).getMonth().getValue();
|
||||
String message = String.format("请知悉:您每月共有%d次往来家居地报销次数,在%d月中已进行过%d次来往家居地报销。",monthTime,monthVal,goHomeCount);
|
||||
if(!StringUtils.isBlank(trSb.toString())){
|
||||
message+="已提交的差旅报销单:【"+trSb.toString()+"】 ";
|
||||
}
|
||||
if(!StringUtils.isBlank(daSb.toString())){
|
||||
message+="已提交的费用报销单:【"+daSb.toString()+"】 ";
|
||||
}
|
||||
this.addFatalErrorMessage(extendedDataEntity, message);
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(daSb.toString())){
|
||||
message+="已提交的费用报销单:【"+daSb.toString()+"】 ";
|
||||
}
|
||||
this.addFatalErrorMessage(extendedDataEntity, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ public class PrepaybillNoContractCkOp extends AbstractOperationServicePlugIn {
|
|||
e.getFieldKeys().add("zcgj_nocontract");//合同付款类型 无合同付款 NOCONTRACT , 合同付款 CONTRACT
|
||||
e.getFieldKeys().add("contractentry");//关联合同
|
||||
e.getFieldKeys().add("zcgj_bizype");//业务类型
|
||||
e.getFieldKeys().add("zcgj_maintenanceackentry");//设备维修
|
||||
e.getFieldKeys().add("zcgj_materialinbillentry");//入库单
|
||||
e.getFieldKeys().add("zcgj_maintenance");//设备维修申请单
|
||||
e.getFieldKeys().add("zcgj_purchaseapply");//采购申请单
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,12 +52,7 @@ public class PrepaybillNoContractCkOp extends AbstractOperationServicePlugIn {
|
|||
class ValidatorExt extends AbstractValidator {
|
||||
@Override
|
||||
public void validate() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
||||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||
Map<Long, Map<String,Object>> allMap = new HashMap<>();
|
||||
//当前提交的探亲单据id集合
|
||||
Map<Long, List<Long>> currentBillIdListMap = new HashMap<>();
|
||||
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||
Object costcompanyObj = dataEntity.get("costcompany");
|
||||
|
@ -71,14 +66,14 @@ public class PrepaybillNoContractCkOp extends AbstractOperationServicePlugIn {
|
|||
String bisType = dataEntity.getString("zcgj_bizype");
|
||||
//物资采购 WZCG
|
||||
if("WZCG".equals(bisType)){
|
||||
DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_materialinbillentry"); //入库单
|
||||
DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_purchaseapply"); //采购申请单
|
||||
if((entry == null || entry.isEmpty())){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为物资采购时,入库单分录不能为空!"));
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为物资采购时,采购申请单分录不能为空!"));
|
||||
}
|
||||
}else if("SBWX".equals(bisType)){//设备维修 SBWX
|
||||
DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_maintenanceackentry"); //入库单
|
||||
DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_maintenance"); //维修申请单
|
||||
if((entry == null || entry.isEmpty())){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为设备维修时,维修确认单分录不能为空!"));
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为设备维修时,设备维修申请单分录不能为空!"));
|
||||
}
|
||||
}
|
||||
//其他工程款 QTGCK 不交易
|
||||
|
|
|
@ -3,13 +3,14 @@ package zcgj.zcdev.zcdev.fs.plugin.operate;
|
|||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.ExtendedDataEntity;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
import kd.bos.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
|
||||
|
@ -35,6 +36,7 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
|||
e.getFieldKeys().add("enddate");//行程结束时间
|
||||
e.getFieldKeys().add("invoiceentry");//发票信息
|
||||
e.getFieldKeys().add("writeoffapply");//关联申请
|
||||
e.getFieldKeys().add("zcgjInvoiceremark");//特殊说明
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,6 +70,7 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
|||
String number = costcompany.getString("number");
|
||||
if(OrgCheckUtils.isKS(costcompanyId) && !number.equals("10006476")){
|
||||
List<String> errorList = new ArrayList<>();
|
||||
String zcgjInvoiceremark = dataEntity.getString("zcgj_invoiceremark");//特殊说明
|
||||
//行程明细,会有多个明细
|
||||
DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("tripentry");
|
||||
//发票明细
|
||||
|
@ -75,8 +78,12 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
|||
DynamicObjectCollection writeoffapply = dataEntity.getDynamicObjectCollection("writeoffapply");//关联的出差申请
|
||||
Date earliestAuditDate = null;
|
||||
for (DynamicObject dynamicObject : writeoffapply) {
|
||||
//er_tripreqbill
|
||||
long sourceapplybillid = dynamicObject.getLong("sourceapplybillid");
|
||||
DynamicObject tripreqbill = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "er_tripreqbill");
|
||||
boolean ischange = tripreqbill.getBoolean("ischange");//出差申请单发生过变更后,不进行校验
|
||||
Date auditDate = dynamicObject.getDate("zcgj_glsq_auditdate");
|
||||
if (auditDate != null) {
|
||||
if (auditDate != null && !ischange) {
|
||||
if (earliestAuditDate == null || auditDate.before(earliestAuditDate)) {
|
||||
earliestAuditDate = auditDate; // 保留最小审批日期
|
||||
}
|
||||
|
@ -103,15 +110,15 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
|||
}
|
||||
}
|
||||
|
||||
if (!inTripRange) {
|
||||
if (!inTripRange && StringUtils.isEmpty(zcgjInvoiceremark)) {
|
||||
//throw new RuntimeException("乘车日期【" + carrierDate + "】不在任何行程时间范围内!");
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期不在任何行程时间范围内!",i));
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期不在任何行程时间范围内,请填写特殊说明!",i));
|
||||
}
|
||||
|
||||
// 校验2: 必须在最早审批日期之后
|
||||
if (earliestAuditDate != null && carrierDate != null) {
|
||||
if (carrierDate.before(earliestAuditDate)) {
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期早于关联申请最早审批日期!",i));
|
||||
if (earliestAuditDate != null && carrierDate != null && StringUtils.isEmpty(zcgjInvoiceremark)) {
|
||||
if (carrierDate.compareTo(earliestAuditDate) != 0 && carrierDate.before(earliestAuditDate)) {
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期早于关联申请最早审批日期,请填写特殊说明!",i));
|
||||
//throw new RuntimeException("乘车日期【" + carrierDate + "】早于出差申请最早审批日期【" + earliestAuditDate + "】!");
|
||||
}
|
||||
}
|
||||
|
@ -133,4 +140,6 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
|||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -71,6 +71,55 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
|||
if(entryentity != null){
|
||||
entryentity.get(rowIndex).set("zcgj_expenseitem", null);
|
||||
this.getView().updateView("zcgj_expenseitem",rowIndex);
|
||||
boolean isshowwxsq = false;
|
||||
boolean isshowcgsq = false;
|
||||
for (DynamicObject dynamicObject : entryentity) {
|
||||
DynamicObject contract = dynamicObject.getDynamicObject("contract");
|
||||
String paymenttype = dynamicObject.getString("paymenttype");
|
||||
if(contract!=null){
|
||||
DynamicObject contracttype = contract.getDynamicObject("contracttype");
|
||||
System.out.println();
|
||||
if("PREPAYMENT".equals(paymenttype)){
|
||||
if("sbwbl".equals(contracttype.getString("number"))){//设备维保 sbwbl
|
||||
isshowwxsq = true;
|
||||
}else if("ZCHLX02".equals(contracttype.getString("number"))){//物资采购 ZCHLX02
|
||||
isshowcgsq = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.getModel().setValue("zcgj_isshowwxsq",isshowwxsq);
|
||||
this.getView().updateView("zcgj_isshowwxsq");
|
||||
|
||||
this.getModel().setValue("zcgj_isshowcgsq",isshowcgsq);
|
||||
this.getView().updateView("zcgj_isshowcgsq");
|
||||
}
|
||||
}else if(name.equals("contract")){
|
||||
DynamicObjectCollection entryentity = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");
|
||||
if (entryentity != null) {
|
||||
boolean isshowwxsq = false;
|
||||
boolean isshowcgsq = false;
|
||||
for (DynamicObject dynamicObject : entryentity) {
|
||||
DynamicObject contract = dynamicObject.getDynamicObject("contract");
|
||||
String paymenttype = dynamicObject.getString("paymenttype");
|
||||
if(contract!=null){
|
||||
DynamicObject contracttype = contract.getDynamicObject("contracttype");
|
||||
System.out.println();
|
||||
if("PREPAYMENT".equals(paymenttype)){
|
||||
if("sbwbl".equals(contracttype.getString("number"))){//设备维保 sbwbl
|
||||
isshowwxsq = true;
|
||||
}else if("ZCHLX02".equals(contracttype.getString("number"))){//物资采购 ZCHLX02
|
||||
isshowcgsq = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.getModel().setValue("zcgj_isshowwxsq",isshowwxsq);
|
||||
this.getView().updateView("zcgj_isshowwxsq");
|
||||
|
||||
this.getModel().setValue("zcgj_isshowcgsq",isshowcgsq);
|
||||
this.getView().updateView("zcgj_isshowcgsq");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue