|
@@ -1,5 +1,6 @@
|
|
|
package com.rf.psychological.scale.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import com.rf.psychological.scale.dao.model.MBTIResultDetail;
|
|
|
import com.rf.psychological.scale.dao.repository.MBTIResultDetailRepository;
|
|
@@ -23,7 +24,9 @@ public class MBTIResultDetailServiceImpl implements MBTIResultDetailService {
|
|
|
|
|
|
@Override
|
|
|
public MBTIResultDetail findByFlag(String flag) {
|
|
|
- MBTIResultDetail detail = detailRepository.findByFlag(flag);
|
|
|
+ MBTIResultDetail detail1 = detailRepository.findByFlag(flag);
|
|
|
+ MBTIResultDetail detail = new MBTIResultDetail();
|
|
|
+ BeanUtil.copyProperties(detail1,detail);
|
|
|
if (detail != null){
|
|
|
detail.setConclusion(this.getRandomResult(detail.getConclusion()));
|
|
|
detail.setCharacteristic(this.getRandomResultByNum(detail.getCharacteristic(),3));
|
|
@@ -36,7 +39,7 @@ public class MBTIResultDetailServiceImpl implements MBTIResultDetailService {
|
|
|
detail.setRevered(this.getRandomResult(detail.getRevered()));
|
|
|
detail.setRepresentative(this.getRandomResultByNum(detail.getRepresentative(),4));
|
|
|
}
|
|
|
- return detailRepository.findByFlag(flag);
|
|
|
+ return detail;
|
|
|
}
|
|
|
|
|
|
private String getRandomResult(String str) {
|