2025-03-03 17:02:19 +08:00
package com.engine.wysecond.service.impl ;
import com.engine.common.util.ServiceUtil ;
import com.engine.core.impl.Service ;
import com.engine.wysecond.entity.ResourcesPo ;
import com.engine.wysecond.service.PostionMatrixService ;
import com.engine.wysecond.service.ResourceCardService ;
import com.weaver.general.Util ;
import weaver.conn.RecordSet ;
import weaver.hrm.User ;
import java.util.List ;
/ * *
* @Author liang . cheng
* @Date 2025 / 2 / 28 16 : 18
* @Description :
* @Version 1 . 0
* /
public class ResourceCardServiceImpl extends Service implements ResourceCardService {
private PostionMatrixService getService ( User user ) {
return ServiceUtil . getService ( PostionMatrixServiceImpl . class , user ) ;
}
2025-03-07 10:23:47 +08:00
2025-03-03 17:02:19 +08:00
@Override
public int upDateCard ( List < ResourcesPo > resourcesPo ) {
RecordSet rs = new RecordSet ( ) ;
String postionType = rs . getPropValue ( " wysecond " , " postionType " ) ;
String postion = rs . getPropValue ( " wysecond " , " postion " ) ;
2025-03-07 10:23:47 +08:00
resourcesPo . forEach ( resources - > {
2025-03-03 17:02:19 +08:00
rs . executeQuery ( " select count(1) as sums from cus_fielddata where id = ? and scopeid =3 and scope = 'HrmCustomFieldByInfoType' " , resources . getResourceId ( ) ) ;
rs . next ( ) ;
int sums = Util . getIntValue ( rs . getString ( " sums " ) ) ;
if ( sums > 0 ) {
//更新
rs . executeUpdate ( " update cus_fielddata set " + postionType + " = ?, " + postion + " = ? where id = ? and scopeid =3 and scope = 'HrmCustomFieldByInfoType' " , resources . getPostionType ( ) ,
resources . getPostion ( ) , resources . getResourceId ( ) ) ;
} else {
//插入
rs . executeUpdate ( " insert into cus_fielddata(id,scopeid,scope, " + postionType + " , " + postion + " ) values(?,?,?,?,?) " , resources . getResourceId ( ) ,
3 , " HrmCustomFieldByInfoType " , resources . getPostionType ( ) , resources . getPostion ( ) ) ;
}
} ) ;
2025-03-07 10:23:47 +08:00
return resourcesPo . size ( ) ;
}
@Override
public int modeExport ( ) {
//导入Excel完成后回调 获取全量数据
List < ResourcesPo > resourcesPoList = getService ( user ) . postionPeoples ( ) ;
return upDateCard ( resourcesPoList ) ;
2025-03-03 17:02:19 +08:00
}
}