|
@@ -1,36 +1,45 @@
|
|
|
package com.diagbot.rule;
|
|
|
|
|
|
+import com.diagbot.dto.AgeNeoDTO;
|
|
|
import com.diagbot.dto.BillMsg;
|
|
|
import com.diagbot.dto.WordCrfDTO;
|
|
|
-import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.util.CoreUtil;
|
|
|
|
|
|
/**
|
|
|
- * @description: 性别规则
|
|
|
+ * @description: 年龄规则
|
|
|
* @author: zhoutg
|
|
|
* @time: 2020/8/3 14:47
|
|
|
*/
|
|
|
public class AgeRule {
|
|
|
+
|
|
|
/**
|
|
|
- * 比较性别
|
|
|
+ * 年龄比较
|
|
|
*
|
|
|
- * @param sex
|
|
|
+ * @param ageNeoDTO
|
|
|
* @param wordCrfDTO
|
|
|
+ * @param name
|
|
|
* @return
|
|
|
*/
|
|
|
- public static BillMsg compareSexWithBill(String sex, WordCrfDTO wordCrfDTO, String name) {
|
|
|
- if (StringUtil.isNotBlank(sex) && wordCrfDTO.getSex() != null) {
|
|
|
- String crfSex = "";
|
|
|
- if (1 == wordCrfDTO.getSex()) {
|
|
|
- crfSex = "男";
|
|
|
- } else if (2 == wordCrfDTO.getSex()) {
|
|
|
- crfSex = "女";
|
|
|
+ public static BillMsg compareAgeWithBill(AgeNeoDTO ageNeoDTO, WordCrfDTO wordCrfDTO, String name) {
|
|
|
+ Boolean flag = false;
|
|
|
+ if (ageNeoDTO != null && wordCrfDTO.getAge() != null) {
|
|
|
+ Integer age = wordCrfDTO.getAge();
|
|
|
+ Integer minAge = ageNeoDTO.getMinage();
|
|
|
+ if (minAge != null) {
|
|
|
+ if (age < minAge) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
}
|
|
|
- if (sex.equals(crfSex)) {
|
|
|
- BillMsg billMsg = new BillMsg();
|
|
|
- billMsg.setMsg(name + "(" + crfSex + ")");
|
|
|
- return billMsg;
|
|
|
+ Integer maxAge = ageNeoDTO.getMaxage();
|
|
|
+ if (maxAge != null) {
|
|
|
+ if (age > minAge) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ if (flag) {
|
|
|
+ return CoreUtil.getCommonBillMsg(String.valueOf(wordCrfDTO.getAge() + "岁"), name);
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
}
|