parent
b9a36ce057
commit
b1dc1bc080
32 changed files with 1178 additions and 7 deletions
@ -0,0 +1,59 @@ |
|||||||
|
package com.ccic.safeliab.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("ex_answers") |
||||||
|
public class ExAnswers extends BaseEntity implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* ID |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ID_WORKER) |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户ID |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long userId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷ID |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long paperId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试ID |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long examId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目ID |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long questionId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户选择的答案 |
||||||
|
*/ |
||||||
|
private String selectedAnswer; |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否正确 |
||||||
|
*/ |
||||||
|
private Integer isCorrect; |
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
package com.ccic.safeliab.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("ex_exam_info") |
||||||
|
public class ExExamInfo extends BaseEntity implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* ID |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ID_WORKER) |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试名称 |
||||||
|
*/ |
||||||
|
private String examName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷ID |
||||||
|
*/ |
||||||
|
private Long paperId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 监管行业ID |
||||||
|
*/ |
||||||
|
private Long industryId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试区域 |
||||||
|
*/ |
||||||
|
private String examRegion; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试有效时间 |
||||||
|
*/ |
||||||
|
private String validFrom; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试失效时间 |
||||||
|
*/ |
||||||
|
private String validTo; |
||||||
|
|
||||||
|
/** |
||||||
|
* 发布状态 |
||||||
|
*/ |
||||||
|
private Integer publishStatus; |
||||||
|
|
||||||
|
/** |
||||||
|
* 内容描述 |
||||||
|
*/ |
||||||
|
private String remark; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
package com.ccic.safeliab.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("ex_exam_scores") |
||||||
|
public class ExExamScoures extends BaseEntity implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* ID |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ID_WORKER) |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户ID |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long userId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷ID |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long paperId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试ID |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long examId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 总分 |
||||||
|
*/ |
||||||
|
private Integer totalScore; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试用时 |
||||||
|
*/ |
||||||
|
private Integer examTimeSpent; |
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package com.ccic.safeliab.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("ex_open_user") |
||||||
|
public class ExOpenUser extends BaseEntity implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* ID |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ID_WORKER) |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 小程序唯一标识 |
||||||
|
*/ |
||||||
|
private String openid; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户昵称 |
||||||
|
*/ |
||||||
|
private String nickname; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户头像URL |
||||||
|
*/ |
||||||
|
private String avatarUrl; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户性别 |
||||||
|
*/ |
||||||
|
private Integer gender; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户电话 |
||||||
|
*/ |
||||||
|
private String phoneNumber; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.ccic.safeliab.config; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.injector.ISqlInjector; |
||||||
|
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
public class MybatisPlusConfig { |
||||||
|
|
||||||
|
/** |
||||||
|
* 注册 LogicSqlInjector 来支持逻辑删除功能 |
||||||
|
* 只有在 MyBatis-Plus 版本低于 3.2.0 时需要添加该配置。 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Bean |
||||||
|
public ISqlInjector sqlInjector(){ |
||||||
|
return new LogicSqlInjector(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.dao; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.ccic.safeliab.entity.ExAnswers; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface AnswersMapper extends BaseMapper<ExAnswers> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.dao; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.ccic.safeliab.entity.ExExamInfo; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface ExamInfoMapper extends BaseMapper<ExExamInfo> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.dao; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.ccic.safeliab.entity.ExExamScoures; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface ExamScouresMapper extends BaseMapper<ExExamScoures> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.dao; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.ccic.safeliab.entity.ExOpenUser; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface OpenUserMapper extends BaseMapper<ExOpenUser> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.dao; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.ccic.safeliab.excel.ServiceStatExcel; |
||||||
|
import com.ccic.safeliab.vo.ServiceStatVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface ServiceStatMapper { |
||||||
|
|
||||||
|
List<ServiceStatVO> selectPage(IPage page, @Param("policy") ServiceStatVO serviceStatVO); |
||||||
|
|
||||||
|
List<ServiceStatExcel> selectExport(@Param("policy") ServiceStatVO serviceStatVO); |
||||||
|
} |
@ -0,0 +1,55 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.excel; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore; |
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* model 保单服务统计 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ColumnWidth(25) |
||||||
|
@HeadRowHeight(20) |
||||||
|
@ContentRowHeight(18) |
||||||
|
public class ServiceStatExcel implements Serializable { |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ColumnWidth(23) |
||||||
|
@ExcelProperty("保单号") |
||||||
|
private String policyNumber; |
||||||
|
|
||||||
|
@ColumnWidth(40) |
||||||
|
@ExcelProperty("归属机构") |
||||||
|
private String insuranceName; |
||||||
|
|
||||||
|
@ColumnWidth(23) |
||||||
|
@ExcelProperty("事故预防状态") |
||||||
|
private String serviceStatusName; |
||||||
|
|
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("备注") |
||||||
|
private String remarks; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.ccic.safeliab.service; |
||||||
|
|
||||||
|
import com.ccic.safeliab.entity.ExAnswers; |
||||||
|
import com.ccic.safeliab.support.BaseService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务类 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
public interface AnswersService extends BaseService<ExAnswers> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.ccic.safeliab.service; |
||||||
|
|
||||||
|
import com.ccic.safeliab.dao.AnswersMapper; |
||||||
|
import com.ccic.safeliab.entity.ExAnswers; |
||||||
|
import com.ccic.safeliab.support.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务实现类 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class AnswersServiceImpl extends BaseServiceImpl<AnswersMapper, ExAnswers> implements AnswersService { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.service; |
||||||
|
|
||||||
|
import com.ccic.safeliab.util.R; |
||||||
|
import com.ccic.safeliab.vo.UserAnswersVO; |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务类 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
public interface ExamService { |
||||||
|
|
||||||
|
R findExamPageData(Long examId); |
||||||
|
|
||||||
|
R saveUserAnswers(UserAnswersVO userAnswersVO); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,136 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.ccic.safeliab.dao.AnswersMapper; |
||||||
|
import com.ccic.safeliab.dao.ExamInfoMapper; |
||||||
|
import com.ccic.safeliab.dao.ExamScouresMapper; |
||||||
|
import com.ccic.safeliab.dao.QuestionMapper; |
||||||
|
import com.ccic.safeliab.entity.ExAnswers; |
||||||
|
import com.ccic.safeliab.entity.ExExamInfo; |
||||||
|
import com.ccic.safeliab.entity.ExExamScoures; |
||||||
|
import com.ccic.safeliab.entity.ExamPapers; |
||||||
|
import com.ccic.safeliab.vo.ExamPageDataVO; |
||||||
|
import com.ccic.safeliab.vo.PageQuestionCategoriesVO; |
||||||
|
import com.ccic.safeliab.vo.UserAnswersVO; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import com.ccic.safeliab.util.R; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 服务实现类 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class ExamServiceImpl implements ExamService { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ExamInfoMapper examInfoMapper; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private QuestionMapper questionCategoriesMapper; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private AnswersService answersService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ExamScouresMapper examScouresMapper; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ExamPaperService paperService; |
||||||
|
|
||||||
|
@Override |
||||||
|
public R findExamPageData(Long examId) { |
||||||
|
QueryWrapper<ExExamInfo> examScouresWrapper = new QueryWrapper<>(); |
||||||
|
examScouresWrapper.lambda().eq(ExExamInfo::getId, examId); |
||||||
|
examScouresWrapper.lambda().eq(ExExamInfo::getPublishStatus, 1);// 已发布
|
||||||
|
ExExamInfo examInfo = examInfoMapper.selectOne(examScouresWrapper); |
||||||
|
if (examInfo == null) { |
||||||
|
log.error("获取考试信息失败,examId: {}", examId); |
||||||
|
return R.error().message("获取考试信息失败"); |
||||||
|
} |
||||||
|
|
||||||
|
ExamPapers examPapers = paperService.getById(examInfo.getPaperId()); |
||||||
|
if (examPapers == null) { |
||||||
|
log.error("获取试卷信息失败,examId: {}", examInfo.getPaperId()); |
||||||
|
return R.error().message("获取试卷信息失败"); |
||||||
|
} |
||||||
|
|
||||||
|
List<PageQuestionCategoriesVO> pageQuestionCategoriesList = questionCategoriesMapper.getListByPaperId(examInfo.getPaperId()); |
||||||
|
if (pageQuestionCategoriesList == null || pageQuestionCategoriesList.size() == 0) { |
||||||
|
log.error("获取试卷关联数据失败,paperId: {}", examInfo.getPaperId()); |
||||||
|
return R.error().message("获取试卷关联数据失败"); |
||||||
|
} |
||||||
|
|
||||||
|
ExamPageDataVO examPageDataVO = new ExamPageDataVO(); |
||||||
|
examPageDataVO.setExamId(examInfo.getId()); |
||||||
|
examPageDataVO.setExamName(examInfo.getExamName()); |
||||||
|
examPageDataVO.setPaperId(examInfo.getPaperId()); |
||||||
|
examPageDataVO.setPaperName(examPapers.getPaperName()); |
||||||
|
examPageDataVO.setTotalScore(examPapers.getTotalScore()); |
||||||
|
examPageDataVO.setExamDuration(examPapers.getExamDuration()); |
||||||
|
examPageDataVO.setPaperContent(examPapers.getPaperContent()); |
||||||
|
examPageDataVO.setQuestionCategoriesList(pageQuestionCategoriesList); |
||||||
|
return R.ok().data(examPageDataVO); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public R saveUserAnswers(UserAnswersVO userAnswersVO) { |
||||||
|
QueryWrapper<ExAnswers> answersQueryWrapper = new QueryWrapper<>(); |
||||||
|
answersQueryWrapper.lambda().eq(ExAnswers::getUserId, userAnswersVO.getUserId()); |
||||||
|
answersQueryWrapper.lambda().eq(ExAnswers::getExamId, userAnswersVO.getExamId()); |
||||||
|
Integer selectCount = answersService.count(answersQueryWrapper); |
||||||
|
if (selectCount > 0) { |
||||||
|
answersService.remove(answersQueryWrapper);// 清空历史做题
|
||||||
|
} |
||||||
|
Integer totalScore = 0; |
||||||
|
List<ExAnswers> answersList = userAnswersVO.getAnswerList(); |
||||||
|
if (answersList != null && answersList.size() > 0) { |
||||||
|
for (ExAnswers exAnswers: answersList) { |
||||||
|
if (exAnswers.getIsCorrect() == 1) { |
||||||
|
totalScore ++; |
||||||
|
} |
||||||
|
exAnswers.setUserId(userAnswersVO.getUserId()); |
||||||
|
exAnswers.setExamId(userAnswersVO.getExamId()); |
||||||
|
} |
||||||
|
} |
||||||
|
answersService.saveBatch(answersList); |
||||||
|
QueryWrapper<ExExamScoures> examScouresQueryWrapper = new QueryWrapper<>(); |
||||||
|
examScouresQueryWrapper.lambda().eq(ExExamScoures::getUserId, userAnswersVO.getUserId()); |
||||||
|
examScouresQueryWrapper.lambda().eq(ExExamScoures::getExamId, userAnswersVO.getExamId()); |
||||||
|
examScouresQueryWrapper.lambda().eq(ExExamScoures::getPaperId, userAnswersVO.getPaperId()); |
||||||
|
Integer examScouresCount = examScouresMapper.selectCount(examScouresQueryWrapper); |
||||||
|
if (examScouresCount > 0) { |
||||||
|
examScouresMapper.delete(examScouresQueryWrapper);// 清空历史记录
|
||||||
|
} |
||||||
|
ExExamScoures examScoures = new ExExamScoures(); |
||||||
|
examScoures.setUserId(userAnswersVO.getUserId()); |
||||||
|
examScoures.setPaperId(userAnswersVO.getPaperId()); |
||||||
|
examScoures.setExamId(userAnswersVO.getExamId()); |
||||||
|
examScoures.setTotalScore(totalScore); |
||||||
|
examScoures.setExamTimeSpent(userAnswersVO.getExamTimeSpent()); |
||||||
|
examScouresMapper.insert(examScoures); |
||||||
|
return R.ok().data(true); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
package com.ccic.safeliab.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class ExamPageDataVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷id |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long examId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试名称 |
||||||
|
*/ |
||||||
|
private String examName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷id |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long paperId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷名称 |
||||||
|
*/ |
||||||
|
private String paperName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目数量 |
||||||
|
*/ |
||||||
|
private Integer questionCount; |
||||||
|
|
||||||
|
/** |
||||||
|
* 总分值 |
||||||
|
*/ |
||||||
|
private Integer totalScore; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试时长 |
||||||
|
*/ |
||||||
|
private Long examDuration; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷内容 |
||||||
|
*/ |
||||||
|
private String paperContent; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考卷题目集合 |
||||||
|
*/ |
||||||
|
private List<PageQuestionCategoriesVO> questionCategoriesList; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.ccic.safeliab.vo; |
||||||
|
|
||||||
|
import com.ccic.safeliab.entity.QuestionCategories; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 试卷题目视图 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||||
|
public class PageQuestionCategoriesVO extends QuestionCategories { |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目编号 |
||||||
|
*/ |
||||||
|
private String questionNumber; |
||||||
|
} |
@ -0,0 +1,64 @@ |
|||||||
|
package com.ccic.safeliab.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务统计视图 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||||
|
public class ServiceStatVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 保单id |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long policyId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 保单号 |
||||||
|
*/ |
||||||
|
private String policyNumber; |
||||||
|
|
||||||
|
/** |
||||||
|
* 归属机构 |
||||||
|
*/ |
||||||
|
private String insuranceName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 备注 |
||||||
|
*/ |
||||||
|
private String remarks; |
||||||
|
|
||||||
|
/** |
||||||
|
* 事故预防状态 |
||||||
|
*/ |
||||||
|
private Integer serviceStatus; |
||||||
|
|
||||||
|
/** |
||||||
|
* 事故预防状态名称 |
||||||
|
*/ |
||||||
|
private String serviceStatusName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 开始时间 |
||||||
|
*/ |
||||||
|
private String startDate; |
||||||
|
|
||||||
|
/** |
||||||
|
* 结束时间 |
||||||
|
*/ |
||||||
|
private String doneDate; |
||||||
|
|
||||||
|
/** |
||||||
|
* 日期过滤 |
||||||
|
*/ |
||||||
|
private String dateFilter; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package com.ccic.safeliab.vo; |
||||||
|
|
||||||
|
import com.ccic.safeliab.entity.ExAnswers; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class UserAnswersVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户id |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long userId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷id |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long examId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 试卷id |
||||||
|
*/ |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||||
|
private Long paperId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答题记录表 |
||||||
|
*/ |
||||||
|
private List<ExAnswers> answerList; |
||||||
|
|
||||||
|
/** |
||||||
|
* 考试用时 |
||||||
|
*/ |
||||||
|
private Integer examTimeSpent; |
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.web; |
||||||
|
|
||||||
|
import com.ccic.safeliab.service.ExamService; |
||||||
|
import com.ccic.safeliab.service.QuestionService; |
||||||
|
import com.ccic.safeliab.util.R; |
||||||
|
import com.ccic.safeliab.vo.UserAnswersVO; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 控制器 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/ex/exam") |
||||||
|
public class ExamController { |
||||||
|
|
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ExamService examService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private QuestionService questionService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取考试与试卷信息 |
||||||
|
* @param examId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/findExamPageData") |
||||||
|
public R findExamPageData(Long examId) { |
||||||
|
return examService.findExamPageData(examId); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存用户考试记录 |
||||||
|
* @param userAnswersVO |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@PostMapping("/submitUserAnswers") |
||||||
|
public R submitUserAnswers(@RequestBody UserAnswersVO userAnswersVO) { |
||||||
|
return examService.saveUserAnswers(userAnswersVO); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
/** |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||||
|
* <p> |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* <p> |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p> |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.ccic.safeliab.web; |
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 控制器 |
||||||
|
* |
||||||
|
* @author edwong |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/ex/openUser") |
||||||
|
public class OpenUserController { |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,112 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.ccic.safeliab.dao.ServiceStatMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="statResultMap" type="com.ccic.safeliab.vo.ServiceStatVO"> |
||||||
|
<id column="policy_id" property="policyId"/> |
||||||
|
<result column="policy_number" property="policyNumber"/> |
||||||
|
<result column="insurance_name" property="insuranceName"/> |
||||||
|
<result column="other_information" property="remarks"/> |
||||||
|
<result column="service_status_name" property="serviceStatusName"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<resultMap id="exportResultMap" type="com.ccic.safeliab.excel.ServiceStatExcel"> |
||||||
|
<result column="policy_number" property="policyNumber"/> |
||||||
|
<result column="insurance_name" property="insuranceName"/> |
||||||
|
<result column="other_information" property="remarks"/> |
||||||
|
<result column="service_status_name" property="serviceStatusName"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<sql id="selectPageColumn"> |
||||||
|
SELECT |
||||||
|
p.policy_id, |
||||||
|
p.policy_number, |
||||||
|
p.insurance_name, |
||||||
|
p.other_information, |
||||||
|
CASE |
||||||
|
WHEN p.policy_id IS NOT NULL AND t.service_id IS NULL AND s.service_apply_id IS NULL THEN '保单未分配(在中支节点)' |
||||||
|
WHEN t.dispatch_status = 2 THEN '已推送服务机构(待服务机构领取任务)' |
||||||
|
WHEN t.status = 1 THEN '任务已分配至XX服务专家(待开展)' |
||||||
|
WHEN t.status = 2 THEN '服务专家已签到(事故预防服务中)' |
||||||
|
WHEN t.status = 10 THEN '服务报告已上传' |
||||||
|
ELSE '-1' |
||||||
|
END AS service_status_name |
||||||
|
</sql> |
||||||
|
|
||||||
|
<sql id="selectExportColumn"> |
||||||
|
SELECT |
||||||
|
p.policy_number, |
||||||
|
p.insurance_name, |
||||||
|
p.other_information, |
||||||
|
CASE |
||||||
|
WHEN p.policy_id IS NOT NULL AND t.service_id IS NULL AND s.service_apply_id IS NULL THEN '保单未分配(在中支节点)' |
||||||
|
WHEN t.dispatch_status = 2 THEN '已推送服务机构(待服务机构领取任务)' |
||||||
|
WHEN t.status = 1 THEN '任务已分配至XX服务专家(待开展)' |
||||||
|
WHEN t.status = 2 THEN '服务专家已签到(事故预防服务中)' |
||||||
|
WHEN t.status = 10 THEN '服务报告已上传' |
||||||
|
ELSE '-1' |
||||||
|
END AS service_status_name |
||||||
|
</sql> |
||||||
|
|
||||||
|
<sql id="baseQuery"> |
||||||
|
FROM |
||||||
|
tbl_policy p |
||||||
|
LEFT JOIN tbl_service_apply s ON p.policy_id = s.policy_id |
||||||
|
LEFT JOIN tbl_service t ON s.service_apply_id = t.service_apply_id |
||||||
|
<where> |
||||||
|
((p.policy_id IS NOT NULL |
||||||
|
AND t.service_id IS NULL |
||||||
|
AND s.service_apply_id IS NULL) |
||||||
|
OR t.dispatch_status = 2 |
||||||
|
OR t.status IN (1, 2, 10)) |
||||||
|
<if test="policy.serviceStatus != null and policy.serviceStatus != ''"> |
||||||
|
<if test="policy.serviceStatus == 1"> |
||||||
|
AND (p.policy_id IS NOT NULL |
||||||
|
AND t.service_id IS NULL |
||||||
|
AND s.service_apply_id IS NULL) |
||||||
|
</if> |
||||||
|
<if test="policy.serviceStatus == 2"> |
||||||
|
AND t.dispatch_status = 2 |
||||||
|
</if> |
||||||
|
<if test="policy.serviceStatus == 3"> |
||||||
|
AND t.status = 1 |
||||||
|
</if> |
||||||
|
<if test="policy.serviceStatus == 4"> |
||||||
|
AND t.status = 2 |
||||||
|
</if> |
||||||
|
<if test="policy.serviceStatus == 5"> |
||||||
|
AND t.status = 10 |
||||||
|
</if> |
||||||
|
</if> |
||||||
|
<if test="policy.dateFilter != null and policy.dateFilter != ''"> |
||||||
|
<if test="policy.dateFilter == 'lastWeek'"> |
||||||
|
AND p.start_date >= CURRENT_TIMESTAMP - INTERVAL '7 days' AND p.done_date <= CURRENT_TIMESTAMP |
||||||
|
</if> |
||||||
|
<if test="policy.dateFilter == 'lastMonth'"> |
||||||
|
AND p.start_date >= CURRENT_TIMESTAMP - INTERVAL '1 month' AND p.done_date <= CURRENT_TIMESTAMP |
||||||
|
</if> |
||||||
|
<if test="policy.dateFilter == 'last3Months'"> |
||||||
|
AND p.start_date >= CURRENT_TIMESTAMP - INTERVAL '3 months' AND p.done_date <= CURRENT_TIMESTAMP |
||||||
|
</if> |
||||||
|
</if> |
||||||
|
<if test="policy.startDate != null and policy.startDate != ''"> |
||||||
|
AND p.start_date >= #{policy.startDate} |
||||||
|
</if> |
||||||
|
<if test="policy.doneDate != null and policy.doneDate != ''"> |
||||||
|
AND p.done_date <= #{policy.doneDate} |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
</sql> |
||||||
|
|
||||||
|
<select id="selectPage" resultMap="statResultMap"> |
||||||
|
<include refid="selectPageColumn" /> |
||||||
|
<include refid="baseQuery" /> |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="selectExport" resultMap="exportResultMap"> |
||||||
|
<include refid="selectExportColumn" /> |
||||||
|
<include refid="baseQuery" /> |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
Loading…
Reference in new issue