From bdbd6ccf185ec5d7bddc0aad22961f8e509a7f25 Mon Sep 17 00:00:00 2001 From: whb <17803890193@163.com> Date: Wed, 21 May 2025 17:27:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=95=B0=E6=8D=AE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=9D=E5=A7=8B=E5=8C=96=E5=92=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../linkCommerce/LinkCommerceApplication.java | 2 + .../controller/stu/CptfController.java | 192 +++++++++++++++++- .../UserBehaviorProfilingAnaServiceImpl.java | 1 + 3 files changed, 194 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sztzjy/linkCommerce/LinkCommerceApplication.java b/src/main/java/com/sztzjy/linkCommerce/LinkCommerceApplication.java index 24c9e68..f907f41 100644 --- a/src/main/java/com/sztzjy/linkCommerce/LinkCommerceApplication.java +++ b/src/main/java/com/sztzjy/linkCommerce/LinkCommerceApplication.java @@ -5,6 +5,7 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @@ -12,6 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @MapperScan(basePackages = "com.sztzjy.linkCommerce.mapper") @EnableScheduling @Slf4j +@EnableAsync public class LinkCommerceApplication { public static void main(String[] args) { diff --git a/src/main/java/com/sztzjy/linkCommerce/controller/stu/CptfController.java b/src/main/java/com/sztzjy/linkCommerce/controller/stu/CptfController.java index aa9139e..154f327 100644 --- a/src/main/java/com/sztzjy/linkCommerce/controller/stu/CptfController.java +++ b/src/main/java/com/sztzjy/linkCommerce/controller/stu/CptfController.java @@ -11,7 +11,7 @@ import com.sztzjy.linkCommerce.mapper.*; import com.sztzjy.linkCommerce.service.ScoreService; import com.sztzjy.linkCommerce.util.CompareListsUtil; import com.sztzjy.linkCommerce.util.ResultEntity; -import com.sztzjy.linkCommerce.util.StringUtils; + import com.sztzjy.linkCommerce.util.file.IFileUtil; import io.swagger.annotations.Api; 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.Value; import org.springframework.http.HttpStatus; +import org.springframework.scheduling.annotation.Async; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; 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 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); + + } + } diff --git a/src/main/java/com/sztzjy/linkCommerce/service/impl/UserBehaviorProfilingAnaServiceImpl.java b/src/main/java/com/sztzjy/linkCommerce/service/impl/UserBehaviorProfilingAnaServiceImpl.java index a13a155..af379d9 100644 --- a/src/main/java/com/sztzjy/linkCommerce/service/impl/UserBehaviorProfilingAnaServiceImpl.java +++ b/src/main/java/com/sztzjy/linkCommerce/service/impl/UserBehaviorProfilingAnaServiceImpl.java @@ -113,6 +113,7 @@ public class UserBehaviorProfilingAnaServiceImpl implements UserBehaviorProfilin BigDecimal aDouble = BigDecimal.valueOf(100).subtract(Convert.toBigDecimal(learning.getErrorField())); //算分 scoreService.insertScore(learning.getUserId(), learning.getProject(), learning.getModule(), aDouble, null); + return new ResultEntity<>(HttpStatus.OK, "提交成功!"); } return new ResultEntity<>(HttpStatus.OK, "保存成功!");