| | |
| | | package com.java110.code.back; |
| | | |
| | | import com.java110.code.util.FileUtilBase; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public class GeneratorAbstractBussiness extends BaseGenerator { |
| | |
| | | * |
| | | * @param data |
| | | */ |
| | | public void generator(Data data) { |
| | | public void generator(Data data) throws Exception { |
| | | StringBuffer sb = readFile(this.getClass().getResource("/template/AbstractBusinessServiceDataFlowListener.txt").getFile()); |
| | | String fileContext = sb.toString(); |
| | | fileContext = fileContext.replace("store", toLowerCaseFirstOne(data.getName())) |
| | | .replace("@@shareName@@",data.getShareName()) |
| | | .replace("@@templateCode@@",data.getName()) |
| | | .replace("Store", toUpperCaseFirstOne(data.getName())) |
| | | .replace("商户", data.getDesc()) |
| | | .replace(data.getName()+"Id", data.getId()) |
| | | .replace(data.getName()+"_id", data.getParams().get(data.getId()).toString()); |
| | | .replace(data.getName() + "Id", data.getId()) |
| | | .replace(data.getName() + "_id", data.getParams().get(data.getId()).toString()); |
| | | Map<String, String> param = data.getParams(); |
| | | String mappingContext = ""; |
| | | String autoMappingContext = ""; |
| | |
| | | |
| | | fileContext = fileContext.replace("$flushBusinessInfo$", mappingContext); |
| | | fileContext = fileContext.replace("$autoSaveDelBusiness$", autoMappingContext); |
| | | System.out.println(this.getClass().getResource("/listener").getPath()); |
| | | String writePath = this.getClass().getResource("/listener").getPath() + "/Abstract" + toUpperCaseFirstOne(data.getName()) + "BusinessServiceDataFlowListener.java"; |
| | | String writePath = this.getClass().getResource("/").getPath() |
| | | + "out/back/listener/" + data.getName() + "/Abstract" + toUpperCaseFirstOne(data.getName()) + "BusinessServiceDataFlowListener.java"; |
| | | writeFile(writePath, |
| | | fileContext); |
| | | // System.out.println("看这里"+toUpperCaseFirstOne(data.getShareName()).toString()); |
| | | FileUtilBase.copyfile(writePath,toUpperCaseFirstOne(data.getShareName()).toString()+"Service\\src\\main\\java\\com\\java110\\community\\listener\\"+ data.getName() + "/Abstract" + toUpperCaseFirstOne(data.getName()) + "BusinessServiceDataFlowListener.java"); |
| | | } |
| | | } |