增加一键下发功能。

yun-zuoyi
钮海涛 4 years ago
parent 8de712ad1d
commit 6effb386a3

@ -26,6 +26,7 @@ import javax.persistence.Table;
@Api("副资源设置时间")
public class AssistResourceSetTime extends BaseAPS {
private static final long serialVersionUID = 901172392855536686L;
@Column(name="RES_CODE")
@ApiParam(value ="资源编码")
@FieldAnnotation(editType = ApsEnumUtil.EDIT_TYPE.MULTI_OBJECT, typeName = "Resource", notEmpty = true)

@ -36,6 +36,7 @@ import java.util.List;
@MainKey(groups = {InsertGroup.class, UpdateGroup.class})
public class BaseOrder extends BaseAPS {
private static final long serialVersionUID = -2571085172798608026L;
@Column(name="CODE")
@ApiParam(value ="编码")
@FieldAnnotation(popSearch = true, mainkey = true)
@ -121,7 +122,7 @@ public class BaseOrder extends BaseAPS {
}
public void setMaterial(Material material) {
this.materialId = material != null ? material.getId() : 0l;
this.materialId = material != null ? material.getId() : 0L;
BeanRelation.set(this, EBaseOrder.Material, material);
}

@ -25,6 +25,7 @@ import javax.persistence.MappedSuperclass;
@ExcludeImportExport
public class BaseRule extends BaseAPS {
private static final long serialVersionUID = -1818853814377611968L;
@Column(name="CODE")
@ApiParam(value ="规则编码")
@FieldAnnotation(popSearch = true, mainkey = true)

@ -26,6 +26,7 @@ import javax.persistence.Table;
@Api("数据集成数据连接信息")
public class DataLink extends BaseAPS {
private static final long serialVersionUID = 8324774871058505466L;
@Column(name="CODE")
@ApiParam(value ="编码")
@FieldAnnotation(notEmpty = true)

@ -32,6 +32,7 @@ import javax.persistence.Table;
@MainKey(groups = {InsertGroup.class, UpdateGroup.class})
public class DayShift extends BaseAPS {
private static final long serialVersionUID = 7964370027924366093L;
@Column(name="CODE")
@ApiParam(value ="编码")
@FieldAnnotation(popSearch = true, mainkey = true)

@ -27,8 +27,8 @@ import javax.persistence.Table;
@Table(name = "APS_EXPORT_DETAIL")
@Api("数据导出明细")
public class ExportDetail extends BaseAPS {
private static final long serialVersionUID = -8898414164032180539L;
@Column(name="OUT_NAME")
@ApiParam(value ="外部表名")
private String outName;
@ -62,7 +62,7 @@ public class ExportDetail extends BaseAPS {
}
public void setProject(ExportProject project) {
this.projectId = project != null ? project.getId() : 0l;
this.projectId = project != null ? project.getId() : 0L;
BeanRelation.set(this, EExportDetail.Project, project);
}
}

@ -51,7 +51,7 @@ public class ExportProject extends BaseAPS {
}
public void setLink(DataLink link) {
this.linkId = link != null ? link.getId() : 0l;
this.linkId = link != null ? link.getId() : 0L;
BeanRelation.set(this, EExportProject.Link, link);
}

@ -25,6 +25,7 @@ import javax.persistence.Table;
@Api("表达式记录")
public class ExpressionRecord extends BaseAPS {
private static final long serialVersionUID = 4038954046132896632L;
@Column(name="BEAN_NAME")
@ApiParam(value ="表名")
private String beanName;

@ -34,6 +34,7 @@ import java.sql.JDBCType;
@ExcludeImportExport
public class FieldInfo extends BaseAPS {
private static final long serialVersionUID = -6195036426929675850L;
@Column(name="CODE")
@ApiParam(value ="编码")
@FieldAnnotation(popSearch = true, mainkey = true)

@ -31,8 +31,8 @@ import java.util.List;
@Table(name="APS_FURNACE_PLAN")
@Api("炉资源计划")
public class FurnacePlan extends BaseAPS {
private static final long serialVersionUID = 6816465736285211114L;
@Column(name="CAPACITY", columnDefinition = "decimal(18,8)")
@ApiParam(value ="已占用的能力")
private Double capacity;

@ -26,6 +26,7 @@ import javax.persistence.Table;
@Api("排程运算规则")
public class HeuristicRule extends BaseRule {
private static final long serialVersionUID = -4856714428377308150L;
@Column(name="WORK_FILTER")
@ApiParam(value ="工作筛选")
private String workFilter;

@ -35,7 +35,6 @@ import java.util.List;
@Api("数据导入明细")
@MainKey(groups = {InsertGroup.class, UpdateGroup.class})
public class ImportDetail extends BaseAPS {
private static final long serialVersionUID = 1264030397500660450L;
@Column(name="NAME")
@ -125,7 +124,7 @@ public class ImportDetail extends BaseAPS {
}
public void setProject(ImportProject project) {
this.projectId = project != null ? project.getId() : 0l;
this.projectId = project != null ? project.getId() : 0L;
BeanRelation.set(this, EImportDetail.Project, project);
}

@ -80,7 +80,7 @@ public class ImportField extends BaseAPS {
}
public void setImportDetail(ImportDetail detail) {
this.importDetailId = detail != null ? detail.getId() : 0l;
this.importDetailId = detail != null ? detail.getId() : 0L;
BeanRelation.set(this, EImportField.ImportDetail, detail);
}
}

@ -29,6 +29,7 @@ import java.util.List;
@Api("数据导入明细集合")
public class ImportProject extends BaseAPS {
private static final long serialVersionUID = -1899074765155621438L;
@Column(name="NAME")
@ApiParam(value ="标识名")
private String name;
@ -49,7 +50,7 @@ public class ImportProject extends BaseAPS {
}
public void setLink(DataLink link) {
this.linkId = link != null ? link.getId() : 0l;
this.linkId = link != null ? link.getId() : 0L;
BeanRelation.set(this, EImportProject.Link, link);
}

@ -63,7 +63,7 @@ public class InsertedOrder extends BaseOrder {
}
public void setProductRouting(ProductRouting routing) {
this.productRoutingId = routing != null ? routing.getId() : 0l;
this.productRoutingId = routing != null ? routing.getId() : 0L;
BeanRelation.set(this, EInsertedOrder.ProductRouting, routing);
}

@ -44,7 +44,7 @@ public class InterMediateDetail extends BaseAPS {
public InterMediateResult getResult() { return BeanRelation.get(this, EInterMediateDetail.Result); }
public void setResult(InterMediateResult result) {
this.resultId = result != null ? result.getId() : 0;
this.resultId = result != null ? result.getId() : 0L;
BeanRelation.set(this, EInterMediateDetail.Result, result);
}
}

@ -51,14 +51,14 @@ public class InterMediateResult extends BaseAPS {
}
public void setWork(Work work) {
this.workId = work != null ? work.getId() : 0l;
this.workId = work != null ? work.getId() : 0L;
BeanRelation.set(this, EInterMediateResult.Work, work);
}
public Resource getResource() { return BeanRelation.get(this, EInterMediateResult.Resource); }
public void setResource(Resource resource) {
this.resourceId = resource != null ? resource.getId() : 0l;
this.resourceId = resource != null ? resource.getId() : 0L;
BeanRelation.set(this, EInterMediateResult.Resource, resource);
}

@ -25,6 +25,7 @@ import javax.persistence.Table;
@Api("物料运算规则")
public class MatCalcRule extends BaseRule {
private static final long serialVersionUID = 2102986260688118982L;
@Column(name="MATERIAL_FILTER")
@ApiParam(value ="物料筛选")
private String materialFilter;

@ -37,6 +37,7 @@ import java.util.List;
@MainKey(groups = {InsertGroup.class, UpdateGroup.class})
public class Material extends BaseAPS {
private static final long serialVersionUID = -7928225487946173108L;
@Column(name="CODE")
@ApiParam(value ="编码")
@FieldAnnotation(popSearch = true, mainkey = true)

@ -48,7 +48,7 @@ public class MaterialDeliveryPromise extends BaseBean {
}
public void setMaterial(Material material) {
this.materialId = material != null ? material.getId() : 0l;
this.materialId = material != null ? material.getId() : 0L;
BeanRelation.set(this, EMaterialDeliveryPromise.Material, material);
}
}

@ -26,6 +26,7 @@ import javax.persistence.Table;
@Api("物料设置时间")
public class MaterialSetTime extends BaseAPS {
private static final long serialVersionUID = -7996431489447641539L;
@Column(name="RES_CODE")
@ApiParam(value ="资源编码")
@FieldAnnotation(editType = ApsEnumUtil.EDIT_TYPE.MULTI_OBJECT, typeName = "Resource", notEmpty = true, mainkey = true)
@ -45,9 +46,4 @@ public class MaterialSetTime extends BaseAPS {
@ApiParam(value ="设置时间")
@FieldAnnotation(notEmpty = true)
private String time;
// @Column(name="PRIORITY")
// @ApiParam(value ="优先级")
// @FieldAnnotation(defaultValue = "10", mainkey = true)
// private Integer priority;
}

@ -30,6 +30,7 @@ import java.util.List;
@Api("工序输入")
public class OperInput extends BaseAPS {
private static final long serialVersionUID = 6653235155693766804L;
@Column(name="OPERATION_ID")
@ApiParam(value ="工序")
@FieldAnnotation(relation = "Operation", notEmpty = true, display = false)
@ -75,7 +76,7 @@ public class OperInput extends BaseAPS {
}
public void setOperation(Operation oper) {
this.operationId = oper != null ? oper.getId() : 0l;
this.operationId = oper != null ? oper.getId() : 0L;
BeanRelation.set(this, EOperInput.Operation, oper);
}
@ -84,7 +85,7 @@ public class OperInput extends BaseAPS {
}
public void setInputMaterial(Material material) {
this.inputMaterialId = material != null ? material.getId() : 0l;
this.inputMaterialId = material != null ? material.getId() : 0L;
BeanRelation.set(this, EOperInput.InputMaterial, material);
}

@ -29,6 +29,7 @@ import java.util.List;
@Api("工序输出")
public class OperOutput extends BaseAPS {
private static final long serialVersionUID = 3185682762290147209L;
@Column(name="OPERATION_ID")
@ApiParam(value ="工序")
@FieldAnnotation(relation = "Operation", notEmpty = true, display = false)
@ -59,7 +60,7 @@ public class OperOutput extends BaseAPS {
}
public void setOperation(Operation oper) {
this.operationId = oper != null ? oper.getId() : 0l;
this.operationId = oper != null ? oper.getId() : 0L;
BeanRelation.set(this, EOperOutput.Operation, oper);
}
@ -68,7 +69,7 @@ public class OperOutput extends BaseAPS {
}
public void setOutputMaterial(Material material) {
this.outputMaterialId = material != null ? material.getId() : 0l;
this.outputMaterialId = material != null ? material.getId() : 0L;
BeanRelation.set(this, EOperOutput.OutputMaterial, material);
}

@ -30,6 +30,7 @@ import java.util.List;
@Api("工序资源")
public class OperResource extends BaseAPS {
private static final long serialVersionUID = -8683889582369342606L;
@Column(name="OPERATION_ID")
@ApiParam(value ="工序")
@FieldAnnotation(relation = "Operation", notEmpty = true, display = false)
@ -88,7 +89,7 @@ public class OperResource extends BaseAPS {
}
public void setOperation(Operation oper) {
this.operationId = oper != null ? oper.getId() : 0l;
this.operationId = oper != null ? oper.getId() : 0L;
BeanRelation.set(this, EOperResource.Operation, oper);
}
@ -97,7 +98,7 @@ public class OperResource extends BaseAPS {
}
public void setResource(Resource res) {
this.resourceId = res != null ? res.getId() : 0l;
this.resourceId = res != null ? res.getId() : 0L;
BeanRelation.set(this, EOperResource.Resource, res);
}

@ -96,7 +96,7 @@ public class Operation extends BaseAPS {
}
public void setProductRouting(ProductRouting routing) {
this.productRoutingId = routing != null ? routing.getId() : 0l;
this.productRoutingId = routing != null ? routing.getId() : 0L;
BeanRelation.set(this, EOperation.ProductRouting, routing);
}
@ -120,7 +120,7 @@ public class Operation extends BaseAPS {
}
public void setStandOperation(StandOperation std) {
this.standOperationId = std != null ? std.getId() : 0l;
this.standOperationId = std != null ? std.getId() : 0L;
BeanRelation.set(this, EOperation.StandOperation, std);
}
}

@ -69,7 +69,7 @@ public class OrderFeedback extends BaseAPS {
}
public void setOrder(BaseOrder order) {
this.orderId = order != null ? order.getId() : 0l;
this.orderId = order != null ? order.getId() : 0L;
BeanRelation.set(this, EOrderFeedback.Order, order);
}
}

@ -25,6 +25,7 @@ import java.util.Date;
@ExcludeImportExport
public class OrderTree extends BaseAPS {
private static final long serialVersionUID = -7505923374791695738L;
@ApiParam(value ="物料编码")
private String material;

@ -33,6 +33,7 @@ import java.util.List;
@ExcludeImportExport
public class ParentWork extends BaseAPS {
private static final long serialVersionUID = 8792781216193806606L;
@Column(name="count", columnDefinition = "decimal(18,8)")
@ApiParam(value ="数量")
private Double count;
@ -57,7 +58,7 @@ public class ParentWork extends BaseAPS {
}
public void setProductOrder(ProductOrder order) {
this.productOrderId = order != null ? order.getId() : 0l;
this.productOrderId = order != null ? order.getId() : 0L;
BeanRelation.set(this, EParentWork.ProductOrder, order);
}
@ -66,7 +67,7 @@ public class ParentWork extends BaseAPS {
}
public void setOperation(Operation oper) {
this.operationId = oper != null ? oper.getId() : 0l;
this.operationId = oper != null ? oper.getId() : 0L;
BeanRelation.set(this, EParentWork.Operation, oper);
}

@ -27,7 +27,6 @@ import javax.persistence.Table;
@Table(name = "APS_PLAN_FEEDBACK")
@Api("工作反馈")
public class PlanFeedback extends BaseAPS {
private static final long serialVersionUID = 2520555825093741381L;
@Column(name="WORK_ID")
@ -52,7 +51,7 @@ public class PlanFeedback extends BaseAPS {
}
public void setWork(Work work) {
this.workId = work != null ? work.getId() : 0l;
this.workId = work != null ? work.getId() : 0L;
BeanRelation.set(this, EPlanFeedback.Work, work);
}
}

@ -31,6 +31,7 @@ import java.util.List;
@Api("生产订单")
public class ProductOrder extends BaseOrder {
private static final long serialVersionUID = 6900226668783662736L;
@Column(name="EST")
@ApiParam(value ="最早开始时间")
private Date est;
@ -113,7 +114,7 @@ public class ProductOrder extends BaseOrder {
}
public void setProductRouting(ProductRouting routing) {
this.productRoutingId = routing != null ? routing.getId() : 0l;
this.productRoutingId = routing != null ? routing.getId() : 0L;
BeanRelation.set(this, EProductOrder.ProductRouting, routing);
}

@ -34,6 +34,7 @@ import java.util.List;
@MainKey(groups = {InsertGroup.class, UpdateGroup.class})
public class ProductRouting extends BaseAPS {
private static final long serialVersionUID = 4905294866468216722L;
@Column(name="CODE")
@ApiParam(value ="编码")
@FieldAnnotation(popSearch = true, mainkey = true)
@ -67,7 +68,7 @@ public class ProductRouting extends BaseAPS {
}
public void setMaterial(Material material) {
this.materialId = material != null ? material.getId() : 0l;
this.materialId = material != null ? material.getId() : 0L;
BeanRelation.set(this, EProductRouting.Material, material);
}

@ -99,18 +99,28 @@ public class Resource extends BaseAPS {
@FieldAnnotation(multiEnumClass = ApsEnumUtil.EFFICIENCY_EFFECT.class)
private Integer EfficiencyEffect;
@ApiParam(value ="是否存在任务冲突")
@FieldAnnotation(property = false)
@Transient
private boolean hasConflict;
@Column(name="BIND_RESOURCE_ID")
@ApiParam(value ="绑定资源")
@FieldAnnotation(relation = "Order", modify = false)
private Long bindResourceId;
public WorkShop getWorkShop() { return BeanRelation.get(this, EResource.WorkShop); }
public void setWorkShop(WorkShop workShop) {
this.workShopId = workShop != null ? workShop.getId() : 0l;
this.workShopId = workShop != null ? workShop.getId() : 0L;
BeanRelation.set(this, EResource.WorkShop, workShop);
}
@JsonBackReference
public List<WorkPlan> getWorkPlans() { return BeanRelation.list(this, EResource.WorkPlans); }
public Resource getBindResource() { return BeanRelation.get(this, EResource.BindResource); }
public void setResource(Resource bindResource) {
this.bindResourceId = bindResource != null ? bindResource.getId() : 0L;
BeanRelation.set(this, EResource.BindResource, bindResource);
}
@JsonBackReference
public List<Resource> getSubBindResources() { return BeanRelation.list(this, EResource.SubBindResources); }
}

@ -61,28 +61,28 @@ public class ShippingTime extends BaseAPS {
public Resource getPrevRes() {return BeanRelation.get(this, EShippingTime.PrevRes); }
public void setPrevRes(Resource res) {
this.prevResId = res != null ? res.getId() : 0l;
this.prevResId = res != null ? res.getId() : 0L;
BeanRelation.set(this, EShippingTime.PrevRes, res);
}
public Resource getPostRes() { return BeanRelation.get(this, EShippingTime.PostRes); }
public void setPostRes(Resource res) {
this.postResId = res != null ? res.getId() : 0l;
this.postResId = res != null ? res.getId() : 0L;
BeanRelation.set(this, EShippingTime.PostRes, res);
}
public StandOperation getPrevStand() { return BeanRelation.get(this, EShippingTime.PrevStand);}
public void setPrevStand(StandOperation stand) {
this.prevStandId = stand != null ? stand.getId() : 0l;
this.prevStandId = stand != null ? stand.getId() : 0L;
BeanRelation.set(this, EShippingTime.PrevStand, stand);
}
public StandOperation getPostStand() { return BeanRelation.get(this, EShippingTime.PostStand); }
public void setPostStand(StandOperation stand) {
this.postStandId = stand != null ? stand.getId() : 0l;
this.postStandId = stand != null ? stand.getId() : 0L;
BeanRelation.set(this, EShippingTime.PostStand, stand);
}
}

@ -96,7 +96,7 @@ public class StandOperation extends BaseAPS {
public WorkShop getWorkShop() { return BeanRelation.get(this, EStandOperation.WorkShop); }
public void setWorkShop(WorkShop workShop) {
this.workShopId = workShop != null ? workShop.getId() : 0l;
this.workShopId = workShop != null ? workShop.getId() : 0L;
BeanRelation.set(this, EStandOperation.WorkShop, workShop);
}
}

@ -194,7 +194,7 @@ public class Work extends BaseAPS {
}
public void setOrder(BaseOrder order) {
this.orderId = order != null ? order.getId() : 0l;
this.orderId = order != null ? order.getId() : 0L;
BeanRelation.set(this, EWork.Order, order);
}
@ -203,7 +203,7 @@ public class Work extends BaseAPS {
}
public void setOperation(Operation oper) {
this.operationId = oper != null ? oper.getId() : 0l;
this.operationId = oper != null ? oper.getId() : 0L;
BeanRelation.set(this, EWork.Operation, oper);
}
@ -212,7 +212,7 @@ public class Work extends BaseAPS {
}
public void setOriginOperation(Operation oper) {
this.originOperationId = oper != null ? oper.getId() : 0l;
this.originOperationId = oper != null ? oper.getId() : 0L;
BeanRelation.set(this, EWork.OriginOperation, oper);
}
@ -221,7 +221,7 @@ public class Work extends BaseAPS {
}
public void setParentWork(ParentWork parentWork) {
this.parentWorkId = parentWork != null ? parentWork.getId() : 0l;
this.parentWorkId = parentWork != null ? parentWork.getId() : 0L;
BeanRelation.set(this, EWork.ParentWork, parentWork);
}

@ -65,7 +65,7 @@ public class WorkInput extends BaseAPS {
}
public void setWork(Work work) {
this.workId = work != null ? work.getId() : 0l;
this.workId = work != null ? work.getId() : 0L;
BeanRelation.set(this, EWorkInput.Work, work);
}
@ -79,7 +79,7 @@ public class WorkInput extends BaseAPS {
}
public void setMaterial(Material material) {
this.materialId = material != null ? material.getId() : 0l;
this.materialId = material != null ? material.getId() : 0L;
BeanRelation.set(this, EWorkInput.Material, material);
}
@ -88,7 +88,7 @@ public class WorkInput extends BaseAPS {
}
public void setOperInput(OperInput input) {
this.operInputId = input != null ? input.getId() : 0l;
this.operInputId = input != null ? input.getId() : 0L;
BeanRelation.set(this, EWorkInput.OperInput, input);
}
}

@ -67,7 +67,7 @@ public class WorkOutput extends BaseAPS {
}
public void setWork(Work work) {
this.workId = work != null ? work.getId() : 0l;
this.workId = work != null ? work.getId() : 0L;
BeanRelation.set(this, EWorkOutput.Work, work);
}
@ -81,7 +81,7 @@ public class WorkOutput extends BaseAPS {
}
public void setMaterial(Material material) {
this.materialId = material != null ? material.getId() : 0l;
this.materialId = material != null ? material.getId() : 0L;
BeanRelation.set(this, EWorkOutput.Material, material);
}
@ -90,7 +90,7 @@ public class WorkOutput extends BaseAPS {
}
public void setOperOutput(OperOutput output) {
this.operOutputId = output != null ? output.getId() : 0l;
this.operOutputId = output != null ? output.getId() : 0L;
BeanRelation.set(this, EWorkOutput.OperOutput, output);
}
}

@ -102,14 +102,14 @@ public class WorkResource extends BaseAPS {
@Column(name="RES_CAPACITY_ID")
@ApiParam(value ="设备能力id")
@FieldAnnotation(property = false)
private Long resCapacityId = 0l;
private Long resCapacityId = 0L;
public Work getWork() {
return BeanRelation.get(this, EWorkResource.Work);
}
public void setWork(Work work) {
this.workId = work != null ? work.getId() : 0l;
this.workId = work != null ? work.getId() : 0L;
BeanRelation.set(this, EWorkResource.Work, work);
}
@ -118,7 +118,7 @@ public class WorkResource extends BaseAPS {
}
public void setResource(Resource res) {
this.resourceId = res != null ? res.getId() : 0l;
this.resourceId = res != null ? res.getId() : 0L;
BeanRelation.set(this, EWorkResource.Resource, res);
}
@ -127,7 +127,7 @@ public class WorkResource extends BaseAPS {
}
public void setOperResource(OperResource res) {
this.operResourceId = res != null ? res.getId() : 0l;
this.operResourceId = res != null ? res.getId() : 0L;
BeanRelation.set(this, EWorkResource.OperResource, res);
}
}

@ -26,6 +26,7 @@ import java.util.HashMap;
@ExcludeImportExport
public abstract class BaseAPS extends BaseBean {
private static final long serialVersionUID = -8638842158403944318L;
@JsonIgnore
@Lob
@FieldAnnotation(property = false)

@ -17,10 +17,10 @@ import java.util.function.Consumer;
* @Modify:
**/
public class BeanInfo {
private Class<? extends BaseBean> cls;
private final Class<? extends BaseBean> cls;
private BeanInfo superBeanInfo;
private List<BeanInfo> childsBeanInfos = new ArrayList<>();
private Map<Enum<?>, RelationInfo> relations = new HashMap<>();
private final List<BeanInfo> childsBeanInfos = new ArrayList<>();
private final Map<Enum<?>, RelationInfo> relations = new HashMap<>();
public BeanInfo(Class<? extends BaseBean> cls) {
this.cls = cls;
@ -97,14 +97,6 @@ public class BeanInfo {
return (Class<T>)cls;
}
public BeanInfo getRelationBeanInfo(Enum<?> holder) {
RelationInfo relaInfo = getRelationInfo(holder);
if (relaInfo != null) {
return relaInfo.getBeanInfo();
}
return null;
}
public BeanInfo getRelationBeanInfo(String name) {
RelationInfo relaInfo = getRelationInfo(name);
if (relaInfo != null) {
@ -130,15 +122,6 @@ public class BeanInfo {
return RELATION_TYPE.INVALID;
}
public RELATION_TYPE getRelationType(String name) {
RelationInfo relaInfo = getRelationInfo(name);
if (relaInfo != null) {
return relaInfo.getType();
}
return RELATION_TYPE.INVALID;
}
private void foreach(Consumer<RelationInfo> fun) {
for (Map.Entry<Enum<?>, RelationInfo> entry : relations.entrySet()) {
fun.accept(entry.getValue());
@ -150,9 +133,7 @@ public class BeanInfo {
public List<Enum<?>> getAllHolders() {
List<Enum<?>> holders = new ArrayList<>();
foreach((RelationInfo info)->{
holders.add(info.getHolder());
});
foreach((RelationInfo info)-> holders.add(info.getHolder()));
return holders;
}
@ -176,8 +157,8 @@ public class BeanInfo {
return holders;
}
private static Map<Class<? extends BaseBean>, BeanInfo> beanInfos = new HashMap<>();
private static Map<String, BeanInfo> nameMapBeanInfos = new HashMap<>();
private static final Map<Class<? extends BaseBean>, BeanInfo> beanInfos = new HashMap<>();
private static final Map<String, BeanInfo> nameMapBeanInfos = new HashMap<>();
private static IMainKeyValidatorImpl mainKeyValidator;
static {
@ -220,13 +201,11 @@ public class BeanInfo {
}
public static BeanInfo getBeanInfo(Class<? extends BaseBean> cls) {
BeanInfo info = beanInfos.get(cls);
return info;
return beanInfos.get(cls);
}
public static BeanInfo getBeanInfo(String name) {
BeanInfo info = nameMapBeanInfos.get(name);
return info;
return nameMapBeanInfos.get(name);
}
public static Class<? extends BaseBean> getSuperClass(Class<? extends BaseBean> cls) {

@ -384,8 +384,8 @@ public class BeanRelation {
/**
* 广
*/
private final static <T extends BaseBean> void recursionImpl(BaseBean bean, Predicate<T> fun,
Enum<?>[] holders, int index) {
private static <T extends BaseBean> void recursionImpl(BaseBean bean, Predicate<T> fun,
Enum<?>[] holders, int index) {
if (index >= holders.length) {
if (!fun.test((T) bean)) {
return;
@ -395,7 +395,7 @@ public class BeanRelation {
List<BaseBean> relaBeans = list(bean, holders[index]);
for (BaseBean relaBean : relaBeans) {
if (relaBean.getId() != bean.getId()) {
if (!relaBean.getId().equals(bean.getId())) {
recursionImpl(relaBean, fun, holders, index + 1);
}
}

@ -9,7 +9,6 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
@ -24,11 +23,7 @@ public class BeanRelationUtil {
static class XMLReader extends DefaultHandler {
private BeanInfo firstInfo = null;
private Enum<?> firstHolder = null;
private BeanInfo secondInfo = null;
private Enum<?> secondHolder = null;
private RELATION_TYPE type = RELATION_TYPE.INVALID;
private boolean owner = false;
public void startElement(String uri, String localName, String nodeName, Attributes attributes) throws SAXException {
if (nodeName.equalsIgnoreCase("Class")) {
final String name = attributes.getValue("name");
@ -49,8 +44,8 @@ public class BeanRelationUtil {
if (firstSignName == null) {
throw new SAXException("Relation节点缺少field属性");
}
this.firstHolder = this.firstInfo.getHolder(firstSignName);
if (this.firstHolder == null) {
Enum<?> firstHolder = this.firstInfo.getHolder(firstSignName);
if (firstHolder == null) {
throw new SAXException("未定义枚举标识" + firstSignName);
}
@ -58,46 +53,44 @@ public class BeanRelationUtil {
if (secondFactoryName == null) {
throw new SAXException("Relation节点缺少name属性");
}
this.secondInfo = BeanInfo.getBeanInfo(secondFactoryName);
if (this.secondInfo == null) {
BeanInfo secondInfo = BeanInfo.getBeanInfo(secondFactoryName);
if (secondInfo == null) {
throw new SAXException("未找到" + secondFactoryName + "的类定义");
}
String secondSignName = attributes.getValue("reverse");
Enum<?> secondHolder = null;
if (secondSignName != null) {
this.secondHolder = this.secondInfo.getHolder(secondSignName);
if (this.secondHolder == null) {
secondHolder = secondInfo.getHolder(secondSignName);
if (secondHolder == null) {
throw new SAXException(secondFactoryName + "类未定义枚举标识" + secondSignName);
}
} else {
this.secondHolder = null;
}
String typeName = attributes.getValue("type");
if (typeName == null) {
throw new SAXException("Relation节点缺少type属性");
}
this.type = RELATION_TYPE.valueOf(typeName);
RELATION_TYPE type = RELATION_TYPE.valueOf(typeName);
String ownerName = attributes.getValue("owner");
if (ownerName == null) {
this.owner = false;
} else {
this.owner = ownerName.equalsIgnoreCase("true") ? true : false;
boolean owner = false;
if (ownerName != null) {
owner = ownerName.equalsIgnoreCase("true");
}
RelationInfo firstData = this.getSignData(firstInfo, this.firstHolder);
firstData.setBeanInfo(this.secondInfo);
firstData.setType(this.type);
firstData.setOwner(this.owner);
firstData.setReverseHolder(this.secondHolder);
RelationInfo firstData = this.getSignData(firstInfo, firstHolder);
firstData.setBeanInfo(secondInfo);
firstData.setType(type);
firstData.setOwner(owner);
firstData.setReverseHolder(secondHolder);
if (this.secondHolder != null) {
RelationInfo secondData = this.getSignData(secondInfo, this.secondHolder);
if (secondHolder != null) {
RelationInfo secondData = this.getSignData(secondInfo, secondHolder);
secondData.setBeanInfo(this.firstInfo);
secondData.setOwner(false);
secondData.setReverseHolder(this.firstHolder);
switch (this.type) {
secondData.setReverseHolder(firstHolder);
switch (type) {
case MULTI_TO_MULTI:
secondData.setType(RELATION_TYPE.MULTI_TO_MULTI);
break;
@ -165,8 +158,7 @@ public class BeanRelationUtil {
}
}
}
} catch (IOException e) {
return;
} catch (IOException ignored) {
}
}
@ -176,13 +168,10 @@ public class BeanRelationUtil {
return;
}
File[] dirFiles = dir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.isDirectory() || file.getName().endsWith(".xml");
}
});
File[] dirFiles = dir.listFiles(file -> file.isDirectory() || file.getName().endsWith(".xml"));
if (dirFiles == null) {
return;
}
for (File file : dirFiles) {
if (file.isDirectory()) {
@ -190,7 +179,7 @@ public class BeanRelationUtil {
} else {
try {
loadXMLConfigure(file.getCanonicalPath());
} catch (IOException e) {
} catch (IOException ignored) {
}
}
}
@ -215,33 +204,30 @@ public class BeanRelationUtil {
/**
* xml
* @param xmlPath
*/
private static void loadXMLConfigure(String xmlPath) {
SAXParserFactory sf = SAXParserFactory.newInstance();
try {
SAXParser sp = sf.newSAXParser();
sp.parse(new InputSource(xmlPath), new XMLReader());
} catch (ParserConfigurationException | SAXException | IOException e) {
} catch (ParserConfigurationException | SAXException | IOException ignored) {
}
}
/**
* jarxml
* @param is
*/
private static void loadXMLConfigure(InputStream is) {
SAXParserFactory sf = SAXParserFactory.newInstance();
try {
SAXParser sp = sf.newSAXParser();
sp.parse(new InputSource(is), new XMLReader());
} catch (ParserConfigurationException | SAXException | IOException e) {
} catch (ParserConfigurationException | SAXException | IOException ignored) {
}
}
/**
*
* @param packName
*/
public static List<Class<?>> loadClass(String packName) {
List<Class<?>> clses = new ArrayList<>();
@ -274,13 +260,10 @@ public class BeanRelationUtil {
return;
}
File[] dirFiles = dir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.isDirectory() || file.getName().endsWith(".class");
}
});
File[] dirFiles = dir.listFiles(file -> file.isDirectory() || file.getName().endsWith(".class"));
if (dirFiles == null) {
return;
}
for (File file : dirFiles) {
if (file.isDirectory()) {

@ -20,7 +20,7 @@ public class CustomDateDeserializer extends JsonDeserializer<Date> {
if (!StringUtils.isEmpty(text)) {
try {
return DATETIME_FORMATOR.parse(text);
} catch (ParseException e) {
} catch (ParseException ignored) {
}
}
return null;

@ -9,5 +9,7 @@ package cn.estsh.i3plus.pojo.aps.holders;
**/
public enum EResource {
WorkShop,
WorkPlans
WorkPlans,
BindResource,
SubBindResources,
}

@ -7,9 +7,6 @@ public class APSDoubleTool {
/**
*
* @param value
* @param pric
* @return
*/
public static double ceilPric(double value, int pric) {
final double digits = Math.pow(10.0, pric);

@ -4,4 +4,6 @@
</Relation>
<Relation field="WorkPlans" name="WorkPlan" reverse="Resource" type="ONE_TO_MULTI" owner="true">
</Relation>
<Relation field="BindResource" name="Resource" reverse="SubBindResources" type="MULTI_TO_ONE">
</Relation>
</Class>
Loading…
Cancel
Save