Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
程小伟 2025-04-02 15:19:53 +08:00
commit 235f27dc6e
14 changed files with 969 additions and 97 deletions

View File

@ -0,0 +1,166 @@
package zcgj.zcdev.zcdev.fs.plugin.operate;
import kd.bos.algo.DataSet;
import kd.bos.context.RequestContext;
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.plugin.PreparePropertysEventArgs;
import kd.bos.entity.validate.AbstractValidator;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
/**
* 费用报销单 发票延迟报销校验
*/
public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugIn {
@Override
public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e);
e.getFieldKeys().add("invoiceentry");
//e.getFieldKeys().add("zcgj_entryentity");
e.getFieldKeys().add("zcgj_attachmentcount_cq");
e.getFieldKeys().add("zcgj_is_cq");
e.getFieldKeys().add("costcompany");
e.getFieldKeys().add("expenseentryentity");
e.getFieldKeys().add("applier");
}
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
Long currentUserId = UserServiceHelper.getCurrentUserId();
// 当前用户所属组织
Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId);
//当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的
if(OrgCheckUtils.isKS(currentOrgId)){
e.getValidators().add(new DailInvoiceOverdueRemindersOp.ValidatorExt());
}
}
class ValidatorExt extends AbstractValidator {
@Override
public void validate() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy");
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
int i =0;
Map<Long, Map<String,Object>> allMap = new HashMap<>();
//当前提交的探亲单据id集合
Map<Long, List<Long>> currentBillIdListMap = new HashMap<>();
//日常费用 FYXM002
//业务招待费 FYXM002.007
String rcNumber = "FYXM002";
String rcYwNumber = "FYXM002.007";
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
long aLong = dataEntity.getLong("id");
//获取报销人
DynamicObject applier = dataEntity.getDynamicObject("applier");
long applierId = applier.getLong("id");
Object costcompanyObj = dataEntity.get("costcompany");
int attachmentcountCq = dataEntity.getInt("zcgj_attachmentcount_cq"); //超期附件数
boolean isCq = dataEntity.getBoolean("zcgj_is_cq"); //超期附件数
if(costcompanyObj!=null){
DynamicObject costcompany = (DynamicObject)costcompanyObj;
long costcompanyId = costcompany.getLong("id");
if(OrgCheckUtils.isKS(costcompanyId)){
DynamicObjectCollection expenseentryentity = dataEntity.getDynamicObjectCollection("expenseentryentity");//费用明细
//1.判断费用项目中是否有包含日常费用的
boolean rc = false;
boolean yw = false;
for (DynamicObject dynamicObject : expenseentryentity) {
DynamicObject expenseitem = dynamicObject.getDynamicObject("expenseitem");
if(expenseitem!=null){
String itemNumber = expenseitem.getString("number");
if(itemNumber.startsWith(rcNumber)){
rc = true;
if(itemNumber.startsWith(rcYwNumber)){//如果有业务招待费报销
yw = true;
}
}
}
}
DynamicObject[] load = null;
if(yw){//如果是业务招待费报销则需要判断是不是领导
QFilter[] filterArray = new QFilter[2];
//查询申请人下的今年的探亲差旅单据
filterArray[0] = new QFilter("zcgj_leadership.id", QCP.equals, applierId);
filterArray[1] = new QFilter("zcgj_is_latency", QCP.equals, true);
load = BusinessDataServiceHelper.load("zcgj_leadership_config",
"id",
filterArray);
/*dateSet = QueryServiceHelper.queryDataSet(
this.getClass().getName(),
"zcgj_leadership_config",
"id",
filterArray, null
);*/
}
if((load == null || load.length == 0)&& rc){ //如果不是领导或领导的延迟报销未开启则进行延时校验
// DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("zcgj_entryentity");//oa流程分录
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息
List<LocalDate> dateList = new ArrayList<>();
for (DynamicObject dynamicObject : entryentity) {
Date invoicedate = dynamicObject.getDate("invoicedate");
//Date invoicedate = dynamicObject.getDate("zcgj_invoicedate");
if(invoicedate!=null){
dateList.add(dateToLocalDate(invoicedate));
}
}
// 找到最大的日期
LocalDate maxDate = dateList.stream()
.max(LocalDate::compareTo)
.orElse(null);
if (maxDate != null) {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 计算最大日期与当前日期之间的天数差
long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate);
// 判断是否超过90天
if (daysBetween > 30 &&(
!isCq || attachmentcountCq == 0)) {
if(yw){ //如果是业务招待则进行强控
this.addFatalErrorMessage(extendedDataEntity, "本次报销已上传最近的发票日期与当前日期相隔超30天请勾选超期报销并上传超期说明附件");
}else{//如果是日常费用的其他的项目则只进行提醒
this.addWarningMessage(extendedDataEntity, "请注意本次报销已上传最近的发票日期与当前日期相隔超30天。");
}
}
}
}
}
}
}
}
}
/**
* java.util.Date 转换为 java.time.LocalDate
* @param date java.util.Date
* @return java.time.LocalDate
*/
public static LocalDate dateToLocalDate(Date date) {
return date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
}
}

View File

