Commit a83b361e authored by tangwei's avatar tangwei

修改 bug

parent 6d70d278
......@@ -14,6 +14,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.lang.reflect.Field;
import java.util.Date;
/**
......@@ -74,10 +75,14 @@ public class MetaHandler implements MetaObjectHandler {
Date currentDate = new Date();
this.setFieldValByName("recDate", currentDate, metaObject);
}
//以下为装备中转移过来的
// if (isExistField("userId", entity)) {
// this.setFieldValByName("userId", String.valueOf(agencyUserModel.getUserId()), metaObject);
// }
if (isExistField("userId", entity)&&isStringField(metaObject,"userId")) {
this.setFieldValByName("userId", String.valueOf(agencyUserModel.getUserId()), metaObject);
}
if (isExistField("creatorId", entity)) {
this.setFieldValByName("creatorId", Long.valueOf(agencyUserModel.getUserId()), metaObject);
}
......@@ -117,6 +122,23 @@ public class MetaHandler implements MetaObjectHandler {
}
return jsonObj.containsKey(field);
}
private Boolean isStringField(MetaObject metaObject,String fieldName) {
Class clazz = metaObject.getOriginalObject().getClass();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (fieldName.equals(field.getName()) &&("class java.lang.String").equals(field.getGenericType().toString())) {
return true;
}
}
return false;
}
/**
* 更新拦截
......
......@@ -278,7 +278,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson());
AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult();
vo.setChargePersonName(userModel.getRealName());
if(userModel!=null&&userModel.getRealName()!=null){
vo.setChargePersonName(userModel.getRealName());
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment