forked from I3-YF/i3plus-mes-yfai
parent
22157ae0eb
commit
5a5bce2767
@ -0,0 +1,44 @@
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool
|
||||
import cn.estsh.i3plus.platform.plugin.datasource.DynamicDataSourceProxy
|
||||
import cn.estsh.i3plus.pojo.mes.dbinterface.MesInterfaceDataMapper
|
||||
import lombok.Getter
|
||||
import lombok.Setter
|
||||
import org.springframework.util.StringUtils
|
||||
|
||||
import javax.annotation.Resource
|
||||
import java.sql.Connection
|
||||
|
||||
/**
|
||||
* @Description :MES2PISCES-更新同步标识
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/8/5 20:19
|
||||
* @Modify:
|
||||
* */
|
||||
class MesUpdateSrcData {
|
||||
|
||||
@Resource(name = "mesDataSource")
|
||||
private DynamicDataSourceProxy mesDataSource;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private Connection mesConn;
|
||||
|
||||
def saveSrcData(MesInterfaceDataMapper mapper, List<Map<String, Object>> srcData) throws Exception {
|
||||
if (srcData == null || srcData.size() == 0 || StringUtils.isEmpty(mapper.getSrcTableName())) {
|
||||
return srcData
|
||||
}
|
||||
List<String> idList = new ArrayList<>();
|
||||
for (Map<String, Object> data : srcData) {
|
||||
idList.add(data.get("id").toString());
|
||||
}
|
||||
|
||||
//更新同步标识
|
||||
List<String> updateList = new ArrayList<>();
|
||||
updateList.add("update " + mapper.getSrcTableName() + " set system_sync_date_time='" + TimeTool.getNowTime(true) + "',system_sync_status='1' where id in (" + String.join(",", idList) + ") ;");
|
||||
this.mesConn = mesDataSource.getWriteConnectionWithoutPool();
|
||||
mesDataSource.executeAsBatch(updateList, mesConn)
|
||||
mesDataSource.closeConnectionWithoutPoll(this.mesConn)
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue