完成重构优化

This commit is contained in:
2026-06-07 18:17:36 +08:00
parent 3f8675f05d
commit 0827050803
30 changed files with 380 additions and 2241 deletions

View File

@@ -5,13 +5,15 @@ import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.contract.ContractAssetsVo; import com.seeyon.apps.src_rent.contract.ContractAssetsVo;
import com.seeyon.apps.src_rent.file.OaFileVo; import com.seeyon.apps.src_rent.file.OaFileVo;
import com.seeyon.apps.src_rent.form.*;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.utils.form.*;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; import com.seeyon.ctp.common.filemanager.manager.AttachmentManager;
import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.bo.V3xOrgMember;
import com.seeyon.ctp.organization.manager.OrgManager; import com.seeyon.ctp.organization.manager.OrgManager;
import com.seeyon.utils.form.FormColumn;
import com.seeyon.utils.form.FormWhereCondition;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -20,7 +22,6 @@ import java.util.*;
public class AssetsService { public class AssetsService {
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");
private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager"); private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
@@ -29,16 +30,17 @@ public class AssetsService {
} }
public PageQueryVo pageQuery(JSONObject params) throws Exception { public PageQueryVo pageQuery(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
PageQueryVo<OaAssetsVo> pageQueryVo = new PageQueryVo(); PageQueryVo<OaAssetsVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
List<OaAssetsVo> vos = new ArrayList<>(); List<OaAssetsVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0){ if(datas.size() > 0){
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String,Object> map = data.getFieldsMap();
OaAssetsVo oaAssetsVo = new OaAssetsVo(); OaAssetsVo oaAssetsVo = new OaAssetsVo();
fillVo(map, oaAssetsVo); fillVo(map, oaAssetsVo);
vos.add(oaAssetsVo); vos.add(oaAssetsVo);
@@ -49,8 +51,13 @@ public class AssetsService {
return pageQueryVo; return pageQueryVo;
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { public TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
private List<FormWhereCondition> buildConditions(JSONObject params) throws Exception {
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
TableContext master = FormTableExecutor.master(getFormNo());
if(StringUtils.isNotBlank(params.getString("cusNo"))) { if(StringUtils.isNotBlank(params.getString("cusNo"))) {
conditions.add(FormWhereCondition.build().display("租户-租户编号").value(params.getString("cusNo"))); conditions.add(FormWhereCondition.build().display("租户-租户编号").value(params.getString("cusNo")));
} }
@@ -58,22 +65,22 @@ public class AssetsService {
conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo"))); conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo")));
} }
if(StringUtils.isNotBlank(params.getString("assetsStatus"))) { if(StringUtils.isNotBlank(params.getString("assetsStatus"))) {
conditions.add(FormWhereCondition.build().display("资产状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产状态",params.getString("assetsStatus")))); conditions.add(FormWhereCondition.build().display("资产状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"资产状态",params.getString("assetsStatus"))));
} }
if(StringUtils.isNotBlank(params.getString("assetsType"))) { if(StringUtils.isNotBlank(params.getString("assetsType"))) {
handleAssetsSubType(conditions,params.getString("assetsType")); handleAssetsSubType(conditions,params.getString("assetsType"));
} }
if(StringUtils.isNotBlank(params.getString("bizZone"))) { if(StringUtils.isNotBlank(params.getString("bizZone"))) {
conditions.add(FormWhereCondition.build().display("商圈位置") conditions.add(FormWhereCondition.build().display("商圈位置")
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"商圈位置",params.getString("bizZone")))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"商圈位置",params.getString("bizZone"))));
} }
if(StringUtils.isNotBlank(params.getString("renovationStatus"))) { if(StringUtils.isNotBlank(params.getString("renovationStatus"))) {
conditions.add(FormWhereCondition.build().display("装修情况") conditions.add(FormWhereCondition.build().display("装修情况")
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"装修情况",params.getString("renovationStatus")))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"装修情况",params.getString("renovationStatus"))));
} }
if(StringUtils.isNotBlank(params.getString("layout"))) { if(StringUtils.isNotBlank(params.getString("layout"))) {
conditions.add(FormWhereCondition.build().display("房屋户型") conditions.add(FormWhereCondition.build().display("房屋户型")
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"房屋户型",params.getString("layout")))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"房屋户型",params.getString("layout"))));
} }
if(StringUtils.isNotBlank(params.getString("rentFeeRange"))) { if(StringUtils.isNotBlank(params.getString("rentFeeRange"))) {
String[] split = params.getString("rentFeeRange").split("-"); String[] split = params.getString("rentFeeRange").split("-");
@@ -92,7 +99,7 @@ public class AssetsService {
if(StringUtils.isNotBlank(params.getString("features"))){ if(StringUtils.isNotBlank(params.getString("features"))){
String[] features = params.getString("features").split(","); String[] features = params.getString("features").split(",");
for (Object feature : features) { for (Object feature : features) {
conditions.add(FormWhereCondition.build().display("基础配套").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"基础配套",feature + "")) conditions.add(FormWhereCondition.build().display("基础配套").value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"基础配套",feature + ""))
.index("FIND_IN_SET(?").clauseFactor(ClauseFactor.GT)); .index("FIND_IN_SET(?").clauseFactor(ClauseFactor.GT));
} }
} }
@@ -111,15 +118,15 @@ public class AssetsService {
return conditions; return conditions;
} }
public Set<String> getAllBizZones(){ public Set<String> getAllBizZones() throws Exception {
return EnumMapUtils.getEnumItemValues(getFormNo(),"商圈位置"); return EnumMapUtils.getEnumItemValues(getTableContext().getTableBean(),"商圈位置");
} }
public Set<String> getFeatures(){ public Set<String> getFeatures() throws Exception {
return EnumMapUtils.getEnumItemValues(getFormNo(),"基础配套"); return EnumMapUtils.getEnumItemValues(getTableContext().getTableBean(),"基础配套");
} }
private void handleBizZoneSet(List<FormWhereCondition> conditions,String keyWord) { private void handleBizZoneSet(List<FormWhereCondition> conditions,String keyWord) throws Exception {
if (conditions == null || keyWord == null || keyWord.isEmpty()) { if (conditions == null || keyWord == null || keyWord.isEmpty()) {
return; return;
} }
@@ -128,48 +135,48 @@ public class AssetsService {
FormWhereCondition condition = FormWhereCondition.build().display("商圈位置").clauseFactor(ClauseFactor.IN).concatFactor(ClauseFactor.OR); FormWhereCondition condition = FormWhereCondition.build().display("商圈位置").clauseFactor(ClauseFactor.IN).concatFactor(ClauseFactor.OR);
for (String bizZone : allBizZones) { for (String bizZone : allBizZones) {
if(bizZone.contains(keyWord)){ if(bizZone.contains(keyWord)){
String enumItemId = EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"商圈位置",bizZone); String enumItemId = EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"商圈位置",bizZone);
tempSet.add(enumItemId); tempSet.add(enumItemId);
} }
} }
condition.addAllValue(tempSet); condition.setValue(tempSet);
if(condition.getValues().size() > 0) { if(condition.getValues().size() > 0) {
conditions.add(condition); conditions.add(condition);
} }
} }
private void handleAssetsSubType(List<FormWhereCondition> conditions,String type) { private void handleAssetsSubType(List<FormWhereCondition> conditions,String type) throws BusinessException {
if("住房".equals(type)) { if("住房".equals(type)) {
conditions conditions
.add(FormWhereCondition.build().display("资产二级类型") .add(FormWhereCondition.build().display("资产二级类型")
.startWithBracket(true) .startWithBracket(true)
.concatFactor(ClauseFactor.OR) .concatFactor(ClauseFactor.OR)
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","住宅"))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","住宅")));
conditions.add(FormWhereCondition.build().display("资产二级类型") conditions.add(FormWhereCondition.build().display("资产二级类型")
.endWithBracket(true) .endWithBracket(true)
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","保障性住房"))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","保障性住房")));
} }
if("商铺".equals(type)) { if("商铺".equals(type)) {
conditions conditions
.add(FormWhereCondition.build().display("资产二级类型") .add(FormWhereCondition.build().display("资产二级类型")
.startWithBracket(true) .startWithBracket(true)
.concatFactor(ClauseFactor.OR) .concatFactor(ClauseFactor.OR)
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","写字楼"))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","写字楼")));
conditions.add(FormWhereCondition.build().display("资产二级类型") conditions.add(FormWhereCondition.build().display("资产二级类型")
.concatFactor(ClauseFactor.OR) .concatFactor(ClauseFactor.OR)
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","商业门面"))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","商业门面")));
conditions.add(FormWhereCondition.build().display("资产二级类型") conditions.add(FormWhereCondition.build().display("资产二级类型")
.concatFactor(ClauseFactor.OR) .concatFactor(ClauseFactor.OR)
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","商业用房"))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","商业用房")));
conditions.add(FormWhereCondition.build().display("资产二级类型") conditions.add(FormWhereCondition.build().display("资产二级类型")
.endWithBracket(true) .endWithBracket(true)
.value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","政府机构"))); .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","政府机构")));
} }
if("厂房".equals(type)) { if("厂房".equals(type)) {
conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","厂房"))); conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","厂房")));
} }
if("停车场".equals(type)) { if("停车场".equals(type)) {
conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","车房"))); conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","车房")));
} }
} }
@@ -186,9 +193,10 @@ public class AssetsService {
if(assetsNo == null) { if(assetsNo == null) {
return null; return null;
} }
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo)); conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return null; return null;
} }
@@ -197,9 +205,10 @@ public class AssetsService {
} }
public ContractAssetsVo queryContractAssetsDetail(JSONObject params) throws Exception { public ContractAssetsVo queryContractAssetsDetail(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
ContractAssetsVo assetsVo = new ContractAssetsVo(); ContractAssetsVo assetsVo = new ContractAssetsVo();
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return assetsVo; return assetsVo;
} }
@@ -214,9 +223,10 @@ public class AssetsService {
} }
public OaAssetsVo queryAssetsDetail(JSONObject params) throws Exception { public OaAssetsVo queryAssetsDetail(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
OaAssetsVo assetsVo = new OaAssetsVo(); OaAssetsVo assetsVo = new OaAssetsVo();
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return assetsVo; return assetsVo;
} }
@@ -280,9 +290,10 @@ public class AssetsService {
public Map<String,Object> getAssetsManagerInfo(String assetsNo) throws Exception { public Map<String,Object> getAssetsManagerInfo(String assetsNo) throws Exception {
String formNo = configProvider.getBizConfigByKey(RentConstants.ASSETS_FORMNO); String formNo = configProvider.getBizConfigByKey(RentConstants.ASSETS_FORMNO);
TableContext masterContext = FormTableExecutor.master(formNo);
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo)); conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, false, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false);
if(formColumn == null || formColumn.getFieldsMap() == null) { if(formColumn == null || formColumn.getFieldsMap() == null) {
return null; return null;
} }

View File

@@ -9,12 +9,13 @@ import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.contract.ContractDocService; import com.seeyon.apps.src_rent.contract.ContractDocService;
import com.seeyon.apps.src_rent.contract.ContractService; import com.seeyon.apps.src_rent.contract.ContractService;
import com.seeyon.apps.src_rent.flow.FlowCreateService; import com.seeyon.apps.src_rent.flow.FlowCreateService;
import com.seeyon.apps.src_rent.form.*;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.utils.form.*;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.cap4.form.api.FormApi4Cap4; import com.seeyon.cap4.form.api.FormApi4Cap4;
import com.seeyon.cap4.form.bean.FormBean; import com.seeyon.cap4.form.bean.FormBean;
import com.seeyon.cap4.form.bean.FormFieldBean; import com.seeyon.cap4.form.bean.FormFieldBean;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.bo.V3xOrgMember;
import com.seeyon.ctp.organization.manager.OrgManager; import com.seeyon.ctp.organization.manager.OrgManager;
@@ -33,7 +34,6 @@ public class BillService {
private static final Log log = Log.get(BillService.class); private static final Log log = Log.get(BillService.class);
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private ContractService contractService = (ContractService) AppContext.getBean("qcContractService"); private ContractService contractService = (ContractService) AppContext.getBean("qcContractService");
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService"); private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService");
@@ -54,7 +54,11 @@ public class BillService {
return o + ""; return o + "";
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { private TableContext getTableContext() throws Exception {
return FormTableExecutor.master(getFormNo());
}
private List<FormWhereCondition> buildConditions(JSONObject params) throws Exception {
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
if(StringUtils.isNotBlank(params.getString("cusNo"))) { if(StringUtils.isNotBlank(params.getString("cusNo"))) {
conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo")));
@@ -73,49 +77,49 @@ public class BillService {
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NOT_NULL)); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NOT_NULL));
}else { }else {
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"账单-收款结果反馈","未收款")).endWithBracket(true)); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"账单-收款结果反馈","未收款")).endWithBracket(true));
} }
} }
return conditions; return conditions;
} }
public PageQueryVo queryAllContractBill(List<FormWhereCondition> conditions) throws Exception {; public List<BillVo> queryAllContractBill(List<FormWhereCondition> conditions) throws Exception {
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo(); TableContext masterContext = FormTableExecutor.master(getFormNo());
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, null,null); List<FormColumn> datas = FormTableExecutor.query(masterContext,null, conditions,true);
List<BillVo> vos = new ArrayList<>(); List<BillVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions);
if(datas.size() > 0){ if(datas.size() > 0){
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String,Object> map = data.getFieldsMap();
BillVo billVo = new BillVo(); BillVo billVo = new BillVo();
fillVo(map, billVo); fillVo(map, billVo);
vos.add(billVo); vos.add(billVo);
} }
pageQueryVo.setDatas(vos);
pageQueryVo.setTotalCount(count);
} }
return pageQueryVo; return vos;
} }
public Integer countUnpayRentBills(JSONObject params) throws Exception { public Integer countUnpayRentBills(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"账单-收款结果反馈","未收款")).endWithBracket(true)); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"账单-收款结果反馈","未收款")).endWithBracket(true));
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
return count.intValue(); return count.intValue();
} }
public PageQueryVo pageQueryContractBill(JSONObject params) throws Exception { public PageQueryVo pageQueryContractBill(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo(); PageQueryVo<BillVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单-开始日期",null); String sortField = Optional.ofNullable(masterContext.getTableBean().getFieldBeanByDisplay("账单-开始日期")).map(FormFieldBean::getColumnName).orElse(null);
List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize,sortField,null, true);
List<BillVo> vos = new ArrayList<>(); List<BillVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0){ if(datas.size() > 0){
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String,Object> map = data.getFieldsMap();
BillVo billVo = new BillVo(); BillVo billVo = new BillVo();
fillVo(map, billVo); fillVo(map, billVo);
vos.add(billVo); vos.add(billVo);
@@ -127,8 +131,9 @@ public class BillService {
} }
public BillVo queryOne(JSONObject params) throws Exception { public BillVo queryOne(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return null; return null;
} }
@@ -174,9 +179,10 @@ public class BillService {
} }
public String getBillPayReceiver(String billNo) throws Exception { public String getBillPayReceiver(String billNo) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo)); conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return null; return null;
} }
@@ -223,9 +229,10 @@ public class BillService {
} }
// 6. 查询账单数据 // 6. 查询账单数据
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo)); conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo));
FormColumn formColumn = this.formDataOperator.queryOneRowFormData(this.getFormNo(), false, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false);
// 7. 主数据非空判断 // 7. 主数据非空判断
if (formColumn == null || formColumn.getFieldsMap() == null) { if (formColumn == null || formColumn.getFieldsMap() == null) {
throw new Exception("根据账单编号:" + billNo + "未查询到账单数据"); throw new Exception("根据账单编号:" + billNo + "未查询到账单数据");
@@ -284,8 +291,9 @@ public class BillService {
log.warn("获取经办人信息失败", e); log.warn("获取经办人信息失败", e);
} }
} }
TableContext tempTableContext = FormTableExecutor.master(templateCode);
// 11. 组装主表数据(线程安全日期) // 11. 组装主表数据(线程安全日期)
mainData.put("收款项", EnumMapUtils.getMasterTableEnumItemValue(templateCode, "收款项", "租金")); mainData.put("收款项", EnumMapUtils.getEnumItemValueByDisplayValue(tempTableContext.getTableBean(), "收款项", "租金"));
mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mainData.put("本次收款时间", payDate); mainData.put("本次收款时间", payDate);
mainData.put("合同编号", contractNo); mainData.put("合同编号", contractNo);

View File

@@ -3,24 +3,20 @@ package com.seeyon.apps.src_rent.bill;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.ClauseFactor;
import com.seeyon.apps.src_rent.form.EnumMapUtils;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.utils.form.*;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class FeeRecordService { public class FeeRecordService {
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private BillService billService = (BillService) AppContext.getBean("qcBillService"); private BillService billService = (BillService) AppContext.getBean("qcBillService");
private WaeBillService waeBillService = (WaeBillService) AppContext.getBean("qcWaeBillService"); private WaeBillService waeBillService = (WaeBillService) AppContext.getBean("qcWaeBillService");
@@ -36,8 +32,13 @@ public class FeeRecordService {
return o + ""; return o + "";
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { public TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
private List<FormWhereCondition> buildConditions(JSONObject params) throws Exception {
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
TableContext tableContext = getTableContext();
if(StringUtils.isNotBlank(params.getString("cusNo"))) { if(StringUtils.isNotBlank(params.getString("cusNo"))) {
conditions.add(FormWhereCondition.build().display("客商编号").value(params.getString("cusNo"))); conditions.add(FormWhereCondition.build().display("客商编号").value(params.getString("cusNo")));
} }
@@ -48,7 +49,7 @@ public class FeeRecordService {
conditions.add(FormWhereCondition.build().display("合同编号").value(params.getString("contractNo"))); conditions.add(FormWhereCondition.build().display("合同编号").value(params.getString("contractNo")));
} }
if(StringUtils.isNotBlank(params.getString("leType"))) { if(StringUtils.isNotBlank(params.getString("leType"))) {
conditions.add(FormWhereCondition.build().display("收支类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"收支类型",params.getString("leType")))); conditions.add(FormWhereCondition.build().display("收支类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"收支类型",params.getString("leType"))));
} }
if(StringUtils.isNotBlank(params.getString("year"))) { if(StringUtils.isNotBlank(params.getString("year"))) {
conditions.add(FormWhereCondition.build() conditions.add(FormWhereCondition.build()
@@ -67,16 +68,17 @@ public class FeeRecordService {
public PageQueryVo queryBillPayRecord(JSONObject params) throws Exception { public PageQueryVo queryBillPayRecord(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
PageQueryVo<PayRecordVo> pageQueryVo = new PageQueryVo(); PageQueryVo<PayRecordVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
List<PayRecordVo> payRecordVos = new ArrayList<>(); List<PayRecordVo> payRecordVos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
for (Object data : datas) { for (FormColumn data : datas) {
PayRecordVo payRecordVo = new PayRecordVo(); PayRecordVo payRecordVo = new PayRecordVo();
Map<String,Object> fieldsMap = (Map<String, Object>) data; Map<String,Object> fieldsMap = data.getFieldsMap();
fillVo(fieldsMap,payRecordVo); fillVo(fieldsMap,payRecordVo);
payRecordVos.add(payRecordVo); payRecordVos.add(payRecordVo);
} }

View File

@@ -3,18 +3,16 @@ package com.seeyon.apps.src_rent.bill;
import cn.hutool.log.Log; import cn.hutool.log.Log;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.src_rent.assets.AssetsService; import com.seeyon.apps.src_rent.assets.AssetsService;
import com.seeyon.apps.src_rent.assets.OaAssetsVo;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.contract.ContractDocService; import com.seeyon.apps.src_rent.contract.ContractDocService;
import com.seeyon.apps.src_rent.contract.ContractService;
import com.seeyon.apps.src_rent.flow.FlowCreateService; import com.seeyon.apps.src_rent.flow.FlowCreateService;
import com.seeyon.apps.src_rent.form.*;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.utils.form.*;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.cap4.form.api.FormApi4Cap4; import com.seeyon.cap4.form.api.FormApi4Cap4;
import com.seeyon.cap4.form.bean.FormBean; import com.seeyon.cap4.form.bean.FormBean;
import com.seeyon.cap4.form.bean.FormFieldBean;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.bo.V3xOrgMember;
import com.seeyon.ctp.organization.manager.OrgManager; import com.seeyon.ctp.organization.manager.OrgManager;
@@ -32,7 +30,6 @@ public class MarginBillService {
private static final Log log = Log.get(MarginBillService.class); private static final Log log = Log.get(MarginBillService.class);
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService"); private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService");
private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService"); private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService");
@@ -52,8 +49,13 @@ public class MarginBillService {
return o + ""; return o + "";
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { public TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
private List<FormWhereCondition> buildConditions(JSONObject params) throws Exception {
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
TableContext tableContext = getTableContext();
if(StringUtils.isNotBlank(params.getString("cusNo"))) { if(StringUtils.isNotBlank(params.getString("cusNo"))) {
conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo")));
} }
@@ -62,7 +64,7 @@ public class MarginBillService {
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL)); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL));
}else { }else {
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"缴费状态","未结清")).endWithBracket(true));
} }
} }
if(StringUtils.isNotBlank(params.getString("startDate"))) { if(StringUtils.isNotBlank(params.getString("startDate"))) {
@@ -76,17 +78,18 @@ public class MarginBillService {
public PageQueryVo pageQuery(JSONObject params) throws Exception { public PageQueryVo pageQuery(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序",""))); conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"是否同步小程序","")));
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo(); PageQueryVo<BillVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单开始日期",null); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
List<BillVo> vos = new ArrayList<>(); List<BillVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0){ if(datas.size() > 0){
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String,Object> map = data.getFieldsMap();
BillVo billVo = new BillVo(); BillVo billVo = new BillVo();
fillVo(map, billVo); fillVo(map, billVo);
vos.add(billVo); vos.add(billVo);
@@ -98,11 +101,12 @@ public class MarginBillService {
} }
public Integer countUnpay(JSONObject params) throws Exception { public Integer countUnpay(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序",""))); conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"是否同步小程序","")));
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"缴费状态","未结清")).endWithBracket(true));
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
return count.intValue(); return count.intValue();
} }
@@ -135,9 +139,10 @@ public class MarginBillService {
} }
public String getBillPayReceiver(String billNo) throws Exception { public String getBillPayReceiver(String billNo) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("单据编号").value(billNo)); conditions.add(FormWhereCondition.build().display("单据编号").value(billNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return null; return null;
} }
@@ -185,9 +190,10 @@ public class MarginBillService {
} }
// 6. 查询账单数据 // 6. 查询账单数据
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("单据编号").value(billNo)); conditions.add(FormWhereCondition.build().display("单据编号").value(billNo));
FormColumn formColumn = this.formDataOperator.queryOneRowFormData(this.getFormNo(), false, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false);
// 7. 主数据非空判断 // 7. 主数据非空判断
if (formColumn == null || formColumn.getFieldsMap() == null) { if (formColumn == null || formColumn.getFieldsMap() == null) {
throw new Exception("根据账单编号:" + billNo + "未查询到账单数据"); throw new Exception("根据账单编号:" + billNo + "未查询到账单数据");
@@ -211,29 +217,18 @@ public class MarginBillService {
subFormDataList.add(subTableRowData); subFormDataList.add(subTableRowData);
// 9. 获取合同信息 + 非空校验 // 9. 获取合同信息 + 非空校验
String contractNo = (String) fieldsMap.get("合同编号"); String contractNo = (String) fieldsMap.get("合同编号");
mainData.put("合同名称", fieldsMap.get("合同名称")); // mainData.put("合同名称", fieldsMap.get("合同名称"));
mainData.put("合同金额", fieldsMap.get("合同金额")); mainData.put("合同金额", fieldsMap.get("合同金额"));
mainData.put("承租方类型", fieldsMap.get("承租方类型")); // mainData.put("承租方类型", fieldsMap.get("承租方类型"));
mainData.put("承租方名称", fieldsMap.get("承租方名称")); mainData.put("承租方名称", fieldsMap.get("承租方"));
mainData.put("承租方名称编号", fieldsMap.get("承租方编号")); mainData.put("承租方名称编号", fieldsMap.get("承租方编号"));
// 10. 经办人/部门信息(安全赋值) // 10. 经办人/部门信息(安全赋值)
String assetNo = (String) fieldsMap.get("资产编号"); mainData.put("经办部门", fieldsMap.get("经办部门"));
Map<String, Object> assetsManagerInfo = this.assetsService.getAssetsManagerInfo(assetNo); mainData.put("经办单位", fieldsMap.get("经办单位"));
if (assetsManagerInfo != null && assetsManagerInfo.get("经办人") != null) { mainData.put("经办人员", fieldsMap.get("经办人"));
String managerId = String.valueOf(assetsManagerInfo.get("经办人")); TableContext tempTableContext = FormTableExecutor.master(templateCode);
try {
V3xOrgMember member = this.orgManager.getMemberById(Long.parseLong(managerId));
if (member != null) {
mainData.put("经办部门", member.getOrgDepartmentId());
mainData.put("经办单位", member.getOrgAccountId());
mainData.put("经办人员", managerId);
}
} catch (Exception e) {
log.warn("获取经办人信息失败", e);
}
}
// 11. 组装主表数据(线程安全日期) // 11. 组装主表数据(线程安全日期)
mainData.put("收款项", EnumMapUtils.getMasterTableEnumItemValue(templateCode, "收款项", "非租金")); mainData.put("收款项", EnumMapUtils.getEnumItemValueByDisplayValue(tempTableContext.getTableBean(), "收款项", "非租金"));
mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mainData.put("本次收款时间", payDate); mainData.put("本次收款时间", payDate);
mainData.put("合同编号", contractNo); mainData.put("合同编号", contractNo);

View File

@@ -5,8 +5,8 @@ import com.seeyon.apps.src_rent.assets.AssetsService;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.contract.ContractDocService; import com.seeyon.apps.src_rent.contract.ContractDocService;
import com.seeyon.apps.src_rent.form.*;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.utils.form.*;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -14,15 +14,13 @@ import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class WaeBillService { public class WaeBillService {
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
private ContractDocService docService = (ContractDocService) AppContext.getBean("qcContractDocService"); private ContractDocService docService = (ContractDocService) AppContext.getBean("qcContractDocService");
@@ -30,31 +28,38 @@ public class WaeBillService {
return configProvider.getBizConfigByKey(RentConstants.WAEBILLFORMNO); return configProvider.getBizConfigByKey(RentConstants.WAEBILLFORMNO);
} }
private String getStringValue(Map<String, Object> fieldsMap,String key) { private String getStringValue(Map<String, Object> fieldsMap, String key) {
Object o = fieldsMap.get(key); Object o = fieldsMap.get(key);
if(o == null) { if (o == null) {
return null; return null;
} }
return o + ""; return o + "";
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { public TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
private List<FormWhereCondition> buildConditions(JSONObject params) throws BusinessException {
TableContext tableContext = getTableContext();
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
if(StringUtils.isNotBlank(params.getString("cusNo"))) { if (StringUtils.isNotBlank(params.getString("cusNo"))) {
conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo")));
} }
if(StringUtils.isNotBlank(params.getString("startDate"))) { if (StringUtils.isNotBlank(params.getString("startDate"))) {
conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.GT).value(params.getString("startDate"))); conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.GT).value(params.getString("startDate")));
} }
if(StringUtils.isNotBlank(params.getString("endDate"))) { if (StringUtils.isNotBlank(params.getString("endDate"))) {
conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.LE).value(params.getString("endDate"))); conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.LE).value(params.getString("endDate")));
} }
if(StringUtils.isNotBlank(params.getString("billStatus"))) { if (StringUtils.isNotBlank(params.getString("billStatus"))) {
if("已缴费".equals(params.getString("billStatus"))) { if ("已缴费".equals(params.getString("billStatus"))) {
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL)); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL));
}else { } else {
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(), "缴费状态", "未结清")).endWithBracket(true));
} }
} }
return conditions; return conditions;
@@ -62,17 +67,18 @@ public class WaeBillService {
public PageQueryVo pageQueryWaeBill(JSONObject params) throws Exception { public PageQueryVo pageQueryWaeBill(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序",""))); conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "是否同步小程序", "")));
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo(); PageQueryVo<BillVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单开始日期",null); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
List<BillVo> vos = new ArrayList<>(); List<BillVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0){ if (datas.size() > 0) {
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String, Object> map = data.getFieldsMap();
BillVo billVo = new BillVo(); BillVo billVo = new BillVo();
fillVo(map, billVo); fillVo(map, billVo);
vos.add(billVo); vos.add(billVo);
@@ -83,40 +89,37 @@ public class WaeBillService {
return pageQueryVo; return pageQueryVo;
} }
public PageQueryVo queryAllWaeBill(List<FormWhereCondition> conditions) throws Exception {; public List<BillVo> queryAllWaeBill(List<FormWhereCondition> conditions) throws Exception {
PageQueryVo<BillVo> pageQueryVo = new PageQueryVo(); TableContext masterContext = FormTableExecutor.master(getFormNo());
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, null,null); List<FormColumn> datas = FormTableExecutor.query(masterContext, null, conditions, true);
List<BillVo> vos = new ArrayList<>(); List<BillVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); for (FormColumn data : datas) {
if(datas.size() > 0){ Map<String, Object> map = data.getFieldsMap();
for (Object data : datas) {
Map<String,Object> map = (Map<String, Object>) data;
BillVo billVo = new BillVo(); BillVo billVo = new BillVo();
fillVo(map, billVo); fillVo(map, billVo);
vos.add(billVo); vos.add(billVo);
} }
pageQueryVo.setDatas(vos);
pageQueryVo.setTotalCount(count); return vos;
}
return pageQueryVo;
} }
public Integer countUnpayWaeBills(JSONObject params) throws Exception { public Integer countUnpayWaeBills(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序",""))); conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "是否同步小程序", "")));
conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR));
conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "缴费状态", "未结清")).endWithBracket(true));
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
return count.intValue(); return count.intValue();
} }
public void fillVo(Map<String, Object> fieldsMap, BillVo billVo) { public void fillVo(Map<String, Object> fieldsMap, BillVo billVo) {
billVo.setBillType("WAE"); billVo.setBillType("WAE");
billVo.setBillStartDate(getStringValue(fieldsMap,"账单开始日期")); billVo.setBillStartDate(getStringValue(fieldsMap, "账单开始日期"));
billVo.setBillEndDate(getStringValue(fieldsMap,"账单结束日期")); billVo.setBillEndDate(getStringValue(fieldsMap, "账单结束日期"));
billVo.setBillStatus(getStringValue(fieldsMap,"缴费状态")); billVo.setBillStatus(getStringValue(fieldsMap, "缴费状态"));
billVo.setCusNo(getStringValue(fieldsMap,"承租方编号")); billVo.setCusNo(getStringValue(fieldsMap, "承租方编号"));
billVo.setBillNo(getStringValue(fieldsMap,"唯一标识")); billVo.setBillNo(getStringValue(fieldsMap, "唯一标识"));
BigDecimal powerFee = fieldsMap.get("本次应缴电费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴电费"); BigDecimal powerFee = fieldsMap.get("本次应缴电费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴电费");
BigDecimal waterFee = fieldsMap.get("本次应缴水费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴水费"); BigDecimal waterFee = fieldsMap.get("本次应缴水费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴水费");
billVo.setBillAmount((powerFee.add(waterFee)).toString()); billVo.setBillAmount((powerFee.add(waterFee)).toString());
@@ -124,10 +127,11 @@ public class WaeBillService {
} }
public String getBillPayReceiver(String billNo) throws Exception { public String getBillPayReceiver(String billNo) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo)); conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if (formColumn == null) {
System.out.println("根据唯一标识查询水电费账单失败"); System.out.println("根据唯一标识查询水电费账单失败");
return null; return null;
} }
@@ -138,10 +142,11 @@ public class WaeBillService {
} }
public void payCallBack(String billNo, String payDate) throws BusinessException { public void payCallBack(String billNo, String payDate) throws BusinessException {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo)); conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo));
List<FormUpdateField> updateFields = new ArrayList<>(); List<FormUpdateField> updateFields = new ArrayList<>();
updateFields.add(FormUpdateField.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","结清"))); updateFields.add(FormUpdateField.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "缴费状态", "结清")));
formDataOperator.updateMasterForm(getFormNo(),updateFields,conditions); FormTableExecutor.update(masterContext, updateFields, conditions);
} }
} }

View File

@@ -2,10 +2,8 @@ package com.seeyon.apps.src_rent.contract;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.FormColumn;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.utils.form.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -15,13 +13,13 @@ import java.util.Map;
public class ContractDocService { public class ContractDocService {
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
public String getAssetsManagerOrg(String contractNo) throws Exception { public String getAssetsManagerOrg(String contractNo) throws Exception {
String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode); String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode);
TableContext masterContext = FormTableExecutor.master(formNo);
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo)); conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null || formColumn.getFieldsMap() == null) { if(formColumn == null || formColumn.getFieldsMap() == null) {
return null; return null;
} }
@@ -31,9 +29,10 @@ public class ContractDocService {
public Map<String,Object> getContractInfoByContractNo(String contractNo) throws Exception { public Map<String,Object> getContractInfoByContractNo(String contractNo) throws Exception {
String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode); String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode);
TableContext masterContext = FormTableExecutor.master(formNo);
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo)); conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, false, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false);
if(formColumn == null) { if(formColumn == null) {
return null; return null;
} }

View File

@@ -6,8 +6,9 @@ import com.seeyon.apps.src_rent.assets.OaAssetsVo;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.file.OaFileVo; import com.seeyon.apps.src_rent.file.OaFileVo;
import com.seeyon.apps.src_rent.form.*;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.utils.form.*;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.apps.src_rent.service.SignLinkService; import com.seeyon.apps.src_rent.service.SignLinkService;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
@@ -28,7 +29,6 @@ public class ContractService {
private static final Log log = LogFactory.getLog(ContractService.class); private static final Log log = LogFactory.getLog(ContractService.class);
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("qcSignLinkService"); private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("qcSignLinkService");
private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");
@@ -45,42 +45,42 @@ public class ContractService {
return o + ""; return o + "";
} }
public TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
public Integer countUnSign(JSONObject params) throws BusinessException { public Integer countUnSign(JSONObject params) throws BusinessException {
TableContext masterContext = FormTableExecutor.master(getFormNo());
FormTableBean tableBean = masterContext.getTableBean();
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"签署状态","待签署"))); conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableBean,"签署状态","待签署")));
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
return count.intValue(); return count.intValue();
} }
public PageQueryVo pageQuery(JSONObject params) throws Exception { public PageQueryVo pageQuery(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
List<String> queryColumnVos = new ArrayList<>();
queryColumnVos.add("合同编号");
queryColumnVos.add("承租方编号");
queryColumnVos.add("合同开始日期");
queryColumnVos.add("合同截止日期");
queryColumnVos.add("签署状态");
queryColumnVos.add("合同名称");
queryColumnVos.add("签约时效");
PageQueryVo<OaContractVo> pageQueryVo = new PageQueryVo(); PageQueryVo<OaContractVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,queryColumnVos, conditions, pageNo, pageSize); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
List<OaContractVo> oaContractVos = new ArrayList<>(); List<OaContractVo> oaContractVos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
pageQueryVo.setDatas(oaContractVos); pageQueryVo.setDatas(oaContractVos);
pageQueryVo.setTotalCount(count); pageQueryVo.setTotalCount(count);
for (Object data : datas) { TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细");
for (FormColumn data : datas) {
OaContractVo oaContractVo = new OaContractVo(); OaContractVo oaContractVo = new OaContractVo();
Map<String, Object> dataMap = (Map<String, Object>) data; Map<String, Object> dataMap = data.getFieldsMap();
fillVo(dataMap,oaContractVo); fillVo(dataMap,oaContractVo);
Long id = Long.parseLong((String)dataMap.get("id"));
List<FormWhereCondition> subConditions = new ArrayList<>(); List<FormWhereCondition> subConditions = new ArrayList<>();
subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); subConditions.add(FormWhereCondition.build().display("formmain_id").value(dataMap.get("id")));
List<Object> subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, 1, 10); List<FormColumn> subDatas = FormTableExecutor.query(subTableContext, null, subConditions, true);
log.info("查询到的关联资产数量: " + subDatas.size()); log.info("查询到的关联资产数量: " + subDatas.size());
if(subDatas.size() > 0) { if(subDatas.size() > 0) {
Map<String, Object> subOneRowData = (Map<String, Object>) subDatas.get(0); FormColumn subOneRow = subDatas.get(0);
Map<String, Object> subOneRowData = subOneRow.getFieldsMap();
String assetsNo = (String) subOneRowData.get("资产编号"); String assetsNo = (String) subOneRowData.get("资产编号");
JSONObject temp = new JSONObject(); JSONObject temp = new JSONObject();
temp.put("assetsNo",assetsNo); temp.put("assetsNo",assetsNo);
@@ -95,26 +95,21 @@ public class ContractService {
} }
public List<OaContractVo> queryAll(JSONObject params) throws Exception { public List<OaContractVo> queryAll(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
List<String> queryColumns = new ArrayList<>(); List<FormColumn> datas = FormTableExecutor.query(masterContext, null,conditions, true);
queryColumns.add("合同编号");
queryColumns.add("合同名称");
List<FormColumn> datas = formDataOperator.queryFormDataCondition(getFormNo(), queryColumns,conditions);
List<OaContractVo> oaContractVos = new ArrayList<>(); List<OaContractVo> oaContractVos = new ArrayList<>();
TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细");
for (FormColumn data : datas) { for (FormColumn data : datas) {
OaContractVo oaContractVo = new OaContractVo(); OaContractVo oaContractVo = new OaContractVo();
Map<String, Object> dataMap = data.getFieldsMap(); Map<String, Object> dataMap = data.getFieldsMap();
fillVo(dataMap,oaContractVo); fillVo(dataMap,oaContractVo);
Long id = Long.parseLong((String)dataMap.get("id"));
List<FormWhereCondition> subConditions = new ArrayList<>(); List<FormWhereCondition> subConditions = new ArrayList<>();
subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); subConditions.add(FormWhereCondition.build().display("formmain_id").value(dataMap.get("id")));
List<Object> subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, null, null); List<FormColumn> subDatas = FormTableExecutor.query(subTableContext, null, subConditions,true);
List<ContractAssetsVo> assetsVos = new ArrayList<>(); List<ContractAssetsVo> assetsVos = new ArrayList<>();
for (Object subData : subDatas) { for (FormColumn subData : subDatas) {
Map<String, Object> subOneRowData = (Map<String, Object>) subData; Map<String, Object> subOneRowData = subData.getFieldsMap();
String assetsNo = (String) subOneRowData.get("资产编号");
JSONObject temp = new JSONObject();
temp.put("assetsNo",assetsNo);
ContractAssetsVo assetsVo = new ContractAssetsVo(); ContractAssetsVo assetsVo = new ContractAssetsVo();
assetsVo.setAssetsNo(subOneRowData.get("资产编号") + ""); assetsVo.setAssetsNo(subOneRowData.get("资产编号") + "");
assetsVo.setAssetsName(subOneRowData.get("资产名称") + ""); assetsVo.setAssetsName(subOneRowData.get("资产名称") + "");
@@ -142,8 +137,9 @@ public class ContractService {
oaContractVo.seteContractFlowId(getStringValue(fieldsMap,"电子签合同流程ID")); oaContractVo.seteContractFlowId(getStringValue(fieldsMap,"电子签合同流程ID"));
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { private List<FormWhereCondition> buildConditions(JSONObject params) throws BusinessException {
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
TableContext tableContext = getTableContext();
if(StringUtils.isNotBlank(params.getString("cusNo"))) { if(StringUtils.isNotBlank(params.getString("cusNo"))) {
conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo")));
} }
@@ -154,7 +150,7 @@ public class ContractService {
conditions.add(FormWhereCondition.build().display("formmainId").value(params.getString("formmainId"))); conditions.add(FormWhereCondition.build().display("formmainId").value(params.getString("formmainId")));
} }
if(StringUtils.isNotBlank(params.getString("signStatus"))) { if(StringUtils.isNotBlank(params.getString("signStatus"))) {
conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"签署状态",params.getString("signStatus")))); conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"签署状态",params.getString("signStatus"))));
} }
if(StringUtils.isNotBlank(params.getString("signWay"))) { if(StringUtils.isNotBlank(params.getString("signWay"))) {
String enumId = EnumMapUtils.getEnumItemIdByGroupNameAndItemShowValue("签订方式",params.getString("signWay")); String enumId = EnumMapUtils.getEnumItemIdByGroupNameAndItemShowValue("签订方式",params.getString("signWay"));
@@ -170,12 +166,13 @@ public class ContractService {
} }
public String queryContractPayPeriod(String contractNo, String billDate) throws Exception { public String queryContractPayPeriod(String contractNo, String billDate) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build() conditions.add(FormWhereCondition.build()
.display("合同编号") .display("合同编号")
.value(contractNo)); .value(contractNo));
FormColumn formColumn = FormColumn formColumn =
formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); FormTableExecutor.queryOne(masterContext, conditions, true);
if (formColumn == null || formColumn.getFieldsMap() == null) { if (formColumn == null || formColumn.getFieldsMap() == null) {
return ""; return "";
} }
@@ -244,8 +241,9 @@ public class ContractService {
} }
public OaContractVo queryContractDetail(JSONObject params) throws Exception { public OaContractVo queryContractDetail(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return new OaContractVo(); return new OaContractVo();
} }
@@ -255,9 +253,11 @@ public class ContractService {
Long id = Long.parseLong((String)dataMap.get("id")); Long id = Long.parseLong((String)dataMap.get("id"));
List<FormWhereCondition> subConditions = new ArrayList<>(); List<FormWhereCondition> subConditions = new ArrayList<>();
subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); subConditions.add(FormWhereCondition.build().display("formmain_id").value(id));
List<Object> subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, 1, 10); TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细");
List<FormColumn> subDatas = FormTableExecutor.query(subTableContext, null, subConditions,true);
if(subDatas.size() > 0) { if(subDatas.size() > 0) {
Map<String, Object> subOneRowData = (Map<String, Object>) subDatas.get(0); FormColumn subOneRow = subDatas.get(0);
Map<String, Object> subOneRowData = subOneRow.getFieldsMap();
String assetsNo = (String) subOneRowData.get("资产编号"); String assetsNo = (String) subOneRowData.get("资产编号");
BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价");
BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积");
@@ -275,20 +275,22 @@ public class ContractService {
} }
public List<OaAssetsVo> queryContractAllAssets(String contractNo) throws Exception { public List<OaAssetsVo> queryContractAllAssets(String contractNo) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> tempConditions = new ArrayList<>(); List<FormWhereCondition> tempConditions = new ArrayList<>();
tempConditions.add(FormWhereCondition.build().display("合同编号").value(contractNo)); tempConditions.add(FormWhereCondition.build().display("合同编号").value(contractNo));
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, tempConditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, tempConditions, true);
if(formColumn == null) { if(formColumn == null) {
return null; return null;
} }
String id = formColumn.getId(); String id = formColumn.getId();
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("formmain_id").value(id)); conditions.add(FormWhereCondition.build().display("formmain_id").value(id));
List<Object> subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, conditions, null, null); TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细");
List<FormColumn> subDatas = FormTableExecutor.query(subTableContext, null, conditions,true);
List<OaAssetsVo> assetsVos = new ArrayList<>(); List<OaAssetsVo> assetsVos = new ArrayList<>();
if(subDatas.size() > 0) { if(subDatas.size() > 0) {
for (Object subData : subDatas) { for (FormColumn subData : subDatas) {
Map<String, Object> subOneRowData = (Map<String, Object>) subData; Map<String, Object> subOneRowData = subData.getFieldsMap();
String assetsNo = (String) subOneRowData.get("资产编号"); String assetsNo = (String) subOneRowData.get("资产编号");
BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价");
BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积");
@@ -306,12 +308,13 @@ public class ContractService {
public PageQueryVo pageQueryContractAssetsInfoWithFee(JSONObject params) throws Exception { public PageQueryVo pageQueryContractAssetsInfoWithFee(JSONObject params) throws Exception {
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
List<Object> subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, conditions, 1, 10); TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细");
List<FormColumn> subDatas = FormTableExecutor.query(subTableContext, null, conditions,true);
PageQueryVo< ContractAssetsVo> pageQueryVo = new PageQueryVo(); PageQueryVo< ContractAssetsVo> pageQueryVo = new PageQueryVo();
List<ContractAssetsVo> assetsVos = new ArrayList<>(); List<ContractAssetsVo> assetsVos = new ArrayList<>();
if(subDatas.size() > 0) { if(subDatas.size() > 0) {
for (Object subData : subDatas) { for (FormColumn subData : subDatas) {
Map<String, Object> subOneRowData = (Map<String, Object>) subData; Map<String, Object> subOneRowData = subData.getFieldsMap();
String assetsNo = (String) subOneRowData.get("资产编号"); String assetsNo = (String) subOneRowData.get("资产编号");
BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价");
BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积");
@@ -324,7 +327,7 @@ public class ContractService {
assetsVos.add(assetsVo); assetsVos.add(assetsVo);
} }
} }
Long totalCount = formDataOperator.countSubTableConditon(getFormNo(), "租赁资产明细", conditions); Long totalCount = FormTableExecutor.count(subTableContext,null,conditions);
pageQueryVo.setTotalCount(totalCount); pageQueryVo.setTotalCount(totalCount);
pageQueryVo.setDatas(assetsVos); pageQueryVo.setDatas(assetsVos);
return pageQueryVo; return pageQueryVo;

View File

@@ -2,8 +2,8 @@ package com.seeyon.apps.src_rent.cus;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.*;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.utils.form.*;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@@ -14,18 +14,22 @@ import java.util.Map;
public class CustomerService { public class CustomerService {
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private String getFormNo() { private String getFormNo() {
return configProvider.getBizConfigByKey(RentConstants.CUSDOCFORMNO); return configProvider.getBizConfigByKey(RentConstants.CUSDOCFORMNO);
} }
private TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
public String matchCusPerson(Customer customer) throws Exception { public String matchCusPerson(Customer customer) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
String cardNo = customer.getCardNo(); String cardNo = customer.getCardNo();
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(cardNo).clauseFactor(ClauseFactor.EQ)); conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(cardNo).clauseFactor(ClauseFactor.EQ));
conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型","个人"))); conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"承租方类型","个人")));
List<FormColumn> formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); List<FormColumn> formColumnList = FormTableExecutor.query(masterContext, null,conditions, true);
if(formColumnList != null && formColumnList.size() > 0){ if(formColumnList != null && formColumnList.size() > 0){
Map<String, Object> fieldsMap = formColumnList.get(0).getFieldsMap(); Map<String, Object> fieldsMap = formColumnList.get(0).getFieldsMap();
return (String)fieldsMap.get("客商编号"); return (String)fieldsMap.get("客商编号");
@@ -34,11 +38,12 @@ public class CustomerService {
} }
public String matchCusOrg(Customer customer) throws BusinessException { public String matchCusOrg(Customer customer) throws BusinessException {
TableContext masterContext = FormTableExecutor.master(getFormNo());
String orgNo = customer.getOrgNo(); String orgNo = customer.getOrgNo();
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型","单位"))); conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"承租方类型","单位")));
conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(orgNo).clauseFactor(ClauseFactor.EQ)); conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(orgNo).clauseFactor(ClauseFactor.EQ));
List<FormColumn> formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); List<FormColumn> formColumnList = FormTableExecutor.query(masterContext, null,conditions, true);
if(formColumnList != null && formColumnList.size() > 0){ if(formColumnList != null && formColumnList.size() > 0){
Map<String, Object> fieldsMap = formColumnList.get(0).getFieldsMap(); Map<String, Object> fieldsMap = formColumnList.get(0).getFieldsMap();
return (String)fieldsMap.get("客商编码"); return (String)fieldsMap.get("客商编码");
@@ -55,9 +60,10 @@ public class CustomerService {
} }
public Customer getCustomerInfo(String cusNo) throws BusinessException { public Customer getCustomerInfo(String cusNo) throws BusinessException {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("客商编号").value(cusNo).clauseFactor(ClauseFactor.EQ)); conditions.add(FormWhereCondition.build().display("客商编号").value(cusNo).clauseFactor(ClauseFactor.EQ));
List<FormColumn> formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); List<FormColumn> formColumnList = FormTableExecutor.query(masterContext, null,conditions, true);
if(formColumnList != null && formColumnList.size() > 0){ if(formColumnList != null && formColumnList.size() > 0){
Map<String, Object> fieldsMap = formColumnList.get(0).getFieldsMap(); Map<String, Object> fieldsMap = formColumnList.get(0).getFieldsMap();
Customer customer = new Customer(); Customer customer = new Customer();

View File

@@ -6,13 +6,11 @@ import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.contract.ContractService; import com.seeyon.apps.src_rent.contract.ContractService;
import com.seeyon.apps.src_rent.flow.FlowCreateService; import com.seeyon.apps.src_rent.flow.FlowCreateService;
import com.seeyon.apps.src_rent.form.EnumMapUtils;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.utils.form.*;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.cap4.form.api.FormApi4Cap4; import com.seeyon.cap4.form.api.FormApi4Cap4;
import com.seeyon.cap4.form.bean.FormBean; import com.seeyon.cap4.form.bean.FormBean;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -24,7 +22,6 @@ import java.util.stream.Collectors;
public class DisCharegeService { public class DisCharegeService {
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService"); private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService");
private ContractService contractService = (ContractService) AppContext.getBean("qcContractService"); private ContractService contractService = (ContractService) AppContext.getBean("qcContractService");
@@ -32,6 +29,10 @@ public class DisCharegeService {
return configProvider.getBizConfigByKey(RentConstants.PAYMENT_REGISTRATION_TEMPLATECODE); return configProvider.getBizConfigByKey(RentConstants.PAYMENT_REGISTRATION_TEMPLATECODE);
} }
private TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
private String getStringValue(Map<String, Object> fieldsMap,String key) { private String getStringValue(Map<String, Object> fieldsMap,String key) {
Object o = fieldsMap.get(key); Object o = fieldsMap.get(key);
if(o == null) { if(o == null) {
@@ -41,17 +42,18 @@ public class DisCharegeService {
} }
public PageQueryVo pageQuery(JSONObject params) throws Exception { public PageQueryVo pageQuery(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
List<String> queryColumnVos = new ArrayList<>(); List<String> queryColumnVos = new ArrayList<>();
PageQueryVo<DisChargeRecordVo> pageQueryVo = new PageQueryVo(); PageQueryVo<DisChargeRecordVo> pageQueryVo = new PageQueryVo();
List<DisChargeRecordVo> vos = new ArrayList<>(); List<DisChargeRecordVo> vos = new ArrayList<>();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,queryColumnVos, conditions, pageNo, pageSize); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0){ if(datas.size() > 0){
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String,Object> map = data.getFieldsMap();
DisChargeRecordVo vo = new DisChargeRecordVo(); DisChargeRecordVo vo = new DisChargeRecordVo();
fillVo(map,vo); fillVo(map,vo);
vos.add(vo); vos.add(vo);
@@ -68,6 +70,7 @@ public class DisCharegeService {
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
String tableName = masterTableBean.getTableName(); String tableName = masterTableBean.getTableName();
List<FormTableBean> subTableBean = cap4FormBean.getSubTableBean(); List<FormTableBean> subTableBean = cap4FormBean.getSubTableBean();
TableContext tableContext = getTableContext();
String subDbTableName = null; String subDbTableName = null;
for (FormTableBean formTableBean : subTableBean) { for (FormTableBean formTableBean : subTableBean) {
if("租赁资产".equals(formTableBean.getDisplay())){ if("租赁资产".equals(formTableBean.getDisplay())){
@@ -97,12 +100,12 @@ public class DisCharegeService {
} }
data.put("合同名称",params.getString("contractName")); data.put("合同名称",params.getString("contractName"));
data.put("合同编号",contractNo); data.put("合同编号",contractNo);
data.put("承租方类型", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型",params.getString("cusType"))); data.put("承租方类型", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"承租方类型",params.getString("cusType")));
data.put("承租方名称",params.getString("cusName")); data.put("承租方名称",params.getString("cusName"));
data.put("联系方式",params.getString("phone")); data.put("联系方式",params.getString("phone"));
data.put("终止原因",params.getString("reason")); data.put("终止原因",params.getString("reason"));
data.put("退租申请状态",EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"退租申请状态","申请中")); data.put("退租申请状态",EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"退租申请状态","申请中"));
data.put("清算状态",EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"清算状态","未清算")); data.put("清算状态",EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"清算状态","未清算"));
flowCreateService.flowStart("退租申请",mainFormData,subFormDataMap,appName,templateCode); flowCreateService.flowStart("退租申请",mainFormData,subFormDataMap,appName,templateCode);
} }
@@ -115,10 +118,11 @@ public class DisCharegeService {
Long id = Long.parseLong(vo.getId()); Long id = Long.parseLong(vo.getId());
List<FormWhereCondition> subConditions = new ArrayList<>(); List<FormWhereCondition> subConditions = new ArrayList<>();
subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); subConditions.add(FormWhereCondition.build().display("formmain_id").value(id));
List<Object> subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产", true, null, subConditions, null, null); TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产");
List<FormColumn> subDatas = FormTableExecutor.query(subTableContext, null, subConditions, true);
StringBuilder dischargeItem = new StringBuilder(""); StringBuilder dischargeItem = new StringBuilder("");
for (Object subData : subDatas) { for (FormColumn subData : subDatas) {
Map<String, Object> subOneRowData = (Map<String, Object>) subData; Map<String, Object> subOneRowData = subData.getFieldsMap();
String assetsName = (String) subOneRowData.get("品牌名称"); String assetsName = (String) subOneRowData.get("品牌名称");
dischargeItem.append(assetsName).append(","); dischargeItem.append(assetsName).append(",");
} }

View File

@@ -4,12 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.flow.FlowCreateService; import com.seeyon.apps.src_rent.flow.FlowCreateService;
import com.seeyon.apps.src_rent.form.EnumMapUtils;
import com.seeyon.apps.src_rent.form.FormColumn;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.utils.form.*;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.v3x.services.form.FormFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -20,25 +19,29 @@ import java.util.*;
public class FallbackService { public class FallbackService {
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService"); private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService");
private FormFactory factory = (FormFactory) AppContext.getBean("formFactory");
private String getFormNo() { private String getFormNo() {
return configProvider.getBizConfigByKey(RentConstants.FALLBACK_FORMNO); return configProvider.getBizConfigByKey(RentConstants.FALLBACK_FORMNO);
} }
private TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
public PageQueryVo pageQuery(JSONObject params) throws Exception { public PageQueryVo pageQuery(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
PageQueryVo<FallbackVo> pageQueryVo = new PageQueryVo(); PageQueryVo<FallbackVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
List<FallbackVo> vos = new ArrayList<>(); List<FallbackVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0) { if(datas.size() > 0) {
for (Object data : datas) { for (FormColumn data : datas) {
FallbackVo fallbackVo = new FallbackVo(); FallbackVo fallbackVo = new FallbackVo();
Map<String, Object> dataMap = (Map<String, Object>) data; Map<String, Object> dataMap = data.getFieldsMap();
fillVo(dataMap,fallbackVo); fillVo(dataMap,fallbackVo);
vos.add(fallbackVo); vos.add(fallbackVo);
} }
@@ -49,8 +52,9 @@ public class FallbackService {
} }
public FallbackVo detail(JSONObject params) throws Exception { public FallbackVo detail(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
Map<String, Object> fieldsMap = formColumn.getFieldsMap(); Map<String, Object> fieldsMap = formColumn.getFieldsMap();
FallbackVo fallbackVo = new FallbackVo(); FallbackVo fallbackVo = new FallbackVo();
fillVo(fieldsMap,fallbackVo); fillVo(fieldsMap,fallbackVo);
@@ -60,17 +64,18 @@ public class FallbackService {
public void saveFallback(JSONObject params) throws Exception { public void saveFallback(JSONObject params) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String,Object> mainFormData = new HashMap<>(); Map<String,Object> mainFormData = new HashMap<>();
TableContext tableContext = getTableContext();
mainFormData.put("承租方编号", params.getString("cusNo")); mainFormData.put("承租方编号", params.getString("cusNo"));
mainFormData.put("承租方姓名", params.getString("tenantName")); mainFormData.put("承租方姓名", params.getString("tenantName"));
mainFormData.put("承租方类型", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型",params.getString("tenantType"))); mainFormData.put("承租方类型", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"承租方类型",params.getString("tenantType")));
mainFormData.put("承租方手机号", params.getString("tenantPhone")); mainFormData.put("承租方手机号", params.getString("tenantPhone"));
mainFormData.put("留言内容", params.getString("content")); mainFormData.put("留言内容", params.getString("content"));
mainFormData.put("留言日期", df.format(new Date())); mainFormData.put("留言日期", df.format(new Date()));
mainFormData.put("处理状态", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(), "处理状态", "未处理")); mainFormData.put("处理状态", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(), "处理状态", "未处理"));
String docNo = "weChat_" + UUID.randomUUID().toString().replace("-",""); String docNo = "weChat_" + UUID.randomUUID().toString().replace("-","");
mainFormData.put("档案编号",docNo); mainFormData.put("档案编号",docNo);
String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName);
formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); FormSaveUtil.formSave(loginName,getFormNo(),factory,mainFormData,null);
} }
private String getStringValue(Map<String, Object> fieldsMap,String key) { private String getStringValue(Map<String, Object> fieldsMap,String key) {

View File

@@ -1,22 +0,0 @@
package com.seeyon.apps.src_rent.form;
public enum ClauseFactor {
NEQ,//不相等
EQ, //相等
GT, //大于
GE, //大于等于
LT, //小于
LE, //小于等于
NULL, //空
NOT_NULL, //非空
LIKE, //模糊
AND,
OR,
IN,
NOT_IN
;
public boolean isNullType() {
return this == NULL || this == NOT_NULL;
}
}

View File

@@ -1,161 +0,0 @@
package com.seeyon.apps.src_rent.form;
import com.seeyon.cap4.form.api.FormApi4Cap4;
import com.seeyon.cap4.form.bean.FormBean;
import com.seeyon.cap4.form.bean.FormFieldBean;
import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager;
import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumBean;
import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem;
import com.seeyon.ctp.util.JDBCAgent;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
public class EnumMapUtils {
public static String getMasterTableEnumItemValue(String formNo,String fieldDisplay, String targetValue) {
if(targetValue == null || "null".equals(targetValue) || "".equals(targetValue)){
return "";
}
try {
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
FormFieldBean beanByDisplay = masterTableBean.getFieldBeanByDisplay(fieldDisplay);
if(beanByDisplay == null || beanByDisplay.getEnumId() == 0l) {
return "";
}
return getEnumItemValueByEnumId(targetValue, beanByDisplay.getEnumId());
} catch (Exception e) {
return "";
}
}
public static String getEnumItemIdByGroupNameAndItemShowValue(String enumGroupName, String targetValue) {
String sql = "SELECT * FROM ctp_enum ce let join ctp_enum_item cei on ce.`ID` = cei.REF_ENUMID where ce.`ENUMNAME` = ? and CEI.`SHOWVALUE` = ?";
if(StringUtils.isAnyBlank(enumGroupName, targetValue)){
return "";
}
Long enumId = null;
JDBCAgent agent = new JDBCAgent();
try {
agent.execute(sql, Arrays.asList(enumGroupName,targetValue));
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.resultSetToList();
if(list == null || list.size() == 0) {
return "";
}
Map map = list.get(0);
enumId = (Long)map.get("ID");
return enumId == null ? "" : enumId + "";
} catch (Exception e) {
}finally {
agent.close();
}
return "";
}
public static String getEnumItemValue(String rootPCode, String groupValue, String targetValue) {
if(targetValue == null || "null".equals(targetValue) || "".equals(targetValue)){
return "";
}
String queryIdSql = "SELECT ce.ID FROM ctp_enum ce inner join ctp_enum cei on ce.`PARENT_ID` = cei.ID where CEI.`PROGRAM_CODE` = ? and ce.`ENUMNAME` = ?";
Long enumId = null;
JDBCAgent agent = new JDBCAgent();
try {
agent.execute(queryIdSql, Arrays.asList(rootPCode,groupValue));
List<Map<String, Object>> list = (List<Map<String, Object>>) agent.resultSetToList();
if(list == null || list.size() == 0) {
return "";
}
Map map = list.get(0);
enumId = (Long)map.get("ID");
} catch (Exception e) {
return "";
}finally {
agent.close();
}
EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId);
if(ctpEnumBean == null) {
return "";
}
List<CtpEnumItem> ctpEnumItems = ctpEnumBean.getItems();
if(ctpEnumBean.getItems() == null) {
return "";
}
for (CtpEnumItem enumItem : ctpEnumItems) {
if(enumItem.getShowvalue().equals(targetValue)) {
return enumItem.getId() + "";
}
}
return "";
}
public static Set<String> getEnumItemValues(String formNo,String fieldDisplay) {
Set<String> set = new HashSet<>();
try {
FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4");
FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo);
FormTableBean masterTableBean = cap4FormBean.getMasterTableBean();
FormFieldBean beanByDisplay = masterTableBean.getFieldBeanByDisplay(fieldDisplay);
if(beanByDisplay == null || beanByDisplay.getEnumId() == 0l) {
return set;
}
EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(beanByDisplay.getEnumId());
if(ctpEnumBean == null) {
return set;
}
List<CtpEnumItem> ctpEnumItems = ctpEnumBean.getItems();
if(ctpEnumBean.getItems() == null) {
return set;
}
for (CtpEnumItem enumItem : ctpEnumItems) {
set.add(enumItem.getShowvalue());
}
} catch (Exception e) {
}
return set;
}
public static String getEnumItemValueByEnumId(String showValue,long enumId) {
EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId);
if(ctpEnumBean == null) {
return "";
}
List<CtpEnumItem> ctpEnumItems = ctpEnumBean.getItems();
if(ctpEnumBean.getItems() == null) {
return "";
}
for (CtpEnumItem enumItem : ctpEnumItems) {
if(enumItem.getShowvalue().equals(showValue)) {
return enumItem.getId() + "";
}
}
return "";
}
public static String getEnumShowValue(Object enumItemId) throws BusinessException {
if(enumItemId == null) {
return "";
}
Long temp = enumItemId instanceof Long ? (Long)enumItemId : (enumItemId instanceof String ? Long.parseLong((String)enumItemId) : null);
if(temp == null) {
return "";
}
EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(temp);
if(ctpEnumItem == null) {
return "";
}
return ctpEnumItem.getShowvalue();
}
}

View File

@@ -1,33 +0,0 @@
package com.seeyon.apps.src_rent.form;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FormColumn {
private String id;
private List<FormFieldVo> vos;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<FormFieldVo> getVos() {
return vos;
}
public void setVos(List<FormFieldVo> vos) {
this.vos = vos;
}
public Map<String,Object> getFieldsMap() {
Map<String,Object> map = new HashMap<>();
vos.forEach(vo -> map.put(vo.getDisplayName(),vo.getValue()));
map.put("id",id);
return map;
}
}

View File

@@ -1,85 +0,0 @@
package com.seeyon.apps.src_rent.form;
import com.seeyon.v3x.services.form.bean.RecordExport;
import com.seeyon.v3x.services.form.bean.SubordinateFormExport;
import com.seeyon.v3x.services.form.bean.ValueExport;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
//创建无流程表单数据处理工具类
public class FormExportUtil {
/**
* 设置主表信息
* @param map 设置主表字段。Map<主表显示名称,主表数据>
* @return
*/
public List<ValueExport> setFormValue(Map<String, Object> map ){
// 创建返回值对象
List<ValueExport> valueExports = new ArrayList<ValueExport>();
ValueExport valueExport ;
// 获取参数信息(显示名称)
Set<String> keys = map.keySet();
if(keys.size()>0) {
// 对控件赋值
for (String key : keys) {
if(map.get(key) != null ){
valueExport = new ValueExport();
valueExport.setDisplayName(key);
valueExport.setValue(map.get(key).toString());
valueExports.add(valueExport);
}
System.out.println(key+":"+map.get(key));
}
}
return valueExports;
}
/**
* 设置从表信息
* @param lists 设置主表字段。List<Map<显示名称,数据值>>
*/
public List<SubordinateFormExport> setSubordinateFormValue(List<Map<String, Object>> lists){
List<SubordinateFormExport> subordinateFormExports = new ArrayList<SubordinateFormExport>();
SubordinateFormExport subordinateFormExport = new SubordinateFormExport();
List<RecordExport> recordExports = new ArrayList<RecordExport>();
List<ValueExport> valueExports;
RecordExport recordExport;
for(int i = 0 ; i < lists.size() ; i++) {
recordExport = new RecordExport();
valueExports = setFormValue(lists.get(i));
recordExport.setRecord(valueExports);
recordExports.add(recordExport);
}
subordinateFormExport.setValues(recordExports);
subordinateFormExports.add(subordinateFormExport);
return subordinateFormExports;
}
public List<SubordinateFormExport> setAllSubordinateFormValue(List<Map<String,Object>> lists){
List<SubordinateFormExport> subordinateFormExports = new ArrayList<SubordinateFormExport>();
for (Map<String, Object> list : lists) {
SubordinateFormExport subordinateFormExport = new SubordinateFormExport();
List<RecordExport> recordExports = new ArrayList<RecordExport>();
for (String key : list.keySet()) {
List<Map<String,Object>> columns = (List<Map<String, Object>>) list.get(key);
for(int i = 0 ; i < columns.size() ; i++) {
List<ValueExport> valueExports = setFormValue(columns.get(i));
RecordExport recordExport = new RecordExport();
recordExport.setRecord(valueExports);
recordExports.add(recordExport);
}
}
subordinateFormExport.setValues(recordExports);
subordinateFormExports.add(subordinateFormExport);
}
return subordinateFormExports;
}
}

View File

@@ -1,22 +0,0 @@
package com.seeyon.apps.src_rent.form;
public class FormFieldVo {
private String displayName;
private Object value;
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}

View File

@@ -1,57 +0,0 @@
package com.seeyon.apps.src_rent.form;
public class FormUpdateField {
private String display;
private String fieldName;
private Object value;
public FormUpdateField(Object value) {
this.value = value;
}
public FormUpdateField() {
}
public static FormUpdateField build() {
return new FormUpdateField();
}
public FormUpdateField display(String display) {
this.display = display;
return this;
}
public FormUpdateField value(String value) {
this.value = value;
return this;
}
public FormUpdateField fieldName(String fieldName) {
this.fieldName = fieldName;
return this;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
}

View File

@@ -1,150 +0,0 @@
package com.seeyon.apps.src_rent.form;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class FormWhereCondition {
private String display;
private String fieldName; //字段名
private Object value; //值
private List<Object> values; //值
private ClauseFactor clauseFactor = ClauseFactor.EQ; //条件因子 eq lt gt not_null null
private ClauseFactor concatFactor = ClauseFactor.AND; //拼接因子
private boolean startWithBracket = false; //是否以括号开头生成子条件
private boolean endWithBracket = false; //是否以括号结尾结束子条件
private String index;
public FormWhereCondition() {
this.values = new ArrayList<>();
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
public static FormWhereCondition build() {
return new FormWhereCondition();
}
public FormWhereCondition fieldName(String fieldName) {
this.fieldName = fieldName;
return this;
}
public FormWhereCondition display(String display) {
this.display = display;
return this;
}
public FormWhereCondition value(Object value) {
this.value = value;
return this;
}
public FormWhereCondition clauseFactor(ClauseFactor clauseFactor) {
this.clauseFactor = clauseFactor;
return this;
}
public FormWhereCondition index(String index) {
this.index = index;
return this;
}
public FormWhereCondition startWithBracket(boolean startWithBracket) {
this.startWithBracket = startWithBracket;
return this;
}
public FormWhereCondition endWithBracket(boolean endWithBracket) {
this.endWithBracket = endWithBracket;
return this;
}
public FormWhereCondition concatFactor(ClauseFactor concatFactor) {
this.concatFactor = concatFactor;
return this;
}
public FormWhereCondition(Object value, ClauseFactor clauseFactor) {
this.value = value;
this.clauseFactor = clauseFactor;
}
public boolean isStartWithBracket() {
return startWithBracket;
}
public void setStartWithBracket(boolean startWithBracket) {
this.startWithBracket = startWithBracket;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public ClauseFactor getClauseFactor() {
return clauseFactor;
}
public void setClauseFactor(ClauseFactor clauseFactor) {
this.clauseFactor = clauseFactor;
}
public ClauseFactor getConcatFactor() {
return concatFactor;
}
public void setConcatFactor(ClauseFactor concatFactor) {
this.concatFactor = concatFactor;
}
public String getIndex() {
return index;
}
public void setIndex(String index) {
this.index = index;
}
public boolean isEndWithBracket() {
return endWithBracket;
}
public void setEndWithBracket(boolean endWithBracket) {
this.endWithBracket = endWithBracket;
}
public List<Object> getValues() {
return values;
}
public FormWhereCondition addValue(Object value) {
this.values.add(value);
return this;
}
public FormWhereCondition addAllValue(Collection <?> values) {
this.values.addAll(values);
return this;
}
public void setValues(List<Object> values) {
this.values = values;
}
}

View File

@@ -1,154 +0,0 @@
package com.seeyon.apps.src_rent.form;
public class QueryWhereCondition {
private String display;
private String fieldName; //字段名
private Object value; //值
private ClauseFactor clauseFactor = ClauseFactor.EQ; //条件因子 eq lt gt not_null null
private ClauseFactor concatFactor = ClauseFactor.AND; //拼接因子
private boolean startWithBracket = false; //是否以括号开头生成子条件
private boolean endWithBracket = false; //是否以括号结尾结束子条件
private String index;
private Integer limit = null;
private Integer offset = null;
public QueryWhereCondition() {
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
public static QueryWhereCondition build() {
return new QueryWhereCondition();
}
public QueryWhereCondition fieldName(String fieldName) {
this.fieldName = fieldName;
return this;
}
public QueryWhereCondition display(String display) {
this.display = display;
return this;
}
public QueryWhereCondition value(Object value) {
this.value = value;
return this;
}
public QueryWhereCondition clauseFactor(ClauseFactor clauseFactor) {
this.clauseFactor = clauseFactor;
return this;
}
public QueryWhereCondition index(String index) {
this.index = index;
return this;
}
public QueryWhereCondition limit(Integer limit) {
this.limit = limit;
return this;
}
public QueryWhereCondition offset(Integer offset) {
this.offset = offset;
return this;
}
public QueryWhereCondition startWithBracket(boolean startWithBracket) {
this.startWithBracket = startWithBracket;
return this;
}
public QueryWhereCondition endWithBracket(boolean endWithBracket) {
this.endWithBracket = endWithBracket;
return this;
}
public QueryWhereCondition concatFactor(ClauseFactor concatFactor) {
this.concatFactor = concatFactor;
return this;
}
public QueryWhereCondition(Object value, ClauseFactor clauseFactor) {
this.value = value;
this.clauseFactor = clauseFactor;
}
public boolean isStartWithBracket() {
return startWithBracket;
}
public void setStartWithBracket(boolean startWithBracket) {
this.startWithBracket = startWithBracket;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public ClauseFactor getClauseFactor() {
return clauseFactor;
}
public void setClauseFactor(ClauseFactor clauseFactor) {
this.clauseFactor = clauseFactor;
}
public ClauseFactor getConcatFactor() {
return concatFactor;
}
public void setConcatFactor(ClauseFactor concatFactor) {
this.concatFactor = concatFactor;
}
public String getIndex() {
return index;
}
public void setIndex(String index) {
this.index = index;
}
public boolean isEndWithBracket() {
return endWithBracket;
}
public void setEndWithBracket(boolean endWithBracket) {
this.endWithBracket = endWithBracket;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
}

View File

@@ -4,12 +4,12 @@ import com.seeyon.apps.ext.quartz.AbstractQuartzTask;
import com.seeyon.apps.src_rent.bill.BillService; import com.seeyon.apps.src_rent.bill.BillService;
import com.seeyon.apps.src_rent.bill.BillVo; import com.seeyon.apps.src_rent.bill.BillVo;
import com.seeyon.apps.src_rent.bill.WaeBillService; import com.seeyon.apps.src_rent.bill.WaeBillService;
import com.seeyon.apps.src_rent.form.ClauseFactor;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.message.ThirdMessageService; import com.seeyon.apps.src_rent.message.ThirdMessageService;
import com.seeyon.apps.src_rent.message.MessageVo; import com.seeyon.apps.src_rent.message.MessageVo;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.utils.form.ClauseFactor;
import com.seeyon.utils.form.FormWhereCondition;
import java.text.DateFormat; import java.text.DateFormat;
@@ -28,6 +28,7 @@ public class BillPayUrgeJob extends AbstractQuartzTask {
@Override @Override
public String taskRun(String s) throws Exception { public String taskRun(String s) throws Exception {
hanleContractBill(); hanleContractBill();
hanleWaeBill();
return ""; return "";
} }
@@ -40,14 +41,11 @@ public class BillPayUrgeJob extends AbstractQuartzTask {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
//拉取收款结果反馈为空,且存在催缴时间的账单记录 //拉取收款结果反馈为空,且存在催缴时间的账单记录
List<FormWhereCondition> conditions = new ArrayList<>();; List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL)); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL));
conditions.add(FormWhereCondition.build().display("账单-催缴时间").clauseFactor(ClauseFactor.NOT_NULL)); conditions.add(FormWhereCondition.build().display("账单-催缴时间").clauseFactor(ClauseFactor.NOT_NULL));
PageQueryVo pageQueryVo = null; List<BillVo> billVos = billService.queryAllContractBill(conditions);
do{ for (BillVo data : billVos) {
pageQueryVo = billService.queryAllContractBill(conditions);
List<BillVo> datas = pageQueryVo.getDatas();
for (BillVo data : datas) {
//发送消息到小程序后端 //发送消息到小程序后端
MessageVo messageVo = new MessageVo(); MessageVo messageVo = new MessageVo();
String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "账单尚未支付,请尽快支付"; String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "账单尚未支付,请尽快支付";
@@ -60,8 +58,7 @@ public class BillPayUrgeJob extends AbstractQuartzTask {
messageVo.setTitle("账单催缴"); messageVo.setTitle("账单催缴");
thirdMessageService.sendMessage(messageVo); thirdMessageService.sendMessage(messageVo);
} }
}while (pageQueryVo != null && pageQueryVo.getDatas() != null); } catch (Exception e) {
}catch (Exception e) {
} }
} }
@@ -69,15 +66,13 @@ public class BillPayUrgeJob extends AbstractQuartzTask {
private void hanleWaeBill() { private void hanleWaeBill() {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
//拉取收款结果反馈为空,且存在催缴时间的账单记录 //拉取缴费状态为空,且存在催缴时间的水电费账单记录
List<FormWhereCondition> conditions = new ArrayList<>();; List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL)); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL));
conditions.add(FormWhereCondition.build().display("账单-催缴时间").clauseFactor(ClauseFactor.NOT_NULL)); conditions.add(FormWhereCondition.build().display("催缴时间").clauseFactor(ClauseFactor.NOT_NULL));
PageQueryVo pageQueryVo = null; List<BillVo> billVos = waeBillService.queryAllWaeBill(conditions);
do{
pageQueryVo = waeBillService.queryAllWaeBill(conditions); for (BillVo data : billVos) {
List<BillVo> datas = pageQueryVo.getDatas();
for (BillVo data : datas) {
//发送消息到小程序后端 //发送消息到小程序后端
MessageVo messageVo = new MessageVo(); MessageVo messageVo = new MessageVo();
String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "水电费账单尚未支付,请尽快支付"; String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "水电费账单尚未支付,请尽快支付";
@@ -90,8 +85,8 @@ public class BillPayUrgeJob extends AbstractQuartzTask {
messageVo.setTitle("账单催缴"); messageVo.setTitle("账单催缴");
thirdMessageService.sendMessage(messageVo); thirdMessageService.sendMessage(messageVo);
} }
}while (pageQueryVo != null && pageQueryVo.getDatas() != null);
}catch (Exception e) { } catch (Exception e) {
} }
} }

View File

@@ -58,7 +58,11 @@ public class SealDocSyncJob extends AbstractQuartzTask {
} }
for (Object o : sealArray) { for (Object o : sealArray) {
SealInfoVo sealInfoVo = JsonUtils.parseObject(JsonUtils.toJSONString(o), SealInfoVo.class); SealInfoVo sealInfoVo = JsonUtils.parseObject(JsonUtils.toJSONString(o), SealInfoVo.class);
try {
sealService.upsertOaSealDoc(sealInfoVo); sealService.upsertOaSealDoc(sealInfoVo);
}catch (Exception e) {
e.printStackTrace();
}
} }
}while (true); }while (true);

View File

@@ -6,9 +6,6 @@ import com.seeyon.apps.ext.workflow.vo.FormDataVo;
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormUpdateField;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils; import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils;
import com.seeyon.apps.src_rent.po.NormalSignFieldConfig; import com.seeyon.apps.src_rent.po.NormalSignFieldConfig;
import com.seeyon.apps.src_rent.po.SignField; import com.seeyon.apps.src_rent.po.SignField;
@@ -23,6 +20,9 @@ import com.seeyon.cap4.form.bean.FormFieldBean;
import com.seeyon.cap4.form.service.CAP4FormManager; import com.seeyon.cap4.form.service.CAP4FormManager;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.utils.form.FormTableExecutor;
import com.seeyon.utils.form.FormUpdateField;
import com.seeyon.utils.form.FormWhereCondition;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -191,14 +191,13 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException { private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException {
String tableName = formDataVo.getTableName(); String tableName = formDataVo.getTableName();
FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID"); FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID");
FormDataOperator formDataOperator = new FormDataOperator();
List<FormUpdateField> updateFields = new ArrayList<>(); List<FormUpdateField> updateFields = new ArrayList<>();
updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId)); updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId));
List<FormWhereCondition> whereConditions = new ArrayList<>(); List<FormWhereCondition> whereConditions = new ArrayList<>();
FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId()); FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId());
condition.setFieldName("ID"); condition.setFieldName("ID");
whereConditions.add(condition); whereConditions.add(condition);
formDataOperator.updateMasterForm(updateFields,tableName,whereConditions); FormTableExecutor.update(tableName,updateFields,whereConditions);
} }
private Map<String, Object> mapOf(Object... keyValues) { private Map<String, Object> mapOf(Object... keyValues) {

View File

@@ -6,9 +6,6 @@ import com.seeyon.apps.ext.workflow.vo.FormDataVo;
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormUpdateField;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils; import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils;
import com.seeyon.apps.src_rent.po.NormalSignFieldConfig; import com.seeyon.apps.src_rent.po.NormalSignFieldConfig;
import com.seeyon.apps.src_rent.po.SignField; import com.seeyon.apps.src_rent.po.SignField;
@@ -24,6 +21,9 @@ import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.bo.V3xOrgMember;
import com.seeyon.ctp.organization.manager.OrgManager; import com.seeyon.ctp.organization.manager.OrgManager;
import com.seeyon.utils.form.FormTableExecutor;
import com.seeyon.utils.form.FormUpdateField;
import com.seeyon.utils.form.FormWhereCondition;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -167,14 +167,13 @@ public class EsignOneSignerNode extends ACommonSuperNode {
private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException { private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException {
String tableName = formDataVo.getTableName(); String tableName = formDataVo.getTableName();
FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID"); FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID");
FormDataOperator formDataOperator = new FormDataOperator();
List<FormUpdateField> updateFields = new ArrayList<>(); List<FormUpdateField> updateFields = new ArrayList<>();
updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId)); updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId));
List<FormWhereCondition> whereConditions = new ArrayList<>(); List<FormWhereCondition> whereConditions = new ArrayList<>();
FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId()); FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId());
condition.setFieldName("ID"); condition.setFieldName("ID");
whereConditions.add(condition); whereConditions.add(condition);
formDataOperator.updateMasterForm(updateFields,tableName,whereConditions); FormTableExecutor.update(tableName,updateFields,whereConditions);
} }
private Map<String, Object> mapOf(Object... keyValues) { private Map<String, Object> mapOf(Object... keyValues) {

View File

@@ -1,12 +1,12 @@
package com.seeyon.apps.src_rent.notice; package com.seeyon.apps.src_rent.notice;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.src_rent.assets.OaAssetsVo;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.file.OaFileVo; import com.seeyon.apps.src_rent.file.OaFileVo;
import com.seeyon.apps.src_rent.form.*;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.utils.form.*;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; import com.seeyon.ctp.common.filemanager.manager.AttachmentManager;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -22,15 +22,18 @@ import java.util.Map;
public class NoticeService { public class NoticeService {
private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");
private DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); private DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
private String getFormNo() { private String getFormNo() {
return configProvider.getBizConfigByKey(RentConstants.NOTICEFORMNO); return configProvider.getBizConfigByKey(RentConstants.NOTICEFORMNO);
} }
private TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
public PageQueryVo pageQuery(JSONObject params) throws Exception { public PageQueryVo pageQuery(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
@@ -38,12 +41,12 @@ public class NoticeService {
conditions.add(FormWhereCondition.build().display("开始日期").clauseFactor(ClauseFactor.LE).value(df.format(date))); conditions.add(FormWhereCondition.build().display("开始日期").clauseFactor(ClauseFactor.LE).value(df.format(date)));
conditions.add(FormWhereCondition.build().display("过期日期").clauseFactor(ClauseFactor.GT).value(df.format(date))); conditions.add(FormWhereCondition.build().display("过期日期").clauseFactor(ClauseFactor.GT).value(df.format(date)));
PageQueryVo<NoticeVo> pageQueryVo = new PageQueryVo(); PageQueryVo<NoticeVo> pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
List<NoticeVo> vos = new ArrayList<>(); List<NoticeVo> vos = new ArrayList<>();
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0){ if(datas.size() > 0){
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String,Object> map = data.getFieldsMap();
NoticeVo vo = new NoticeVo(); NoticeVo vo = new NoticeVo();
fillVo(map, vo); fillVo(map, vo);
vos.add(vo); vos.add(vo);
@@ -54,23 +57,25 @@ public class NoticeService {
return pageQueryVo; return pageQueryVo;
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { private List<FormWhereCondition> buildConditions(JSONObject params) throws BusinessException {
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
TableContext tableContext = getTableContext();
if(StringUtils.isNotBlank(params.getString("assetsNo"))) { if(StringUtils.isNotBlank(params.getString("assetsNo"))) {
conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo"))); conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo")));
} }
if(StringUtils.isNotBlank(params.getString("id"))) { if(StringUtils.isNotBlank(params.getString("id"))) {
conditions.add(FormWhereCondition.build().display("id").value(params.getString("id"))); conditions.add(FormWhereCondition.build().display("id").value(params.getString("id")));
} }
conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序",""))); conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"是否同步小程序","")));
conditions.add(FormWhereCondition.build().display("招商状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"招商状态","上架"))); conditions.add(FormWhereCondition.build().display("招商状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"招商状态","上架")));
return conditions; return conditions;
} }
public NoticeVo queryNoticeDetail(JSONObject params) throws Exception { public NoticeVo queryNoticeDetail(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
NoticeVo vo = new NoticeVo(); NoticeVo vo = new NoticeVo();
FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true);
if(formColumn == null) { if(formColumn == null) {
return vo; return vo;
} }

View File

@@ -5,37 +5,40 @@ import com.seeyon.apps.src_rent.assets.AssetsService;
import com.seeyon.apps.src_rent.assets.OaAssetsVo; import com.seeyon.apps.src_rent.assets.OaAssetsVo;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.EnumMapUtils;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.apps.src_rent.po.PageQueryVo;
import com.seeyon.utils.form.*;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.v3x.services.form.FormFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.*;
public class ReserveService { public class ReserveService {
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
private FormFactory factory = (FormFactory) AppContext.getBean("formFactory");
private String getFormNo() { private String getFormNo() {
return configProvider.getBizConfigByKey(RentConstants.RESERVE_FORMNO); return configProvider.getBizConfigByKey(RentConstants.RESERVE_FORMNO);
} }
private TableContext getTableContext() throws BusinessException {
return FormTableExecutor.master(getFormNo());
}
public PageQueryVo pageQuery(JSONObject params) throws Exception { public PageQueryVo pageQuery(JSONObject params) throws Exception {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo");
Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize");
List<ReservationVo> vos = new ArrayList<>(); List<ReservationVo> vos = new ArrayList<>();
PageQueryVo pageQueryVo = new PageQueryVo(); PageQueryVo pageQueryVo = new PageQueryVo();
List<Object> datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); List<FormColumn> datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true);
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
if(datas.size() > 0){ if(datas.size() > 0){
for (Object data : datas) { for (FormColumn data : datas) {
Map<String,Object> map = (Map<String, Object>) data; Map<String,Object> map = data.getFieldsMap();
ReservationVo vo = new ReservationVo(); ReservationVo vo = new ReservationVo();
fillVo(map,vo); fillVo(map,vo);
vos.add(vo); vos.add(vo);
@@ -55,9 +58,10 @@ public class ReserveService {
} }
public Integer countHandling(JSONObject params) throws BusinessException { public Integer countHandling(JSONObject params) throws BusinessException {
TableContext masterContext = FormTableExecutor.master(getFormNo());
List<FormWhereCondition> conditions = buildConditions(params); List<FormWhereCondition> conditions = buildConditions(params);
conditions.add(FormWhereCondition.build().display("处理状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"处理状态","未处理"))); conditions.add(FormWhereCondition.build().display("处理状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"处理状态","未处理")));
Long count = formDataOperator.countConditon(getFormNo(), conditions); Long count = FormTableExecutor.count(masterContext, null, conditions);
return count.intValue(); return count.intValue();
} }
@@ -81,6 +85,7 @@ public class ReserveService {
public void saveReserve(JSONObject params) throws Exception { public void saveReserve(JSONObject params) throws Exception {
Map<String,Object> mainFormData = new HashMap<>(); Map<String,Object> mainFormData = new HashMap<>();
TableContext tableContext = getTableContext();
mainFormData.put("资产编号", params.getString("assetsNo")); mainFormData.put("资产编号", params.getString("assetsNo"));
mainFormData.put("资产名称", params.getString("assetsName")); mainFormData.put("资产名称", params.getString("assetsName"));
mainFormData.put("看房人姓名", params.getString("reserveName")); mainFormData.put("看房人姓名", params.getString("reserveName"));
@@ -88,9 +93,9 @@ public class ReserveService {
mainFormData.put("微信openId", params.getString("openId")); mainFormData.put("微信openId", params.getString("openId"));
String docNo = "weChat_" + UUID.randomUUID().toString().replace("-",""); String docNo = "weChat_" + UUID.randomUUID().toString().replace("-","");
mainFormData.put("档案编号",docNo); mainFormData.put("档案编号",docNo);
mainFormData.put("处理状态", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(), "处理状态", "未处理")); mainFormData.put("处理状态", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(), "处理状态", "未处理"));
String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName);
formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); FormSaveUtil.formSave(loginName,getFormNo(),factory,mainFormData,null);
} }
private List<FormWhereCondition> buildConditions(JSONObject params) { private List<FormWhereCondition> buildConditions(JSONObject params) {

View File

@@ -3,10 +3,7 @@ package com.seeyon.apps.src_rent.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.EnumMapUtils; import com.seeyon.utils.form.*;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormUpdateField;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.utils.FileUtil; import com.seeyon.apps.src_rent.utils.FileUtil;
import com.seeyon.apps.src_rent.utils.ProtUtil; import com.seeyon.apps.src_rent.utils.ProtUtil;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
@@ -33,7 +30,6 @@ public class EsignCallbackBizService {
String enumId = statusParams[1]; String enumId = statusParams[1];
String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已签署",Long.parseLong(enumId)); String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已签署",Long.parseLong(enumId));
//下载文件到本地 //下载文件到本地
FormDataOperator formDataOperator = new FormDataOperator();
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
String refId = FileUtil.uploadContractToOA(fileUrl, String refId = FileUtil.uploadContractToOA(fileUrl,
fileName, getModuleId(tempFormId), fileName, getModuleId(tempFormId),
@@ -47,7 +43,7 @@ public class EsignCallbackBizService {
params.put("message", "签署完成!!!"); params.put("message", "签署完成!!!");
params.put("returnCode", 1); params.put("returnCode", 1);
protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId); protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId);
formDataOperator.updateMasterForm(updateFields,tablename,conditions); FormTableExecutor.update(tablename, updateFields, conditions);
} }
public void handleExpiredSignCallbackBiz(String tableName,String statusField,String formId) throws Exception { public void handleExpiredSignCallbackBiz(String tableName,String statusField,String formId) throws Exception {
@@ -58,7 +54,6 @@ public class EsignCallbackBizService {
String status = statusParams[0]; String status = statusParams[0];
String enumId = statusParams[1]; String enumId = statusParams[1];
String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已过期",Long.parseLong(enumId)); String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已过期",Long.parseLong(enumId));
FormDataOperator formDataOperator = new FormDataOperator();
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
List<FormUpdateField> updateFields = new ArrayList<>(); List<FormUpdateField> updateFields = new ArrayList<>();
updateFields.add(FormUpdateField.build().fieldName(status).value(enumItemId)); updateFields.add(FormUpdateField.build().fieldName(status).value(enumItemId));
@@ -67,7 +62,7 @@ public class EsignCallbackBizService {
params.put("message", "签署失败: 合同已过最大签署期限未签署"); params.put("message", "签署失败: 合同已过最大签署期限未签署");
params.put("returnCode", 2); params.put("returnCode", 2);
protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId); protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId);
formDataOperator.updateMasterForm(updateFields,tableName,conditions); FormTableExecutor.update(tableName, updateFields, conditions);
} }
public void handleFailSignCallbackBiz(String tableName,String statusField,String formId,String failMsg) throws Exception { public void handleFailSignCallbackBiz(String tableName,String statusField,String formId,String failMsg) throws Exception {
@@ -78,7 +73,6 @@ public class EsignCallbackBizService {
String status = statusParams[0]; String status = statusParams[0];
String enumId = statusParams[1]; String enumId = statusParams[1];
String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已过期",Long.parseLong(enumId)); String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已过期",Long.parseLong(enumId));
FormDataOperator formDataOperator = new FormDataOperator();
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
List<FormUpdateField> updateFields = new ArrayList<>(); List<FormUpdateField> updateFields = new ArrayList<>();
updateFields.add(FormUpdateField.build().fieldName(status).value(enumItemId)); updateFields.add(FormUpdateField.build().fieldName(status).value(enumItemId));
@@ -87,7 +81,7 @@ public class EsignCallbackBizService {
params.put("message", "签署失败: " + failMsg); params.put("message", "签署失败: " + failMsg);
params.put("returnCode", 2); params.put("returnCode", 2);
protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId); protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId);
formDataOperator.updateMasterForm(updateFields,tableName,conditions); FormTableExecutor.update(tableName, updateFields, conditions);
} }
private String getModuleId(String formId) { private String getModuleId(String formId) {

View File

@@ -6,10 +6,9 @@ import com.seeyon.aicloud.common.JsonUtils;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.EsignApiUrl; import com.seeyon.apps.src_rent.constants.EsignApiUrl;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.FormColumn; import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.apps.src_rent.form.FormDataOperator; import com.seeyon.utils.form.*;
import com.seeyon.apps.src_rent.form.FormExportUtil; import com.seeyon.cap4.form.bean.FormTableBean;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import com.seeyon.apps.src_rent.po.EsignApiHeader; import com.seeyon.apps.src_rent.po.EsignApiHeader;
import com.seeyon.apps.src_rent.po.EsignBaseResp; import com.seeyon.apps.src_rent.po.EsignBaseResp;
import com.seeyon.apps.src_rent.po.SealInfoVo; import com.seeyon.apps.src_rent.po.SealInfoVo;
@@ -88,14 +87,14 @@ public class SealService {
return null; return null;
} }
public void upsertOaSealDoc(SealInfoVo vo) { public void upsertOaSealDoc(SealInfoVo vo) throws BusinessException {
FormDataOperator formDataOperator = new FormDataOperator();
String formNo = configProvider.getBizConfigByKey(RentConstants.sealInfoFormCode); String formNo = configProvider.getBizConfigByKey(RentConstants.sealInfoFormCode);
TableContext masterContext = FormTableExecutor.master(formNo);
List<FormWhereCondition> conditions = new ArrayList<>(); List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("印章ID").value(vo.getSealId())); conditions.add(FormWhereCondition.build().display("印章ID").value(vo.getSealId()));
FormColumn formColumn = null; FormColumn formColumn = null;
try { try {
formColumn = formDataOperator.queryOneRowFormData(formNo,false ,null, conditions); formColumn = FormTableExecutor.queryOne(masterContext, conditions, false);
} catch (Exception e) { } catch (Exception e) {
log.error("查询印章信息失败: " + e.getMessage(), e); log.error("查询印章信息失败: " + e.getMessage(), e);
} }
@@ -107,14 +106,8 @@ public class SealService {
params.put("印章类型", vo.getSealBizTypeDescription()); params.put("印章类型", vo.getSealBizTypeDescription());
params.put("印章状态", vo.getStatusDescription()); params.put("印章状态", vo.getStatusDescription());
// params.put("印章图片地址",vo.getSealImageDownloadUrl()); // params.put("印章图片地址",vo.getSealImageDownloadUrl());
FormExport formExport = new FormExport();
FormExportUtil formExportUtil = new FormExportUtil();
List<ValueExport> valueExport = formExportUtil.setFormValue(params);
formExport.setValues(valueExport);
try { try {
getFormFactory().importBusinessFormData(configProvider.getBizConfigByKey(RentConstants.formLoginName), configProvider.getBizConfigByKey(RentConstants.sealInfoFormCode), FormSaveUtil.formSave(configProvider.getBizConfigByKey(RentConstants.formLoginName),formNo,getFormFactory(),params,null);
formExport, new String[]{});
} catch (ServiceException e) { } catch (ServiceException e) {
log.error(vo.getSealName() + "信息写入OA档案失败," + e.getMessage(), e); log.error(vo.getSealName() + "信息写入OA档案失败," + e.getMessage(), e);
} }
@@ -122,7 +115,7 @@ public class SealService {
} else { } else {
if (!"已启用".equals(vo.getStatusDescription())) { if (!"已启用".equals(vo.getStatusDescription())) {
try { try {
formDataOperator.deleteByCondition(formNo, conditions); FormTableExecutor.delete(masterContext,conditions);
} catch (Exception e) { } catch (Exception e) {
log.error("删除停用印章失败" + e.getMessage(), e); log.error("删除停用印章失败" + e.getMessage(), e);
} }

View File

@@ -1,25 +0,0 @@
package com.seeyon.apps.src_rent.utils;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.apps.src_rent.form.FormUpdateField;
import com.seeyon.apps.src_rent.form.FormWhereCondition;
import java.util.ArrayList;
import java.util.List;
public class AttachmentUtils {
public void fileFillBack(String url,String fileName,String loginName,String unitName,String tableName,String updateField,String formId,String formNo) throws Exception {
String refId = FileUtil.uploadContractToOA(url, fileName, formId, loginName, unitName);
if(formNo != null) {
}else {
FormDataOperator formDataOperator = new FormDataOperator();
List<FormUpdateField> updateFields = new ArrayList<>();
List<FormWhereCondition> conditions = new ArrayList<>();
updateFields.add(FormUpdateField.build().fieldName(updateField).value(refId));
conditions.add(FormWhereCondition.build().value(formId).fieldName("ID"));
formDataOperator.updateMasterForm(updateFields,tableName,conditions);
}
}
}

View File

@@ -4,8 +4,9 @@ import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.src_rent.assets.AssetsService; import com.seeyon.apps.src_rent.assets.AssetsService;
import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.config.RentConfigProvider;
import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.constants.RentConstants;
import com.seeyon.apps.src_rent.form.FormDataOperator;
import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.AppContext;
import com.seeyon.utils.form.FormSaveUtil;
import com.seeyon.v3x.services.form.FormFactory;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@@ -17,8 +18,8 @@ import java.util.UUID;
public class ViewRecordService { public class ViewRecordService {
private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider");
private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator");
private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService");
private FormFactory factory = (FormFactory) AppContext.getBean("formFactory");
private String getFormNo() { private String getFormNo() {
return configProvider.getBizConfigByKey(RentConstants.VIEWRECORD_FORMNO); return configProvider.getBizConfigByKey(RentConstants.VIEWRECORD_FORMNO);
@@ -34,6 +35,6 @@ public class ViewRecordService {
mainFormData.put("档案编号",docNo); mainFormData.put("档案编号",docNo);
mainFormData.put("浏览时间",df.format(new Date())); mainFormData.put("浏览时间",df.format(new Date()));
String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName);
formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); FormSaveUtil.formSave(loginName,getFormNo(),factory,mainFormData,null);
} }
} }

View File

@@ -12,7 +12,6 @@
<bean id="qcFallbackService" class="com.seeyon.apps.src_rent.fallback.FallbackService" /> <bean id="qcFallbackService" class="com.seeyon.apps.src_rent.fallback.FallbackService" />
<bean id="qcFileHandlerService" class="com.seeyon.apps.src_rent.file.FileHandlerService" /> <bean id="qcFileHandlerService" class="com.seeyon.apps.src_rent.file.FileHandlerService" />
<bean id="qcFlowCreateService" class="com.seeyon.apps.src_rent.flow.FlowCreateService" /> <bean id="qcFlowCreateService" class="com.seeyon.apps.src_rent.flow.FlowCreateService" />
<bean id="qcFormDataOperator" class="com.seeyon.apps.src_rent.form.FormDataOperator" />
<bean id="qcBillPayUrgeJob" class="com.seeyon.apps.src_rent.job.BillPayUrgeJob" /> <bean id="qcBillPayUrgeJob" class="com.seeyon.apps.src_rent.job.BillPayUrgeJob" />
<bean id="qcContractSignUrgeJob" class="com.seeyon.apps.src_rent.job.ContractSignUrgeJob" /> <bean id="qcContractSignUrgeJob" class="com.seeyon.apps.src_rent.job.ContractSignUrgeJob" />
<bean id="qcSealDocSyncJob" class="com.seeyon.apps.src_rent.job.SealDocSyncJob" /> <bean id="qcSealDocSyncJob" class="com.seeyon.apps.src_rent.job.SealDocSyncJob" />