班级数据数据初始化和用户操作

main
whb 1 year ago
parent 1325d739bd
commit bdbd6ccf18

@ -5,6 +5,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@ -12,6 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@MapperScan(basePackages = "com.sztzjy.linkCommerce.mapper") @MapperScan(basePackages = "com.sztzjy.linkCommerce.mapper")
@EnableScheduling @EnableScheduling
@Slf4j @Slf4j
@EnableAsync
public class LinkCommerceApplication { public class LinkCommerceApplication {
public static void main(String[] args) { public static void main(String[] args) {

@ -11,7 +11,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;
@ -19,7 +19,9 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -452,6 +454,194 @@ public class CptfController {
} }
@Autowired
private HyxqfxStuAnswerMapper hyxqfxStuAnswerMapper;
@Autowired
private JzhyfxStuAnswerMapper jzhyfxStuAnswerMapper;
@Autowired
private StuMachineLearningMapper machineLearningMapper;
@Autowired
private CpdjStuAnswerMapper cpdjStuAnswerMapper;
@Autowired
private CpcyhdwStuAnswerMapper cpcyhdwStuAnswerMapper;
@Autowired
private CpjgghStuAnswerMapper cpjgghStuAnswerMapper;
@Autowired
CgxqycStuAnswerMapper cgxqycStuAnswerMapper;
@Autowired
CgcpdwStuAnswerMapper cgcpdwStuAnswerMapper;
@Autowired
GyspgyxzStuAnswerMapper gyspgyxzStuAnswerMapper;
@Autowired
CpbxfxStuAnswerMapper cpbxfxStuAnswerMapper;
@Autowired
CpwtzdWwslStuAnswerMapper cpwtzdWwslStuAnswerMapper;
@Autowired
CpwtzdKanomxStuAnswerMapper cpwtzdKanomxStuAnswerMapper;
@Autowired
CpwtzdScjhjzStuAnswerMapper cpwtzdScjhjzStuAnswerMapper;
@Autowired
CpwtzdLlsjfxfStuAnswerMapper cpwtzdLlsjfxfStuAnswerMapper;
@Autowired
private UserinfoMapper userinfoMapper;
@GetMapping("/restartTrainingByAll")
@ApiOperation("根据用户ID或者班级ID重置所有案例")
@Async
public ResultEntity restartTrainingByAll(@RequestParam(required = false) @ApiParam("用户重置 用户重置") String userId,
@RequestParam(required = false) @ApiParam("班级ID 整个班级重置") String classId) {
//用户ID不为空
if (StringUtils.hasText(userId)) {
restartByUserId(userId);
System.out.println( userId+":用户实训重置成功!");
}
//班级ID不为空
if (StringUtils.hasText(classId)) {
//查询所有班级
UserinfoExample userinfoExample = new UserinfoExample();
userinfoExample.createCriteria().andSchoolClassIdEqualTo(classId);
List<Userinfo> userinfoList = userinfoMapper.selectByExample(userinfoExample);
if (!CollectionUtils.isEmpty(userinfoList)) {
for (Userinfo userinfo : userinfoList) {
restartByUserId(userinfo.getUserId());
}
}
System.out.println( classId+":班级实训重置成功!");
}
return new ResultEntity<>(HttpStatus.OK, "重置指令已接收,系统正在处理中!");
}
public void restartByUserId(String userId) {
//清除所有成绩
StuGradeExample stuGradeExample = new StuGradeExample();
stuGradeExample.createCriteria().andUserIdEqualTo(userId);
stuGradeMapper.deleteByExample(stuGradeExample);
//1.行业需求分析
HyxqfxStuAnswerExample example = new HyxqfxStuAnswerExample();
example.createCriteria().andUserIdEqualTo(userId);
hyxqfxStuAnswerMapper.deleteByExample(example);
//2.竞争环境分析
JzhyfxStuAnswerExample jzhyfxStuAnswerExample = new JzhyfxStuAnswerExample();
jzhyfxStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
jzhyfxStuAnswerMapper.deleteByExample(jzhyfxStuAnswerExample);
//3.消费人群分析/渠道表现分析/品类结构优化 (波士顿 RFM 漏斗模型 帕累托 购物篮分析 )
StuMachineLearningExample machineLearningExample = new StuMachineLearningExample();
machineLearningExample.createCriteria().andUserIdEqualTo(userId);
machineLearningMapper.deleteByExample(machineLearningExample);
//用户数据分析/产品定位-重新实训 (描述性统计 聚类分析 线性预测法 用户评论分析 )
AlgorithmStuAnswerExample algorithmStuAnswerExample = new AlgorithmStuAnswerExample();
algorithmStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
algorithmStuAnswerMapper.deleteByExample(algorithmStuAnswerExample);
//产品定价
CpdjStuAnswerExample cpdjStuAnswerExample = new CpdjStuAnswerExample();
cpdjStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpdjStuAnswerMapper.deleteByExample(cpdjStuAnswerExample);
//产品差异化定位
CpcyhdwStuAnswerExample cpcyhdwStuAnswerExample = new CpcyhdwStuAnswerExample();
cpcyhdwStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpcyhdwStuAnswerMapper.deleteByExample(cpcyhdwStuAnswerExample);
//产品结构规划
CpjgghStuAnswerExample cpjgghStuAnswerExample = new CpjgghStuAnswerExample();
cpjgghStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpjgghStuAnswerMapper.deleteByExample(cpjgghStuAnswerExample);
//发布渠道评估
FbqdStuAnswerExample fbqdStuAnswerExample = new FbqdStuAnswerExample();
fbqdStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
fbqdStuAnswerMapper.deleteByExample(fbqdStuAnswerExample);
//产品推广测试
CptgcsStuAnswerExample cptgcsStuAnswerExample = new CptgcsStuAnswerExample();
cptgcsStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cptgcsStuAnswerMapper.deleteByExample(cptgcsStuAnswerExample);
//产品营销定位
CpyxdwStuAnswerExample cpyxdwStuAnswerExample = new CpyxdwStuAnswerExample();
cpyxdwStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpyxdwStuAnswerMapper.deleteByExample(cpyxdwStuAnswerExample);
//采购需求预测-重新实训
CgxqycStuAnswerExample cgxqycStuAnswerExample = new CgxqycStuAnswerExample();
cgxqycStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cgxqycStuAnswerMapper.deleteByExample(cgxqycStuAnswerExample);
//采购产品定位
CgcpdwStuAnswerExample cgcpdwStuAnswerExample = new CgcpdwStuAnswerExample();
cgcpdwStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cgcpdwStuAnswerMapper.deleteByExample(cgcpdwStuAnswerExample);
//供应商评估与选择
GyspgyxzStuAnswerExample gyspgyxzStuAnswerExample = new GyspgyxzStuAnswerExample();
gyspgyxzStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
gyspgyxzStuAnswerMapper.deleteByExample(gyspgyxzStuAnswerExample);
//产品表现分析
CpbxfxStuAnswerExample cpbxfxStuAnswerExample = new CpbxfxStuAnswerExample();
cpbxfxStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpbxfxStuAnswerMapper.deleteByExample(cpbxfxStuAnswerExample);
//产产品问题诊断-五维四率-重新实训
CpwtzdWwslStuAnswerExample cpwtzdWwslStuAnswerExample = new CpwtzdWwslStuAnswerExample();
cpwtzdWwslStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpwtzdWwslStuAnswerMapper.deleteByExample(cpwtzdWwslStuAnswerExample);
//产品问题诊断-Kano模型-重新实训
CpwtzdKanomxStuAnswerExample cpwtzdKanomxStuAnswerExample = new CpwtzdKanomxStuAnswerExample();
cpwtzdKanomxStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpwtzdKanomxStuAnswerMapper.deleteByExample(cpwtzdKanomxStuAnswerExample);
//产品问题诊断-市场机会矩阵
CpwtzdScjhjzStuAnswerExample cpwtzdScjhjzStuAnswerExample = new CpwtzdScjhjzStuAnswerExample();
cpwtzdScjhjzStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpwtzdScjhjzStuAnswerMapper.deleteByExample(cpwtzdScjhjzStuAnswerExample);
//产品问题诊断-流量数据分析法
CpwtzdLlsjfxfStuAnswerExample cpwtzdLlsjfxfStuAnswerExample = new CpwtzdLlsjfxfStuAnswerExample();
cpwtzdLlsjfxfStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
cpwtzdLlsjfxfStuAnswerMapper.deleteByExample(cpwtzdLlsjfxfStuAnswerExample);
}
} }

@ -113,6 +113,7 @@ public class UserBehaviorProfilingAnaServiceImpl implements UserBehaviorProfilin
BigDecimal aDouble = BigDecimal.valueOf(100).subtract(Convert.toBigDecimal(learning.getErrorField())); BigDecimal aDouble = BigDecimal.valueOf(100).subtract(Convert.toBigDecimal(learning.getErrorField()));
//算分 //算分
scoreService.insertScore(learning.getUserId(), learning.getProject(), learning.getModule(), aDouble, null); scoreService.insertScore(learning.getUserId(), learning.getProject(), learning.getModule(), aDouble, null);
return new ResultEntity<>(HttpStatus.OK, "提交成功!");
} }
return new ResultEntity<>(HttpStatus.OK, "保存成功!"); return new ResultEntity<>(HttpStatus.OK, "保存成功!");

Loading…
Cancel
Save