提交 6dfab0b2 作者: guofeng

6、更新bkpf的aedat字段为date类型

4、重写bkpf更新删除流程
上级 129512cc
......@@ -111,11 +111,6 @@ public interface GPMapper {
@Cacheable(key = "#root.method.name+':'+#p0.mandt+','+#p0.rueck+','+#p0.rmzhl", unless="#result == null")
public Afru selectAfru(Afru afru); // 查询替代删除
public void insertAfru(Afru element);
@CacheEvict(key = "'selectAfru'+':'+#p0.mandt+','+#p0.rueck+','+#p0.rmzhl")
public void deleteAfru(Afru item);
@CacheEvict(key = "'selectAfru'+':'+#p0.mandt+','+#p0.rueck+','+#p0.rmzhl")
public void updateAfru(Afru element);
public List<Afru> selectAfruCheck(Afru build);
@Cacheable(key = "#root.method.name+':'+#p0.mandt+','+#p0.mblnr+','+#p0.mjahr+','+#p0.zeile", unless="#result == null")
public Mseg selectMseg(Mseg mseg); // 查询替代删除
......@@ -165,11 +160,6 @@ public interface GPMapper {
@Cacheable(key = "#root.method.name+':'+#p0.mblnr+','+#p0.mandt+','+#p0.mjahr+','+#p0.zeile", unless="#result == null")
public Aufm selectAufm(Aufm aufm); // 查询替代删除
public void insertAufm(Aufm element);
@CacheEvict(key = "'selectAufm'+':'+#p0.mblnr+','+#p0.mandt+','+#p0.mjahr+','+#p0.zeile")
public void deleteAufm(Aufm aufm);
@CacheEvict(key = "'selectAufm'+':'+#p0.mblnr+','+#p0.mandt+','+#p0.mjahr+','+#p0.zeile")
public void updateAufm(Aufm aufm);
public List<Aufm> selectAufmCheck(Aufm build);
@Cacheable(key = "#root.method.name+':'+#p0.kunnr+','+#p0.mandt", unless="#result == null")
public Kna1 selectKna1(Kna1 kna1); // 查询替代删除
......
package com.huazheng.project.greenplum.service.impl;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GPMapper;
import com.huazheng.project.hana.mapper.SapMapper;
import com.huazheng.project.hana.model.Afko;
import com.huazheng.project.hana.model.Afpo;
import com.huazheng.project.hana.model.Aufk;
import com.huazheng.project.hana.model.Bkpf;
import cn.hutool.core.thread.ThreadUtil;
import lombok.extern.log4j.Log4j2;
@Log4j2
@Service
public class CheckDeleteServiceImpl {
@Autowired
private RedisTemplate<String, String> redis1Template;
@Autowired
private GPMapper gpMapper;
@Autowired
private SapMapper sapMapper;
public String getErrorInfoFromException(Exception e) {
try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return "\r\n" + sw.toString() + "\r\n";
} catch (Exception e2) {
return "bad getErrorInfoFromException";
}
}
public void selectAufkCheckByDelete() {
try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:checkDelete:Aufk:rowNum", "0");
String rowNum = opsForValue.get("huazheng:checkDelete:Aufk:rowNum");
Aufk build = Aufk.builder().rowNum(rowNum).build();
List<Aufk> list = gpMapper.selectAufkCheck(build); // 从数仓中查询一组数据
if (list.size() == 0) {
redis1Template.opsForValue().set("huazheng:checkDelete:Aufk:rowNum", "0"); // 计数器复位
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
list.forEach(target -> { // 遍历要检查的数据
Aufk source = sapMapper.selectAufkById(target); // 根据主键查询源库中的数据
String operator = "none";
if (source == null) { // 如果源库中没有数据
gpMapper.deleteAufk(target); // 删除数仓中的数据
operator = "delete";
}
redis1Template.opsForValue().set("huazheng:checkDelete:Aufk:rowNum", target.getRowNum());
if (!operator.equals("none")) {
log.info(String.format("selectAufkcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
}
});
} catch (Exception e) {
redis1Template.opsForValue().set("huazheng:checkDeleteError:Aufk:rowNum", getErrorInfoFromException(e));
}
}
public void selectAfkoCheckByDelete() {
try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:checkDelete:Afko:rowNum", "0");
String rowNum = opsForValue.get("huazheng:checkDelete:Afko:rowNum");
Afko build = Afko.builder().rowNum(rowNum).build();
List<Afko> list = gpMapper.selectAfkoCheck(build); // 从数仓中查询一组数据
if (list.size() == 0) {
redis1Template.opsForValue().set("huazheng:checkDelete:Afko:rowNum", "0"); // 计数器复位
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
list.forEach(target -> { // 遍历要检查的数据
Afko source = sapMapper.selectAfkoById(target); // 根据主键查询源库中的数据
String operator = "none";
if (source == null) { // 如果源库中没有数据
gpMapper.deleteAfko(target); // 删除数仓中的数据
operator = "delete";
}
redis1Template.opsForValue().set("huazheng:checkDelete:Afko:rowNum", target.getRowNum());
if (!operator.equals("none")) {
log.info(String.format("selectAfkocheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
}
});
} catch (Exception e) {
redis1Template.opsForValue().set("huazheng:checkDeleteError:Afko:rowNum", getErrorInfoFromException(e));
}
}
public void selectAfpoCheckByDelete() {
try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:checkDelete:Afpo:rowNum", "0");
String rowNum = opsForValue.get("huazheng:checkDelete:Afpo:rowNum");
Afpo build = Afpo.builder().rowNum(rowNum).build();
List<Afpo> list = gpMapper.selectAfpoCheck(build); // 从数仓中查询一组数据
if (list.size() == 0) {
redis1Template.opsForValue().set("huazheng:checkDelete:Afpo:rowNum", "0"); // 计数器复位
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
list.forEach(target -> { // 遍历要检查的数据
Afpo source = sapMapper.selectAfpoById(target); // 根据主键查询源库中的数据
String operator = "none";
if (source == null) { // 如果源库中没有数据
gpMapper.deleteAfpo(target); // 删除数仓中的数据
operator = "delete";
}
redis1Template.opsForValue().set("huazheng:checkDelete:Afpo:rowNum", target.getRowNum());
if (!operator.equals("none")) {
log.info(String.format("selectAfpocheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
}
});
} catch (Exception e) {
redis1Template.opsForValue().set("huazheng:checkDeleteError:Afpo:rowNum", getErrorInfoFromException(e));
}
}
public void selectBkpfCheckByDelete() {
try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:checkDelete:Bkpf:rowNum", "0");
String rowNum = opsForValue.get("huazheng:checkDelete:Bkpf:rowNum");
Bkpf build = Bkpf.builder().rowNum(rowNum).build();
List<Bkpf> list = gpMapper.selectBkpfCheck(build); // 从数仓中查询一组数据
if (list.size() == 0) {
redis1Template.opsForValue().set("huazheng:checkDelete:Bkpf:rowNum", "0"); // 计数器复位
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
list.forEach(target -> { // 遍历要检查的数据
Bkpf source = sapMapper.selectBkpfById(target); // 根据主键查询源库中的数据
String operator = "none";
if (source == null) { // 如果源库中没有数据
gpMapper.deleteBkpf(target); // 删除数仓中的数据
operator = "delete";
}
redis1Template.opsForValue().set("huazheng:checkDelete:Bkpf:rowNum", target.getRowNum());
if (!operator.equals("none")) {
log.info(String.format("selectBkpfcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
}
});
} catch (Exception e) {
redis1Template.opsForValue().set("huazheng:checkDeleteError:Bkpf:rowNum", getErrorInfoFromException(e));
}
}
}
package com.huazheng.project.greenplum.service.impl;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import com.huazheng.project.greenplum.mapper.GPMapper;
import com.huazheng.project.hana.mapper.SapMapper;
import com.huazheng.project.hana.model.Afko;
import com.huazheng.project.hana.model.Afpo;
import com.huazheng.project.hana.model.Aufk;
import com.huazheng.project.hana.model.Bkpf;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.log4j.Log4j2;
@Log4j2
@Service
public class CheckUpdateServiceImpl {
@Autowired
private RedisTemplate<String, String> redis1Template;
@Autowired
private GPMapper gpMapper;
@Autowired
private SapMapper sapMapper;
public String getErrorInfoFromException(Exception e) {
try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return "\r\n" + sw.toString() + "\r\n";
} catch (Exception e2) {
return "bad getErrorInfoFromException";
}
}
public void selectAufkCheckByUpdate() {
try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:checkUpdate:Aufk:rowids", "0");
Long rowids = Long.parseLong(opsForValue.get("huazheng:checkUpdate:Aufk:rowids"));
Aufk build = Aufk.builder().rowids(rowids).build();
List<Aufk> slist = sapMapper.selectAufkCheckByUpdate(build); // 从源库中按更新时间查询,只更新今天的数据
if (slist.size() == 0) {
redis1Template.opsForValue().set("huazheng:checkUpdate:Aufk:rowids", "0"); // 计数器复位
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
slist.forEach(source -> { // 遍历源库中的数据,去目标库中查询数据
Aufk target = gpMapper.selectAufk(source);
String operator = "none";
Long srowids = source.getRowids();
if (target != null) {
source.setRowids(null);
String shash = SecureUtil.md5(JSONUtil.toJsonStr(source)); // 源库中数据的hash结果
String thash = target.getHashResult(); // 数仓中数据的hash结果
if (!shash.equals(thash)) { // 如果hash结果不一致
source.setHashResult(shash);
// ===============================
if (source.getErdat() != null && source.getErfzeit() != null) {
String erdat2 = new StringBuffer(source.getErdat()).insert(4, "-").insert(7, "-").toString();
String erzet2 = new StringBuffer(source.getErfzeit()).insert(2, ":").insert(5, ":").toString();
String dateStr = erdat2 + " " + erzet2;
Date date = DateUtil.parse(dateStr);
source.setErdat1(date);
source.setErdat2(date);
}
// ===============================
while (true) {
try {
gpMapper.updateAufk(source); // 更新数据到数仓中
break;
} catch (RuntimeException e) {
log.error(e.getMessage());ThreadUtil.safeSleep(500);
}
}
// 级联更新业务
Afko sAfko = sapMapper.cascadeAfkoByAufk(source); // 级联查询源库afko表
Afko tAfko = gpMapper.selectAfko(sAfko); // 查询目标库中afko表
cascadeAfkoCheckByUpdate(sAfko, tAfko); // 级联更新afko表
// 级联更新业务
Afpo sAfpo = sapMapper.cascadeAfpoByAufk(source); // 级联查询源库afko表
Afpo tAfpo = gpMapper.selectAfpo(sAfpo); // 查询目标库中afko表
cascadeAfpoCheckByUpdate(sAfpo, tAfpo); // 级联更新afko表
ThreadUtil.safeSleep(500);
}
}
redis1Template.opsForValue().set("huazheng:checkUpdate:Aufk:rowids", srowids.toString());
if (!operator.equals("none")) {
log.info(String.format("selectAufkcheckUpdate --> rowids:%s, operator:%s", srowids.toString(), operator));
}
});
} catch (Exception e) {
redis1Template.opsForValue().set("huazheng:checkUpdateError:Aufk:rowids", getErrorInfoFromException(e));
}
}
// 所属selectAufkCheckByUpdate的级联
private void cascadeAfkoCheckByUpdate(Afko source, Afko target) {
if (target != null) { // 目标库有数据
String shash = SecureUtil.md5(JSONUtil.toJsonStr(source)); // 源库中数据的hash结果
String thash = target.getHashResult(); // 数仓中数据的hash结果
if (!shash.equals(thash)) { // 如果hash结果不一致
source.setHashResult(shash);
// ===============================
if (source.getGltrp() != null) {
String erdat2 = new StringBuffer(source.getGltrp()).insert(4, "-").insert(7, "-").toString();
Date date = DateUtil.parse(erdat2);
source.setGltrp1(date);
}
if (source.getGstrp() != null) {
String erdat2 = new StringBuffer(source.getGstrp()).insert(4, "-").insert(7, "-").toString();
Date date = DateUtil.parse(erdat2);
source.setGstrp1(date);
}
// ===============================
while (true) {
try {
gpMapper.updateAfko(source); // 更新数据到数仓中
break;
} catch (RuntimeException e) {
log.error(e.getMessage());ThreadUtil.safeSleep(500);
}
}
ThreadUtil.safeSleep(500);
}
}
}
// 所属selectAufkCheckByUpdate的级联
private void cascadeAfpoCheckByUpdate(Afpo source, Afpo target) {
if (target != null) {
String shash = SecureUtil.md5(JSONUtil.toJsonStr(source)); // 源库中数据的hash结果
String thash = target.getHashResult(); // 数仓中数据的hash结果
if (!shash.equals(thash)) { // 如果hash结果不一致
source.setHashResult(shash);
// ===============================
// ===============================
while (true) {
try {
gpMapper.updateAfpo(source); // 更新数据到数仓中
break;
} catch (RuntimeException e) {
log.error(e.getMessage());ThreadUtil.safeSleep(500);
}
}
ThreadUtil.safeSleep(500);
}
}
}
public void selectBkpfCheckByUpdate() {
try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:checkUpdate:Bkpf:rowids", "0");
Long rowids = Long.parseLong(opsForValue.get("huazheng:checkUpdate:Bkpf:rowids"));
Bkpf build = Bkpf.builder().rowids(rowids).build();
List<Bkpf> slist = sapMapper.selectBkpfCheckByUpdate(build); // 从源库中按更新时间查询,只更新今天的数据
if (slist.size() == 0) {
redis1Template.opsForValue().set("huazheng:checkUpdate:Bkpf:rowids", "0"); // 计数器复位
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
slist.forEach(source -> { // 遍历源库中的数据,去目标库中查询数据
Bkpf target = gpMapper.selectBkpf(source);
String operator = "none";
Long srowids = source.getRowids();
if (target != null) {
source.setRowids(null);
String shash = SecureUtil.md5(JSONUtil.toJsonStr(source)); // 源库中数据的hash结果
String thash = target.getHashResult(); // 数仓中数据的hash结果
if (!shash.equals(thash)) { // 如果hash结果不一致
source.setHashResult(shash);
while (true) {
try {
gpMapper.updateBkpf(source); // 更新数据到数仓中
break;
} catch (RuntimeException e) {
log.error(e.getMessage());ThreadUtil.safeSleep(500);
}
}
ThreadUtil.safeSleep(500);
}
}
redis1Template.opsForValue().set("huazheng:checkUpdate:Bkpf:rowids", srowids.toString());
if (!operator.equals("none")) {
log.info(String.format("selectBkpfcheckUpdate --> rowids:%s, operator:%s", srowids.toString(), operator));
}
});
} catch (Exception e) {
redis1Template.opsForValue().set("huazheng:checkUpdateError:Bkpf:rowids", getErrorInfoFromException(e));
}
}
}
......@@ -86,6 +86,7 @@ public interface SapMapper {
public List<Knvp> selectKnvpNew(Knvp knvp);
public List<Bkpf> selectBkpfNew(Bkpf bkpf);
// .........
public List<Knkk> selectKnkkCheckByUpdate(Knkk knkk);
public List<Likp> selectLikpCheckByUpdate(Likp likp);
public List<Lips> selectLipsCheckByUpdate(Lips lips);
......@@ -95,19 +96,24 @@ public interface SapMapper {
public List<Zsd06> selectZsd06CheckByUpdate(Zsd06 zsd06);
public List<Zsdfhzl> selectZsdfhzlCheckByUpdate(Zsdfhzl zsdfhzl);
public List<Aufk> selectAufkCheckByUpdate(Aufk aufk);
public Afko cascadeAfkoByAufk(Aufk aufk);
public Afpo cascadeAfpoByAufk(Aufk aufk);
public List<Bkpf> selectBkpfCheckByUpdate(Bkpf bkpf);
// ......
public Bkpf selectBkpfById(Bkpf target);
public Knvp selectKnvpById(Knvp target);
public Ausp selectAuspById(Ausp target);
public Zpoedit selectZpoeditById(Zpoedit target);
public Tspat selectTspatById(Tspat target);
public Afru selectAfruById(Afru target);
public Mseg selectMsegById(Mseg target);
public Mkpf selectMkpfById(Mkpf target);
public Afko selectAfkoById(Afko target);
public Afpo selectAfpoById(Afpo target);
public Afvc selectAfvcById(Afvc target);
public Aufk selectAufkById(Aufk target);
public Aufm selectAufmById(Aufm target);
public Kna1 selectKna1ById(Kna1 target);
public Knkk selectKnkkById(Knkk target);
public Knvv selectKnvvById(Knvv target);
......
......@@ -37,7 +37,9 @@ public class Bkpf implements Serializable {
@JSONField(format="yyyy-MM-dd") // 数据库导出页面时json格式化
private String cpudt; // 会计凭证输入日期
private String cputm; // 输入时间
private String aedat; // 上次根据事务修改凭证的日期
@DateTimeFormat(pattern="yyyy-MM-dd") // 页面写入数据库时格式化
@JSONField(format="yyyy-MM-dd") // 数据库导出页面时json格式化
private Date aedat; // 上次根据事务修改凭证的日期
private String upddt; // 上次凭证更新日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") // 页面写入数据库时格式化
......
select count(1) from sapabap1.bkpf where aedat = '00000000' union all
select count(1) from sapabap1.bkpf where aedat != '00000000' union all
select count(1) from sapabap1.bkpf where aedat is null;
select top 20 "$rowid$" as rowids,
kdauf,kdpos,mandt,aufnr,erdat,erfzeit,ernam,aenam,bukrs,loekz,auart,werks,
case aedat when '00000000' then null else to_date(aedat) end as aedat
from sapabap1.aufk
where "$rowid$" > 100 and mandt = '800'
order by "$rowid$"
\ No newline at end of file
mandt, bukrs, belnr, gjahr, blart, bldat, budat, monat, cpudt, cputm,
case aedat when '00000000' then null else to_date(aedat) end as aedat, upddt,
(to_date(cpudt)||' '||to_time(cputm)) as cpudt_cputm
from sapabap1.Bkpf
where mandt = '800' and bukrs = '1100' and belnr = '5100000028' and gjahr = '2020'
\ No newline at end of file
......@@ -18,3 +18,6 @@ rowNum serial,
PRIMARY KEY (mandt,bukrs,belnr,gjahr)
)
Distributed by (mandt,bukrs,belnr,gjahr);
alter table bkpf drop column aedat;
alter table bkpf add column aedat date;
......@@ -540,20 +540,6 @@
values(#{mblnr}, #{mjahr}, #{zeile}, #{bldat}, #{budat}, #{bwart}, #{matnr}, #{werks}, #{lgort},
#{charg}, #{sobkz}, #{lifnr}, #{kdauf}, #{kdpos}, #{shkzg}, #{menge}, #{bwtar}, #{aufnr}, #{bldat1}, #{budat1}, #{mandt}, #{hashResult})
</insert>
<delete id="deleteAufm" parameterType="com.huazheng.project.hana.model.Aufm">
delete from aufm where mblnr = #{mblnr} and mandt = #{mandt} and mjahr = #{mjahr} and zeile = #{zeile}
</delete>
<update id="updateAufm" parameterType="com.huazheng.project.hana.model.Aufm">
update Aufm set
mblnr = #{mblnr}, mjahr = #{mjahr}, zeile = #{zeile}, bldat = #{bldat}, budat = #{budat}, bwart = #{bwart}, matnr = #{matnr},
werks = #{werks}, lgort = #{lgort}, charg = #{charg}, sobkz = #{sobkz}, lifnr = #{lifnr}, kdauf = #{kdauf}, kdpos = #{kdpos},
shkzg = #{shkzg}, menge = #{menge}, bwtar = #{bwtar}, aufnr = #{aufnr}, bldat1 = #{bldat1}, budat1 = #{budat1}, mandt = #{mandt},
hashResult = #{hashResult}
where mblnr = #{mblnr} and mandt = #{mandt} and mjahr = #{mjahr} and zeile = #{zeile}
</update>
<select id="selectAufmCheck" parameterType="com.huazheng.project.hana.model.Aufm" resultType="com.huazheng.project.hana.model.Aufm">
select * from Aufm where rownum &gt; #{rowNum} order by rownum limit 20
</select>
<select id="selectKna1" parameterType="com.huazheng.project.hana.model.Kna1" resultType="com.huazheng.project.hana.model.Kna1">
select * from kna1 where kunnr = #{kunnr} and mandt = #{mandt}
......@@ -676,17 +662,6 @@
insert into Afru (mandt, rueck, rmzhl, ersda, wablnr, aufnr, stokz, stzhl, hashResult)
values(#{mandt},#{rueck},#{rmzhl},#{ersda},#{wablnr},#{aufnr},#{stokz},#{stzhl},#{hashResult})
</insert>
<delete id="deleteAfru" parameterType="com.huazheng.project.hana.model.Afru">
delete from Afru where mandt = #{mandt} and rueck = #{rueck} and rmzhl = #{rmzhl}
</delete>
<update id="updateAfru" parameterType="com.huazheng.project.hana.model.Afru">
update Afru set
mandt = #{mandt}, rueck = #{rueck}, rmzhl = #{rmzhl}, ersda = #{ersda}, wablnr = #{wablnr}, aufnr = #{aufnr}, stokz = #{stokz}, stzhl = #{stzhl}, hashResult = #{hashResult}
where mandt = #{mandt} and rueck = #{rueck} and rmzhl = #{rmzhl}
</update>
<select id="selectAfruCheck" parameterType="com.huazheng.project.hana.model.Afru" resultType="com.huazheng.project.hana.model.Afru">
select * from Afru where rownum &gt; #{rowNum} order by rownum limit 20
</select>
<select id="selectTspat" parameterType="com.huazheng.project.hana.model.Tspat" resultType="com.huazheng.project.hana.model.Tspat">
select * from Tspat where mandt = #{mandt} and spras = #{spras} and spart = #{spart}
......
......@@ -179,16 +179,15 @@
where "$rowid$" &gt; #{rowids} ${hana_mandt}
order by "$rowid$"
</select>
<select id="selectBkpfNew" parameterType="Bkpf" resultType="Bkpf">
select top 20 "$rowid$" as rowids,
mandt, bukrs, belnr, gjahr, blart, bldat, budat, monat, cpudt, cputm, aedat, upddt,
mandt, bukrs, belnr, gjahr, blart, bldat, budat, monat, cpudt, cputm,
case aedat when '00000000' then null else to_date(aedat) end as aedat, upddt,
(to_date(cpudt)||' '||to_time(cputm)) as cpudt_cputm
from ${hana_user}.Bkpf
where "$rowid$" &gt; #{rowids} ${hana_mandt}
order by "$rowid$"
</select>
<select id="selectKnvpNew" parameterType="Knvp" resultType="Knvp">
select top 20 "$rowid$" as rowids,
mandt, kunnr, vkorg, vtweg, spart, parvw, parza, kunn2, pernr, knref, pernr as pernr1
......@@ -325,7 +324,7 @@
<!-- 第一次修改的,后期要改成时间一天内的,还要删除原始的那个更新逻辑 -->
<select id="selectKnkkCheckByUpdate" parameterType="Knkk" resultType="Knkk">
select top 20 "$rowid$" as rowids,
mandt,kunnr,kkber,klimk,skfor,ssobl,aedat
......@@ -398,6 +397,40 @@
where "$rowid$" &gt; #{rowids} and cha_datum != '00000000' ${hana_mandt}
order by "$rowid$"
</select>
<!-- 第二次修改的,限制时间今天内的,以后更新逻辑按照这个模式来做 -->
<select id="selectAufkCheckByUpdate" parameterType="Aufk" resultType="Aufk">
select top 20 "$rowid$" as rowids,
kdauf,kdpos,mandt,aufnr,erdat,erfzeit,ernam,aenam,bukrs,loekz,auart,werks,
case aedat when '00000000' then null else to_date(aedat) end as aedat
from ${hana_user}.aufk
where "$rowid$" &gt; #{rowids} and aedat != '00000000' and aedat = CURRENT_DATE ${hana_mandt}
order by "$rowid$"
</select>
<select id="cascadeAfkoByAufk" parameterType="Aufk" resultType="Afko">
select
aufnr, mandt, gltrp, gamng, plnbez, gmein, plnnr, plnal,
stlnr, cy_seqnr, gstrp, aufpl, aplzt
from ${hana_user}.afko
where aufnr = #{aufnr} ${hana_mandt}
</select>
<select id="cascadeAfpoByAufk" parameterType="Aufk" resultType="Afpo">
select
kdauf, kdpos, aufnr, mandt, posnr, psmng, wemng, meins, matnr,
uebto, untto, pwerk, verid, dwerk, dauat, krsnr, sernr, plnum
from ${hana_user}.afpo
where aufnr = #{aufnr} ${hana_mandt}
</select>
<select id="selectBkpfCheckByUpdate" parameterType="Bkpf" resultType="Bkpf">
select top 20 "$rowid$" as rowids,
mandt, bukrs, belnr, gjahr, blart, bldat, budat, monat, cpudt, cputm,
case aedat when '00000000' then null else to_date(aedat) end as aedat, upddt,
(to_date(cpudt)||' '||to_time(cputm)) as cpudt_cputm
from ${hana_user}.Bkpf
where "$rowid$" &gt; #{rowids} and aedat != '00000000' and aedat = CURRENT_DATE ${hana_mandt}
order by "$rowid$"
</select>
......@@ -423,13 +456,6 @@
from ${hana_user}.aufk
where mandt = #{mandt} and aufnr = #{aufnr}
</select>
<select id="selectAufmById" parameterType="Aufm" resultType="Aufm">
select
mblnr, mjahr, zeile, bldat, budat, bwart, matnr, werks, lgort,
charg, sobkz, lifnr, kdauf, kdpos, shkzg, menge, bwtar, aufnr, mandt
from ${hana_user}.aufm
where mblnr = #{mblnr} and mandt = #{mandt} and mjahr = #{mjahr} and zeile = #{zeile}
</select>
<select id="selectKna1ById" parameterType="Kna1" resultType="Kna1">
select kunnr, name1, name2, mandt, ktokd
from ${hana_user}.kna1
......@@ -460,11 +486,6 @@
from ${hana_user}.Ausp
where mandt = #{mandt} and objek = #{objek} and atinn = #{atinn} and atzhl = #{atzhl} and mafid = #{mafid} and klart = #{klart} and adzhl = #{adzhl}
</select>
<select id="selectAfruById" parameterType="Afru" resultType="Afru">
select mandt, rueck, rmzhl, ersda, wablnr, aufnr, stokz, stzhl
from ${hana_user}.Afru
where mandt = #{mandt} and rueck = #{rueck} and rmzhl = #{rmzhl}
</select>
<select id="selectTspatById" parameterType="Tspat" resultType="Tspat">
select mandt, spras, spart, vtext
from ${hana_user}.Tspat
......@@ -497,15 +518,14 @@
from ${hana_user}.likp
where vbeln = #{vbeln} and mandt = #{mandt}
</select>
<select id="selectBkpfById" parameterType="Bkpf" resultType="Bkpf">
select
mandt, bukrs, belnr, gjahr, blart, bldat, budat,monat,cpudt, cputm, aedat,upddt,
mandt, bukrs, belnr, gjahr, blart, bldat, budat,monat,cpudt, cputm,
case aedat when '00000000' then null else to_date(aedat) end as aedat,upddt,
(to_date(cpudt)||' '||to_time(cputm)) as cpudt_cputm
from ${hana_user}.Bkpf
where mandt = #{mandt} and bukrs = #{bukrs} and belnr = #{belnr} and gjahr = #{gjahr}
</select>
<select id="selectLipsById" parameterType="Lips" resultType="Lips">
select
vbeln, posnr, vgbel, vgpos, mandt, matnr, matkl, arktx, werks, lgort,
......
......@@ -769,6 +769,65 @@
<property name="cronExpression" value="* * * * * ?" />
</bean>
<!-- 更新流程 -->
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="checkUpdateServiceImpl" />
<property name="targetMethod" value="selectAufkCheckByUpdate" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="checkUpdateServiceImpl" />
<property name="targetMethod" value="selectBkpfCheckByUpdate" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
<!-- 删除流程 -->
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="checkDeleteServiceImpl" />
<property name="targetMethod" value="selectAufkCheckByDelete" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="checkDeleteServiceImpl" />
<property name="targetMethod" value="selectAfkoCheckByDelete" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="checkDeleteServiceImpl" />
<property name="targetMethod" value="selectAfpoCheckByDelete" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="checkDeleteServiceImpl" />
<property name="targetMethod" value="selectBkpfCheckByDelete" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
</list>
</constructor-arg>
</bean>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论