|
|
|
@ -437,7 +437,8 @@ public class TalkingPenService implements ITalkingPenService { |
|
|
|
for (ToolFindDifference d : differences) { |
|
|
|
for (CoordinateDto.Point p : coordinates) { |
|
|
|
// 计算点到距离的平方和
|
|
|
|
double supplier = Math.pow(p.getX() - d.getCoordinatesX().intValue(), 2) + Math.pow(p.getX() - d.getCoordinatesX().intValue(), 2); |
|
|
|
double supplier = Math.pow(p.getX() - d.getCoordinatesX().intValue(), 2) + Math.pow(p.getY() - d.getCoordinatesY().intValue(), 2); |
|
|
|
log.info("正确点:{},当前点:{}, 距离平方:{}, 正确平方:{}", d, p, supplier, pow); |
|
|
|
if (supplier <= pow) { |
|
|
|
current++; |
|
|
|
} else { |
|
|
|
@ -445,13 +446,17 @@ public class TalkingPenService implements ITalkingPenService { |
|
|
|
} |
|
|
|
} |
|
|
|
int currentRate = current * 100 / (current + error); |
|
|
|
log.info("正确比例:{}, 正确数:{}, 错误数:{}", currentRate, current, error); |
|
|
|
if (currentRate > percentNum) { |
|
|
|
percentNum = currentRate; |
|
|
|
curPlace = d.getWhichPlace(); |
|
|
|
} |
|
|
|
|
|
|
|
current = 0; |
|
|
|
error = 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 比较比例
|
|
|
|
if (percentNum >= minPercent) { |
|
|
|
// 大于标准比例
|
|
|
|
@ -491,12 +496,12 @@ public class TalkingPenService implements ITalkingPenService { |
|
|
|
trainCorrectDao.insertSelective(correct); |
|
|
|
currents.add(curPointPlace); |
|
|
|
} |
|
|
|
if (o == null || (Integer)o < currents.size()) { |
|
|
|
// if (o == null || (Integer)o < currents.size()) {
|
|
|
|
int audioIndex = currents.size() >= max ? YanYuanConstant.Equipment.AUDIO_DIFFERENCE_COMPLETE : |
|
|
|
YanYuanConstant.Equipment.AUDIO_DIFFERENCE_CURRENT; |
|
|
|
sendAudio(audioIndex, authId); |
|
|
|
log.info("{}继续找下一个,播放语音:{}", trainCardId, audioIndex); |
|
|
|
} |
|
|
|
// }
|
|
|
|
redisUtil.set(key, currents.size(), YanYuanConstant.Equipment.TALKING_PEN_JUDGE_AUDIO_TIME); |
|
|
|
} |
|
|
|
|
|
|
|
|