提交 1566ad14 作者: think

增加表vbup

上级 246e0693
...@@ -52,6 +52,7 @@ import com.huazheng.project.greenplum.source.hana.VbpaSource; ...@@ -52,6 +52,7 @@ import com.huazheng.project.greenplum.source.hana.VbpaSource;
import com.huazheng.project.greenplum.source.hana.VbrkSource; import com.huazheng.project.greenplum.source.hana.VbrkSource;
import com.huazheng.project.greenplum.source.hana.VbrpSource; import com.huazheng.project.greenplum.source.hana.VbrpSource;
import com.huazheng.project.greenplum.source.hana.VbukSource; import com.huazheng.project.greenplum.source.hana.VbukSource;
import com.huazheng.project.greenplum.source.hana.VbupSource;
import com.huazheng.project.greenplum.source.hana.ZmdpcSource; import com.huazheng.project.greenplum.source.hana.ZmdpcSource;
import com.huazheng.project.greenplum.source.hana.ZpoeditSource; import com.huazheng.project.greenplum.source.hana.ZpoeditSource;
import com.huazheng.project.greenplum.source.hana.Zsd06Source; import com.huazheng.project.greenplum.source.hana.Zsd06Source;
...@@ -109,6 +110,7 @@ import com.huazheng.project.hana.model.Vbpa; ...@@ -109,6 +110,7 @@ import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk; import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp; import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk; import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Vbup;
import com.huazheng.project.hana.model.Zmdpc; import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit; import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06; import com.huazheng.project.hana.model.Zsd06;
...@@ -203,6 +205,7 @@ redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del ...@@ -203,6 +205,7 @@ redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del
private static S066Source s066Source; private static S066Source s066Source;
private static S067Source s067Source; private static S067Source s067Source;
private static VbukSource vbukSource; private static VbukSource vbukSource;
private static VbupSource vbupSource;
private static LikpSource likpSource; private static LikpSource likpSource;
private static KonvSource konvSource; private static KonvSource konvSource;
private static LipsSource lipsSource; private static LipsSource lipsSource;
...@@ -275,6 +278,7 @@ redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del ...@@ -275,6 +278,7 @@ redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del
s066Source = (S066Source) context.getBean("s066Source"); s066Source = (S066Source) context.getBean("s066Source");
s067Source = (S067Source) context.getBean("s067Source"); s067Source = (S067Source) context.getBean("s067Source");
vbukSource = (VbukSource) context.getBean("vbukSource"); vbukSource = (VbukSource) context.getBean("vbukSource");
vbupSource = (VbupSource) context.getBean("vbupSource");
likpSource = (LikpSource) context.getBean("likpSource"); likpSource = (LikpSource) context.getBean("likpSource");
konvSource = (KonvSource) context.getBean("konvSource"); konvSource = (KonvSource) context.getBean("konvSource");
lipsSource = (LipsSource) context.getBean("lipsSource"); lipsSource = (LipsSource) context.getBean("lipsSource");
...@@ -915,6 +919,17 @@ redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del ...@@ -915,6 +919,17 @@ redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del
} }
}).setParallelism(1).name("拉取Vbuk数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbuk数据"); }).setParallelism(1).name("拉取Vbuk数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbuk数据");
// ================= VbupRedis 队列 =================
// 销售凭证 : 项目状态
DataStream<String> vbupRedis = env.addSource(vbupSource).setParallelism(1).name("输入Vbup队列");
vbupRedis.flatMap(new FlatMapFunction<String, Vbup>() {
private static final long serialVersionUID = 1L;
@Override
public void flatMap(String value, Collector<Vbup> out) throws Exception {
gpserviceImpl.processVbup(value, out);
}
}).setParallelism(1).name("拉取Vbup数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbup数据");
// =========================================== mysql =========================================== // =========================================== mysql ===========================================
// Handover // Handover
DataStream<String> handoverRedis = env.addSource(handoverSource).setParallelism(1).name("输入Handover队列"); DataStream<String> handoverRedis = env.addSource(handoverSource).setParallelism(1).name("输入Handover队列");
......
...@@ -46,6 +46,7 @@ import com.huazheng.project.hana.model.Vbpa; ...@@ -46,6 +46,7 @@ import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk; import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp; import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk; import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Vbup;
import com.huazheng.project.hana.model.Zmdpc; import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit; import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06; import com.huazheng.project.hana.model.Zsd06;
...@@ -377,6 +378,15 @@ public interface GPMapper { ...@@ -377,6 +378,15 @@ public interface GPMapper {
public List<Vbuk> selectVbukCheck(Vbuk build); public List<Vbuk> selectVbukCheck(Vbuk build);
@Cacheable(key = "#root.method.name+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt", unless="#result == null") @Cacheable(key = "#root.method.name+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt", unless="#result == null")
public Vbup selectVbup(Vbup vbup); // 查询替代删除
public void insertVbup(Vbup element);
@CacheEvict(key = "'selectVbup'+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt")
public void updateVbup(Vbup vbup);
@CacheEvict(key = "'selectVbup'+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt")
public void deleteVbup(Vbup vbup);
public List<Vbup> selectVbupCheck(Vbup build);
@Cacheable(key = "#root.method.name+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt", unless="#result == null")
public Zmdpc selectZmdpc(Zmdpc zmdpc); // 查询替代删除 public Zmdpc selectZmdpc(Zmdpc zmdpc); // 查询替代删除
public void insertZmdpc(Zmdpc element); public void insertZmdpc(Zmdpc element);
@CacheEvict(key = "'selectZmdpc'+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt") @CacheEvict(key = "'selectZmdpc'+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt")
......
...@@ -32,6 +32,7 @@ import com.huazheng.project.hana.model.Vbpa; ...@@ -32,6 +32,7 @@ import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk; import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp; import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk; import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Vbup;
import com.huazheng.project.hana.model.Zmdpc; import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit; import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06; import com.huazheng.project.hana.model.Zsd06;
...@@ -541,6 +542,37 @@ public class CheckDeleteServiceImpl { ...@@ -541,6 +542,37 @@ public class CheckDeleteServiceImpl {
redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbuk:rowNum", SomeUtils.getErrorInfoFromException(e)); redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbuk:rowNum", SomeUtils.getErrorInfoFromException(e));
} }
} }
public void selectVbupCheckByDelete() {
try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:checkDelete:Vbup:rowNum", "0");
String rowNum = opsForValue.get("huazheng:checkDelete:Vbup:rowNum");
Vbup build = Vbup.builder().rowNum(rowNum).build();
List<Vbup> list = gpMapper.selectVbupCheck(build); // 从数仓中查询一组数据
if (list.size() == 0) {
redis1Template.opsForValue().set("huazheng:checkDelete:Vbup:rowNum", "0"); // 计数器复位
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
list.forEach(target -> { // 遍历要检查的数据
Vbup source = sapMapper.selectVbupById(target); // 根据主键查询源库中的数据
String operator = "none";
if (source == null) { // 如果源库中没有数据
gpMapper.deleteVbup(target); // 删除数仓中的数据
operator = "delete";
}
redis1Template.opsForValue().set("huazheng:checkDelete:Vbup:rowNum", target.getRowNum());
if (!operator.equals("none")) {
log.info(String.format("selectVbupcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
}
});
} catch (Exception e) {
redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbup:rowNum", SomeUtils.getErrorInfoFromException(e));
}
}
public void selectZpoeditCheckByDelete() { public void selectZpoeditCheckByDelete() {
try { try {
ValueOperations<String, String> opsForValue = redis1Template.opsForValue(); ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
......
...@@ -40,6 +40,7 @@ import com.huazheng.project.hana.model.Vbpa; ...@@ -40,6 +40,7 @@ import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk; import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp; import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk; import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Vbup;
import com.huazheng.project.hana.model.Zmdpc; import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit; import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06; import com.huazheng.project.hana.model.Zsd06;
...@@ -763,6 +764,30 @@ public class CheckUpdateServiceImpl { ...@@ -763,6 +764,30 @@ public class CheckUpdateServiceImpl {
} }
} }
} }
// 所属selectLipsCheckUpdate的级联
private void cascadeVbupCheckByUpdate(Vbup source, Vbup 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.updateVbup(source); // 更新数据到数仓中
break;
} catch (RuntimeException e) {
log.error(e.getMessage());
ThreadUtil.safeSleep(500);
}
}
ThreadUtil.safeSleep(500);
}
}
}
// 所属selectMaraCheckUpdate的级联 // 所属selectMaraCheckUpdate的级联
private void cascadeMaktCheckByUpdate(Makt source, Makt target) { private void cascadeMaktCheckByUpdate(Makt source, Makt target) {
if (target != null) { // 目标库有数据 if (target != null) { // 目标库有数据
...@@ -1713,6 +1738,12 @@ public class CheckUpdateServiceImpl { ...@@ -1713,6 +1738,12 @@ public class CheckUpdateServiceImpl {
Vbuk tVbuk = gpMapper.selectVbuk(sVbuk); // 查询目标库中afko表 Vbuk tVbuk = gpMapper.selectVbuk(sVbuk); // 查询目标库中afko表
cascadeVbukCheckByUpdate(sVbuk, tVbuk); // 级联更新afko表 cascadeVbukCheckByUpdate(sVbuk, tVbuk); // 级联更新afko表
} }
// 级联更新业务
List<Vbup> sVbupList = sapMapper.cascadeVbupByLips(source); // 级联查询源库vbup表
for (Vbup sVbup : sVbupList) {
Vbup tVbup = gpMapper.selectVbup(sVbup); // 查询目标库中vbup表
cascadeVbupCheckByUpdate(sVbup, tVbup); // 级联更新vbup表
}
ThreadUtil.safeSleep(500); ThreadUtil.safeSleep(500);
} }
......
...@@ -49,6 +49,7 @@ import com.huazheng.project.hana.model.Vbpa; ...@@ -49,6 +49,7 @@ import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk; import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp; import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk; import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Vbup;
import com.huazheng.project.hana.model.Zmdpc; import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit; import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06; import com.huazheng.project.hana.model.Zsd06;
...@@ -1121,6 +1122,35 @@ public class GPServiceImpl { ...@@ -1121,6 +1122,35 @@ public class GPServiceImpl {
} }
} }
public void processVbup(String value, Collector<Vbup> out) {
try {
Vbup data = JSONUtil.toBean(value, Vbup.class);
Vbup exist = gpMapper.selectVbup(data);
if (exist != null) {
data.setExist(true); // 已经在库
}
out.collect(data);
} catch (Exception e) {
redis1Template.opsForHash().put("huazheng:Vbup:error", "processVbup", getErrorInfoFromException(e));
log.error(e.getMessage());
}
}
public void sinkVbup(Vbup element) {
try {
if (element.isExist() == false) {
log.debug("GPServiceImpl.sinkVbup()");
gpMapper.insertVbup(element);
}
} catch (RuntimeException e) {
redis1Template.opsForHash().put("huazheng:Vbup:error", "sinkVbup", getErrorInfoFromException(e));
log.error(e.getMessage());
} catch (Exception e) {
redis1Template.opsForHash().put("huazheng:Vbup:error", "sinkVbup", getErrorInfoFromException(e));
log.error(e.getMessage());
}
}
public void processHandover(String value, Collector<Handover> out) { public void processHandover(String value, Collector<Handover> out) {
try { try {
Handover data = JSONUtil.toBean(value, Handover.class); Handover data = JSONUtil.toBean(value, Handover.class);
......
...@@ -52,6 +52,7 @@ import com.huazheng.project.hana.model.Vbpa; ...@@ -52,6 +52,7 @@ import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk; import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp; import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk; import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Vbup;
import com.huazheng.project.hana.model.Zmdpc; import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit; import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06; import com.huazheng.project.hana.model.Zsd06;
...@@ -1005,6 +1006,32 @@ public class JobServiceImpl { ...@@ -1005,6 +1006,32 @@ public class JobServiceImpl {
} }
} }
} }
public void selectVbupNew() {
DefaultRedisScript<String> script = new DefaultRedisScript<String>();
script.setResultType(String.class);
script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
List<String> keys = Arrays.asList("huazheng:Vbup:sendcount", "huazheng:Vbup:rowids", "huazheng:list:Vbup");
ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
opsForValue.setIfAbsent("huazheng:Vbup:sendcount", "0"); // 不存在则创建,存在则么有操作
opsForValue.setIfAbsent("huazheng:Vbup:receivecount", "0"); // 不存在则创建,存在则么有操作
opsForValue.setIfAbsent("huazheng:Vbup:rowids", "0"); // 不存在则创建,存在则么有操作
Long sendcount = Long.valueOf(opsForValue.get("huazheng:Vbup:sendcount"));
Long receivecount = Long.valueOf(opsForValue.get("huazheng:Vbup:receivecount"));
if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
String rowids = opsForValue.get("huazheng:Vbup:rowids"); // 标记id
Vbup vbup = Vbup.builder().rowids(Long.valueOf(rowids)).build();
List<Vbup> list = sapMapper.selectVbupNew(vbup);
if (!list.isEmpty()) {
list.forEach(item -> {
JSONObject json = JSONUtil.parseObj(item, false);
String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
log.info("标记时间回写 --> " + execute);
});
}
}
}
public void selectVbapNew() { public void selectVbapNew() {
DefaultRedisScript<String> script = new DefaultRedisScript<String>(); DefaultRedisScript<String> script = new DefaultRedisScript<String>();
script.setResultType(String.class); script.setResultType(String.class);
......
package com.huazheng.project.greenplum.source.hana;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
import org.apache.flink.streaming.api.functions.source.SourceFunction;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.scripting.support.ResourceScriptSource;
import org.springframework.stereotype.Service;
import com.huazheng.project.HZDataStream;
import cn.hutool.core.thread.ThreadUtil;
import lombok.extern.log4j.Log4j2;
@Log4j2
@Service
public class VbupSource implements SourceFunction<String> {
private static final long serialVersionUID = 1L;
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";
}
}
@Override
public void run(SourceContext<String> ctx) throws Exception {
DefaultRedisScript<String> script = new DefaultRedisScript<String>();
script.setResultType(String.class);
script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap.lua")));
List<String> keys = Arrays.asList("huazheng:Vbup:sendcount", "huazheng:Vbup:id", "huazheng:list:Vbup", "huazheng:Vbup:receivecount");
while (true) {
try {
String value = HZDataStream.redis1Template.execute(script, keys, "");
String[] values = value.toString().split("==========");
String checkString = values[0];
String[] split = checkString.split(", ");
boolean check = split[0].split(":")[1].equals(split[1].split(":")[1]);
if (values.length > 1) { // 有数据字符串
// log.info(msg + " " + value.toString() + " " + check);
log.info(checkString + " " + check);
ctx.collect(values[1]);
} else { // 没有数据字符串
ThreadUtil.sleep(1000); // 没有数据了,休眠一下
}
} catch (Exception e) {
HZDataStream.redis1Template.opsForHash().put("huazheng:Vbup:error", "receivecount_elseerror", getErrorInfoFromException(e));
}
}
}
@Override
public void cancel() {
}
}
...@@ -39,6 +39,7 @@ import com.huazheng.project.hana.model.Vbpa; ...@@ -39,6 +39,7 @@ import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk; import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp; import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk; import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Vbup;
import com.huazheng.project.hana.model.Zmdpc; import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit; import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06; import com.huazheng.project.hana.model.Zsd06;
...@@ -58,6 +59,7 @@ public interface SapMapper { ...@@ -58,6 +59,7 @@ public interface SapMapper {
public List<S066> selectS066New(S066 s066); public List<S066> selectS066New(S066 s066);
public List<S067> selectS067New(S067 s067); public List<S067> selectS067New(S067 s067);
public List<Vbuk> selectVbukNew(Vbuk vbuk); public List<Vbuk> selectVbukNew(Vbuk vbuk);
public List<Vbup> selectVbupNew(Vbup vbup);
public List<Likp> selectLikpNew(Likp likp); public List<Likp> selectLikpNew(Likp likp);
public List<Konv> selectKonvNew(Konv konv); public List<Konv> selectKonvNew(Konv konv);
public List<Lips> selectLipsNew(Lips lips); public List<Lips> selectLipsNew(Lips lips);
...@@ -112,6 +114,7 @@ public interface SapMapper { ...@@ -112,6 +114,7 @@ public interface SapMapper {
public List<Konv> cascadeKonvByVbak(Vbak vbak); public List<Konv> cascadeKonvByVbak(Vbak vbak);
public List<Makt> cascadeMaktByMara(Mara mara); public List<Makt> cascadeMaktByMara(Mara mara);
public List<Vbuk> cascadeVbukByLips(Lips lips); public List<Vbuk> cascadeVbukByLips(Lips lips);
public List<Vbup> cascadeVbupByLips(Lips lips);
public List<Zpoedit> cascadeZpoeditByAufk(Aufk aufk); public List<Zpoedit> cascadeZpoeditByAufk(Aufk aufk);
public List<Bsad> cascadeBsadByBkpf(Bkpf bkpf); public List<Bsad> cascadeBsadByBkpf(Bkpf bkpf);
public List<Bsid> cascadeBsidByBkpf(Bkpf bkpf); public List<Bsid> cascadeBsidByBkpf(Bkpf bkpf);
...@@ -149,6 +152,7 @@ public interface SapMapper { ...@@ -149,6 +152,7 @@ public interface SapMapper {
public Vbrk selectVbrkById(Vbrk target); public Vbrk selectVbrkById(Vbrk target);
public Vbrp selectVbrpById(Vbrp target); public Vbrp selectVbrpById(Vbrp target);
public Vbuk selectVbukById(Vbuk target); public Vbuk selectVbukById(Vbuk target);
public Vbup selectVbupById(Vbup target);
public Zmdpc selectZmdpcById(Zmdpc target); public Zmdpc selectZmdpcById(Zmdpc target);
public Zsd06 selectZsd06ById(Zsd06 target); public Zsd06 selectZsd06ById(Zsd06 target);
public Zsdfhzl selectZsdfhzlById(Zsdfhzl target); public Zsdfhzl selectZsdfhzlById(Zsdfhzl target);
......
package com.huazheng.project.hana.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* 销售凭证 : 项目状态
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
public class Vbup implements Serializable {
private static final long serialVersionUID = 1L;
private String mandt; // 集团
private String vbeln; // 销售和分销凭证号
private String posnr; // 销售和分销凭证的项目号
private String besta; // 凭证项目的确认状态
private String lfsta; // 交货状态
private String lfgsa; // 项目的总交货状态
private String wbsta; // 货物移动状态
private Long rowids; // sap那边的rowid
private boolean exist; // 用于标记,不是字段
private String hashResult; // 数据hash标记
private String rowNum; // 用于标记,不是字段
}
drop table vbup;
CREATE TABLE vbup (
mandt text,
vbeln text,
posnr text,
besta text,
lfsta text,
lfgsa text,
wbsta text,
PRIMARY KEY (mandt, vbeln, posnr)
)
Distributed by (mandt, vbeln, posnr);
alter table vbuk add column hashResult text;
alter table vbuk add column rowNum serial;
...@@ -1267,6 +1267,25 @@ ...@@ -1267,6 +1267,25 @@
select * from Vbuk where rownum &gt; #{rowNum} order by rownum limit 20 select * from Vbuk where rownum &gt; #{rowNum} order by rownum limit 20
</select> </select>
<select id="selectVbup" parameterType="com.huazheng.project.hana.model.Vbup" resultType="com.huazheng.project.hana.model.Vbup">
select * from Vbup where vbeln = #{vbeln} and posnr = #{posnr} and mandt = #{mandt}
</select>
<insert id="insertVbup" parameterType="com.huazheng.project.hana.model.Vbup">
insert into Vbup (mandt, vbeln, posnr, besta, lfsta, lfgsa, wbsta, hashResult)
values(#{mandt}, #{vbeln}, #{posnr}, #{besta}, #{lfsta}, #{lfgsa}, #{wbsta}, #{hashResult})
</insert>
<delete id="deleteVbup" parameterType="com.huazheng.project.hana.model.Vbup">
delete from Vbup where vbeln = #{vbeln} and posnr = #{posnr} and mandt = #{mandt}
</delete>
<update id="updateVbup" parameterType="com.huazheng.project.hana.model.Vbup">
update Vbup set
mandt = #{mandt}, vbeln = #{vbeln}, posnr = #{posnr}, besta = #{besta}, lfsta = #{lfsta}, lfgsa = #{lfgsa}, wbsta = #{wbsta}, hashResult = #{hashResult}
where vbeln = #{vbeln} and posnr = #{posnr} and mandt = #{mandt}
</update>
<select id="selectVbupCheck" parameterType="com.huazheng.project.hana.model.Vbup" resultType="com.huazheng.project.hana.model.Vbup">
select * from Vbup where rownum &gt; #{rowNum} order by rownum limit 20
</select>
<select id="selectZmdpc" parameterType="com.huazheng.project.hana.model.Zmdpc" resultType="com.huazheng.project.hana.model.Zmdpc"> <select id="selectZmdpc" parameterType="com.huazheng.project.hana.model.Zmdpc" resultType="com.huazheng.project.hana.model.Zmdpc">
select * from Zmdpc select * from Zmdpc
where vbeln = #{vbeln} and posnr = #{posnr} and mandt = #{mandt} where vbeln = #{vbeln} and posnr = #{posnr} and mandt = #{mandt}
......
...@@ -105,6 +105,15 @@ ...@@ -105,6 +105,15 @@
where "$rowid$" &gt; #{rowids} ${hana_mandt} where "$rowid$" &gt; #{rowids} ${hana_mandt}
order by "$rowid$" order by "$rowid$"
</select> </select>
<select id="selectVbupNew" parameterType="Vbup" resultType="Vbup">
select top 20 "$rowid$" as rowids,
mandt, vbeln, posnr, besta, lfsta, lfgsa, wbsta
from ${hana_user}.vbup
where "$rowid$" &gt; #{rowids} ${hana_mandt}
order by "$rowid$"
</select>
<select id="selectLikpNew" parameterType="Likp" resultType="Likp"> <select id="selectLikpNew" parameterType="Likp" resultType="Likp">
select top 20 "$rowid$" as rowids, select top 20 "$rowid$" as rowids,
vbeln, mandt, erdat, wadat_ist, ctlpc, kunnr, aedat,lfuhr vbeln, mandt, erdat, wadat_ist, ctlpc, kunnr, aedat,lfuhr
...@@ -481,6 +490,14 @@ ...@@ -481,6 +490,14 @@
from ${hana_user}.vbuk from ${hana_user}.vbuk
where vbeln = #{vbeln} ${hana_mandt} where vbeln = #{vbeln} ${hana_mandt}
</select> </select>
<select id="cascadeVbupByLips" parameterType="Lips" resultType="Vbup">
select
mandt, vbeln, posnr, besta, lfsta, lfgsa, wbsta
from ${hana_user}.vbup
where vbeln=#{vbeln} and posnr=#{posnr} ${hana_mandt}
</select>
<select id="cascadeZpoeditByAufk" parameterType="Aufk" resultType="Zpoedit"> <select id="cascadeZpoeditByAufk" parameterType="Aufk" resultType="Zpoedit">
select select
mandt, pwerk, aufnr, reason mandt, pwerk, aufnr, reason
...@@ -699,6 +716,13 @@ ...@@ -699,6 +716,13 @@
from ${hana_user}.vbuk from ${hana_user}.vbuk
where vbeln = #{vbeln} and mandt = '800' where vbeln = #{vbeln} and mandt = '800'
</select> </select>
<select id="selectVbupById" parameterType="Vbup" resultType="Vbup">
select mandt, vbeln, posnr, besta, lfsta, lfgsa, wbsta
from ${hana_user}.vbup
where vbeln = #{vbeln} and posnr = #{posnr} and mandt = '800'
</select>
<select id="selectZmdpcById" parameterType="Zmdpc" resultType="Zmdpc"> <select id="selectZmdpcById" parameterType="Zmdpc" resultType="Zmdpc">
select vbeln,posnr,f_plant,plant,x_plant,mandt select vbeln,posnr,f_plant,plant,x_plant,mandt
from ${hana_user}.Zmdpc from ${hana_user}.Zmdpc
......
...@@ -595,6 +595,15 @@ ...@@ -595,6 +595,15 @@
<property name="jobDetail"> <property name="jobDetail">
<bean parent="methodJobDetail"> <bean parent="methodJobDetail">
<property name="targetObject" ref="jobServiceImpl" /> <property name="targetObject" ref="jobServiceImpl" />
<property name="targetMethod" value="selectVbupNew" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="jobServiceImpl" />
<property name="targetMethod" value="selectVbpaNew" /> <property name="targetMethod" value="selectVbpaNew" />
</bean> </bean>
</property> </property>
...@@ -1217,6 +1226,17 @@ ...@@ -1217,6 +1226,17 @@
</property> </property>
<property name="cronExpression" value="* * * * * ?" /> <property name="cronExpression" value="* * * * * ?" />
</bean> --> </bean> -->
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean parent="methodJobDetail">
<property name="targetObject" ref="checkDeleteServiceImpl" />
<property name="targetMethod" value="selectVbupCheckByDelete" />
</bean>
</property>
<property name="cronExpression" value="* * * * * ?" />
</bean>
<!-- <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <!-- <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail"> <property name="jobDetail">
<bean parent="methodJobDetail"> <bean parent="methodJobDetail">
...@@ -1431,7 +1451,7 @@ ...@@ -1431,7 +1451,7 @@
<property name="cronExpression" value="* * * * * ?" /> <property name="cronExpression" value="* * * * * ?" />
</bean> </bean>
<!-- 以上73个任务 --> <!-- 以上75个任务 -->
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论