@ -8,6 +8,7 @@ import com.sztzjy.linkCommerce.mapper.*;
import com.sztzjy.linkCommerce.service.ScoreService ;
import com.sztzjy.linkCommerce.service.ScoreService ;
import com.sztzjy.linkCommerce.util.CompareListsUtil ;
import com.sztzjy.linkCommerce.util.CompareListsUtil ;
import com.sztzjy.linkCommerce.util.ResultEntity ;
import com.sztzjy.linkCommerce.util.ResultEntity ;
import com.sztzjy.linkCommerce.util.StringUtils ;
import com.sztzjy.linkCommerce.util.file.IFileUtil ;
import com.sztzjy.linkCommerce.util.file.IFileUtil ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.ApiOperation ;
import io.swagger.annotations.ApiOperation ;
@ -55,106 +56,106 @@ public class CptfController {
public String url ;
public String url ;
// @PostMapping("/commitCpdjAnswer")
@PostMapping ( "/commitCpdjAnswer" )
// @ApiOperation("发布渠道-提交")
@ApiOperation ( "发布渠道-提交" )
// @AnonymousAccess
@AnonymousAccess
// public ResultEntity commitFbqdAnswer(@RequestBody FbqdStuAnswer stuAnswer) {
public ResultEntity commitFbqdAnswer ( @RequestBody FbqdStuAnswer stuAnswer ) {
// //先查询是否提交过
//先查询是否提交过
// StuGradeExample stuGradeExample = new StuGradeExample();
StuGradeExample stuGradeExample = new StuGradeExample ( ) ;
// stuGradeExample.createCriteria().andUserIdEqualTo(stuAnswer.getUserId()).andProjectEqualTo(Constant.PRO_CPTFCS).andModuleEqualTo(Constant.MODULE_CPDJ);
stuGradeExample . createCriteria ( ) . andUserIdEqualTo ( stuAnswer . getUserId ( ) ) . andProjectEqualTo ( Constant . PRO_CPTFCS ) . andModuleEqualTo ( Constant . MODULE_CPDJ ) ;
// List<StuGrade> stuGradeList = stuGradeMapper.selectByExampleWithBLOBs(stuGradeExample);
List < StuGrade > stuGradeList = stuGradeMapper . selectByExampleWithBLOBs ( stuGradeExample ) ;
// if(CollectionUtils.isEmpty(stuGradeList)){
if ( CollectionUtils . isEmpty ( stuGradeList ) ) {
// FbqdAnswer answer = fbqdAnswerMapper.selectByExampleWithBLOBs(new FbqdAnswerExample()).get(0);
FbqdAnswer answer = fbqdAnswerMapper . selectByExampleWithBLOBs ( new FbqdAnswerExample ( ) ) . get ( 0 ) ;
// int count = 0;
int count = 0 ;
//
// //1.数据标准化结果
//1.数据标准化结果
// String stuExposureData = stuAnswer.getExposureData();
String stuExposureData = stuAnswer . getExposureData ( ) ;
//
// String exposureData = answer.getExposureData();
String exposureData = answer . getExposureData ( ) ;
// //数据标准化结果 校验
//数据标准化结果 校验
//
// //错误次数
//错误次数
// int monthlyDataErrorCount =compareListsUtil.compareErrorCount(stuExposureData, exposureData).getErrorCount();
int monthlyDataErrorCount = compareListsUtil . compareErrorCount ( stuExposureData , exposureData ) . getErrorCount ( ) ;
// count = count + monthlyDataErrorCount;
count = count + monthlyDataErrorCount ;
//
//
// //2.渠道中的比重
//2.渠道中的比重
// String stuAnswerClickData = stuAnswer.getClickData();
String stuAnswerClickData = stuAnswer . getClickData ( ) ;
//
// String clickData = answer.getClickData();
String clickData = answer . getClickData ( ) ;
// //错误次数
//错误次数
// int cheapSumCount =compareListsUtil.compareErrorCount(stuAnswerClickData, clickData).getErrorCount();
int cheapSumCount = compareListsUtil . compareErrorCount ( stuAnswerClickData , clickData ) . getErrorCount ( ) ;
// count = count + cheapSumCount;
count = count + cheapSumCount ;
//
//
//
// //3.信息滴
//3.信息滴
// String stuAnswerAdCost = stuAnswer.getAdCost();
String stuAnswerAdCost = stuAnswer . getAdCost ( ) ;
//
// String adCost = answer.getAdCost();
String adCost = answer . getAdCost ( ) ;
// //错误次数
//错误次数
// int cheapPercentageCount =compareListsUtil.compareErrorCount(stuAnswerAdCost, adCost).getErrorCount();
int cheapPercentageCount = compareListsUtil . compareErrorCount ( stuAnswerAdCost , adCost ) . getErrorCount ( ) ;
// count = count + cheapPercentageCount;
count = count + cheapPercentageCount ;
//
//
// //每个指标的权重
//每个指标的权重
// String stuAnswerOrderAmount = stuAnswer.getOrderAmount();
String stuAnswerOrderAmount = stuAnswer . getOrderAmount ( ) ;
//
// String orderAmount = answer.getOrderAmount();
String orderAmount = answer . getOrderAmount ( ) ;
// //错误次数
//错误次数
// int costEffectiveSumCount =compareListsUtil.compareErrorCount(stuAnswerOrderAmount, orderAmount).getErrorCount();
int costEffectiveSumCount = compareListsUtil . compareErrorCount ( stuAnswerOrderAmount , orderAmount ) . getErrorCount ( ) ;
// count = count + costEffectiveSumCount;
count = count + costEffectiveSumCount ;
//
//
//
// //综合评分
//综合评分
// String stuAnswerKeywords = stuAnswer.getKeywords();
String stuAnswerKeywords = stuAnswer . getKeywords ( ) ;
//
// String keywords = answer.getKeywords();
String keywords = answer . getKeywords ( ) ;
// //错误次数
//错误次数
// int costEffectivePercentageCount =compareListsUtil.compareErrorCount(stuAnswerKeywords, keywords).getErrorCount();
int costEffectivePercentageCount = compareListsUtil . compareErrorCount ( stuAnswerKeywords , keywords ) . getErrorCount ( ) ;
// count = count + costEffectivePercentageCount;
count = count + costEffectivePercentageCount ;
//
//
//
// //主观题
//主观题
// int i = compareListsUtil.calculateLengthPenaltyEnhanced(stuAnswer.getScenePromotion());
int i = compareListsUtil . calculateLengthPenaltyEnhanced ( stuAnswer . getScenePromotion ( ) ) ;
// count = count + i;
count = count + i ;
// stuAnswer.setId(IdUtil.simpleUUID());
stuAnswer . setId ( IdUtil . simpleUUID ( ) ) ;
//
// fbqdStuAnswerMapper.insertSelective(stuAnswer);
fbqdStuAnswerMapper . insertSelective ( stuAnswer ) ;
//
// Boolean aBoolean = scoreService.insertScore(stuAnswer.getUserId(), Constant.PRO_CPTFCS, Constant.MODULE_FBQDPG, BigDecimal.valueOf(100 - count), stuAnswer.getScenePromotion());
Boolean aBoolean = scoreService . insertScore ( stuAnswer . getUserId ( ) , Constant . PRO_CPTFCS , Constant . MODULE_FBQDPG , BigDecimal . valueOf ( 100 - count ) , stuAnswer . getScenePromotion ( ) ) ;
// if(aBoolean){
if ( aBoolean ) {
// return new ResultEntity<>(HttpStatus.OK, "提交成功");
return new ResultEntity < > ( HttpStatus . OK , "提交成功" ) ;
// }else {
} else {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "提交失败");
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "提交失败" ) ;
// }
}
// }else {
} else {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "已提交过");
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "已提交过" ) ;
// }
}
// }
}
//
//
//
// @ApiOperation("发布渠道-回显接口")
@ApiOperation ( "发布渠道-回显接口" )
// @GetMapping("/selectByCpdjUserId")
@GetMapping ( "/selectByCpdjUserId" )
// @AnonymousAccess
@AnonymousAccess
// public ResultEntity selectByCpdjUserId(@ApiParam("用户ID") String userId) {
public ResultEntity selectByCpdjUserId ( @ApiParam ( "用户ID" ) String userId ) {
//
// FbqdStuAnswerExample cpdjStuAnswerExample = new FbqdStuAnswerExample();
FbqdStuAnswerExample cpdjStuAnswerExample = new FbqdStuAnswerExample ( ) ;
// cpdjStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpdjStuAnswerExample . createCriteria ( ) . andUserIdEqualTo ( userId ) ;
//
// List<FbqdStuAnswer> stuAnswerList = fbqdStuAnswerMapper.selectByExampleWithBLOBs(cpdjStuAnswerExample);
List < FbqdStuAnswer > stuAnswerList = fbqdStuAnswerMapper . selectByExampleWithBLOBs ( cpdjStuAnswerExample ) ;
//
// if (CollectionUtils.isEmpty(stuAnswerList)) {
if ( CollectionUtils . isEmpty ( stuAnswerList ) ) {
// return new ResultEntity<>(HttpStatus.OK);
return new ResultEntity < > ( HttpStatus . OK ) ;
// } else {
} else {
// return new ResultEntity<>(HttpStatus.OK, stuAnswerList.get(0));
return new ResultEntity < > ( HttpStatus . OK , stuAnswerList . get ( 0 ) ) ;
// }
}
//
// }
}
//
@ -186,20 +187,30 @@ public class CptfController {
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "重新实训失败" ) ;
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "重新实训失败" ) ;
}
}
}
}
//
// if (Constant.MODULE_CPJGGH.equals(module)) {
// Boolean b=scoreService.deleteScore(userId,Constant.PRO_CPGH,module);
// if(b){
// CpjgghStuAnswerExample cpjgghStuAnswerExample = new CpjgghStuAnswerExample();
// cpjgghStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
// cpjgghStuAnswerMapper.deleteByExample(cpjgghStuAnswerExample);
// return new ResultEntity<>(HttpStatus.OK, "重新实训成功");
// }else {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "重新实训失败");
// }
// }
if ( Constant . MODULE_CPTGCS . equals ( module ) ) {
Boolean b = scoreService . deleteScore ( userId , Constant . PRO_CPGH , module ) ;
if ( b ) {
CptgcsStuAnswerExample cptgcsStuAnswerExample = new CptgcsStuAnswerExample ( ) ;
cptgcsStuAnswerExample . createCriteria ( ) . andUserIdEqualTo ( userId ) ;
cptgcsStuAnswerMapper . deleteByExample ( cptgcsStuAnswerExample ) ;
return new ResultEntity < > ( HttpStatus . OK , "重新实训成功" ) ;
} else {
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "重新实训失败" ) ;
}
}
if ( Constant . MODULE_CPYXDW . equals ( module ) ) {
Boolean b = scoreService . deleteScore ( userId , Constant . PRO_CPGH , module ) ;
if ( b ) {
CpyxdwStuAnswerExample cpyxdwStuAnswerExample = new CpyxdwStuAnswerExample ( ) ;
cpyxdwStuAnswerExample . createCriteria ( ) . andUserIdEqualTo ( userId ) ;
cpyxdwStuAnswerMapper . deleteByExample ( cpyxdwStuAnswerExample ) ;
return new ResultEntity < > ( HttpStatus . OK , "重新实训成功" ) ;
} else {
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "重新实训失败" ) ;
}
}
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "重新实训失败" ) ;
return new ResultEntity < > ( HttpStatus . BAD_REQUEST , "重新实训失败" ) ;
@ -217,7 +228,7 @@ public class CptfController {
@PostMapping ( "/commitCptgcsAnswer" )
@PostMapping ( "/commitCptgcsAnswer" )
@ApiOperation ( " 发布 推广测试-提交")
@ApiOperation ( " 产品 推广测试-提交")
@AnonymousAccess
@AnonymousAccess
public ResultEntity commitCptgcsAnswer ( @RequestBody CptgcsStuAnswer stuAnswer ) {
public ResultEntity commitCptgcsAnswer ( @RequestBody CptgcsStuAnswer stuAnswer ) {
//先查询是否提交过
//先查询是否提交过
@ -298,15 +309,17 @@ public class CptfController {
@ApiOperation ( "发布渠道-回显接口" )
@GetMapping ( "/selectByCpdjUserId" )
@ApiOperation ( "产品推广测试-回显接口" )
@GetMapping ( "/selectCptgcsByUserId" )
@AnonymousAccess
@AnonymousAccess
public ResultEntity selectByCpdjUserId ( @ApiParam ( "用户ID" ) String userId ) {
public ResultEntity select CptgcsBy UserId( @ApiParam ( "用户ID" ) String userId ) {
CptgcsStuAnswerExample cptgcsStuAnswerExample = new CptgcsStuAnswerExample ( ) ;
CptgcsStuAnswerExample cptgcsStuAnswerExample = new CptgcsStuAnswerExample ( ) ;
cptgcsStuAnswerExample . createCriteria ( ) . andUserIdEqualTo ( userId ) ;
cptgcsStuAnswerExample . createCriteria ( ) . andUserIdEqualTo ( userId ) ;
List < CptgcsStuAnswer > stuAnswerList = cptgcsStuAnswerMapper . selectByExampleWithBLOBs ( cptgcsStuAnswerExample ) ;
List < CptgcsStuAnswer > stuAnswerList = cptgcsStuAnswerMapper . selectByExampleWithBLOBs ( cptgcsStuAnswerExample ) ;
if ( CollectionUtils . isEmpty ( stuAnswerList ) ) {
if ( CollectionUtils . isEmpty ( stuAnswerList ) ) {
return new ResultEntity < > ( HttpStatus . OK ) ;
return new ResultEntity < > ( HttpStatus . OK ) ;
@ -316,6 +329,85 @@ public class CptfController {
}
}
@Autowired
private CpyxdwStuAnswerMapper cpyxdwStuAnswerMapper ;
@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 , "已提交过" ) ;
}
}
@ApiOperation ( "产品营销定位-回显接口" )
@GetMapping ( "/selectCpyxdwByUserId" )
@AnonymousAccess
public ResultEntity selectCpyxdwByUserId ( @ApiParam ( "用户ID" ) String userId ) {
CpyxdwStuAnswerExample cpyxdwStuAnswerExample = new CpyxdwStuAnswerExample ( ) ;
cpyxdwStuAnswerExample . createCriteria ( ) . andUserIdEqualTo ( userId ) ;
List < CpyxdwStuAnswer > stuAnswerList = cpyxdwStuAnswerMapper . selectByExampleWithBLOBs ( cpyxdwStuAnswerExample ) ;
if ( CollectionUtils . isEmpty ( stuAnswerList ) ) {
return new ResultEntity < > ( HttpStatus . OK ) ;
} else {
return new ResultEntity < > ( HttpStatus . OK , stuAnswerList . get ( 0 ) ) ;
}
}