行政组织接口增加字段;清账接口问题处理

This commit is contained in:
yuxueliang0813 2025-04-21 13:23:29 +08:00
parent 3aea51e7bd
commit e433a31c33
9 changed files with 239 additions and 28 deletions

View File

@ -31,20 +31,20 @@ public class ClearBillListPlugin extends AbstractListPlugin implements Plugin {
@Override
public void itemClick(ItemClickEvent evt) {
super.itemClick(evt);
// try {
// if ("shjh_unclearacctount".equals(evt.getItemKey())) {
// //点击反清账按钮
// FormShowParameter showParameter = createParam(evt.getItemKey(),unClearFormID);
// this.getView().showForm(showParameter);
// }else if("shjh_changestatus".equals(evt.getItemKey())){
// //点击修改清账单状态按钮
try {
if ("shjh_unclearacctount".equals(evt.getItemKey())) {
//点击反清账按钮
FormShowParameter showParameter = createParam(evt.getItemKey(),unClearFormID);
this.getView().showForm(showParameter);
}else if("shjh_changestatus".equals(evt.getItemKey())){
//点击修改清账单状态按钮
// FormShowParameter showParameter = createParam(evt.getItemKey(),updateStatusFormID);
// this.getView().showForm(showParameter);
// }
// } catch (Exception e) {
// logger.error("按钮处理异常:"+e.getMessage());
// this.getView().showMessage("按钮处理异常"+e.getMessage());
// }
}
} catch (Exception e) {
logger.error("按钮处理异常:"+e.getMessage());
this.getView().showMessage("按钮处理异常"+e.getMessage());
}
}
@Override

View File

@ -18,24 +18,21 @@ import java.util.EventObject;
*/
public class ClearDetailBillListPlugin extends AbstractListPlugin implements Plugin {
private boolean isArRole = false;//是否属于应收组
private static final String entityName = "bos_usergroupstaff";//用户组职员关系 T_SEC_UserGroupStaff
@Override
public void setFilter(SetFilterEvent e) {
//设置过滤条件单据创建人等于当前操作人如果当前操作人是应收老师则不用此过滤
super.setFilter(e);
if(!isArRole){
if(!getArRole()){
e.getQFilters().add(new QFilter("creator.id", QCP.equals, RequestContext.get().getCurrUserId()));
}
}
private void setArRole(){
private boolean getArRole(){
//如果是全功能用户返回true
if(PermissionServiceHelper.isSuperUser(RequestContext.get().getCurrUserId())){
isArRole = true;
return;
return true;
}
// PermissionServiceHelper.getUsersByRoleNum("source_quality_DJ");//根据角色编号查找下属所有用户
// Set<String> roles = PermissionServiceHelper.getRolesByUser(RequestContext.get().getCurrUserId());//根据用户ID查找所属角色集合
@ -51,10 +48,10 @@ public class ClearDetailBillListPlugin extends AbstractListPlugin implements Plu
for (DynamicObject ddo : ddos) {
groupinfo = ddo.getDynamicObject("usergroup");
if("应收组".equals(groupinfo.getString("name"))){
isArRole = true;
break;
return true;
}
}
return false;
}
@Override
@ -67,6 +64,5 @@ public class ClearDetailBillListPlugin extends AbstractListPlugin implements Plu
public void afterCreateNewData(EventObject e) {
//界面初始化新建数据包完毕后触发此事件刷新按钮不会触发
super.afterCreateNewData(e);
setArRole();
}
}

View File

@ -380,6 +380,7 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
detailinfo.set("shjh_recebillno", prinfo.getString("shjh_recebillno"));//收款单编号
detailinfo.set("shjh_recepzh", prinfo.getString("shjh_recepzh"));//收款单凭证号
detailinfo.set("shjh_receamount", prinfo.getBigDecimal("shjh_receamount"));//收款金额
detailinfo.set("shjh_unclaimamount", prinfo.getBigDecimal("shjh_unclaimamount"));//未清金额 = 清账单未认领收款金额
detailinfo.set("billstatus", "A");//单据状态-暂存
detailinfo.set("shjh_clearstatus", "B");//清账状态-待清账
detailinfo.set("creator", userinfo);//创建人
@ -424,6 +425,10 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(prinfo.getDate("shjh_uncleardate"));
addFilterCondition(IT_LIST, "BUDAT", datestr, datestr);
}else{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(new Date());
addFilterCondition(IT_LIST, "BUDAT", datestr, datestr);
}
JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno"));
@ -449,7 +454,7 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
//调用SAP反清账接口更新清账单中反清状态和反清凭证号
fqzpzh = sapReversalVoucher(prinfo);
if (fqzpzh == null) {
addErrorInfo(prinfo,"反清账失败原因是未获取到SAP反清凭证号");
addErrorInfo(prinfo,"反清账失败原因是未获取到SAP反清结果,请查看接口日志");
continue;
}
//若SAP反清成功清账单单据状态=作废清账状态=反清账反写反清账凭证号
@ -518,7 +523,8 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
String isoCode = prinfo.getDynamicObject("shjh_currency").getString("number");
IS_HEADER.put("WAERS",JhzjUtils.getCurrencyCode(isoCode));//币种
IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位
IS_HEADER.put("BKTXT",customerinfo.getString("name"));//凭证抬头文本 习惯传 供应商||客户名称
// IS_HEADER.put("BKTXT",customerinfo.getString("name"));//凭证抬头文本 习惯传 供应商||客户名称
IS_HEADER.put("BKTXT","上海禾诗家化妆品有限公司");// -- 仅测试
//添加用户名过滤条件-操作审核按钮的用户OA用户名
DynamicObject userinfo = BusinessDataServiceHelper.loadSingleFromCache(RequestContext.get().getCurrUserId(), userName);
String oauser = userinfo.getString("shjh_oauser");

View File

@ -57,6 +57,10 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp
e.setCancelMessage(billno+"【未清金额】+【账扣】+【尾差】≥【本次核销金额合计】,【本次核销金额合计】-【账扣】-【尾差】>=0才允许提交");
e.setCancel(true);
}
if(checkEntryAmount(prinfo)){
e.setCancelMessage(billno+"分录本次核销金额的合计等于0负数金额合计的绝对值小于等于未清金额才允许提交");
e.setCancel(true);
}
//判断对应的清账单是否已提交如果是则不允许提交此明细单
clearBillInfo = BusinessDataServiceHelper.loadSingle(prinfo.getString("shjh_clearbillid"),clearBillName,"id,billno,billstatus");
if("B".equals(clearBillInfo.getString("billstatus"))){
@ -93,12 +97,35 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp
}
}
private boolean checkEntryAmount(DynamicObject prinfo){
//校验分录本次核销金额的合计等于0 负数金额相加部分的绝对值不能大于未清金额
BigDecimal entrytotal = BigDecimal.ZERO;
BigDecimal entrynegatetotal = BigDecimal.ZERO;
DynamicObjectCollection doc = prinfo.getDynamicObjectCollection("shjh_details");//获取分录
for (int i = 0; i < doc.size(); i++) {
if(doc.get(i).getBigDecimal("shjh_e_cursettle") != null){
entrytotal = entrytotal.add(doc.get(i).getBigDecimal("shjh_e_cursettle"));//累计分录本次核销金额
if(doc.get(i).getBigDecimal("shjh_e_cursettle").signum() == -1){
entrynegatetotal = entrynegatetotal.add(doc.get(i).getBigDecimal("shjh_e_cursettle"));
}
}
}
if(entrytotal.signum() != 0){
return true;
}
BigDecimal a1 = prinfo.getBigDecimal("shjh_unclaimamount");//未清金额
if(entrynegatetotal.abs().compareTo(a1) > 0){
return true;
}
return false;
}
private boolean checkAmount(DynamicObject prinfo){
//未清金额+账扣金额+尾差金额本次核销金额合计
BigDecimal billtotal = BigDecimal.ZERO;
BigDecimal a1 = prinfo.getBigDecimal("shjh_unclaimamount");
BigDecimal a2 = prinfo.getBigDecimal("shjh_deductionamount");
BigDecimal a3 = prinfo.getBigDecimal("shjh_diffamount");
BigDecimal a1 = prinfo.getBigDecimal("shjh_unclaimamount");//未清金额
BigDecimal a2 = prinfo.getBigDecimal("shjh_deductionamount");//账扣金额
BigDecimal a3 = prinfo.getBigDecimal("shjh_diffamount");//尾差金额
if(a1 != null){
billtotal = billtotal.add(a1);
}

View File

@ -12,6 +12,8 @@ import kd.bos.entity.operate.result.OperateErrorInfo;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.entity.plugin.args.BeforeOperationArgs;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -34,6 +36,8 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
private static final String userName = "bos_user";//用户
private static final String voucherName = "gl_voucher";//凭证
private final static Log logger = LogFactory.getLog(RevenueBillOperation.class);
@Override
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
@ -84,7 +88,7 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
}else if(sapReturnData != null){
addErrorInfo(prinfo,"推送SAP接口失败"+sapReturnData.getString("msg"));
}else{
addErrorInfo(prinfo,"推送SAP接口失败SAP返回值为空");
addErrorInfo(prinfo,"推送SAP接口失败SAP返回值为空;或者金蝶凭证未审核,请检查");
}
}
}
@ -110,9 +114,11 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
String oauser = userinfo.getString("shjh_oauser");
IS_HEADER.put("USNAM",oauser);//用户名
//----------------处理详细入参--TODO 获取对应凭证--------------------
QFilter voucherFilters = new QFilter("sourcebill", QCP.equals, prinfo.getPkValue());//凭证源单ID为预提单
voucherFilters.and(new QFilter("billstatus",QCP.equals,"C"));//凭证状态已审核
DynamicObject gl_voucher = BusinessDataServiceHelper.loadSingle(voucherName,
"id,sourcebill,entries,entries.account,entries.debitlocal,entries.creditlocal,entries.entrydc",
new QFilter("sourcebill", QCP.equals, prinfo.getPkValue()).toArray());
voucherFilters.toArray());
if (null != gl_voucher) {
DynamicObjectCollection entries = gl_voucher.getDynamicObjectCollection("entries");
if (!entries.isEmpty()) {
@ -143,6 +149,10 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
IT_ITEM.add(item);
}
}
}else{
String billNo = prinfo.getString("billno");
logger.error("无法获取预提记账处理单[" + billNo + "]关联的凭证信息,凭证不存在或未审核");
return null;
}
//组装参数调用推送sap凭证接口
JSONObject sapReturnData = SapUtils.sapTransactionAPI(IS_HEADER,IT_ITEM,null,prinfo.getString("billno"));