@ -0,0 +1,131 @@
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.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.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
/**
* 差旅报销单 发票延迟报销校验
*/
public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlugIn {
@Override
public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e);
e.getFieldKeys().add("invoiceentry");
e.getFieldKeys().add("zcgj_attachmentcount_cq");
e.getFieldKeys().add("zcgj_is_cq");
e.getFieldKeys().add("costcompany");
e.getFieldKeys().add("applier");
}
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
Long currentUserId = UserServiceHelper.getCurrentUserId();
// 当前用户所属组织
Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId);
//当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的
if(OrgCheckUtils.isKS(currentOrgId)){
e.getValidators().add(new TravelInvoiceOverdueRemindersOp.ValidatorExt());
}
}
class ValidatorExt extends AbstractValidator {
@Override
public void validate() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy");
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
int i =0;
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");
Object costcompanyObj = dataEntity.get("costcompany");
int attachmentcountCq = dataEntity.getInt("zcgj_attachmentcount_cq"); //超期附件数
boolean isCq = dataEntity.getBoolean("zcgj_is_cq"); //超期附件数
if(costcompanyObj!=null){
DynamicObject costcompany = (DynamicObject)costcompanyObj;
long costcompanyId = costcompany.getLong("id");
if(OrgCheckUtils.isKS(costcompanyId)){
//获取报销人
DynamicObject applier = dataEntity.getDynamicObject("applier");
long applierId = applier.getLong("id");
QFilter[] filterArray = new QFilter[2];
//查询申请人下的今年的探亲差旅单据
filterArray[0] = new QFilter("zcgj_leadership.id", QCP.equals, applierId);
filterArray[1] = new QFilter("zcgj_is_latency", QCP.equals, true);
DynamicObject[] load = BusinessDataServiceHelper.load("zcgj_leadership_config",
"id",
filterArray);
if(load == null || load.length == 0){
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息
List<LocalDate> dateList = new ArrayList<>();
for (DynamicObject dynamicObject : entryentity) {
Date invoicedate = dynamicObject.getDate("invoicedate");
if(invoicedate!=null){
dateList.add(dateToLocalDate(invoicedate));
}
}
// 找到最大的日期
LocalDate maxDate = dateList.stream()
.max(LocalDate::compareTo)
.orElse(null);
if (maxDate != null) {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 计算最大日期与当前日期之间的时间差
//Period period = Period.between(maxDate, currentDate);
// 计算最大日期与当前日期之间的天数差
long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate);
// 判断是否超过90天
if (daysBetween > 30 &&(
!isCq || attachmentcountCq == 0)) {
this.addFatalErrorMessage(extendedDataEntity, "最近发票日期与当前日期相隔超30天请勾选超期报销并上传超期说明附件");
}
}
}
}
}
}
}
}
/**
* java.util.Date 转换为 java.time.LocalDate
* @param date java.util.Date
* @return java.time.LocalDate
*/
public static LocalDate dateToLocalDate(Date date) {
return date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
}
}

View File

@ -65,7 +65,11 @@ public class EmpTravelRptDetailListPlugin extends AbstractFormPlugin implements
for (Row row : tripreimbursebillHome) {
DynamicObject dynamicObject = zcgjKccbList.addNew();
dynamicObject.set("zcgj_bill_type","差旅报销单");
dynamicObject.set("zcgj_type","往来居家");
if(row.getBoolean("ishome")){
dynamicObject.set("zcgj_type","往来居家");
}else{
dynamicObject.set("zcgj_type","差旅报销");
}
dynamicObject.set("zcgj_billno",row.getString("billno"));
Date startdate = row.getDate("startdate");
dynamicObject.set("zcgj_start_date",startdate);
@ -166,14 +170,15 @@ public class EmpTravelRptDetailListPlugin extends AbstractFormPlugin implements
//查询申请人下的今年的探亲差旅单据
List<QFilter> searchFilterList = new ArrayList<>();
searchFilterList.add(new QFilter("applier", QCP.equals, applierId));
searchFilterList.add(new QFilter( "zcgj_is_include_home", QCP.equals, true));
//searchFilterList.add(new QFilter( "zcgj_is_include_home", QCP.equals, true));
searchFilterList.add(new QFilter( "zcgj_kccbdays", QCP.large_than, 0));
searchFilterList.add(new QFilter("billstatus", QCP.in, billStatuslist));
searchFilterList.add( new QFilter("bizdate", QCP.large_equals, firstDayOfMonth));
searchFilterList.add( new QFilter("bizdate", QCP.less_equals, lastDayOfMonth));
DataSet dateSet = QueryServiceHelper.queryDataSet(
this.getClass().getName(),
"er_tripreimbursebill",
"id,applier,billno,zcgj_homeentity.zcgj_startdate as startdate,zcgj_homeentity.zcgj_enddate as enddate,zcgj_homeentity.zcgj_kccbdaycount as kccbdaycount" ,
"id,applier,billno,zcgj_is_include_home as ishome,zcgj_homeentity.zcgj_startdate as startdate,zcgj_homeentity.zcgj_enddate as enddate,zcgj_homeentity.zcgj_kccbdaycount as kccbdaycount" ,
searchFilterList.toArray(new QFilter [] {}), null
);
return dateSet;

View File

@ -12,6 +12,7 @@ import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import java.math.BigDecimal;
@ -89,6 +90,8 @@ public class EmpTravelRptQueryPlugin extends AbstractReportListDataPlugin {
//获取公司下的所有人
List<Long> orgIds = new ArrayList<>();
orgIds.add(orgId);
//获取当前组织的所有下级组织
List<Long> subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true);
List<Long> allUsersOfOrg = UserServiceHelper.getAllUsersOfOrg(orgIds);
if(!applierId.isEmpty()){
//通过查询用户过滤组织下的人
@ -193,7 +196,8 @@ public class EmpTravelRptQueryPlugin extends AbstractReportListDataPlugin {
//查询申请人下的今年的探亲差旅单据
List<QFilter> searchFilterList = new ArrayList<>();
searchFilterList.add(new QFilter("applier", QCP.equals, applierId));
searchFilterList.add(new QFilter( "zcgj_is_include_home", QCP.equals, true));
//searchFilterList.add(new QFilter( "zcgj_is_include_home", QCP.equals, true));
searchFilterList.add(new QFilter( "zcgj_kccbdays", QCP.large_than, 0));
searchFilterList.add(new QFilter("billstatus", QCP.in, billStatuslist));
searchFilterList.add( new QFilter("bizdate", QCP.large_equals, firstDay));
searchFilterList.add( new QFilter("bizdate", QCP.less_equals, lastDay));

View File

@ -0,0 +1,103 @@
package zcgj.zcdev.zcdev.fs.plugin.report;
import java.util.Date;
public class VisitReportVo {
private Long applier;
private String appliername;
private String orgname;
private Integer holidayHaveDays;
private Integer holidayDays;
private Integer holidayNoDays;
private String phone;
private Integer totalCount;
private Integer usesCount;
public VisitReportVo() {
}
public VisitReportVo(Long applier, String appliername, String orgname, Integer holidayHaveDays, Integer holidayDays, Integer holidayNoDays, String phone, Integer totalCount, Integer usesCount) {
this.applier = applier;
this.appliername = appliername;
this.orgname = orgname;
this.holidayHaveDays = holidayHaveDays;
this.holidayDays = holidayDays;
this.holidayNoDays = holidayNoDays;
this.phone = phone;
this.totalCount = totalCount;
this.usesCount = usesCount;
}
public Long getApplier() {
return applier;
}
public void setApplier(Long applier) {
this.applier = applier;
}
public String getAppliername() {
return appliername;
}
public void setAppliername(String appliername) {
this.appliername = appliername;
}
public String getOrgname() {
return orgname;
}
public void setOrgname(String orgname) {
this.orgname = orgname;
}
public Integer getHolidayHaveDays() {
return holidayHaveDays;
}
public void setHolidayHaveDays(Integer holidayHaveDays) {
this.holidayHaveDays = holidayHaveDays;
}
public Integer getHolidayDays() {
return holidayDays;
}
public void setHolidayDays(Integer holidayDays) {
this.holidayDays = holidayDays;
}
public Integer getHolidayNoDays() {
return holidayNoDays;
}
public void setHolidayNoDays(Integer holidayNoDays) {
this.holidayNoDays = holidayNoDays;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Integer getTotalCount() {
return totalCount;
}
public void setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
}
public Integer getUsesCount() {
return usesCount;
}
public void setUsesCount(Integer usesCount) {
this.usesCount = usesCount;
}
}

View File

@ -0,0 +1,136 @@
package zcgj.zcdev.zcdev.fs.plugin.report;
import kd.bos.algo.DataSet;
import kd.bos.algo.Row;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.form.FormShowParameter;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.sdk.plugin.Plugin;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
* 探亲休假详情
*/
public class VisitRptDetailListPlugin extends AbstractFormPlugin implements Plugin {
@Override
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
// 获取当前页面的FormShowParameter对象
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
// 日期格式化
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// 获取自定义参数
Long userId = (Long)formShowParameter.getCustomParam("userId");
String queryDate = (String)formShowParameter.getCustomParam("queryDate");
LocalDate parse = LocalDate.parse(queryDate);
System.out.println();
DynamicObjectCollection zcgjKccbList = this.getModel().getDataEntity().getDynamicObjectCollection("zcgj_entryentity");
DataSet tripreimbursebill = getDailyreimbursebill(queryDate, userId);
for (Row row : tripreimbursebill) {
DynamicObject dynamicObject = zcgjKccbList.addNew();
String billNo = row.getString("billno");
dynamicObject.set("zcgj_billno",billNo);
String triptypename = row.getString("triptypename");
dynamicObject.set("zcgj_holiday_type","1".equals(triptypename) ?"探望父母":"探望配偶");
Date startdate = row.getDate("startdate");
String startdateStr = dateFormat.format(startdate);
Date enddate = row.getDate("enddate");
String enddateStr = dateFormat.format(enddate);
dynamicObject.set("zcgj_holiday_date_start",startdate);
dynamicObject.set("zcgj_holiday_date_end",enddate);
Integer days = row.getInteger("days");
dynamicObject.set("zcgj_holiday_days",days);
String address = row.getString("address");
dynamicObject.set("zcgj_holiday_addr",address);
String description = row.getString("description");
dynamicObject.set("zcgj_reason",description);
}
}
/**
* 获取差旅费报销单-行程信息
*
* @param applierId
* @return
*/
public DataSet getDailyreimbursebill(String queryDate, Long applierId) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate queryYear = LocalDate.parse(queryDate, formatter);
// 查询条件
List<QFilter> searchFilterList = new ArrayList<>();
searchFilterList.add(new QFilter("zcgj_is_visit", QCP.equals, true));
//QFilter[] filterArray = new QFilter[1];
//查询申请人下的单据
searchFilterList.add(new QFilter("applier", QCP.equals, applierId));
if(queryYear!=null){
LocalDate firstDay = getFirstDayOfYear(queryYear.getYear());
LocalDate lastDay = getLastDayOfYear(queryYear.getYear());
searchFilterList.add(new QFilter("zcgj_holiday_start_time", QCP.large_equals, firstDay));
searchFilterList.add(new QFilter("zcgj_holiday_start_time", QCP.less_equals, lastDay));
}
List<String> billStatuslist = new ArrayList<>();
//billStatuslist.add("A"); //暂存
//billStatuslist.add("B"); //已提交
//billStatuslist.add("C"); //审核中
//billStatuslist.add("D"); //审核未通过
billStatuslist.add("E"); //审核通过
billStatuslist.add("F"); //等待付款
billStatuslist.add("G"); //已付款
//billStatuslist.add("H"); //废弃
billStatuslist.add("I"); //关闭
searchFilterList.add(new QFilter("billstatus", QCP.in, billStatuslist));//增加过滤
DataSet dateSet = QueryServiceHelper.queryDataSet(
this.getClass().getName(),
"er_dailyreimbursebill",
"id,applier,billno,applier.name as appliername,applier.phone as appliernamephone,description," +
"org.name as orgname,zcgj_visit_type as triptypename," +
"zcgj_holiday_address as address," +
"zcgj_holiday_start_time as startdate,zcgj_holiday_end_time as enddate,zcgj_holiday_days as days" ,
searchFilterList.toArray(new QFilter [] {}), null
).orderBy(new String[]{"applier", "startdate"});
return dateSet;
}
// 获取某年份的第一天
public static LocalDate getFirstDayOfYear(int year) {
return LocalDate.of(year, 1, 1);
}
// 获取某年份的最后一天
public static LocalDate getLastDayOfYear(int year) {
return LocalDate.of(year, 12, 31);
}
private static boolean isWeekend(LocalDate date) {
return date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY;
}
/**
* java.util.Date 转换为 java.time.LocalDate
* @param date java.util.Date
* @return java.time.LocalDate
*/
public static LocalDate dateToLocalDate(Date date) {
if (date == null) {
throw new IllegalArgumentException("日期不能为 null");
}
return date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
}
}

View File

@ -1,20 +1,32 @@
package zcgj.zcdev.zcdev.fs.plugin.report;
import kd.bos.algo.DataSet;
import kd.bos.algo.Row;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.PackageDataEvent;
import kd.bos.entity.report.FilterInfo;
import kd.bos.entity.report.IReportListModel;
import kd.bos.entity.report.ReportQueryParam;
import kd.bos.form.FormShowParameter;
import kd.bos.form.ShowType;
import kd.bos.form.StyleCss;
import kd.bos.form.events.HyperLinkClickEvent;
import kd.bos.form.events.HyperLinkClickListener;
import kd.bos.report.ReportList;
import kd.bos.report.events.CellStyleRule;
import kd.bos.report.events.SortAndFilterEvent;
import kd.bos.report.plugin.AbstractReportFormPlugin;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.sdk.plugin.Plugin;
import java.util.Date;
import java.util.EventObject;
import java.util.List;
/**
* 务消费台账
* 工探亲休假台账
* 报表格式化插件
*/
public class VisitRptListPlugin extends AbstractReportFormPlugin implements Plugin {
@ -24,11 +36,28 @@ public class VisitRptListPlugin extends AbstractReportFormPlugin implements Plug
private static final String DEV_KEY="zcgj";
private static final String[] FIELDS = {
DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_department",DEV_KEY+"_holiday_date_start",
DEV_KEY+"_holiday_date_end",DEV_KEY+"_holiday_days",
DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_department",DEV_KEY+"_holiday_date",
DEV_KEY+"_holiday_have_days",DEV_KEY+"_holiday_days",DEV_KEY+"_holiday_no_days",
DEV_KEY+"_holiday_type", DEV_KEY+"_holiday_addr", DEV_KEY+"_phone",
DEV_KEY+"_reason"
DEV_KEY+"_reason",DEV_KEY+"_total_count",DEV_KEY+"_uses_count"
};
@Override
public void afterQuery(ReportQueryParam queryParam) {
ReportList reportList = getView().getControl("reportlistap");
IReportListModel reportModel = reportList.getReportModel();
/*DataSet dataSet = QueryServiceHelper.queryDataSet(this.getClass().getName(), "zcgj_family_leave_rpt",
"zcgj_user as user,zcgj_holiday_have_days as havdDays,zcgj_holiday_days as holidayDays," +
"zcgj_holiday_no_days as holidayNoDays,zcgj_total_count as totalCount,zcgj_uses_count as usesCount", null, null);
int sumApplyDay = 0;
for (Row row : dataSet) {
int applyday = (int) row.get("havdDays");
sumApplyDay = sumApplyDay + applyday;
}*/
//this.getModel().setValue("kdec_sumapplyday", sumApplyDay);
super.afterQuery(queryParam);
}
@Override
public void setMergeColums(List<String> columns) {
columns.add(MERGECOLUM);
@ -70,6 +99,43 @@ public class VisitRptListPlugin extends AbstractReportFormPlugin implements Plug
super.setCellStyleRules(cellStyleRules);
}
@Override
public void registerListener(EventObject e) {
//监听报表超链接点击事件
super.registerListener(e);
ReportList reportList = getControl("reportlistap");
reportList.addHyperClickListener(new HyperLinkClickListener() {
@Override
public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) {
String fieldName = hyperLinkClickEvent.getFieldName();
int rowIndex = hyperLinkClickEvent.getRowIndex();
if(rowIndex > 0){
ReportList reportList = getView().getControl("reportlistap");
DynamicObject rowData = reportList.getReportModel().getRowData(rowIndex);
//row.getString()
if(rowData!=null && rowData.get("zcgj_user") != null){
DynamicObject user = (DynamicObject)rowData.get(0);
Long userId = (Long)user.getPkValue();
String zcgjYear = rowData.getString("zcgj_year");
FormShowParameter formShowParameter;
formShowParameter = new FormShowParameter();
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
formShowParameter.setFormId("zcgj_visit_rpt_detail");
// 自定义传参把当前单据的文本字段传过去
formShowParameter.setCustomParam("queryDate", zcgjYear);
formShowParameter.setCustomParam("userId", userId);
StyleCss styleCss = new StyleCss();
styleCss.setWidth("800");
styleCss.setHeight("600");
formShowParameter.getOpenStyle().setInlineStyleCss(styleCss);
getView().showForm(formShowParameter);
}
}
}
});
}
/**
* 设置过滤排序列
*

View File

@ -57,14 +57,13 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin {
// 报表字段及数据类型
String[] FIELDS = {
DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_department",DEV_KEY+"_holiday_date_start",
DEV_KEY+"_holiday_date_end",DEV_KEY+"_holiday_days",
DEV_KEY+"_holiday_type", DEV_KEY+"_holiday_addr", DEV_KEY+"_phone",
DEV_KEY+"_reason"
DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_department",
DEV_KEY+"_holiday_have_days",DEV_KEY+"_holiday_days",DEV_KEY+"_holiday_no_days",
DEV_KEY+"_phone",DEV_KEY+"_total_count",DEV_KEY+"_uses_count",DEV_KEY+"_year"
};
DataType[] DATATYPES = {
DataType.LongType,DataType.StringType, DataType.StringType, DataType.StringType,
DataType.StringType,DataType.IntegerType,
DataType.LongType,DataType.StringType, DataType.StringType,
DataType.StringType,DataType.StringType,DataType.StringType,
DataType.StringType, DataType.StringType, DataType.StringType,
DataType.StringType
};
@ -116,44 +115,135 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin {
this.getClass().getName(),
"er_dailyreimbursebill",
"id,applier,applier.name as appliername,applier.phone as appliernamephone,description," +
"org.name as orgname,'探亲休假' as triptypename," +
"org.name as orgname,zcgj_visit_type as triptypename," +
"zcgj_holiday_address as address," +
"zcgj_holiday_start_time as startdate,zcgj_holiday_end_time as enddate,zcgj_holiday_days as days" ,
searchFilterList.toArray(new QFilter [] {}), null
).orderBy(new String[]{"applier", "startdate"});
// 汇总数据
Map<Long, Map<String, Map<String, BigDecimal>>> allData = new HashMap<>();
Map<Long,VisitReportVo> map = new HashMap<>();
for (Row itemRow : bdMaterialDataSet) {
Long applier = itemRow.getLong("applier");
String appliername = itemRow.getString("appliername");
String orgname = itemRow.getString("orgname");
String appliernamephone = itemRow.getString("appliernamephone");
Date startdate = itemRow.getDate("startdate");
String startdateStr = dateFormat.format(startdate);
Date enddate = itemRow.getDate("enddate");
String enddateStr = dateFormat.format(enddate);
String triptypename = itemRow.getString("triptypename");
String description = itemRow.getString("description");
String address = itemRow.getString("address");
Integer days = itemRow.getInteger("days");
Map<String, Integer> visitCount = getVisitCount(applier);
//婚姻状况1已婚2未婚
int marriedStatus = visitCount.get("marriedStatus");
//探父母天数
int visitDays = visitCount.get("visitDays");
//已婚探望配偶年限
int marriedSpouseYear =visitCount.get("marriedSpouseYear");
//已婚探配偶天数
int marriedSpouseDays =visitCount.get("marriedSpouseDays");
//未婚探望父母年限
int unmarriedParentsYear =visitCount.get("unmarriedParentsYear");
//已婚探望父母次数
int marriedParentsTime =visitCount.get("marriedParentsTime");
//已婚探望配偶次数
int marriedSpouseTime =visitCount.get("marriedSpouseTime");
//未婚探望父母次数
int unmarriedParentsTime =visitCount.get("unmarriedParentsTime");
//总探亲假天数 = 探望父母天数+已婚探配偶天数
VisitReportVo vp = null;
if(map.containsKey(applier)){
vp = map.get(applier);
vp.setHolidayDays(vp.getHolidayDays()+days);//未休
vp.setHolidayNoDays(vp.getHolidayNoDays()-days);//未休
Integer usesCount = vp.getUsesCount();
usesCount = usesCount+1;
vp.setUsesCount(usesCount);//已报销次数
}else{
vp = new VisitReportVo();
String appliername = itemRow.getString("appliername");
String orgname = itemRow.getString("orgname");
String appliernamephone = itemRow.getString("appliernamephone");
vp.setApplier(applier);
vp.setAppliername(appliername);
vp.setOrgname(orgname);
vp.setPhone(appliernamephone);
if(marriedStatus == 1){ //已婚
vp.setHolidayHaveDays(visitDays+marriedSpouseDays);
vp.setTotalCount(marriedSpouseTime+marriedParentsTime);//可报销次数 = 已婚探望配偶次数+已婚探望父母次数
}else{
vp.setHolidayHaveDays(visitDays);
vp.setTotalCount(unmarriedParentsTime);//可报销次数 = 未婚探望父母次数
}
vp.setHolidayDays(days); //已休
vp.setHolidayNoDays(vp.getHolidayHaveDays()-days);//未休
vp.setUsesCount(1);//已报销次数
map.put(applier,vp);
}
}
for (Long userId : map.keySet()) {
Object[] totalRow = new Object[FIELDS.length];
totalRow[0] = applier;
totalRow[1] = appliername;
totalRow[2] = orgname;
totalRow[3] = startdateStr;
totalRow[4] = enddateStr;
totalRow[5] = days;
totalRow[6] = triptypename;
totalRow[7] = address;
totalRow[8] = appliernamephone;
totalRow[9] = description;
VisitReportVo visitReportVo = map.get(userId);
totalRow[0] = visitReportVo.getApplier();
totalRow[1] = visitReportVo.getAppliername(); //用户名
totalRow[2] = visitReportVo.getOrgname();//组织
totalRow[3] = visitReportVo.getHolidayHaveDays();//应休
totalRow[4] = visitReportVo.getHolidayDays();//已休
totalRow[5] = visitReportVo.getHolidayNoDays();//20; //未休
totalRow[6] = visitReportVo.getPhone();
totalRow[7] = visitReportVo.getTotalCount();//可报销次数
totalRow[8] = visitReportVo.getUsesCount();//已报销次数
totalRow[9] = dateToLocalDate(queryYear);//已报销次数
coll.add(totalRow);
}
return resultDataSet;
}
public Map<String,Integer> getVisitCount(Long applierId){
Map<String,Integer> map = new HashMap<>();
QFilter[] visitSetFilterArray = new QFilter[1];
visitSetFilterArray[0] = new QFilter("zcgj_user", QCP.equals, applierId);
DynamicObject dynamicObject = QueryServiceHelper.queryOne( "zcgj_user_visit_set",
"id,zcgj_visit_times as visitTime,zcgj_visit_days as visitDays,zcgj_married_spouse_days marriedSpouseDays,zcgj_married_status as marriedStatus," +
"zcgj_married_parents_year as marriedParentsYear,zcgj_married_parents_time as marriedParentsTime," +
"zcgj_married_spouse_year as marriedSpouseYear,zcgj_married_spouse_time as marriedSpouseTime," +
"zcgj_unmarried_parents_y as unmarriedParentsYear,zcgj_unmarried_parents_t as unmarriedParentsTime",visitSetFilterArray);
if(dynamicObject == null){
return map;
}
//婚姻状况1已婚2未婚
int marriedStatus =dynamicObject.getInt("marriedStatus");
//未婚/已婚探父母天数
int visitDays =dynamicObject.getInt("visitDays");
//已婚探望配偶天数
int marriedSpouseDays = dynamicObject.getInt("marriedSpouseDays");
//已婚探望父母年限
int marriedParentsYear =dynamicObject.getInt("marriedParentsYear");
//已婚探望父母次数
int marriedParentsTime =dynamicObject.getInt("marriedParentsTime");
//已婚探望配偶年限
int marriedSpouseYear =dynamicObject.getInt("marriedSpouseYear");
//已婚探望配偶次数
int marriedSpouseTime =dynamicObject.getInt("marriedSpouseTime");
//未婚探望父母年限
int unmarriedParentsYear =dynamicObject.getInt("unmarriedParentsYear");
//未婚探望父母次数
int unmarriedParentsTime =dynamicObject.getInt("unmarriedParentsTime");
map.put("marriedStatus", marriedStatus);
map.put("visitDays", visitDays);
map.put("marriedSpouseDays", marriedSpouseDays);
map.put("marriedParentsYear", marriedParentsYear);
map.put("marriedParentsTime", marriedParentsTime);
map.put("marriedSpouseYear", marriedSpouseYear);
map.put("marriedSpouseTime", marriedSpouseTime);
map.put("unmarriedParentsYear", unmarriedParentsYear);
map.put("unmarriedParentsTime", unmarriedParentsTime);
return map;
}
// 获取某年份的第一天
public static LocalDate getFirstDayOfYear(int year) {

View File

@ -0,0 +1,75 @@
package zcgj.zcdev.zcdev.fs.plugin.workflow;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.message.api.MessageChannels;
import kd.bos.metadata.dao.MetaCategory;
import kd.bos.metadata.dao.MetadataDao;
import kd.bos.metadata.form.FormMetadata;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.servicehelper.workflow.WorkflowServiceHelper;
import kd.bos.workflow.api.AgentExecution;
import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
import kd.bos.workflow.engine.impl.persistence.entity.runtime.ExecutionEntityImpl;
import kd.bos.workflow.engine.precomputor.IPreComputorRecord;
import kd.bos.workflow.engine.precomputor.IPreComputorRecordItem;
import kd.bos.servicehelper.workflow.MessageCenterServiceHelper;
import kd.bos.workflow.engine.msg.info.MessageInfo;
import java.util.ArrayList;
import java.util.List;
import kd.bos.dataentity.entity.LocaleString;
/**
* 审批流程预测审批人提醒
*/
public class SendMessageWorkFlowPlugin implements IWorkflowPlugin {
@Override
public void notify(AgentExecution execution) {
String businessKey = execution.getBusinessKey();
String entityNumber = execution.getEntityNumber();
long processId = WorkflowServiceHelper.getProcessInstanceIdByBusinessKey(businessKey);
IPreComputorRecord record = WorkflowServiceHelper.getPreComputorRecord(processId);
List<IPreComputorRecordItem> recordItems = record.getPcrData();
List<Long> userIds = new ArrayList<>();
for (IPreComputorRecordItem recordItem : recordItems) {
List<String> nextNodeId = recordItem.getNextNodeId();
if (nextNodeId.size() > 0) {
//获取下一个节点的审核人
List<Long> assignee = recordItem.getAssignee();
if (assignee.size() > 0) {
for (Long userId : assignee) {
userIds.add(userId);
}
}
}
}
if (!userIds.isEmpty()) {
sendMessage(userIds,entityNumber);
}
IWorkflowPlugin.super.notify(execution);
}
public void sendMessage(List<Long> userIds,String entityNumber) {
String id = MetadataDao.getIdByNumber(entityNumber, MetaCategory.Form);
FormMetadata formMeta = (FormMetadata) MetadataDao.readRuntimeMeta(id, MetaCategory.Form);
//单据名称
String billName = formMeta.getName().getLocaleValue();
//messageinfo 使用工作流包下的对象
MessageInfo messageInfo = new MessageInfo();
messageInfo.setTitle(billName+"-审批提醒");
LocaleString localeString = new LocaleString();
localeString.setLocaleValue_zh_CN(billName+"待审批提醒");
messageInfo.setMessageContent(localeString);
messageInfo.setUserIds(userIds);
//messageInfo.setType(MessageInfo.TYPE_TASK);
messageInfo.setType(MessageInfo.TYPE_MESSAGE);
messageInfo.setTag(billName+"-审批提醒");
messageInfo.setEntityNumber(entityNumber);
messageInfo.setNotifyType(MessageChannels.MC.getNumber());
MessageCenterServiceHelper.sendMessage(messageInfo);
}
}

View File

@ -0,0 +1,34 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.form.control.events.BeforeItemClickEvent;
import kd.sdk.plugin.Plugin;
import java.util.EventObject;
/**
* 收付款申请单选择合同时项目提醒插件
*/
public class ContractSelectProjectPlugin extends AbstractBillPlugIn implements Plugin {
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
//监听工具栏按钮点击事件
this.addItemClickListeners("entrytoolbar");
//this.addClickListeners("advcontoolbarap");
}
@Override
public void beforeItemClick(BeforeItemClickEvent evt) {
//工具栏上的所有按钮的点击都会激活itemClick和beforeItemClick方法 //要开发人员实现不同按钮的逻辑
if (evt.getItemKey().equals("selectcontract")) {
Object project = this.getModel().getValue("project");
if(project == null) {
evt.setCancel(true);
this.getView().showErrorNotification("请选择项目");
}
}
super.beforeItemClick(evt);
}
}

