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); } @Override public int upDateCard(List resourcesPo) { RecordSet rs = new RecordSet(); String postionType = rs.getPropValue("wysecond", "postionType"); String postion = rs.getPropValue("wysecond", "postion"); resourcesPo.forEach(resources -> { 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()); } }); return resourcesPo.size(); } @Override public int modeExport() { //导入Excel完成后回调 获取全量数据 List resourcesPoList = getService(user).postionPeoples(); return upDateCard(resourcesPoList); } }