12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- package com.miniframe.bisiness.$tools.toLower($!map.get("code"));
- import java.util.Map;
- import com.miniframe.core.ExecProcessFlow;
- #set ( $package = "system.model."+$tools.toUpper($!map.get("交易编码"))+"BaseModel")
- import com.miniframe.generate.business.$package;
- import com.miniframe.tools.XIFileUtils;
- import java.io.File;
- import java.io.RandomAccessFile;
- import java.math.BigDecimal;
- import java.nio.channels.FileChannel;
- import java.nio.channels.FileLock;
- /**
- * $!map.get("name"),“$!map.get("交易名称")”逻辑处理(重新生成不覆盖)。
- */
- public class $tools.toUpper($!map.get("交易编码"))Service extends $tools.toUpper($!map.get("交易编码"))BaseModel implements ExecProcessFlow {
-
- private static final long serialVersionUID = -7051358269847459502L;
-
- /**
- * $!map.get("name"),“$!map.get("交易名称")”业务核心处理
- */
- public void transExecute() throws Exception {
-
- }
-
- /**
- * $!map.get("name"),“$!map.get("交易名称")”业务前处理
- */
- public void preTransFlow() throws Exception {
- //this.validater();
- }
-
- /**
- * $!map.get("name"),“$!map.get("交易名称")”业务后处理
- */
- public void afterTransFlow() throws Exception {
-
- }
-
- /**
- * $!map.get("name"),“$!map.get("交易名称")”逻辑入口处理方法
- */
- @SuppressWarnings("rawtypes")
- @Override
- public Map execute(Map vars) throws Exception {
- this.setTransMap(vars);
- File file = XIFileUtils.getAbsolutePath(this.getClass().getSimpleName() + ".pid").toFile();
- RandomAccessFile raf = null;
- FileChannel fc = null;
- FileLock fl = null;
- try {
- raf = new RandomAccessFile(file, "rw");
- fc = raf.getChannel();
- try {
- fl = fc.tryLock();
- if (fl != null) {
- preTransFlow();// 执行业务开始的规则检查和校验
- transExecute();// 执行核心业务段
- afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
- }
- } catch (Exception e) {
- } finally {
- //获得文件锁权限后,进行相应的操作
- if (fl != null) {
- fl.release();
- }
- fc.close();
- raf.close();
- }
- } catch (Exception e) {
- }
- return this.getTransMap();
- }
- }
|