修改发布渠道bug

main
whb 1 year ago
parent 163884a70c
commit b2917df971

@ -48,8 +48,6 @@ public class CptfController {
private FbqdStuAnswerMapper fbqdStuAnswerMapper; private FbqdStuAnswerMapper fbqdStuAnswerMapper;
@Autowired @Autowired
StuGradeMapper stuGradeMapper; StuGradeMapper stuGradeMapper;
@Autowired @Autowired
@ -127,7 +125,6 @@ public class CptfController {
} }
@ApiOperation("发布渠道-回显接口") @ApiOperation("发布渠道-回显接口")
@GetMapping("/selectByCpdjUserId") @GetMapping("/selectByCpdjUserId")
@AnonymousAccess @AnonymousAccess
@ -149,9 +146,6 @@ public class CptfController {
} }
@GetMapping("/restartTraining") @GetMapping("/restartTraining")
@ApiOperation("产品投放-重新实训") @ApiOperation("产品投放-重新实训")
@AnonymousAccess @AnonymousAccess
@ -210,16 +204,12 @@ public class CptfController {
} }
@Autowired @Autowired
private CptgcsAnswerMapper cptgcsAnswerMapper; private CptgcsAnswerMapper cptgcsAnswerMapper;
@Autowired @Autowired
private CptgcsStuAnswerMapper cptgcsStuAnswerMapper; private CptgcsStuAnswerMapper cptgcsStuAnswerMapper;
@PostMapping("/commitCptgcsAnswer") @PostMapping("/commitCptgcsAnswer")
@ApiOperation("产品推广测试-提交") @ApiOperation("产品推广测试-提交")
@AnonymousAccess @AnonymousAccess
@ -252,7 +242,6 @@ public class CptfController {
count = count + cheapSumCount; count = count + cheapSumCount;
//3.投资回报率数据 //3.投资回报率数据
String stuRoiData = stuAnswer.getRoiData(); String stuRoiData = stuAnswer.getRoiData();
@ -271,7 +260,6 @@ public class CptfController {
count = count + costEffectiveSumCount; count = count + costEffectiveSumCount;
//5.p值 //5.p值
String stuPValue = stuAnswer.getpValue(); String stuPValue = stuAnswer.getpValue();
@ -281,7 +269,6 @@ public class CptfController {
count = count + costEffectivePercentageCount; count = count + costEffectivePercentageCount;
//主观题 //主观题
int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getContext()); int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getContext());
count = count + i; count = count + i;
@ -301,9 +288,6 @@ public class CptfController {
} }
@ApiOperation("产品推广测试-回显接口") @ApiOperation("产品推广测试-回显接口")
@GetMapping("/selectCptgcsByUserId") @GetMapping("/selectCptgcsByUserId")
@AnonymousAccess @AnonymousAccess
@ -326,9 +310,6 @@ public class CptfController {
private CpyxdwStuAnswerMapper cpyxdwStuAnswerMapper; private CpyxdwStuAnswerMapper cpyxdwStuAnswerMapper;
@PostMapping("/commitCpyxdwAnswer") @PostMapping("/commitCpyxdwAnswer")
@ApiOperation("产品营销定位-提交") @ApiOperation("产品营销定位-提交")
@AnonymousAccess @AnonymousAccess
@ -343,8 +324,7 @@ public class CptfController {
//1.产品点击率 //1.产品点击率
String axis = stuAnswer.getxAxis(); String axis = stuAnswer.getxAxis();
if (axis!=null) if (axis != null) {
{
if (!"点击率".equals(axis)) { if (!"点击率".equals(axis)) {
count++; count++;
} }
@ -352,16 +332,13 @@ public class CptfController {
String yAxis = stuAnswer.getyAxis(); String yAxis = stuAnswer.getyAxis();
if (yAxis!=null) if (yAxis != null) {
{
if (!"转换率".equals(yAxis)) { if (!"转换率".equals(yAxis)) {
count++; count++;
} }
} }
//主观题 //主观题
int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getAnalysis()); int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getAnalysis());
count = count + i; count = count + i;
@ -381,9 +358,6 @@ public class CptfController {
} }
@ApiOperation("产品营销定位-回显接口") @ApiOperation("产品营销定位-回显接口")
@GetMapping("/selectCpyxdwByUserId") @GetMapping("/selectCpyxdwByUserId")
@AnonymousAccess @AnonymousAccess
@ -403,24 +377,19 @@ public class CptfController {
} }
public Integer calculte(List<FbqdDTO> dataInfoList, Integer ser, String answer) { public Integer calculte(List<FbqdDTO> dataInfoList, Integer ser, String answer) {
int count = 0; int count = 0;
if (CollectionUtils.isEmpty(dataInfoList)) { if (CollectionUtils.isEmpty(dataInfoList)) {
if (ser==1) if (ser == 1) {
{
return 12; return 12;
} }
if (ser==2) if (ser == 2) {
{
return 12; return 12;
} }
if (ser==3) if (ser == 3) {
{
return 4; return 4;
} }
if (ser==4) if (ser == 4) {
{
return 4; return 4;
} }
return 0; return 0;
@ -441,4 +410,54 @@ public Integer calculte( List<FbqdDTO> dataInfoList,Integer ser,String answer )
return count; 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[] submitted = stulist.split(",");
String[] answers = answerList.split(","); String[] answers = answerList.split(",");
int errorCount = 0; // 错误数量 int errorCount = 0; // 错误数量
List<Integer> errorPositions = new ArrayList<>(); // 错误位置 List<Integer> errorPositions = new ArrayList<>(); // 错误位置
// 获取较长数组的长度 // 获取较长数组的长度
int maxLength = Math.max(submitted.length, answers.length); int maxLength = Math.max(submitted.length, answers.length);
// 遍历较长的数组 // 遍历较长的数组
for (int i = 0; i < maxLength; i++) { for (int i = 0; i < maxLength; i++) {
String submittedValue = (i < submitted.length) ? submitted[i] : null; String submittedValue = (i < submitted.length) ? submitted[i] : null;
String answerValue = (i < answers.length) ? answers[i] : null; String answerValue = (i < answers.length) ? answers[i] : null;
// 检查对应位置是否相同(处理数值和字符串) // 检查对应位置是否相同(处理数值和字符串)
if (!valuesEqual(submittedValue, answerValue)) { if (!valuesEqual(submittedValue, answerValue)) {
errorCount++; errorCount++;
errorPositions.add(i + 1); // 位置从1开始 errorPositions.add(i + 1); // 位置从1开始
} }
} }
return new Result(errorCount, errorPositions); return new Result(errorCount, errorPositions);
} }
@ -123,7 +118,6 @@ public class CompareListsUtil {
if (a == null || b == null) { if (a == null || b == null) {
return false; return false;
} }
try { try {
// 尝试解析为Double比较数值 // 尝试解析为Double比较数值
double numA = Double.parseDouble(a); double numA = Double.parseDouble(a);
@ -134,5 +128,4 @@ public class CompareListsUtil {
return a.equals(b); return a.equals(b);
} }
} }
} }

Loading…
Cancel
Save