View File

@ -0,0 +1,51 @@
package shjh.jhzj7.fi.fi.plugin.operate;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.BeforeOperationArgs;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;
public class VoucherBillOperation extends AbstractOperationServicePlugIn implements Plugin {
private static final String recbillName = "cas_recbill";//收款单
private static final String paybillName = "cas_paybill";//付款单
private static final String intbillName = "cim_intbill_revenue";//预提记账处理单
@Override
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
super.beforeExecuteOperationTransaction(e);
String eok = e.getOperationKey();
if("unaudit".equals(eok)){
DynamicObject[] dos = e.getDataEntities();
long sourcebillid;
String sourcebilltype;
DynamicObject bizbillinfo;
for (DynamicObject pzinfo : dos) {
sourcebillid = pzinfo.getLong("sourcebill");
sourcebilltype = pzinfo.getDynamicObject("sourcebilltype").getString("number");
if(recbillName.equals(sourcebilltype)){
bizbillinfo = BusinessDataServiceHelper.loadSingle(sourcebillid,recbillName,"id,billno,shjh_ispushsap");
if(bizbillinfo.getBoolean("shjh_ispushsap")){
e.setCancelMessage(pzinfo.getString("billno")+"对应的收款单"+bizbillinfo.getString("billno")+"已推送SAP不允许反审核");
e.setCancel(true);
}
}else if(paybillName.equals(sourcebilltype)){
bizbillinfo = BusinessDataServiceHelper.loadSingle(sourcebillid,paybillName,"id,billno,shjh_ispushsap");
if(bizbillinfo.getBoolean("shjh_ispushsap")){
e.setCancelMessage(pzinfo.getString("billno")+"对应的付款单"+bizbillinfo.getString("billno")+"已推送SAP不允许反审核");
e.setCancel(true);
}
}else if(intbillName.equals(sourcebilltype)){
bizbillinfo = BusinessDataServiceHelper.loadSingle(sourcebillid,intbillName,"id,billno,shjh_sendsap");
if(bizbillinfo.getBoolean("shjh_sendsap")){
e.setCancelMessage(pzinfo.getString("billno")+"对应的预提记账处理单"+bizbillinfo.getString("billno")+"已推送SAP不允许反审核");
e.setCancel(true);
}
}
}
}
}
}

