修改发布渠道bug

main
whb 1 year ago
parent 163884a70c
commit b2917df971

@ -48,8 +48,6 @@ public class CptfController {
private FbqdStuAnswerMapper fbqdStuAnswerMapper;
@Autowired
StuGradeMapper stuGradeMapper;
@Autowired
@ -127,7 +125,6 @@ public class CptfController {
}
@ApiOperation("发布渠道-回显接口")
@GetMapping("/selectByCpdjUserId")
@AnonymousAccess
@ -149,9 +146,6 @@ public class CptfController {
}
@GetMapping("/restartTraining")
@ApiOperation("产品投放-重新实训")
@AnonymousAccess
@ -210,16 +204,12 @@ public class CptfController {
}
@Autowired
private CptgcsAnswerMapper cptgcsAnswerMapper;
@Autowired
private CptgcsStuAnswerMapper cptgcsStuAnswerMapper;
@PostMapping("/commitCptgcsAnswer")
@ApiOperation("产品推广测试-提交")
@AnonymousAccess
@ -252,7 +242,6 @@ public class CptfController {
count = count + cheapSumCount;
//3.投资回报率数据
String stuRoiData = stuAnswer.getRoiData();
@ -271,7 +260,6 @@ public class CptfController {
count = count + costEffectiveSumCount;
//5.p值
String stuPValue = stuAnswer.getpValue();
@ -281,7 +269,6 @@ public class CptfController {
count = count + costEffectivePercentageCount;
//主观题
int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getContext());
count = count + i;
@ -301,9 +288,6 @@ public class CptfController {
}
@ApiOperation("产品推广测试-回显接口")
@GetMapping("/selectCptgcsByUserId")
@AnonymousAccess
@ -326,9 +310,6 @@ public class CptfController {
private CpyxdwStuAnswerMapper cpyxdwStuAnswerMapper;
@PostMapping("/commitCpyxdwAnswer")
@ApiOperation("产品营销定位-提交")
@AnonymousAccess
@ -343,8 +324,7 @@ public class CptfController {
//1.产品点击率
String axis = stuAnswer.getxAxis();
if (axis!=null)
{
if (axis != null) {
if (!"点击率".equals(axis)) {
count++;
}
@ -352,16 +332,13 @@ public class CptfController {
String yAxis = stuAnswer.getyAxis();
if (yAxis!=null)
{
if (yAxis != null) {
if (!"转换率".equals(yAxis)) {
count++;
}
}
//主观题
int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getAnalysis());
count = count + i;
@ -381,9 +358,6 @@ public class CptfController {
}
@ApiOperation("产品营销定位-回显接口")
@GetMapping("/selectCpyxdwByUserId")
@AnonymousAccess
@ -403,24 +377,19 @@ public class CptfController {
}
public Integer calculte(List<FbqdDTO> dataInfoList, Integer ser, String answer) {
int count = 0;
if (CollectionUtils.isEmpty(dataInfoList)) {
if (ser==1)
{
if (ser == 1) {
return 12;
}
if (ser==2)
{
if (ser == 2) {
return 12;
}
if (ser==3)
{
if (ser == 3) {
return 4;
}
if (ser==4)
{
if (ser == 4) {
return 4;
}
return 0;
@ -441,4 +410,54 @@ public Integer calculte( List<FbqdDTO> dataInfoList,Integer ser,String answer )
return count;
}
}
// @PostMapping("/commitCpyxdwAnswer")
// @ApiOperation("用户数据分析/产品定位-提交")
// @AnonymousAccess
// public ResultEntity commitCpyxdwAnswer(@RequestBody CpyxdwStuAnswer stuAnswer) {
// //先查询是否提交过
// StuGradeExample stuGradeExample = new StuGradeExample();
// stuGradeExample.createCriteria().andUserIdEqualTo(stuAnswer.getUserId()).andProjectEqualTo(Constant.PRO_CPTFCS).andModuleEqualTo(Constant.MODULE_CPYXDW);
// List<StuGrade> stuGradeList = stuGradeMapper.selectByExampleWithBLOBs(stuGradeExample);
// if (CollectionUtils.isEmpty(stuGradeList)) {
//
// int count = 0;
//
// //1.产品点击率
// String axis = stuAnswer.getxAxis();
// if (axis != null) {
// if (!"点击率".equals(axis)) {
// count++;
// }
// }
//
//
// String yAxis = stuAnswer.getyAxis();
// if (yAxis != null) {
// if (!"转换率".equals(yAxis)) {
// count++;
// }
// }
//
//
// //主观题
// int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getAnalysis());
// count = count + i;
// stuAnswer.setId(IdUtil.simpleUUID());
//
// cpyxdwStuAnswerMapper.insertSelective(stuAnswer);
//
// Boolean aBoolean = scoreService.insertScore(stuAnswer.getUserId(), Constant.PRO_CPTFCS, Constant.MODULE_CPYXDW, BigDecimal.valueOf(100 - count), stuAnswer.getAnalysis());
// if (aBoolean) {
// return new ResultEntity<>(HttpStatus.OK, "提交成功");
// } else {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "提交失败");
// }
// } else {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "已提交过");
// }
// }
}

@ -93,25 +93,20 @@ public class CompareListsUtil {
// 将字符串分割成数组
String[] submitted = stulist.split(",");
String[] answers = answerList.split(",");
int errorCount = 0; // 错误数量
List<Integer> errorPositions = new ArrayList<>(); // 错误位置
// 获取较长数组的长度
int maxLength = Math.max(submitted.length, answers.length);
// 遍历较长的数组
for (int i = 0; i < maxLength; i++) {
String submittedValue = (i < submitted.length) ? submitted[i] : null;
String answerValue = (i < answers.length) ? answers[i] : null;
// 检查对应位置是否相同(处理数值和字符串)
if (!valuesEqual(submittedValue, answerValue)) {
errorCount++;
errorPositions.add(i + 1); // 位置从1开始
}
}
return new Result(errorCount, errorPositions);
}
@ -123,7 +118,6 @@ public class CompareListsUtil {
if (a == null || b == null) {
return false;
}
try {
// 尝试解析为Double比较数值
double numA = Double.parseDouble(a);
@ -134,5 +128,4 @@ public class CompareListsUtil {
return a.equals(b);
}
}
}

Loading…
Cancel
Save