View File

@ -0,0 +1,59 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.form.control.EntryGrid;
import kd.bos.form.control.events.ItemClickEvent;
import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.util.EventObject;
import java.util.List;
public class PaymentapplyCopyPlugin extends AbstractBillPlugIn implements Plugin {
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
//监听工具栏按钮点击事件
this.addItemClickListeners("entrytoolbar");
//this.addClickListeners("advcontoolbarap");
}
@Override
public void itemClick(ItemClickEvent evt) {
super.itemClick(evt);
String ENTITY_KEY = "entryentity";
if (evt.getItemKey().equals("zcgj_pay_copy")) {
EntryGrid entryGrid = this.getControl("entryentity");
//获取选中行数组为行号从0开始int[]
int[] selectRows = entryGrid.getSelectRows();
//获取单据体数据集合
DynamicObjectCollection entity=this.getModel().getEntryEntity("entryentity");
List<DynamicObject> dynamicObjects = entity.subList(entity.size() - selectRows.length, entity.size());
for (int i = 0; i < selectRows.length; i++) {
DynamicObject dynamicObject = entity.get(selectRows[i]); //选择的单据体数据
DynamicObject dynamicObjectCopy = dynamicObjects.get(i); //复制的单据提数据
dynamicObjectCopy.set("thisapplyoftax",dynamicObject.get("thisapplyoftax"));
dynamicObjectCopy.set("applyoftaxamount",dynamicObject.get("applyoftaxamount"));
dynamicObjectCopy.set("endpaymentrate",dynamicObject.get("endpaymentrate"));
}
this.getModel().setValue("totalshouldpay", this.getSum("entryentity", "applyoftaxamount"));
this.getView().updateView(ENTITY_KEY);
this.getView().updateView("totalshouldpay");
}
}
protected BigDecimal getSum(String entryId, String columnId) {
int rowCount = this.getModel().getEntryRowCount(entryId);
BigDecimal totalAmount = BigDecimal.ZERO;
for(int i = 0; i < rowCount; ++i) {
BigDecimal amount = (BigDecimal)this.getModel().getValue(columnId, i);
amount = amount == null ? BigDecimal.ZERO : amount;
totalAmount = totalAmount.add(amount);
}
return totalAmount;
}
}

