Commit a1fd9fd7 authored by 鲁鑫's avatar 鲁鑫

客户延迟付款申请流程

parent a4d6a480
var gridManager = null;
$(document).ready(function () {
initialize();
loadGrid();
bindEvent();
});
function initialize(){
UICtrl.layout("#layout", {leftWidth: 3});
if (!isApplyProcUnit()){
$("#button").hide()
}
}
function doQuery() {
if (Public.isBlank($("#bukrs").val())){
Public.tip("请选择公司代码");
return false
}
if (Public.isBlank($("#customer").val())){
Public.tip("请选择客户名称");
return false
}
gridManager.loadData();
}
function doClear(){
$('#bukrs').val("");
$('#bukrsName').val("");
$('#customer').val("");
$('#name').val("");
}
function bindEvent(){
$('#bukrsName').searchbox({
type: "system", name: "dictionary",
getParam: function (item) {
return {fieldName: "BUKRS"}
},
onChange: function (value, data) {
$('#bukrs').val(data.BUKRS);
$('#bukrsName').val(data.BUTXT);
var _grid=UICtrl.getGridManager('#maingrid');
_grid.options.parms.bukrs = data.BUKRS;
}
});
$('#name').searchbox({
type: "system", name: "getCusAndSuppliers",
getParam: function (item) {
if (Public.isBlank($("#bukrs").val())){
Public.tip("请先选择公司名称");
return false
}
return {
ZEP_BPTYPE: 'D',
BUKRS: $("#bukrs").val()
}
},
onChange: function (value, data) {
$('#customer').val(data.PARTNER);
$('#name').val(data.NAME_ORG1);
var _grid=UICtrl.getGridManager('#maingrid');
_grid.options.parms.customer = data.PARTNER;
}
});
$('input[name="xblock"]').change(function () {
var _grid=UICtrl.getGridManager('#maingrid');
if ($(this).is(':checked')) {
_grid.options.parms.xblock = 'X';
}else {
_grid.options.parms.xblock = '';
}
});
}
function loadGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
});
gridManager = UICtrl.grid("#maingrid", {
columns: getGridColumns(),
dataAction: "server",
url: web_app.name + '/customerDelayPay/queryCustomerDelayPayItems.ajax',
pageSize: 50,
usePager: true,
parms: {
customerDelayPayId:getId(),
bukrs: $("#bukrs").val(),
customer: $("#customer").val(),
xblock: $("#xblock").val()
},
toolbar: toolbarOptions,
enabledEdit: false,
width: "100%",
height: "95%",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
});
UICtrl.setSearchAreaToggle(gridManager);
}
function getGridColumns(){
var columns=[];
columns.push({
display: "到期日期", name: "netdt", width: 150, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "延期次数", name: "zextnd", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "公司代码", name: "compCode", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "客户编号", name: "customer", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "名称", name: "name", width: 200, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "抬头文本/增值税发票号", name: "bktxt", width: 200, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "付款参考 /请款单号", name: "kidno", width: 140, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "催款层次", name: "dunnLevel", width: 150, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "上次催款日期", name: "lastDunn", width: 150, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "会计年度", name: "fiscYear", width: 150, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "会计期间", name: "fisPeriod", width: 150, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "凭证编号", name: "docNo", width: 200, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "行项目号", name: "itemNum", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "凭证日期", name: "docDate", width: 150, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "交易金额", name: "amtDoccur", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "交易货币", name: "currency", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "本币金额", name: "lcAmount", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "本币", name: "locCurrcy", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "项目文本", name: "itemText", width: 200, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "付款条件代码", name: "pmnttrms", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "起算日期", name: "blineDate", width: 150, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "扣单应收项次", name: "xblock", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "账期", name: "zbd1t", width: 100, minWidth: 60, type: "string", align: "left",
},)
columns.push({
display: "到期天数", name: "dsctDays1", width: 100, minWidth: 60, type: "string", align: "left",
},)
return columns;
}
/**
* 流程引擎回调设置打样的id
* @param value 打样申请的id
*/
function setId(id) {
$("#id").val(id);
var _grid=UICtrl.getGridManager('#maingrid');
_grid.options.parms.customerDelayPayId = id;
}
/**
* 流程引擎获取id的回掉方法。
* @return id
*/
function getId() {
return $("#id").val() || "";
}
function reloadGrid() {
gridManager.loadData();
}
function getExtendedData(processAction) {
//回退、打回、转交时,不需要验证必填项是否已经填写;
if (processAction == ProcessAction.BACK
|| processAction == ProcessAction.REPLENISH
|| processAction == ProcessAction.TRANSMIT) {
//不验证
$('#submitForm').attr('check', false);
}
var extendedData = {};
var _grid = UICtrl.getGridManager('#maingrid');
if (_grid) {
// var datas = DataUtil.getGridData({
// gridManager: _grid,
// isAllData: true
// });
var datas = gridManager.getSelectedRows();
if (!datas) {
return;
}
if (!datas) {
return false;
}
extendedData.items = Public.encodeJSONURI(datas);
}
return extendedData;
}
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<x:base include="layout,dialog,grid,tree,combox,commonTree,date"/>
<x:script src='/biz/topsun/sap/customerDelayPay/customerDelayPayDetail.js'/>
</head>
<x:billTitle title="客户延期付款申请" needStatus="false" needPerson="true"/>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="id"/>
<x:hidden name="billCode"/>
<x:hidden name="fillinDate" type="datetime"/>
<x:hidden name="fullId"/>
<x:hidden name="organId"/>
<x:hidden name="organName"/>
<x:hidden name="deptId"/>
<x:hidden name="deptName"/>
<x:hidden name="positionId"/>
<x:hidden name="positionName"/>
<x:hidden name="personMemberId"/>
<x:hidden name="personMemberName"/>
<x:hidden name="statusId"/>
<div class="hg-form-cols">
<div class="hg-form-row">
<x:hidden name="bukrs"/>
<x:inputC name="bukrsName" required="true" label="公司名称" labelCol="2" fieldCol="2" wrapper="select"/>
<x:hidden name="customer"/>
<x:inputC name="name" required="true" label="客户名称" labelCol="2" fieldCol="2" wrapper="select"/>
<x:checkboxListC name="xblock" required="false" label="仅显示扣单应收项次" labelCol="2" fieldCol="2" dictionary="xblock"/>
</div>
<div class="hg-form-row">
<x:inputC name="payDate" required="false" label="客户承诺付款时间" labelCol="2" fieldCol="2" wrapper="date"/>
<div id="button">
<x:button value="查 询" icon="fa-search" onclick="doQuery(this.form)"/>&nbsp;&nbsp;
<x:button value="重 置" icon="fa-history" onclick="doClear()"/>
</div>
</div>
</div>
<div class="blank_div clearfix"></div>
<div id="maingrid" style="margin: 2px;">
</div>
</form>
</body>
</html>
var gridManager = null;
$(document).ready(function () {
initUI();
loadGrid();
})
function initUI() {
UICtrl.initDefaultLayout();
}
function loadGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: addHandler,
});
gridManager = UICtrl.grid("#maingrid", {
columns: [
{display: "单据编号", name: "billCode", width: 150, minWidth: 60, type: "string", align: "left"},
{display: "创建日期", name: "fillinDate", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "申请人", name: "personMemberName", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "申请部门", name: "deptName", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "公司代码", name: "bukrsName", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "客户编码描述", name: "kunnrName", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "扣单应收项次", name: "xblock", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "收款方式", name: "paymentMethodTextView", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "客户承诺付款时间", name: "payDate", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "状态", name: "statusTextView", width: 200, minWidth: 60, type: "string", align: "left"},
],
dataAction: "server",
url: web_app.name + '/customerDelayPay/slicedCustomerDelayPayList.ajax',
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
width: "100%",
height: "100%",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
onDblClickRow: function (data, rowindex, rowobj) {
doView(data.id);
},
});
UICtrl.setSearchAreaToggle(gridManager);
}
function query(obj) {
var param = $(obj).formToJSON();
UICtrl.gridSearch(gridManager, param);
}
function reloadGrid() {
gridManager.loadData();
}
function resetForm(obj) {
$(obj).formClean();
}
function addHandler() {
UICtrl.addTabItem({
tabid: 'customerDelayPay',
text: "新增客户延期付款申请",
url: web_app.name + '/customerDelayPay/forwardCustomerDelayPayDetail.job'
});
}
function doView(id) {
UICtrl.addTabItem({
tabid: 'customerDelayPay'+id,
text: "查看客户延期付款申请",
url: web_app.name + '/customerDelayPay/showCustomerDelayPayDetail.job?bizId='+id+"&isReadOnly=true"
});
}
<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ taglib uri="/WEB-INF/taglib.tld" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<x:base include="layout,dialog,grid,tree,combox,commonTree"/>
<x:script src='/biz/topsun/sap/customerDelayPay/customerDelayPayList.js'/>
</head>
<body>
<div class="container-fluid">
<div class="ui-hide">
</div>
<div id="layout">
<div position="center" title="客户延期付款申请">
<x:title title="common.button.search" hideTable="queryMainForm" isHide="true"/>
<form class="hg-form ui-hide" method="post" action="" id="queryMainForm">
<x:inputC name="billCode" required="false" label="申请单号" labelCol="1"/>
<x:searchButtons/>
</form>
<div class="blank_div clearfix"></div>
<div id="maingrid" style="margin: 2px;"></div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
package com.huigou.topsun.sap.customerDelayPay.application;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPay;
import com.huigou.topsun.sap.customerDelayPay.domain.query.CustomerDelayPayQueryRequest;
import java.util.Map;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:49
* @Description:
*/
public interface CustomerDelayPayApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/sap/customerDelayPay/customerDelayPay.xml";
String PROCESS_DEFINITION_KEY = "customerDelayPayProc";
CustomerDelayPay findCustomerDelayPayById(String id);
CustomerDelayPay saveCustomerDelayPay(CustomerDelayPay customerDelayPay);
Map<String, Object> slicedCustomerDelayPayList(CustomerDelayPayQueryRequest queryRequest);
}
package com.huigou.topsun.sap.customerDelayPay.application;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPayItem;
import com.huigou.topsun.sap.customerDelayPay.domain.query.CustomerDelayPayQueryRequest;
import com.huigou.topsun.sap.customerDelayPay.domain.query.SapCustomerDelayPayQueryVo;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:50
* @Description:
*/
public interface CustomerDelayPayItemApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/sap/customerDelayPay/customerDelayPay.xml";
void saveCustomerDelayPayItems(String customerDelayPayId, List<CustomerDelayPayItem> customerDelayPayItems);
Map<String,Object> queryCustomerDelayPayItems(CustomerDelayPayQueryRequest queryRequest);
void deleteByIds(List<String> ids);
List<CustomerDelayPayItem> queryCustomerDelayPayItemsFromSap(SapCustomerDelayPayQueryVo queryVo);
}
package com.huigou.topsun.sap.customerDelayPay.application.impl;
import com.huigou.data.domain.model.CommonDomainConstants;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayApplication;
import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayItemApplication;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPay;
import com.huigou.topsun.sap.customerDelayPay.domain.query.CustomerDelayPayQueryRequest;
import com.huigou.topsun.sap.customerDelayPay.repository.CustomerDelayPayRepository;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPay;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPayItem;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bpm.FlowBroker;
import com.huigou.util.ClassHelper;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:50
* @Description:
*/
@Service("customerDelayPayApplication")
public class CustomerDelayPayApplicationImpl extends FlowBroker implements CustomerDelayPayApplication {
@Autowired
private CustomerDelayPayRepository customerDelayPayRepository;
@Autowired
private CustomerDelayPayItemApplication customerDelayPayItemApplication;
@Override
public CustomerDelayPay findCustomerDelayPayById(String id) {
return customerDelayPayRepository.findOne(id);
}
@Override
public CustomerDelayPay saveCustomerDelayPay(CustomerDelayPay customerDelayPay) {
return customerDelayPayRepository.save(customerDelayPay);
}
@Override
public Map<String, Object> slicedCustomerDelayPayList(CustomerDelayPayQueryRequest queryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "customerDelayPay");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
Map<String, Object> map = this.sqlExecutorDao.executeSlicedQuery(queryModel);
return map;
}
@Override
protected String saveBizAndApprovalData() {
super.saveBizAndApprovalData();
CustomerDelayPay customerDelayPay = getBizEntity(CustomerDelayPay.class);
if (customerDelayPay.isNew()) {
customerDelayPay.setStatusId(BizBillStatus.APPLYING.getId());
} else {
customerDelayPay = (CustomerDelayPay) commonDomainService.loadAndFillinProperties(customerDelayPay);
}
customerDelayPay = customerDelayPayRepository.save(customerDelayPay);
List<CustomerDelayPayItem> customerDelayPayItems = getBizEntities(CustomerDelayPayItem.class, "items");
customerDelayPayItemApplication.saveCustomerDelayPayItems(customerDelayPay.getId(),customerDelayPayItems);
return customerDelayPay.getId();
}
@Override
protected Map<String, Object> getProcessBizParams(String bizId) {
// 返回业务数据给流程实例,
return ClassHelper.toMap(customerDelayPayRepository.getOne(bizId));
}
/**
* 任务完成前执行
*/
@Override
protected void onBeforeComplete(DelegateTask delegateTask) {
super.onBeforeComplete(delegateTask);
String bizId = delegateTask.getExecution().getProcessBusinessKey();
if (this.isApplyProcUnit(delegateTask) && this.getApprovalParameter().isAdvanceProcessAction()) {// 校验及预算
updateStatus(bizId, BizBillStatus.APPROVING);
}
}
@Transactional
protected void updateStatus(String bizId, BizBillStatus status) {
Assert.hasText(bizId, CommonDomainConstants.ID_NOT_BLANK);
this.commonDomainService.updateStatus(CustomerDelayPay.class, bizId, status.getId());
}
/**
* 流程撤销事件
**/
@Override
protected void onRecallProcessInstance(DelegateExecution delegateExecution) {
String bizId = delegateExecution.getProcessBusinessKey();
// 修改单据状态为申请
updateStatus(bizId, BizBillStatus.APPLYING);
}
/**
* 回收事件
**/
@Override
protected void onWithdraw(DelegateTask delegateTask, String destActivityId) {
super.onWithdraw(delegateTask, destActivityId);
String bizId = delegateTask.getExecution().getProcessBusinessKey();
if (destActivityId.equalsIgnoreCase("apply")) {
updateStatus(bizId, BizBillStatus.APPLYING);
}
}
@Override
protected void onEnd(DelegateExecution delegateExecution) {
super.onEnd(delegateExecution);
String bizId = delegateExecution.getProcessBusinessKey();
BizBillStatus status = approvePassed() ? BizBillStatus.COMPLETED : BizBillStatus.ABORTED;
CustomerDelayPay customerDelayPay = customerDelayPayRepository.findOne(bizId);
customerDelayPay.setStatusId(status.getId());
customerDelayPayRepository.save(customerDelayPay);
}
@Override
protected void onAbortProcessInstance(DelegateExecution delegateExecution) {
super.onAbortProcessInstance(delegateExecution);
String bizId = delegateExecution.getProcessBusinessKey();
CustomerDelayPay customerDelayPay = customerDelayPayRepository.findOne(bizId);
customerDelayPay.setStatusId(BizBillStatus.ABORTED.getId());
customerDelayPayRepository.save(customerDelayPay);
}
/**
* @param delegateTask
* @param destActivityId 回退到的目标节点id
*/
@Override
protected void onBack(DelegateTask delegateTask, String destActivityId) {
super.onBack(delegateTask, destActivityId);
if ("Apply".equalsIgnoreCase(destActivityId)) {
String bizId = delegateTask.getExecution().getProcessBusinessKey();
CustomerDelayPay customerDelayPay = customerDelayPayRepository.findOne(bizId);
customerDelayPay.setStatusId(BizBillStatus.APPLYING.getId());
customerDelayPayRepository.save(customerDelayPay);
}
}
}
package com.huigou.topsun.sap.customerDelayPay.application.impl;
import com.alibaba.fastjson.JSONObject;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.sap.common.HttpClient;
import com.huigou.topsun.sap.common.domain.SapResult;
import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayItemApplication;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPayItem;
import com.huigou.topsun.sap.customerDelayPay.domain.query.CustomerDelayPayQueryRequest;
import com.huigou.topsun.sap.customerDelayPay.domain.query.SapCustomerDelayPayQueryVo;
import com.huigou.topsun.sap.customerDelayPay.repository.CustomerDelayPayItemRepository;
import com.huigou.topsun.sap.customerDelayPay.vo.CustomerDelayPayItemVo;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import com.huigou.util.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:50
* @Description:
*/
@Service("customerDelayPayItemApplication")
public class CustomerDelayPayItemApplicationImpl extends BaseApplication implements CustomerDelayPayItemApplication {
@Autowired
private CustomerDelayPayItemRepository customerDelayPayItemRepository;
@Autowired
private HttpClient httpClient;
@Override
public void saveCustomerDelayPayItems(String customerDelayPayId, List<CustomerDelayPayItem> customerDelayPayItems) {
for (CustomerDelayPayItem customerDelayPayItem : customerDelayPayItems) {
customerDelayPayItem.setCustomerDelayPayId(customerDelayPayId);
customerDelayPayItemRepository.save(customerDelayPayItem);
}
}
@Override
public Map<String, Object> queryCustomerDelayPayItems(CustomerDelayPayQueryRequest queryRequest) {
List<CustomerDelayPayItem> customerDelayPayItems = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
if (StringUtil.isNotBlank(queryRequest.getCustomerDelayPayId())){
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "customerDelayPayItems");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
map = this.sqlExecutorDao.executeSlicedQuery(queryModel);
}else {
SapCustomerDelayPayQueryVo sapCustomerDelayPayQueryVo = new SapCustomerDelayPayQueryVo();
BeanUtils.copyProperties(queryRequest, sapCustomerDelayPayQueryVo);
customerDelayPayItems = this.queryCustomerDelayPayItemsFromSap(sapCustomerDelayPayQueryVo);
map.put("Rows",customerDelayPayItems);
map.put("Total",customerDelayPayItems.size());
map.put("page",1);
}
return map;
}
@Override
public void deleteByIds(List<String> ids) {
for (String id : ids) {
customerDelayPayItemRepository.delete(id);
}
}
@Override
public List<CustomerDelayPayItem> queryCustomerDelayPayItemsFromSap(SapCustomerDelayPayQueryVo queryVo) {
List<SapCustomerDelayPayQueryVo> queryVoList = new ArrayList<>();
queryVoList.add(queryVo);
List<CustomerDelayPayItem> customerDelayPayItemList = new ArrayList<>();
try {
String execute = httpClient.execute(queryVoList, "get_ar_due");
List<SapResult> sapResultList = JSONObject.parseArray(execute, SapResult.class);
if ("E".equals(sapResultList.get(0).getTYPE())){
return customerDelayPayItemList;
}
List<CustomerDelayPayItemVo> resultList = JSONObject.parseArray(execute, CustomerDelayPayItemVo.class);
if (!CollectionUtils.isEmpty(resultList)){
customerDelayPayItemList = resultList
.stream()
.map(customerDelayPayItemVo -> {
CustomerDelayPayItem customerDelayPayItem = new CustomerDelayPayItem();
BeanUtils.copyProperties(customerDelayPayItemVo,customerDelayPayItem);
return customerDelayPayItem;
}).collect(Collectors.toList());
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return customerDelayPayItemList;
}
}
package com.huigou.topsun.sap.customerDelayPay.controller;
import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayApplication;
import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayItemApplication;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPay;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPayItem;
import com.huigou.topsun.sap.customerDelayPay.domain.query.CustomerDelayPayQueryRequest;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:51
* @Description:
*/
@Controller
@ControllerMapping("/customerDelayPay")
public class CustomerDelayPayController extends CommonController {
@Override
protected String getPagePath() {
return "/biz/topsun/sap/customerDelayPay/";
}
@Autowired
private CustomerDelayPayApplication customerDelayPayApplication;
@Autowired
private CustomerDelayPayItemApplication customerDelayPayItemApplication;
public String forwardCustomerDelayPayList(){
return forward("customerDelayPayList");
}
public String slicedCustomerDelayPayList(){
SDO sdo = this.getSDO();
CustomerDelayPayQueryRequest queryRequest = sdo.toQueryRequest(CustomerDelayPayQueryRequest.class);
Map<String, Object> map = customerDelayPayApplication.slicedCustomerDelayPayList(queryRequest);
return toResult(map);
}
public String forwardCustomerDelayPayDetail(){
this.putAttribute("processDefinitionKey", CustomerDelayPayApplication.PROCESS_DEFINITION_KEY);
// 新增的时候procUnitId一定要设置成Apply,不然jsp页面的所有表单元素是readonly状态
this.putAttribute("procUnitId", "Apply");
CustomerDelayPay customerDelayPay = new CustomerDelayPay();
customerDelayPay.setStatusId(BizBillStatus.APPLYING.getId());
/**
* 设置jsp页面初始化填充数据,如果不设置, 那么在jsp页面上填写完表单之后立即提交申请TaskDescription获取不到时间和相关人员信息
*/
Operator operator = getOperator();
customerDelayPay.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName()));
return forward("customerDelayPayDetail",customerDelayPay);
}
public String showCustomerDelayPayDetail(){
SDO sdo = this.getSDO();
String id = sdo.getBizId();
CustomerDelayPay customerDelayPay = customerDelayPayApplication.findCustomerDelayPayById(id);
return forward("customerDelayPayDetail",customerDelayPay);
}
public String queryCustomerDelayPayItems(){
SDO sdo = this.getSDO();
CustomerDelayPayQueryRequest queryRequest = sdo.toQueryRequest(CustomerDelayPayQueryRequest.class);
Map<String,Object> map = customerDelayPayItemApplication.queryCustomerDelayPayItems(queryRequest);
return toResult(map);
}
public String deleteCustomerDelayPayItem(){
SDO sdo = this.getSDO();
List<String> ids = sdo.getIds();
customerDelayPayItemApplication.deleteByIds(ids);
return success();
}
}
package com.huigou.topsun.sap.customerDelayPay.domain;
import com.huigou.data.domain.model.FlowBillAbstractEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/11:40
* @Description: 客户延期付款申请
*/
@Table(name = "sap_customer_delay_pay")
@Entity
@Data
public class CustomerDelayPay extends FlowBillAbstractEntity {
/**
* 公司代码
*/
@Column(name = "BUKRS")
private String bukrs;
/**
* 公司代码描述
*/
@Column(name = "BUKRS_NAME")
private String bukrsName;
/**
* 客户编码
*/
@Column(name = "CUSTOMER")
private String customer;
/**
* 客户编码描述
*/
@Column(name = "NAME")
private String name;
/**
* 扣单应收项次
* (勾选传输X,不勾选留空)
*/
@Column(name = "XBLOCK")
private String xblock;
/**
* 客户承诺付款时间
*/
@Column(name = "PAY_DATE")
private Date payDate;
@Override
protected String getCodeRuleId() {
return "customerDelayPay";
}
}
package com.huigou.topsun.sap.customerDelayPay.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.huigou.data.domain.model.AbstractEntity;
import com.huigou.data.domain.model.FlowBillAbstractEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/11:40
* @Description: 客户延期付款申请明细
*/
@Table(name = "sap_customer_delay_pay_item")
@Entity
@Data
public class CustomerDelayPayItem extends AbstractEntity {
@Column(name = "customer_delay_pay_id")
private String customerDelayPayId;
/**
到期日期
*/
@Column(name = "NETDT")
private String netdt;
/**
* 延期次数
*/
@Column(name = "ZEXTND")
private String zextnd;
/**
* 公司代码
*/
@Column(name = "COMP_CODE")
private String compCode;
/**
* 客户编号
*/
@Column(name = "CUSTOMER")
private String customer;
/**
* 名称
*/
@Column(name = "NAME")
private String name;
/**
* 抬头文本/增值税发票号
*/
@Column(name = "BKTXT")
private String bktxt;
/**
* 付款参考 /请款单号
*/
@Column(name = "KIDNO")
private String kidno;
/**
* 催款层次
*/
@Column(name = "DUNN_LEVEL")
private String dunnLevel;
/**
* 上次催款日期
*/
@Column(name = "LAST_DUNN")
private String lastDunn;
/**
* 会计年度
*/
@Column(name = "FISC_YEAR")
private String fiscYear;
/**
* 会计期间
*/
@Column(name = "FIS_PERIOD")
private String fisPeriod;
/**
* 凭证编号
*/
@Column(name = "DOC_NO")
private String docNo;
/**
* 行项目号
*/
@Column(name = "ITEM_NUM")
private String itemNum;
/**
* 凭证日期
*/
@Column(name = "DOC_DATE")
private String docDate;
/**
* 交易金额
*/
@Column(name = "AMT_DOCCUR")
private String amtDoccur;
/**
* 交易货币
*/
@Column(name = "CURRENCY")
private String currency;
/**
* 本币金额
*/
@Column(name = "LC_AMOUNT")
private String lcAmount;
/**
* 本币
*/
@Column(name = "LOC_CURRCY")
private String locCurrcy;
/**
* 项目文本
*/
@Column(name = "ITEM_TEXT")
private String itemText;
/**
* 付款条件代码
*/
@Column(name = "PMNTTRMS")
private String pmnttrms;
/**
* 起算日期
*/
@Column(name = "BLINE_DATE")
private String blineDate;
/**
* 扣单应收项次
*/
@Column(name = "XBLOCK")
private String xblock;
/**
* 账期
*/
@Column(name = "ZBD1T")
private String zbd1t;
/**
* 到期天数
*/
@Column(name = "DSCT_DAYS1")
private String dsctDays1;
}
package com.huigou.topsun.sap.customerDelayPay.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
import lombok.Data;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:53
* @Description:
*/
@Data
public class CustomerDelayPayQueryRequest extends QueryAbstractRequest {
private String customerDelayPayId;
private String bukrs;
/**
* 客户编码
*/
private String customer;
/**
* 扣单应收项次
* (勾选传输X,不勾选留空)
*/
private String xblock;
}
package com.huigou.topsun.sap.customerDelayPay.domain.query;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/16:10
* @Description:
*/
@Data
public class SapCustomerDelayPayQueryVo implements Serializable {
@JsonProperty("BUKRS")
private String bukrs;
/**
* 客户编码
*/
@JsonProperty("KUNNR")
private String customer;
/**
* 扣单应收项次
* (勾选传输X,不勾选留空)
*/
@JsonProperty("XBLOCK")
private String xblock;
}
package com.huigou.topsun.sap.customerDelayPay.repository;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPayItem;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:49
* @Description:
*/
public interface CustomerDelayPayItemRepository extends JpaRepository<CustomerDelayPayItem,String> {
}
package com.huigou.topsun.sap.customerDelayPay.repository;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPay;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/14:48
* @Description:
*/
public interface CustomerDelayPayRepository extends JpaRepository<CustomerDelayPay,String> {
}
package com.huigou.topsun.sap.customerDelayPay.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.huigou.data.domain.model.AbstractEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/13/11:40
* @Description: 客户延期付款申请明细
*/
@Data
public class CustomerDelayPayItemVo implements Serializable {
/**
到期日期
*/
@JsonProperty("NETDT")
private String netdt;
/**
* 延期次数
*/
@JsonProperty("ZEXTND")
private String zextnd;
/**
* 公司代码
*/
@JsonProperty("COMP_CODE")
private String compCode;
/**
* 客户编号
*/
@JsonProperty("CUSTOMER")
private String customer;
/**
* 名称
*/
@JsonProperty("NAME")
private String name;
/**
* 抬头文本/增值税发票号
*/
@JsonProperty("BKTXT")
private String bktxt;
/**
* 付款参考 /请款单号
*/
@JsonProperty("KIDNO")
private String kidno;
/**
* 催款层次
*/
@JsonProperty("DUNN_LEVEL")
private String dunnLevel;
/**
* 上次催款日期
*/
@JsonProperty("LAST_DUNN")
private String lastDunn;
/**
* 会计年度
*/
@JsonProperty("FISC_YEAR")
private String fiscYear;
/**
* 会计期间
*/
@JsonProperty("FIS_PERIOD")
private String fisPeriod;
/**
* 凭证编号
*/
@JsonProperty("DOC_NO")
private String docNo;
/**
* 行项目号
*/
@JsonProperty("ITEM_NUM")
private String itemNum;
/**
* 凭证日期
*/
@JsonProperty("DOC_DATE")
private String docDate;
/**
* 交易金额
*/
@JsonProperty("AMT_DOCCUR")
private String amtDoccur;
/**
* 交易货币
*/
@JsonProperty("CURRENCY")
private String currency;
/**
* 本币金额
*/
@JsonProperty("LC_AMOUNT")
private String lcAmount;
/**
* 本币
*/
@JsonProperty("LOC_CURRCY")
private String locCurrcy;
/**
* 项目文本
*/
@JsonProperty("ITEM_TEXT")
private String itemText;
/**
* 付款条件代码
*/
@JsonProperty("PMNTTRMS")
private String pmnttrms;
/**
* 起算日期
*/
@JsonProperty("BLINE_DATE")
private String blineDate;
/**
* 扣单应收项次
*/
@JsonProperty("XBLOCK")
private String xblock;
/**
* 账期
*/
@JsonProperty("ZBD1T")
private String zbd1t;
/**
* 到期天数
*/
@JsonProperty("DSCT_DAYS1")
private String dsctDays1;
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="customerDelayPayProc" name="客户延期付款申请" isExecutable="true">
<extensionElements>
<activiti:executionListener event="start" delegateExpression="#{customerDelayPayApplication}"></activiti:executionListener>
<activiti:executionListener event="end" delegateExpression="#{customerDelayPayApplication}"></activiti:executionListener>
</extensionElements>
<startEvent id="startevent1" name="Start"></startEvent>
<endEvent id="endevent1" name="End"></endEvent>
<userTask id="Apply" name="客户延期付款申请" activiti:formKey="customerDelayPay/showCustomerDelayPayDetail.job">
<extensionElements>
<activiti:taskListener event="all" delegateExpression="#{customerDelayPayApplication}"></activiti:taskListener>
<activiti:taskListener event="saveBizData" delegateExpression="#{customerDelayPayApplication}"></activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="Approve" name="客户延期付款审批" activiti:assignee="${assignee} " activiti:formKey="customerDelayPay/showCustomerDelayPayDetail.job">
<extensionElements>
<activiti:taskListener event="all" delegateExpression="#{customerDelayPayApplication}"></activiti:taskListener>
<activiti:taskListener event="saveBizData" delegateExpression="#{customerDelayPayApplication}"></activiti:taskListener>
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="handlerList" activiti:elementVariable="assignee">
<completionCondition>${chiefApprovePassed}</completionCondition>
</multiInstanceLoopCharacteristics>
</userTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="Apply"></sequenceFlow>
<sequenceFlow id="flow2" sourceRef="Apply" targetRef="Approve"></sequenceFlow>
<exclusiveGateway id="ApproveFinished" name="审批结束"></exclusiveGateway>
<sequenceFlow id="flow3" name="审批通过" sourceRef="ApprovePassed" targetRef="ApproveFinished">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvePassed}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" name="审批结束" sourceRef="ApproveFinished" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${approveFinished}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow5" name="审批未结束" sourceRef="ApproveFinished" targetRef="Approve">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!approveFinished}]]></conditionExpression>
</sequenceFlow>
<exclusiveGateway id="ApprovePassed" name="审批通过"></exclusiveGateway>
<sequenceFlow id="flow6" sourceRef="Approve" targetRef="ApprovePassed"></sequenceFlow>
<sequenceFlow id="flow9" name="审批未通过" sourceRef="ApprovePassed" targetRef="Apply">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!approvePassed}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_customerDelayPayProc">
<bpmndi:BPMNPlane bpmnElement="customerDelayPayProc" id="BPMNPlane_customerDelayPayProc">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="355.0" y="50.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="355.0" y="550.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="Apply" id="BPMNShape_Apply">
<omgdc:Bounds height="55.0" width="161.0" x="292.0" y="140.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="Approve" id="BPMNShape_Approve">
<omgdc:Bounds height="55.0" width="161.0" x="292.0" y="240.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ApproveFinished" id="BPMNShape_ApproveFinished">
<omgdc:Bounds height="40.0" width="40.0" x="352.0" y="440.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ApprovePassed" id="BPMNShape_ApprovePassed">
<omgdc:Bounds height="40.0" width="40.0" x="352.0" y="349.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="372.0" y="85.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="140.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="372.0" y="195.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="240.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="372.0" y="389.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="440.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="48.0" x="320.0" y="396.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="372.0" y="480.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="550.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="48.0" x="382.0" y="489.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="392.0" y="460.0"></omgdi:waypoint>
<omgdi:waypoint x="519.0" y="459.0"></omgdi:waypoint>
<omgdi:waypoint x="519.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="519.0" y="267.0"></omgdi:waypoint>
<omgdi:waypoint x="489.0" y="267.0"></omgdi:waypoint>
<omgdi:waypoint x="453.0" y="267.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="60.0" x="459.0" y="411.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="372.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="372.0" y="349.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
<omgdi:waypoint x="352.0" y="369.0"></omgdi:waypoint>
<omgdi:waypoint x="231.0" y="369.0"></omgdi:waypoint>
<omgdi:waypoint x="231.0" y="167.0"></omgdi:waypoint>
<omgdi:waypoint x="292.0" y="167.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="60.0" x="257.0" y="376.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<query-mappings>
<query name="customerDelayPay" label="客户延期付款申请" table="sap_customer_delay_pay">
<sql-query>
select t.* from sap_customer_delay_pay t
</sql-query>
<condition column="bill_code" name="billCode" type="java.lang.String" symbol="like" alias="t"/>
</query>
<query name="customerDelayPayItems" label="客户延期付款申请明细" table="sap_customer_delay_pay_item">
<sql-query>
select t.* from sap_customer_delay_pay_item t
</sql-query>
<condition column="customer_delay_pay_id" name="customerDelayPayId" type="java.lang.String" symbol="=" alias="t"/>
</query>
</query-mappings>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment