@@ -1,495 +0,0 @@
package com.yunzhupaas.base.service.impl ;
import com.yunzhupaas.base.entity.* ;
import com.yunzhupaas.base.mapper.PcmContractMapper ;
import com.yunzhupaas.base.service.* ;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl ;
import com.yunzhupaas.base.model.pcmcontract.* ;
import org.springframework.stereotype.Service ;
import com.yunzhupaas.base.service.SuperServiceImpl ;
import org.springframework.beans.factory.annotation.Autowired ;
import com.yunzhupaas.util.GeneraterSwapUtil ;
import java.sql.Connection ;
import java.sql.SQLException ;
import lombok.Cleanup ;
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface ;
import com.yunzhupaas.database.util.DynamicDataSourceUtil ;
import org.apache.commons.collections4.CollectionUtils ;
import com.yunzhupaas.i18n.util.I18nUtil ;
import com.yunzhupaas.exception.DataException ;
import com.yunzhupaas.constant.MsgCode ;
import java.math.BigDecimal ;
import cn.hutool.core.util.ObjectUtil ;
import java.lang.reflect.Field ;
import com.baomidou.mybatisplus.annotation.TableField ;
import com.baomidou.mybatisplus.annotation.TableName ;
import java.util.regex.Pattern ;
import java.util.stream.Collectors ;
import com.yunzhupaas.base.model.ColumnDataModel ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
import org.springframework.transaction.annotation.Transactional ;
import com.baomidou.dynamic.datasource.annotation.DSTransactional ;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.github.yulichang.toolkit.JoinWrappers ;
import com.github.yulichang.wrapper.MPJLambdaWrapper ;
import com.yunzhupaas.model.QueryAllModel ;
import java.text.SimpleDateFormat ;
import com.yunzhupaas.util.* ;
import java.util.* ;
import com.yunzhupaas.base.UserInfo ;
import com.yunzhupaas.permission.entity.UserEntity ;
import com.github.pagehelper.PageHelper ;
/**
*
* pcm_contract
* 版本: V5.2.7
* 版权: Copyright @ 2025 深圳市乐程软件有限公司版权所有
* 作者: 深圳市乐程软件有限公司
* 日期: 2026-03-31
*/
@Service
public class PcmContractServiceImpl extends SuperServiceImpl < PcmContractMapper , PcmContractEntity > implements PcmContractService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil ;
@Autowired
private UserProvider userProvider ;
@Autowired
private Pcm_contract_itemService pcm_contract_itemService ;
@Autowired
private Pcm_payment_planService pcm_payment_planService ;
@Override
public List < PcmContractEntity > getList ( PcmContractPagination pcmContractPagination ) {
return getTypeList ( pcmContractPagination , pcmContractPagination . getDataType ( ) ) ;
}
/** 列表查询 */
@Override
public List < PcmContractEntity > getTypeList ( PcmContractPagination pcmContractPagination , String dataType ) {
String userId = userProvider . get ( ) . getUserId ( ) ;
Map < String , Class > tableClassMap = new HashMap < > ( ) ;
tableClassMap . put ( " pcm_contract " , PcmContractEntity . class ) ;
tableClassMap . put ( " pcm_contract_item " , Pcm_contract_itemEntity . class ) ;
tableClassMap . put ( " pcm_payment_plan " , Pcm_payment_planEntity . class ) ;
MPJLambdaWrapper < PcmContractEntity > wrapper = JoinWrappers
. lambda ( " pcm_contract " , PcmContractEntity . class )
. selectCollection ( Pcm_contract_itemEntity . class , PcmContractEntity : : getPcm_contract_item )
. leftJoin ( Pcm_contract_itemEntity . class , " pcm_contract_item " , Pcm_contract_itemEntity : : getContractId , PcmContractEntity : : getContractId )
. selectCollection ( Pcm_payment_planEntity . class , PcmContractEntity : : getPcm_payment_plan )
. leftJoin ( Pcm_payment_planEntity . class , " pcm_payment_plan " , Pcm_payment_planEntity : : getContractId , PcmContractEntity : : getContractId )
. selectAll ( PcmContractEntity . class ) ;
MPJLambdaWrapper < PcmContractEntity > wrapper2 = JoinWrappers
. lambda ( " pcm_contract " , PcmContractEntity . class )
. leftJoin ( Pcm_contract_itemEntity . class , " pcm_contract_item " , Pcm_contract_itemEntity : : getContractId , PcmContractEntity : : getContractId )
. leftJoin ( Pcm_payment_planEntity . class , " pcm_payment_plan " , Pcm_payment_planEntity : : getContractId , PcmContractEntity : : getContractId )
. distinct ( ) . select ( PcmContractEntity : : getContractId ) ;
QueryAllModel queryAllModel = new QueryAllModel ( ) ;
queryAllModel . setWrapper ( wrapper ) ;
queryAllModel . setClassMap ( tableClassMap ) ;
queryAllModel . setDbLink ( PcmContractConstant . DBLINKID ) ;
//数据过滤
boolean isPc = ServletUtil . getHeader ( " yunzhupaas-origin " ) . equals ( " pc " ) ;
String columnData = ! isPc ? PcmContractConstant . getAppColumnData ( ) : PcmContractConstant . getColumnData ( ) ;
ColumnDataModel columnDataModel = JsonUtil . getJsonToBean ( columnData , ColumnDataModel . class ) ;
String ruleJson = ! isPc ? JsonUtil . getObjectToString ( columnDataModel . getRuleListApp ( ) ) : JsonUtil . getObjectToString ( columnDataModel . getRuleList ( ) ) ;
queryAllModel . setRuleJson ( ruleJson ) ;
//高级查询
boolean hasSuperQuery = true ;
if ( hasSuperQuery ) {
queryAllModel . setSuperJson ( pcmContractPagination . getSuperQueryJson ( ) ) ;
}
//数据权限
boolean pcPermission = false ;
boolean appPermission = false ;
if ( isPc & & pcPermission ) {
queryAllModel . setModuleId ( pcmContractPagination . getMenuId ( ) ) ;
}
if ( ! isPc & & appPermission ) {
queryAllModel . setModuleId ( pcmContractPagination . getMenuId ( ) ) ;
}
//拼接复杂条件
wrapper = generaterSwapUtil . getConditionAllTable ( queryAllModel ) ;
if ( wrapper = = null ) return new ArrayList < > ( ) ;
queryAllModel . setWrapper ( wrapper2 ) ;
wrapper2 = generaterSwapUtil . getConditionAllTable ( queryAllModel ) ;
//其他条件拼接
otherConditions ( pcmContractPagination , wrapper , isPc ) ;
otherConditions ( pcmContractPagination , wrapper2 , isPc ) ;
if ( " 0 " . equals ( dataType ) ) {
com . github . pagehelper . Page < Object > objects = PageHelper . startPage ( ( int ) pcmContractPagination . getCurrentPage ( ) , ( int ) pcmContractPagination . getPageSize ( ) , true ) ;
List < PcmContractEntity > userIPage = this . selectJoinList ( PcmContractEntity . class , wrapper2 ) ;
List < Object > collect = userIPage . stream ( ) . map ( t - > t . getContractId ( ) ) . collect ( Collectors . toList ( ) ) ;
if ( CollectionUtils . isNotEmpty ( collect ) ) {
wrapper . in ( PcmContractEntity : : getContractId , collect ) ;
}
List < PcmContractEntity > result = this . selectJoinList ( PcmContractEntity . class , wrapper ) ;
return pcmContractPagination . setData ( result , objects . getTotal ( ) ) ;
} else {
List < PcmContractEntity > list = this . selectJoinList ( PcmContractEntity . class , wrapper ) ;
if ( " 2 " . equals ( dataType ) ) {
List < Object > selectIds = Arrays . asList ( pcmContractPagination . getSelectIds ( ) ) ;
return list . stream ( ) . filter ( t - > selectIds . contains ( t . getContractId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
} else {
return list ;
}
}
}
/**
* 其他条件拼接
*/
private void otherConditions ( PcmContractPagination pcmContractPagination , MPJLambdaWrapper < PcmContractEntity > wrapper , boolean isPc ) {
String databaseName ;
try {
@Cleanup Connection cnn = DynamicDataSourceUtil . getCurrentConnection ( ) ;
databaseName = cnn . getMetaData ( ) . getDatabaseProductName ( ) . trim ( ) ;
} catch ( SQLException e ) {
throw new DataException ( e . getMessage ( ) ) ;
}
wrapper . isNull ( PcmContractEntity : : getFlowId ) ;
//关键词
if ( ObjectUtil . isNotEmpty ( pcmContractPagination . getYunzhupaasKeyword ( ) ) ) {
}
//普通查询
if ( isPc ) {
if ( ObjectUtil . isNotEmpty ( pcmContractPagination . getContractName ( ) ) ) {
String value = pcmContractPagination . getContractName ( ) instanceof List ?
JsonUtil . getObjectToString ( pcmContractPagination . getContractName ( ) ) :
String . valueOf ( pcmContractPagination . getContractName ( ) ) ;
wrapper . like ( PcmContractEntity : : getContractName , value ) ;
}
if ( ObjectUtil . isNotEmpty ( pcmContractPagination . getContractCode ( ) ) ) {
String value = pcmContractPagination . getContractCode ( ) instanceof List ?
JsonUtil . getObjectToString ( pcmContractPagination . getContractCode ( ) ) :
String . valueOf ( pcmContractPagination . getContractCode ( ) ) ;
wrapper . like ( PcmContractEntity : : getContractCode , value ) ;
}
if ( ObjectUtil . isNotEmpty ( pcmContractPagination . getContractDate ( ) ) ) {
List ContractDateList = JsonUtil . getJsonToList ( pcmContractPagination . getContractDate ( ) , String . class ) ;
for ( int i = 0 ; i < ContractDateList . size ( ) ; i + + ) {
String id = String . valueOf ( ContractDateList . get ( i ) ) ;
boolean idAll = StringUtil . isNotEmpty ( id ) & & ! id . equals ( " null " ) ;
if ( idAll ) {
Object b = new Date ( Long . valueOf ( id ) ) ;
if ( i = = 0 ) {
wrapper . ge ( PcmContractEntity : : getContractDate , b ) ;
} else {
wrapper . le ( PcmContractEntity : : getContractDate , b ) ;
}
}
}
}
}
//排序
if ( StringUtil . isEmpty ( pcmContractPagination . getSidx ( ) ) ) {
wrapper . orderByDesc ( PcmContractEntity : : getContractId ) ;
} else {
try {
String [ ] split = pcmContractPagination . getSidx ( ) . split ( " , " ) ;
for ( String sidx : split ) {
PcmContractEntity pcmContractEntity = new PcmContractEntity ( ) ;
String oderTableField = pcmContractEntity . getClass ( ) . getAnnotation ( TableName . class ) . value ( ) ;
boolean descFlag = sidx . startsWith ( " - " ) ;
String sidxField = descFlag ? sidx . substring ( 1 ) : sidx ;
try {
Field declaredField = pcmContractEntity . getClass ( ) . getDeclaredField ( sidxField ) ;
declaredField . setAccessible ( true ) ;
sidxField = declaredField . getAnnotation ( TableField . class ) . value ( ) ;
} catch ( Exception e ) {
}
String finalOderTableField = oderTableField ;
String finalSidxField = sidxField ;
Object select = wrapper . getSelectColumns ( ) . stream ( ) . filter ( t - > Objects . equals ( finalOderTableField , t . getTableAlias ( ) )
& & Objects . equals ( finalSidxField , t . getColumn ( ) ) ) . findFirst ( ) . orElse ( null ) ;
oderTableField = oderTableField + " . " + sidxField ;
if ( select = = null ) {
wrapper . select ( oderTableField ) ;
}
if ( descFlag ) {
wrapper . orderByDesc ( oderTableField ) ;
} else {
wrapper . orderByAsc ( oderTableField ) ;
}
}
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
}
}
@Override
public PcmContractEntity getInfo ( String contractid ) {
MPJLambdaWrapper < PcmContractEntity > wrapper = JoinWrappers
. lambda ( " pcm_contract " , PcmContractEntity . class )
. selectCollection ( Pcm_contract_itemEntity . class , PcmContractEntity : : getPcm_contract_item )
. leftJoin ( Pcm_contract_itemEntity . class , " pcm_contract_item " , Pcm_contract_itemEntity : : getContractId , PcmContractEntity : : getContractId )
. selectCollection ( Pcm_payment_planEntity . class , PcmContractEntity : : getPcm_payment_plan )
. leftJoin ( Pcm_payment_planEntity . class , " pcm_payment_plan " , Pcm_payment_planEntity : : getContractId , PcmContractEntity : : getContractId )
. selectAll ( PcmContractEntity . class )
. orderByAsc ( " pcm_payment_plan.period " ) ;
wrapper . and (
t - > t . eq ( PcmContractEntity : : getContractId , contractid )
. or ( ) . eq ( PcmContractEntity : : getFlowTaskId , contractid )
) ;
return this . selectJoinOne ( PcmContractEntity . class , wrapper ) ;
}
@Override
public void create ( PcmContractEntity entity ) {
this . save ( entity ) ;
}
@Override
public boolean update ( String contractid , PcmContractEntity entity ) {
return this . updateById ( entity ) ;
}
@Override
public void delete ( PcmContractEntity entity ) {
if ( entity ! = null ) {
this . removeById ( entity . getContractId ( ) ) ;
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm ( PcmContractForm form , int i ) {
boolean isUp = StringUtil . isNotEmpty ( form . getContractId ( ) ) & & ! form . getContractId ( ) . equals ( " 0 " ) ;
Object id = null ;
String countRecover = " " ;
String fieldTipName = " " ;
String canNotNull = I18nUtil . getMessageStr ( " sys.validate.textRequiredSuffix " , " 不能为空 " ) ;
String canNotRepeated = I18nUtil . getMessageStr ( " EXIST103 " , " 不能重复 " ) ;
if ( isUp ) {
id = form . getContractId ( ) ;
}
//主表字段验证
fieldTipName = " 合同名称 " ;
if ( StringUtil . isEmpty ( form . getContractName ( ) ) ) {
return fieldTipName + canNotNull ;
}
if ( StringUtil . isNotEmpty ( form . getContractName ( ) ) ) {
form . setContractName ( form . getContractName ( ) . trim ( ) ) ;
QueryWrapper < PcmContractEntity > contract_nameWrapper = new QueryWrapper < > ( ) ;
contract_nameWrapper . lambda ( ) . eq ( PcmContractEntity : : getContractName , form . getContractName ( ) ) ;
contract_nameWrapper . lambda ( ) . isNull ( PcmContractEntity : : getFlowId ) ;
if ( isUp ) {
contract_nameWrapper . lambda ( ) . ne ( PcmContractEntity : : getContractId , id ) ;
}
if ( ( int ) this . count ( contract_nameWrapper ) > 0 ) {
countRecover = fieldTipName + canNotRepeated ;
}
}
fieldTipName = " 合同编号 " ;
if ( StringUtil . isEmpty ( form . getContractCode ( ) ) ) {
return fieldTipName + canNotNull ;
}
if ( StringUtil . isNotEmpty ( form . getContractCode ( ) ) ) {
form . setContractCode ( form . getContractCode ( ) . trim ( ) ) ;
QueryWrapper < PcmContractEntity > contract_codeWrapper = new QueryWrapper < > ( ) ;
contract_codeWrapper . lambda ( ) . eq ( PcmContractEntity : : getContractCode , form . getContractCode ( ) ) ;
contract_codeWrapper . lambda ( ) . isNull ( PcmContractEntity : : getFlowId ) ;
if ( isUp ) {
contract_codeWrapper . lambda ( ) . ne ( PcmContractEntity : : getContractId , id ) ;
}
if ( ( int ) this . count ( contract_codeWrapper ) > 0 ) {
countRecover = fieldTipName + canNotRepeated ;
}
}
fieldTipName = " 归属项目 " ;
fieldTipName = " 合同类型 " ;
fieldTipName = " 签约日期 " ;
fieldTipName = " 合同有效期 " ;
fieldTipName = " 对方单位 " ;
fieldTipName = " 合作方类型 " ;
fieldTipName = " 我方单位 " ;
fieldTipName = " 我方类型。JF=甲方; YF=乙方 " ;
fieldTipName = " 通讯地址 " ;
fieldTipName = " 通讯地址 " ;
fieldTipName = " 负责人 " ;
fieldTipName = " 负责人 " ;
fieldTipName = " 联系方式 " ;
fieldTipName = " 联系方式 " ;
fieldTipName = " 合同条款 " ;
fieldTipName = " 说明 " ;
fieldTipName = " 经办人 " ;
fieldTipName = " 经办日期 " ;
fieldTipName = " 附件 " ;
//子表字段验证
if ( form . getPcm_contract_itemList ( ) ! = null ) {
fieldTipName = " 劳务清单 "
+ " - " + " 工种 " ;
fieldTipName = " 劳务清单 "
+ " - " + " 单位 " ;
fieldTipName = " 劳务清单 "
+ " - " + " 单价 " ;
fieldTipName = " 劳务清单 "
+ " - " + " 工时 " ;
fieldTipName = " 劳务清单 "
+ " - " + " 小计 " ;
}
if ( form . getPcm_payment_planList ( ) ! = null ) {
fieldTipName = " "
+ " - " + " 款项名称 " ;
fieldTipName = " "
+ " - " + " 付款条件 " ;
fieldTipName = " "
+ " - " + " 预计付款日期 " ;
fieldTipName = " "
+ " - " + " 付款比例 (%) " ;
fieldTipName = " "
+ " - " + " 付款金额 " ;
}
return countRecover ;
}
/**
* 新增修改数据(事务回滚)
* @param id
* @param pcmContractForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate ( PcmContractForm pcmContractForm , String id , boolean isSave ) throws Exception {
UserInfo userInfo = userProvider . get ( ) ;
UserEntity userEntity = generaterSwapUtil . getUser ( userInfo . getUserId ( ) ) ;
pcmContractForm = JsonUtil . getJsonToBean (
generaterSwapUtil . swapDatetime ( PcmContractConstant . getFormData ( ) , pcmContractForm , PcmContractConstant . TABLERENAMES ) , PcmContractForm . class ) ;
PcmContractEntity entity = JsonUtil . getJsonToBean ( pcmContractForm , PcmContractEntity . class ) ;
String mainUuid = StringUtil . isEmpty ( id ) ? RandomUtil . uuId ( ) : id ;
if ( isSave ) {
entity . setFlowTaskId ( mainUuid ) ;
entity . setContractId ( mainUuid ) ;
} else {
}
entity . setContractNo ( entity . getContractId ( ) ) ;
entity . setContractMoney ( entity . getContractMoney ( ) ) ;
entity . setState ( " 30 " ) ;
boolean b = this . saveOrUpdate ( entity ) ;
PcmContractEntity info = this . getInfo ( mainUuid ) ;
if ( info = = null ) throw new RuntimeException ( MsgCode . FA001 . get ( ) ) ;
//删除附件信息
this . baseMapper . deleteByBusinessObjectId ( " pcm_contract " , info . getContractId ( ) ) ;
if ( pcmContractForm . getPcmDocument ( ) ! = null & & pcmContractForm . getPcmDocument ( ) . size ( ) > 0 ) {
// 新增附件信息
for ( PcmDocument item : pcmContractForm . getPcmDocument ( ) ) {
String [ ] split = item . getFileId ( ) . split ( " \\ . " ) ;
item . setFileId ( split [ 0 ] ) ;
item . setFileExtension ( split [ 1 ] ) ;
PcmBusinessDocumentVo vo = new PcmBusinessDocumentVo ( ) ;
vo . setDocumentId ( split [ 0 ] ) ;
vo . setTableName ( " pcm_contract " ) ;
vo . setBusinessObjectId ( info . getContractId ( ) ) ;
this . baseMapper . addPcmDocument ( item ) ;
this . baseMapper . addPcmBusinessDocument ( vo ) ;
} }
//Pcm_contract_item子表数据新增修改
QueryWrapper < Pcm_contract_itemEntity > Pcm_contract_itemqueryWrapper = new QueryWrapper < > ( ) ;
Pcm_contract_itemqueryWrapper . lambda ( ) . eq ( Pcm_contract_itemEntity : : getContractId , info . getContractId ( ) ) ;
if ( ! isSave & & ! CollectionUtils . isNotEmpty ( pcmContractForm . getPcm_contract_itemList ( ) ) ) {
pcm_contract_itemService . remove ( Pcm_contract_itemqueryWrapper ) ;
}
if ( CollectionUtils . isNotEmpty ( pcmContractForm . getPcm_contract_itemList ( ) ) ) {
List < Pcm_contract_itemEntity > tableFieldc5c2d3 = JsonUtil . getJsonToList ( pcmContractForm . getPcm_contract_itemList ( ) , Pcm_contract_itemEntity . class ) ;
List < Pcm_contract_itemEntity > tableFieldc5c2d4 = JsonUtil . getJsonToList ( pcmContractForm . getCg_pcm_contract_itemList ( ) , Pcm_contract_itemEntity . class ) ;
List < Pcm_contract_itemEntity > tableFieldc5c2d5 = JsonUtil . getJsonToList ( pcmContractForm . getZd_pcm_contract_itemList ( ) , Pcm_contract_itemEntity . class ) ;
List < Pcm_contract_itemEntity > tableFieldc5c2d6 = JsonUtil . getJsonToList ( pcmContractForm . getGcl_pcm_contract_itemList ( ) , Pcm_contract_itemEntity . class ) ;
//移除的数据
List < Object > childIds = tableFieldc5c2d3 . stream ( ) . filter ( t - > t . getContractItemId ( ) ! = null ) . map ( Pcm_contract_itemEntity : : getContractItemId ) . collect ( Collectors . toList ( ) ) ;
if ( CollectionUtils . isNotEmpty ( childIds ) ) {
Pcm_contract_itemqueryWrapper . lambda ( ) . notIn ( Pcm_contract_itemEntity : : getContractItemId , childIds ) ;
}
pcm_contract_itemService . remove ( Pcm_contract_itemqueryWrapper ) ;
for ( Pcm_contract_itemEntity entitys : tableFieldc5c2d3 ) {
entitys . setContractId ( entity . getContractId ( ) ) ;
if ( entitys . getContractItemId ( ) = = null ) {
entitys . setContractItemId ( RandomUtil . uuId ( ) ) ;
}
pcm_contract_itemService . saveOrUpdate ( entitys ) ;
}
for ( Pcm_contract_itemEntity entitys : tableFieldc5c2d4 ) {
entitys . setContractId ( entity . getContractId ( ) ) ;
if ( entitys . getContractItemId ( ) = = null ) {
entitys . setContractItemId ( RandomUtil . uuId ( ) ) ;
}
pcm_contract_itemService . saveOrUpdate ( entitys ) ;
}
for ( Pcm_contract_itemEntity entitys : tableFieldc5c2d5 ) {
entitys . setContractId ( entity . getContractId ( ) ) ;
if ( entitys . getContractItemId ( ) = = null ) {
entitys . setContractItemId ( RandomUtil . uuId ( ) ) ;
}
pcm_contract_itemService . saveOrUpdate ( entitys ) ;
}
for ( Pcm_contract_itemEntity entitys : tableFieldc5c2d6 ) {
entitys . setContractId ( entity . getContractId ( ) ) ;
if ( entitys . getContractItemId ( ) = = null ) {
entitys . setContractItemId ( RandomUtil . uuId ( ) ) ;
}
pcm_contract_itemService . saveOrUpdate ( entitys ) ;
}
}
//Pcm_payment_plan子表数据新增修改
QueryWrapper < Pcm_payment_planEntity > Pcm_payment_planqueryWrapper = new QueryWrapper < > ( ) ;
Pcm_payment_planqueryWrapper . lambda ( ) . eq ( Pcm_payment_planEntity : : getContractId , info . getContractId ( ) ) ;
if ( ! isSave & & ! CollectionUtils . isNotEmpty ( pcmContractForm . getPcm_payment_planList ( ) ) ) {
pcm_payment_planService . remove ( Pcm_payment_planqueryWrapper ) ;
}
if ( CollectionUtils . isNotEmpty ( pcmContractForm . getPcm_payment_planList ( ) ) ) {
List < Pcm_payment_planEntity > tableField9213ba = JsonUtil . getJsonToList ( pcmContractForm . getPcm_payment_planList ( ) , Pcm_payment_planEntity . class ) ;
//移除的数据
List < Object > childIds = tableField9213ba . stream ( ) . filter ( t - > t . getPaymentPlanId ( ) ! = null ) . map ( Pcm_payment_planEntity : : getPaymentPlanId ) . collect ( Collectors . toList ( ) ) ;
if ( CollectionUtils . isNotEmpty ( childIds ) ) {
Pcm_payment_planqueryWrapper . lambda ( ) . notIn ( Pcm_payment_planEntity : : getPaymentPlanId , childIds ) ;
}
pcm_payment_planService . remove ( Pcm_payment_planqueryWrapper ) ;
int i = 0 ;
for ( Pcm_payment_planEntity entitys : tableField9213ba ) {
entitys . setContractId ( entity . getContractId ( ) ) ;
entitys . setContractNo ( entity . getContractNo ( ) ) ;
entitys . setPeriod ( tableField9213ba . size ( ) - i ) ;
if ( entitys . getPaymentPlanId ( ) = = null ) {
entitys . setPaymentPlanId ( RandomUtil . uuId ( ) ) ;
}
pcm_payment_planService . saveOrUpdate ( entitys ) ;
i + + ;
}
}
}
@Override
public List < PcmDocument > getFjxxList ( String id ) {
List < PcmDocument > list = this . baseMapper . selectByIdAndTableName ( " pcm_contract " , id ) ;
for ( PcmDocument pcmDocument : list ) {
pcmDocument . setFileId ( pcmDocument . getFileId ( ) + " . " + pcmDocument . getFileExtension ( ) ) ;
}
return list ;
}
@Override
public String selectByFEnCode ( String resourcesName ) {
return this . baseMapper . selectByFEnCode ( resourcesName ) ;
}
}