View File

@ -26,62 +26,64 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
long referbillid = payitemdetailentry.getLong("referbillid");
QFilter f1 = new QFilter("id", "=", referbillid);
DynamicObject outcontractmeasure = BusinessDataServiceHelper.loadSingle("ec_outcontractmeasure", new QFilter[]{f1});
DynamicObjectCollection listmodelentry = outcontractmeasure.getDynamicObjectCollection("listmodelentry");
//判断是否有含有计量单id 若有跳过 避免多次新增
Set<String> set = new HashSet();
if(outcontractmeasure!=null){
DynamicObjectCollection listmodelentry = outcontractmeasure.getDynamicObjectCollection("listmodelentry");
//判断是否有含有计量单id 若有跳过 避免多次新增
Set<String> set = new HashSet();
// QFilter f2 = new QFilter("id", "!=", "0");
DynamicObjectCollection query = QueryServiceHelper.query(dataEntity1.getDynamicObjectType().getName(), "listmodelentry.zcgj_jldenrtyid", null);
DynamicObjectCollection query = QueryServiceHelper.query(dataEntity1.getDynamicObjectType().getName(), "listmodelentry.zcgj_jldenrtyid", null);
// DynamicObject[] jldenrtyids = BusinessDataServiceHelper.load(listmodelentrys.getDynamicObjectType().getName(),"zcgj_jldenrtyid", new QFilter[]{f2});
for (DynamicObject object : query) {
String id = object.getString("listmodelentry.zcgj_jldenrtyid");
if (id != null) {
set.add(id);
for (DynamicObject object : query) {
String id = object.getString("listmodelentry.zcgj_jldenrtyid");
if (id != null) {
set.add(id);
}
}
}
for (DynamicObject listmodelEntry : listmodelentry) {
String id = listmodelEntry.getString("id");
if (set.contains(id)) {
continue;
}
DynamicObject addNew = listmodelentrys.addNew();
addNew.set("modelname", listmodelEntry.getString("modelname"));//清单模板名称
addNew.set("cmptype", listmodelEntry.getString("cmptype"));//文本
addNew.set("totalamount", listmodelEntry.getBigDecimal("totalamount"));//税额
addNew.set("totaltax", listmodelEntry.getBigDecimal("totaltax"));//税额
addNew.set("totaloftaxamount", listmodelEntry.getBigDecimal("totaloftaxamount"));//价税合计
addNew.set("listmodelid", listmodelEntry.getLong(("listmodelid")));//清单模板id
addNew.set("zcgj_jldenrtyid", id);//计量单分录id
DynamicObjectCollection listEntry = addNew.getDynamicObjectCollection("listentry");//结算分录
DynamicObjectCollection measureEntry = listmodelEntry.getDynamicObjectCollection("listentry");//计量分录
for (DynamicObject dynamicObject : measureEntry) {
DynamicObject object = listEntry.addNew();
object.set("listing", dynamicObject.getDynamicObject("listing"));//清单编码
object.set("listingname", dynamicObject.getString("listingname"));//清单名称
object.set("materiel", dynamicObject.getDynamicObject("materiel"));//物料编码
object.set("resourceitem", dynamicObject.getDynamicObject("listing"));//资源编码
object.set("resname", dynamicObject.getString("resname"));//资源名称
object.set("boqnumber", dynamicObject.getDynamicObject("boqnumber"));//工程量清单编码
object.set("contlistnumber", dynamicObject.getDynamicObject("contlistnumber"));//
object.set("measureunit", dynamicObject.getDynamicObject("measureunit"));//计量单位
object.set("totalqty", dynamicObject.getBigDecimal("totalqty"));//总数量
object.set("entrytaxrate", dynamicObject.getBigDecimal("entrytaxrate"));//税率%
object.set("curtaxprice", dynamicObject.getBigDecimal("curtaxprice"));//当前含税单价
object.set("currentprice", dynamicObject.getBigDecimal("currentprice"));//当前单价
object.set("currentamt", dynamicObject.getBigDecimal("currentamt"));//当前
object.set("currenttaxamt", dynamicObject.getBigDecimal("currenttaxamt"));//当前税额
object.set("currentoftax", dynamicObject.getBigDecimal("currentoftax"));//当前价税合计
object.set("preqty", dynamicObject.getBigDecimal("preqty"));//期初累计计量数量
object.set("preamout", dynamicObject.getBigDecimal("preamout"));//期初累计计量金额
object.set("thisqty", dynamicObject.getBigDecimal("thisqty"));//本期计量数量
object.set("thisamount", dynamicObject.getBigDecimal("thisamount"));//本期计量不含
object.set("thistax", dynamicObject.getBigDecimal("thistax"));//本期税额
object.set("thisoftaxmount", dynamicObject.getBigDecimal("thisoftaxmount"));//本期计量含税金额
object.set("lstqty", dynamicObject.getBigDecimal("lstqty"));//期末累计计量数量
object.set("lstamount", dynamicObject.getBigDecimal("lstamount"));//期末累计计量不含税金额
object.set("listca", dynamicObject.getDynamicObject("listca"));//成本科目
object.set("listcbs", dynamicObject.getDynamicObject("listcbs"));//成本分解结构
object.set("listboq", dynamicObject.getDynamicObject("listboq"));//工程量清单
object.set("desc", dynamicObject.getString("desc"));//说明
for (DynamicObject listmodelEntry : listmodelentry) {
String id = listmodelEntry.getString("id");
if (set.contains(id)) {
continue;
}
DynamicObject addNew = listmodelentrys.addNew();
addNew.set("modelname", listmodelEntry.getString("modelname"));//清单模板名称
addNew.set("cmptype", listmodelEntry.getString("cmptype"));//文本
addNew.set("totalamount", listmodelEntry.getBigDecimal("totalamount"));//税额
addNew.set("totaltax", listmodelEntry.getBigDecimal("totaltax"));//税额
addNew.set("totaloftaxamount", listmodelEntry.getBigDecimal("totaloftaxamount"));//价税合计
addNew.set("listmodelid", listmodelEntry.getLong(("listmodelid")));//清单模板id
addNew.set("zcgj_jldenrtyid", id);//计量单分录id
DynamicObjectCollection listEntry = addNew.getDynamicObjectCollection("listentry");//结算分录
DynamicObjectCollection measureEntry = listmodelEntry.getDynamicObjectCollection("listentry");//计量分录
for (DynamicObject dynamicObject : measureEntry) {
DynamicObject object = listEntry.addNew();
object.set("listing", dynamicObject.getDynamicObject("listing"));//清单编码
object.set("listingname", dynamicObject.getString("listingname"));//清单名称
object.set("materiel", dynamicObject.getDynamicObject("materiel"));//物料编码
object.set("resourceitem", dynamicObject.getDynamicObject("listing"));//资源编码
object.set("resname", dynamicObject.getString("resname"));//资源名称
object.set("boqnumber", dynamicObject.getDynamicObject("boqnumber"));//工程量清单编码
object.set("contlistnumber", dynamicObject.getDynamicObject("contlistnumber"));//
object.set("measureunit", dynamicObject.getDynamicObject("measureunit"));//计量单位
object.set("totalqty", dynamicObject.getBigDecimal("totalqty"));//总数量
object.set("entrytaxrate", dynamicObject.getBigDecimal("entrytaxrate"));//税率%
object.set("curtaxprice", dynamicObject.getBigDecimal("curtaxprice"));//当前含税单价
object.set("currentprice", dynamicObject.getBigDecimal("currentprice"));//当前单价
object.set("currentamt", dynamicObject.getBigDecimal("currentamt"));//当前金额
object.set("currenttaxamt", dynamicObject.getBigDecimal("currenttaxamt"));//当前
object.set("currentoftax", dynamicObject.getBigDecimal("currentoftax"));//当前价税合计
object.set("preqty", dynamicObject.getBigDecimal("preqty"));//期初累计计量数量
object.set("preamout", dynamicObject.getBigDecimal("preamout"));//期初累计计量金额
object.set("thisqty", dynamicObject.getBigDecimal("thisqty"));//本期计量数量
object.set("thisamount", dynamicObject.getBigDecimal("thisamount"));//本期计量不含税金额
object.set("thistax", dynamicObject.getBigDecimal("thistax"));//本期税额
object.set("thisoftaxmount", dynamicObject.getBigDecimal("thisoftaxmount"));//本期计量含
object.set("lstqty", dynamicObject.getBigDecimal("lstqty"));//期末累计计量数量
object.set("lstamount", dynamicObject.getBigDecimal("lstamount"));//期末累计计量不含税金额
object.set("listca", dynamicObject.getDynamicObject("listca"));//成本科目
object.set("listcbs", dynamicObject.getDynamicObject("listcbs"));//成本分解结构
object.set("listboq", dynamicObject.getDynamicObject("listboq"));//工程量清单
object.set("desc", dynamicObject.getString("desc"));//说明
}
}
}
}

View File

@ -25,8 +25,8 @@ public class PaymentApplyFundExtOp extends PaymentApplyFundOp {
// 删除标品校验器
validators.removeIf(validator -> validator instanceof PaymentMaxAmountValidator);
validators.removeIf(validator -> validator instanceof PaymentTypeValidator);
// 添加定制二开的校验器位置放第一位优先执行
validators.add(0, new PaymentMaxAmountExtValidator());
// 添加定制二开的校验器位置放第一位优先执行 不需要产品校验自定义开发校验
//validators.add(0, new PaymentMaxAmountExtValidator());
}
}

View File

@ -27,7 +27,8 @@ public class PaymentMaxAmountExtValidator extends PaymentMaxAmountValidator {
if(contractObj!=null)
{
String zcgjPricetype = contractObj.getString("zcgj_pricetype");
if(!"bdlbdj".equals(zcgjPricetype)){ //如果支出合同计价方式为不定量不定价时则移除校验
//if(!"bdlbdj".equals(zcgjPricetype)){ //如果支出合同计价方式为不定量不定价时则移除校验
//20250318 全放开后续在增加特定逻辑校验
BigDecimal maxShouldPayAmount = this.calculateMaxShouldPayAmount(contract);
DynamicObject contCurrency = contract.getDynamicObject("currency");
if (contCurrency != null) {
@ -44,10 +45,10 @@ public class PaymentMaxAmountExtValidator extends PaymentMaxAmountValidator {
} else if (maxShouldPayAmount.compareTo(curMaxShouldPayAmount) != 0) {
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同付款信息:第%s行因暂存期间存在其他单据提交审核导致应付金额上限发生变化本单数据未刷新继续提交将超过应付金额上限。", "PaymentMaxAmountValidator_1", "ec-contract-opplugin", new Object[0]), i + 1));
} else {
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同付款信息:第%s行本次应付金额不允许超应付金额上限请确认。", "PaymentMaxAmountValidator_2", "ec-contract-opplugin", new Object[0]), i + 1));
//this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同付款信息:第%s行本次应付金额不允许超应付金额上限请确认。", "PaymentMaxAmountValidator_2", "ec-contract-opplugin", new Object[0]), i + 1));
}
}
}
//}
}
}
@ -58,9 +59,9 @@ public class PaymentMaxAmountExtValidator extends PaymentMaxAmountValidator {
DynamicObject contractObj = BusinessDataServiceHelper.loadSingle("ec_out_contract", "id,zcgj_pricetype", new QFilter[]{contractIdFilter});
if(contractObj!=null){
String zcgjPricetype = contractObj.getString("zcgj_pricetype");
if(!"bdlbdj".equals(zcgjPricetype)){ //如果支出合同计价方式为不定量不定价时则移除校验
super.maxApplyAmountValidate( shouldPayAmountMap, deductionAmountMap, contractTypeApplyAmountMap, appliedAmountMap, appliedBillMap, dataEntity, i, entry, contract, type, key);
}
//if(!"bdlbdj".equals(zcgjPricetype)){ //如果支出合同计价方式为不定量不定价时则移除校验
// super.maxApplyAmountValidate( shouldPayAmountMap, deductionAmountMap, contractTypeApplyAmountMap, appliedAmountMap, appliedBillMap, dataEntity, i, entry, contract, type, key);
//}
}
}