View File

@ -298,6 +298,13 @@ public class FundPlanPaymentTask extends AbstractTask implements Plugin {
notsuppFlag = getDOOutFlag(pzbinfo,"shjh_bbhgys",sapresult.getString(""));//不包含供应商
notorgFlag = getDOOutFlag(pzbinfo,"shjh_bbhzz",sapresult.getString(""));//不包含公司
getBooleanFlag(pzbinfo,"shjh_czl",sapresult.getString(""));//是否充值类
getBooleanFlag(pzbinfo,"shjh_zxcg",sapresult.getString(""));//是否自行采购
getBooleanFlag(pzbinfo,"shjh_poisnull",sapresult.getString(""));//PO号是否为空
getInTextFlag(pzbinfo,"shjh_billtype",sapresult.getString(""));//包含的单据类型
getOutTextFlag(pzbinfo,"shjh_bbhdjlx",sapresult.getString(""));//不包含的单据类型
}
return null;

View File

@ -134,6 +134,18 @@ public class AdminOrgControler {
propertyMap.put("shjh_ssgs", company);//设置所属公司编号
propertyMap.put("shjh_deptmanager", person_charge);//设置部门负责人编号
//-------------设置IT测试过程中提出的增加10个字段问题----------------------
propertyMap.put("shjh_threemanager", json_body.getString("threeManager"));
propertyMap.put("shjh_fourmanager", json_body.getString("fourManager"));
propertyMap.put("shjh_fivemanager", json_body.getString("fiveManager"));
propertyMap.put("shjh_matrixleader", json_body.getString("matrixLeader"));
propertyMap.put("shjh_bp1", json_body.getString("bp1"));
propertyMap.put("shjh_bp2", json_body.getString("bp2"));
propertyMap.put("shjh_bp3", json_body.getString("bp3"));
propertyMap.put("shjh_bp4", json_body.getString("bp4"));
propertyMap.put("shjh_bp5", json_body.getString("bp5"));
propertyMap.put("shjh_bp6", json_body.getString("bp6"));
//处理禁用组织
if("0".equals(json_body.getString("status"))){
propertyMap.put("enable", "0");

View File

@ -48,6 +48,108 @@ public class AdminOrgModel implements Serializable {
@ApiParam(value="简称",position=9)
private String deptshortname;
@ApiParam(value="三级部门负责人",position=10)
private String threeManager;
@ApiParam(value="四级部门负责人",position=11)
private String fourManager;
@ApiParam(value="五级部门负责人",position=12)
private String fiveManager;
@ApiParam(value="矩阵管理部门分管领导",position=13)
private String matrixLeader;
@ApiParam(value="财务BP1",position=14)
private String bp1;
@ApiParam(value="财务BP2",position=15)
private String bp2;
@ApiParam(value="财务BP3",position=16)
private String bp3;
@ApiParam(value="财务BP4",position=17)
private String bp4;
@ApiParam(value="财务BP5",position=18)
private String bp5;
@ApiParam(value="财务BP6",position=19)
private String bp6;
public String getThreeManager() {
return threeManager;
}
public void setThreeManager(String threeManager) {
this.threeManager = threeManager;
}
public String getFourManager() {
return fourManager;
}
public void setFourManager(String fourManager) {
this.fourManager = fourManager;
}
public String getFiveManager() {
return fiveManager;
}
public void setFiveManager(String fiveManager) {
this.fiveManager = fiveManager;
}
public String getMatrixLeader() {
return matrixLeader;
}
public void setMatrixLeader(String matrixLeader) {
this.matrixLeader = matrixLeader;
}
public String getBp1() {
return bp1;
}
public void setBp1(String bp1) {
this.bp1 = bp1;
}
public String getBp2() {
return bp2;
}
public void setBp2(String bp2) {
this.bp2 = bp2;
}
public String getBp3() {
return bp3;
}
public void setBp3(String bp3) {
this.bp3 = bp3;
}
public String getBp4() {
return bp4;
}
public void setBp4(String bp4) {
this.bp4 = bp4;
}
public String getBp5() {
return bp5;
}
public void setBp5(String bp5) {
this.bp5 = bp5;
}
public String getBp6() {
return bp6;
}
public void setBp6(String bp6) {
this.bp6 = bp6;
}
public void setCode(String code) {
this.code = code;
}