| @ -1,3 +1,3 @@ | |||
| # assessment-admin | |||
| 风险测评后端代码仓库 | |||
| 易税通财税风险检测后端代码仓库 | |||
| @ -1,5 +1,5 @@ | |||
| NODE_ENV=production | |||
| VUE_APP_PLATFORM_NAME=风险测评 | |||
| VUE_APP_PLATFORM_NAME=易税通财税风险检测 | |||
| # 开启单点登录 | |||
| VUE_APP_SSO=false | |||
| # 开启微应用模式 | |||
| @ -1,5 +1,6 @@ | |||
| NODE_ENV=development | |||
| VUE_APP_API_BASE_URL=http://localhost:8000/assessment-admin/ | |||
| //VUE_APP_API_BASE_URL=https://assessment.augcl.com/assessment-admin/ | |||
| VUE_APP_API_BASE_URL=http://localhost:8001/assessment-admin/ | |||
| VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas | |||
| VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview | |||
| @ -1,4 +1,5 @@ | |||
| NODE_ENV=production | |||
| VUE_APP_API_BASE_URL=http://localhost:8000/assessment-admin/ | |||
| //VUE_APP_API_BASE_URL=https://assessment.augcl.com/assessment-admin/ | |||
| VUE_APP_API_BASE_URL=http://localhost:8001/assessment-admin/ | |||
| VUE_APP_CAS_BASE_URL=http://localhost:8888/cas | |||
| VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview | |||
| @ -1,14 +1,7 @@ | |||
| #pay.mchId=1636874683 | |||
| #pay.appId=wx6fb4a17b28186d58 | |||
| #pay.mchKey=GVIP1008611ABCDEFGGGGJKHLOSJFLGK | |||
| #pay.keyPath=classpath:apiclient_cert.p12 | |||
| #pay.notifyUrl=https://jobadmin.java996.icu/job-dev/job/pay/notify | |||
| #pay.notifyUrlDev=https://jobadmin.java996.icu/job-dev/job/pay/notify | |||
| pay.mchId=1669760259 | |||
| pay.appId=wxe934cebcbc89d869 | |||
| pay.mchKey=78e4e80a2096b362114a7afeefd2ef24 | |||
| pay.keyPath=classpath:apiclient_cert.pem | |||
| pay.notifyUrl=http://h5.xzaiyp.top/massage-api/post/create | |||
| pay.notifyUrlDev=http://h5.xzaiyp.top/massage-api/post/notify | |||
| pay.mchId= | |||
| pay.appId= | |||
| pay.mchKey= | |||
| pay.keyPath= | |||
| pay.notifyUrl= | |||
| pay.notifyUrlDev= | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.assessmentReportUser.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.assessmentReportUser.entity.AssessmentReportUser; | |||
| import org.jeecg.modules.assessmentReportUser.service.IAssessmentReportUserService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 用户测评报告基本信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-09-23 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="用户测评报告基本信息表") | |||
| @RestController | |||
| @RequestMapping("/assessmentReportUser/assessmentReportUser") | |||
| @Slf4j | |||
| public class AssessmentReportUserController extends JeecgController<AssessmentReportUser, IAssessmentReportUserService> { | |||
| @Autowired | |||
| private IAssessmentReportUserService assessmentReportUserService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param assessmentReportUser | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "用户测评报告基本信息表-分页列表查询") | |||
| @ApiOperation(value="用户测评报告基本信息表-分页列表查询", notes="用户测评报告基本信息表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<AssessmentReportUser>> queryPageList(AssessmentReportUser assessmentReportUser, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<AssessmentReportUser> queryWrapper = QueryGenerator.initQueryWrapper(assessmentReportUser, req.getParameterMap()); | |||
| Page<AssessmentReportUser> page = new Page<AssessmentReportUser>(pageNo, pageSize); | |||
| IPage<AssessmentReportUser> pageList = assessmentReportUserService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param assessmentReportUser | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "用户测评报告基本信息表-添加") | |||
| @ApiOperation(value="用户测评报告基本信息表-添加", notes="用户测评报告基本信息表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody AssessmentReportUser assessmentReportUser) { | |||
| assessmentReportUserService.save(assessmentReportUser); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param assessmentReportUser | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "用户测评报告基本信息表-编辑") | |||
| @ApiOperation(value="用户测评报告基本信息表-编辑", notes="用户测评报告基本信息表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody AssessmentReportUser assessmentReportUser) { | |||
| assessmentReportUserService.updateById(assessmentReportUser); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "用户测评报告基本信息表-通过id删除") | |||
| @ApiOperation(value="用户测评报告基本信息表-通过id删除", notes="用户测评报告基本信息表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| assessmentReportUserService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "用户测评报告基本信息表-批量删除") | |||
| @ApiOperation(value="用户测评报告基本信息表-批量删除", notes="用户测评报告基本信息表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.assessmentReportUserService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "用户测评报告基本信息表-通过id查询") | |||
| @ApiOperation(value="用户测评报告基本信息表-通过id查询", notes="用户测评报告基本信息表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<AssessmentReportUser> queryById(@RequestParam(name="id",required=true) String id) { | |||
| AssessmentReportUser assessmentReportUser = assessmentReportUserService.getById(id); | |||
| if(assessmentReportUser==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(assessmentReportUser); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param assessmentReportUser | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, AssessmentReportUser assessmentReportUser) { | |||
| return super.exportXls(request, assessmentReportUser, AssessmentReportUser.class, "用户测评报告基本信息表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, AssessmentReportUser.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,75 @@ | |||
| package org.jeecg.modules.assessmentReportUser.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 用户测评报告基本信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-09-23 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("assessment_report_user") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="assessment_report_user对象", description="用户测评报告基本信息表") | |||
| public class AssessmentReportUser implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**报告标题*/ | |||
| @Excel(name = "报告标题", width = 15) | |||
| @ApiModelProperty(value = "报告标题") | |||
| private java.lang.String title; | |||
| /**批次标识*/ | |||
| @Excel(name = "批次标识", width = 15) | |||
| @ApiModelProperty(value = "批次标识") | |||
| private java.lang.String batchNo; | |||
| /**姓名*/ | |||
| @Excel(name = "姓名", width = 15) | |||
| @ApiModelProperty(value = "姓名") | |||
| private java.lang.String name; | |||
| /**手机号*/ | |||
| @Excel(name = "手机号", width = 15) | |||
| @ApiModelProperty(value = "手机号") | |||
| private java.lang.String phone; | |||
| /**公司名称*/ | |||
| @Excel(name = "公司名称", width = 15) | |||
| @ApiModelProperty(value = "公司名称") | |||
| private java.lang.String company; | |||
| /**关联用户*/ | |||
| @Excel(name = "关联用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
| @Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
| @ApiModelProperty(value = "关联用户") | |||
| private java.lang.String userId; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.assessmentReportUser.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.assessmentReportUser.entity.AssessmentReportUser; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 用户测评报告基本信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-09-23 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface AssessmentReportUserMapper extends BaseMapper<AssessmentReportUser> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?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="org.jeecg.modules.assessmentReportUser.mapper.AssessmentReportUserMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.assessmentReportUser.service; | |||
| import org.jeecg.modules.assessmentReportUser.entity.AssessmentReportUser; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 用户测评报告基本信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-09-23 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface IAssessmentReportUserService extends IService<AssessmentReportUser> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.assessmentReportUser.service.impl; | |||
| import org.jeecg.modules.assessmentReportUser.entity.AssessmentReportUser; | |||
| import org.jeecg.modules.assessmentReportUser.mapper.AssessmentReportUserMapper; | |||
| import org.jeecg.modules.assessmentReportUser.service.IAssessmentReportUserService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 用户测评报告基本信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2025-09-23 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class AssessmentReportUserServiceImpl extends ServiceImpl<AssessmentReportUserMapper, AssessmentReportUser> implements IAssessmentReportUserService { | |||
| } | |||
| @ -0,0 +1,202 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('用户测评报告基本信息表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <assessment-report-user-modal ref="modalForm" @ok="modalFormOk"></assessment-report-user-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import AssessmentReportUserModal from './modules/AssessmentReportUserModal' | |||
| import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
| export default { | |||
| name: 'AssessmentReportUserList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| AssessmentReportUserModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '用户测评报告基本信息表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'报告标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title:'批次标识', | |||
| align:"center", | |||
| dataIndex: 'batchNo' | |||
| }, | |||
| { | |||
| title:'姓名', | |||
| align:"center", | |||
| dataIndex: 'name' | |||
| }, | |||
| { | |||
| title:'手机号', | |||
| align:"center", | |||
| dataIndex: 'phone' | |||
| }, | |||
| { | |||
| title:'公司名称', | |||
| align:"center", | |||
| dataIndex: 'company' | |||
| }, | |||
| { | |||
| title:'关联用户', | |||
| align:"center", | |||
| dataIndex: 'userId_dictText' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/assessmentReportUser/assessmentReportUser/list", | |||
| delete: "/assessmentReportUser/assessmentReportUser/delete", | |||
| deleteBatch: "/assessmentReportUser/assessmentReportUser/deleteBatch", | |||
| exportXlsUrl: "/assessmentReportUser/assessmentReportUser/exportXls", | |||
| importExcelUrl: "assessmentReportUser/assessmentReportUser/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'Text',value:'title',text:'报告标题',dictCode:''}) | |||
| fieldList.push({type:'string',value:'batchNo',text:'批次标识',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'name',text:'姓名',dictCode:''}) | |||
| fieldList.push({type:'string',value:'phone',text:'手机号',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'company',text:'公司名称',dictCode:''}) | |||
| fieldList.push({type:'string',value:'userId',text:'关联用户',dictCode:"han_hai_member,nick_name,id"}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,133 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="报告标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
| <a-input v-model="model.title" placeholder="请输入报告标题" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="批次标识" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batchNo"> | |||
| <a-input v-model="model.batchNo" placeholder="请输入批次标识" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> | |||
| <a-input v-model="model.name" placeholder="请输入姓名" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="手机号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="phone"> | |||
| <a-input v-model="model.phone" placeholder="请输入手机号" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="公司名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="company"> | |||
| <a-input v-model="model.company" placeholder="请输入公司名称" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="关联用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> | |||
| <j-dict-select-tag type="list" v-model="model.userId" dictCode="han_hai_member,nick_name,id" placeholder="请选择关联用户" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'AssessmentReportUserForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| phone: [ | |||
| { required: false}, | |||
| { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | |||
| ], | |||
| }, | |||
| url: { | |||
| add: "/assessmentReportUser/assessmentReportUser/add", | |||
| edit: "/assessmentReportUser/assessmentReportUser/edit", | |||
| queryById: "/assessmentReportUser/assessmentReportUser/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <assessment-report-user-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></assessment-report-user-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import AssessmentReportUserForm from './AssessmentReportUserForm' | |||
| export default { | |||
| name: 'AssessmentReportUserModal', | |||
| components: { | |||
| AssessmentReportUserForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <assessment-report-user-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></assessment-report-user-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import AssessmentReportUserForm from './AssessmentReportUserForm' | |||
| export default { | |||
| name: 'AssessmentReportUserModal', | |||
| components: { | |||
| AssessmentReportUserForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/assessmentReportUser/assessmentReportUser/list', | |||
| save='/assessmentReportUser/assessmentReportUser/add', | |||
| edit='/assessmentReportUser/assessmentReportUser/edit', | |||
| deleteOne = '/assessmentReportUser/assessmentReportUser/delete', | |||
| deleteBatch = '/assessmentReportUser/assessmentReportUser/deleteBatch', | |||
| importExcel = '/assessmentReportUser/assessmentReportUser/importExcel', | |||
| exportXls = '/assessmentReportUser/assessmentReportUser/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,82 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '报告标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '批次标识', | |||
| align:"center", | |||
| dataIndex: 'batchNo' | |||
| }, | |||
| { | |||
| title: '姓名', | |||
| align:"center", | |||
| dataIndex: 'name' | |||
| }, | |||
| { | |||
| title: '手机号', | |||
| align:"center", | |||
| dataIndex: 'phone' | |||
| }, | |||
| { | |||
| title: '公司名称', | |||
| align:"center", | |||
| dataIndex: 'company' | |||
| }, | |||
| { | |||
| title: '关联用户', | |||
| align:"center", | |||
| dataIndex: 'userId_dictText' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '报告标题', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '批次标识', | |||
| field: 'batchNo', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '姓名', | |||
| field: 'name', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '手机号', | |||
| field: 'phone', | |||
| component: 'Input', | |||
| dynamicRules: ({model,schema}) => { | |||
| return [ | |||
| { required: false}, | |||
| { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, | |||
| ]; | |||
| }, | |||
| }, | |||
| { | |||
| label: '公司名称', | |||
| field: 'company', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '关联用户', | |||
| field: 'userId', | |||
| component: 'JDictSelectTag', | |||
| componentProps:{ | |||
| dictCode:"han_hai_member,nick_name,id" | |||
| }, | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <AssessmentReportUserModal @register="registerModal" @success="handleSuccess"></AssessmentReportUserModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="assessmentReportUser-assessmentReportUser" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import AssessmentReportUserModal from './components/AssessmentReportUserModal.vue' | |||
| import {columns, searchFormSchema} from './assessmentReportUser.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './assessmentReportUser.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '用户测评报告基本信息表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"用户测评报告基本信息表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../assessmentReportUser.data'; | |||
| import {saveOrUpdate} from '../assessmentReportUser.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,48 @@ | |||
| package org.jeecg.modules.api.assessmentController; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.ConfigService; | |||
| import org.jeecg.modules.assessmentBanner.entity.AssessmentBanner; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.annotation.Resource; | |||
| @Api(tags="系统配置-相关接口") | |||
| @RestController | |||
| @RequestMapping("/assessment/config") | |||
| @Slf4j | |||
| public class ConfigController { | |||
| /******************************************************************************************************************/ | |||
| //配置信息 | |||
| @Resource | |||
| private ConfigService configService; | |||
| /******************************************************************************************************************/ | |||
| //查看系统配置列表 | |||
| @ApiOperation(value="系统配置-查询系统配置列表", notes="系统配置-查询系统配置列表") | |||
| @RequestMapping(value = "/queryConfigList", method = {RequestMethod.GET}) | |||
| public Result<?> queryConfigList(PageBean pageBean){ | |||
| return configService.queryConfigList(pageBean); | |||
| } | |||
| //查看系统配置详情 | |||
| @ApiOperation(value="系统配置-查询系统配置详情", notes="系统配置-查询系统配置详情") | |||
| @RequestMapping(value = "/queryConfigByParamCode", method = {RequestMethod.GET}) | |||
| public Result<?> queryConfigByParamCode(String paramCode){ | |||
| return configService.queryConfigByParamCode(paramCode); | |||
| } | |||
| @ApiOperation(value="首页-查询banner图列表", notes="type:0-首页") | |||
| @RequestMapping(value = "/queryBannerList", method = {RequestMethod.GET}) | |||
| public Result<?> queryBannerList(AssessmentBanner assessmentBanner, PageBean pageBean){ | |||
| return configService.queryBannerList(assessmentBanner, pageBean); | |||
| } | |||
| } | |||
| @ -0,0 +1,75 @@ | |||
| package org.jeecg.modules.api.assessmentController; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.ConfigService; | |||
| import org.jeecg.modules.api.service.ExamService; | |||
| import org.jeecg.modules.assessmentAnswerLog.entity.AssessmentAnswerLog; | |||
| import org.jeecg.modules.assessmentPayLog.entity.AssessmentPayLog; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.annotation.Resource; | |||
| @Api(tags="测评-相关接口") | |||
| @RestController | |||
| @RequestMapping("/assessment/exam") | |||
| @Slf4j | |||
| public class ExamController { | |||
| /******************************************************************************************************************/ | |||
| //配置信息 | |||
| @Resource | |||
| private ExamService examService; | |||
| /******************************************************************************************************************/ | |||
| //查询题库列表 | |||
| @ApiOperation(value="测评-开始测评(查询题库列表)", notes="测评-查询题库列表") | |||
| @RequestMapping(value = "/queryCategoryList", method = {RequestMethod.GET}) | |||
| public Result<?> queryCategoryList(PageBean pageBean){ | |||
| return examService.queryCategoryList(pageBean); | |||
| } | |||
| //查询答题列表 | |||
| @ApiOperation(value="测评-开始答题(查询题目列表)", notes="categories:以;分隔题库id") | |||
| @RequestMapping(value = "/queryQuestionList", method = {RequestMethod.GET}) | |||
| public Result<?> queryQuestionList(@RequestHeader("X-Access-Token") String token, String categories){ | |||
| return examService.queryQuestionList(token, categories); | |||
| } | |||
| //测评-提交答案 | |||
| @ApiOperation(value="测评-提交答案", notes="测评-提交答案") | |||
| @RequestMapping(value = "/updateAnswer", method = {RequestMethod.GET}) | |||
| public Result<?> updateAnswer(@RequestHeader("X-Access-Token") String token, AssessmentAnswerLog assessmentAnswerLog){ | |||
| return examService.updateAnswer(token, assessmentAnswerLog); | |||
| } | |||
| //我的-我的答题 | |||
| @ApiOperation(value="我的-我的答题", notes="我的-我的答题") | |||
| @RequestMapping(value = "/queryExamLogList", method = {RequestMethod.GET}) | |||
| public Result<?> queryExamLogList(@RequestHeader("X-Access-Token") String token, String isFinished, PageBean pageBean){ | |||
| return examService.queryExamLogList(token, isFinished, pageBean); | |||
| } | |||
| //测评-继续答题 | |||
| @ApiOperation(value="测评-继续答题", notes="测评-继续答题") | |||
| @RequestMapping(value = "/queryExamById", method = {RequestMethod.GET}) | |||
| public Result<?> queryExamById(@RequestHeader("X-Access-Token") String token, String examId){ | |||
| return examService.queryExamById(token, examId); | |||
| } | |||
| //支付-创建订单 | |||
| @ApiOperation(value="支付-立即支付(创建订单)", notes="支付-立即支付(创建订单)") | |||
| @RequestMapping(value = "/createOrder", method = {RequestMethod.POST}) | |||
| public Result<?> createOrder(@RequestHeader("X-Access-Token") String token, AssessmentPayLog assessmentPayLog){ | |||
| return examService.createOrder(token, assessmentPayLog); | |||
| } | |||
| //支付回调 | |||
| @PostMapping("/payOrderNotify") | |||
| public Object payOrderNotify(@RequestBody String requestBody){ | |||
| return examService.payOrderNotify(requestBody); | |||
| } | |||
| } | |||
| @ -0,0 +1,41 @@ | |||
| package org.jeecg.modules.api.assessmentController; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.service.LoginApiService; | |||
| import org.jeecg.modules.bean.LoginReq; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.annotation.Resource; | |||
| @Api(tags="登录-相关接口") | |||
| @RestController | |||
| @RequestMapping("/assessment/login") | |||
| @Slf4j | |||
| public class LoginApiController { | |||
| /******************************************************************************************************************/ | |||
| //登录信息 | |||
| @Resource | |||
| private LoginApiService loginApiService; | |||
| /******************************************************************************************************************/ | |||
| //小程序-微信授权登录接口 | |||
| @ApiOperation(value="小程序-微信授权登录接口", notes="小程序-微信授权登录接口") | |||
| @GetMapping("/login") | |||
| public Result<?> login(LoginReq loginReq){ | |||
| return loginApiService.login(loginReq); | |||
| } | |||
| //绑定手机号码 | |||
| @ApiOperation(value="小程序-绑定手机号码", notes="小程序-绑定手机号码") | |||
| @GetMapping(value = "/bindPhone") | |||
| public Result<Object> bindPhone(String phoneCode){ | |||
| return loginApiService.bindPhone(phoneCode); | |||
| } | |||
| } | |||
| @ -0,0 +1,50 @@ | |||
| package org.jeecg.modules.api.assessmentController; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.ConfigService; | |||
| import org.jeecg.modules.api.service.ReportService; | |||
| import org.jeecg.modules.assessmentReportUser.entity.AssessmentReportUser; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.annotation.Resource; | |||
| @Api(tags="报告-相关接口") | |||
| @RestController | |||
| @RequestMapping("/assessment/report") | |||
| @Slf4j | |||
| public class ReportController { | |||
| /******************************************************************************************************************/ | |||
| //配置信息 | |||
| @Resource | |||
| private ReportService reportService; | |||
| /******************************************************************************************************************/ | |||
| //新增测评报告基本信息 | |||
| @ApiOperation(value="测评-新增测评报告基本信息", notes="测评-新增报告基本信息") | |||
| @RequestMapping(value = "/addReport", method = {RequestMethod.POST}) | |||
| public Result<?> addReport(@RequestHeader("X-Access-Token") String token, AssessmentReportUser assessmentReportUser){ | |||
| return reportService.addReport(token, assessmentReportUser); | |||
| } | |||
| //查看报告列表 | |||
| @ApiOperation(value="报告-查询报告列表", notes="报告-查询报告列表") | |||
| @RequestMapping(value = "/queryReportList", method = {RequestMethod.GET}) | |||
| public Result<?> queryReportList(@RequestHeader("X-Access-Token") String token, PageBean pageBean){ | |||
| return reportService.queryReportList(token, pageBean); | |||
| } | |||
| //查看报告详情 | |||
| @ApiOperation(value="报告-查询报告详情", notes="报告-查询报告详情") | |||
| @RequestMapping(value = "/queryReportById", method = {RequestMethod.GET}) | |||
| public Result<?> queryReportById(@RequestHeader("X-Access-Token") String token, String batchNo){ | |||
| return reportService.queryReportById(token, batchNo); | |||
| } | |||
| } | |||
| @ -0,0 +1,59 @@ | |||
| package org.jeecg.modules.api.assessmentController; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.UserInfoService; | |||
| import org.jeecg.modules.assessmentFeedback.entity.AssessmentFeedback; | |||
| import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.annotation.Resource; | |||
| @Api(tags="我的-相关接口") | |||
| @RestController | |||
| @RequestMapping("/assessment/userInfo") | |||
| @Slf4j | |||
| public class UserInfoController { | |||
| /******************************************************************************************************************/ | |||
| @Resource | |||
| private UserInfoService userInfoService; | |||
| /******************************************************************************************************************/ | |||
| //获取个人信息 | |||
| @ApiOperation(value="我的资料-获取个人信息", notes="我的资料-获取个人信息") | |||
| @RequestMapping(value = "/queryUser", method = {RequestMethod.GET}) | |||
| public Result<?> queryUser(@RequestHeader("X-Access-Token") String token){ | |||
| return userInfoService.queryUserInfo(token); | |||
| } | |||
| //修改个人信息 | |||
| @ApiOperation(value="我的资料-修改个人信息", notes="我的资料-修改个人信息") | |||
| @RequestMapping(value = "/updateUser", method = {RequestMethod.POST}) | |||
| public Result<?> updateUser(@RequestHeader("X-Access-Token") String token, HanHaiMember member){ | |||
| return userInfoService.updateUserInfo(token, member); | |||
| } | |||
| //咨询客服-常见问题列表 | |||
| @ApiOperation(value="咨询客服-常见问题列表", notes="咨询客服-常见问题列表") | |||
| @RequestMapping(value = "/queryFaqList", method = {RequestMethod.GET}) | |||
| public Result<?> queryFaqList(PageBean pageBean){ | |||
| return userInfoService.queryFaqList(pageBean); | |||
| } | |||
| //我的-意见反馈 | |||
| @ApiOperation(value="我的-意见反馈", notes="我的-意见反馈") | |||
| @RequestMapping(value = "/addFeedback", method = {RequestMethod.POST}) | |||
| public Result<?> addFeedback(@RequestHeader("X-Access-Token") String token, AssessmentFeedback assessmentFeedback){ | |||
| return userInfoService.addFeedback(token, assessmentFeedback); | |||
| } | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.api.bean; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| @Data | |||
| public class PageBean { | |||
| /**显示条数*/ | |||
| @ApiModelProperty(value = "显示条数" ) | |||
| private Integer pageSize; | |||
| /**当前页*/ | |||
| @ApiModelProperty(value = "当前页" ) | |||
| private Integer pageNo; | |||
| public PageBean() { | |||
| this.pageNo = 1; | |||
| this.pageSize = 1000; | |||
| } | |||
| } | |||
| @ -0,0 +1,21 @@ | |||
| package org.jeecg.modules.api.service; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.assessmentBanner.entity.AssessmentBanner; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| public interface ConfigService { | |||
| //查询系统配置列表 | |||
| public Result<?> queryConfigList(PageBean pageBean); | |||
| //查询系统配置详情 | |||
| public Result<?> queryConfigByParamCode(String paramCode); | |||
| //首页-查询banner图列表 | |||
| public Result<?> queryBannerList(AssessmentBanner assessmentBanner, PageBean pageBean); | |||
| } | |||
| @ -0,0 +1,34 @@ | |||
| package org.jeecg.modules.api.service; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.assessmentAnswerLog.entity.AssessmentAnswerLog; | |||
| import org.jeecg.modules.assessmentPayLog.entity.AssessmentPayLog; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| public interface ExamService { | |||
| //查询题库列表 | |||
| public Result<?> queryCategoryList(PageBean pageBean); | |||
| //查询答题列表 | |||
| public Result<?> queryQuestionList(String token, String categories); | |||
| //测评-提交答案 | |||
| public Result<?> updateAnswer(String token, AssessmentAnswerLog assessmentAnswerLog); | |||
| //我的-我的答题 | |||
| public Result<?> queryExamLogList(String token, String isFinished, PageBean pageBean); | |||
| //测评-继续答题 | |||
| public Result<?> queryExamById(String token, String examId); | |||
| //支付-创建订单 | |||
| public Result<?> createOrder(String token, AssessmentPayLog assessmentPayLog); | |||
| //支付回调 | |||
| Object payOrderNotify(String requestBody); | |||
| } | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.api.service; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.bean.LoginReq; | |||
| public interface LoginApiService { | |||
| //小程序-微信授权登录接口 | |||
| public Result<?> login(LoginReq loginReq); | |||
| //绑定手机号码 | |||
| public Result<Object> bindPhone(String phoneCode); | |||
| } | |||
| @ -0,0 +1,22 @@ | |||
| package org.jeecg.modules.api.service; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.assessmentReportUser.entity.AssessmentReportUser; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| public interface ReportService { | |||
| //新增测评报告基本信息 | |||
| public Result<?> addReport(@RequestHeader("X-Access-Token") String token, AssessmentReportUser assessmentReportUser); | |||
| //查看报告列表 | |||
| public Result<?> queryReportList(@RequestHeader("X-Access-Token") String token, PageBean pageBean); | |||
| //查看报告详情 | |||
| public Result<?> queryReportById(@RequestHeader("X-Access-Token") String token, String batchNo); | |||
| } | |||
| @ -0,0 +1,26 @@ | |||
| package org.jeecg.modules.api.service; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.assessmentFeedback.entity.AssessmentFeedback; | |||
| import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| public interface UserInfoService { | |||
| //获取个人信息 | |||
| Result<?> queryUserInfo(String token); | |||
| //修改个人信息 | |||
| Result<?> updateUserInfo(String token, HanHaiMember member); | |||
| //咨询客服-常见问题列表 | |||
| public Result<?> queryFaqList(PageBean pageBean); | |||
| //我的-意见反馈 | |||
| public Result<?> addFeedback(@RequestHeader("X-Access-Token") String token, AssessmentFeedback assessmentFeedback); | |||
| } | |||
| @ -0,0 +1,132 @@ | |||
| package org.jeecg.modules.api.service.impl; | |||
| import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang.StringUtils; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.ConfigService; | |||
| import org.jeecg.modules.assessmentBanner.entity.AssessmentBanner; | |||
| import org.jeecg.modules.assessmentBanner.service.IAssessmentBannerService; | |||
| import org.jeecg.modules.assessmentConfig.entity.AssessmentConfig; | |||
| import org.jeecg.modules.assessmentConfig.service.IAssessmentConfigService; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.annotation.Resource; | |||
| @Service | |||
| @Slf4j | |||
| public class ConfigServiceImpl implements ConfigService { | |||
| /******************************************************************************************************************/ | |||
| //配置信息 | |||
| @Resource | |||
| private IAssessmentConfigService assessmentConfigService; | |||
| //轮播图信息 | |||
| @Resource | |||
| private IAssessmentBannerService assessmentBannerService; | |||
| /******************************************************************************************************************/ | |||
| //查询系统配置列表 | |||
| @Override | |||
| public Result<?> queryConfigList(PageBean pageBean) { | |||
| log.info("开始查询系统配置列表"); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //分页信息 | |||
| Page<AssessmentConfig> page = null; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentConfig> query = null; | |||
| //返回信息 | |||
| Page<AssessmentConfig> pageList = null; | |||
| try{ | |||
| //分页 | |||
| page = new Page<AssessmentConfig>(pageBean.getPageNo(), pageBean.getPageSize()); | |||
| query = assessmentConfigService | |||
| .lambdaQuery(); | |||
| //组装查询条件 | |||
| //按照创建时间降序排列 | |||
| query.orderByDesc(AssessmentConfig::getCreateTime); | |||
| //获取系统配置列表信息 | |||
| pageList = query.page(page); | |||
| log.info("系统配置查询结束"); | |||
| return Result.OK("系统配置列表", pageList); | |||
| }catch (Exception e){ | |||
| log.error("系统配置查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("系统配置列表查询失败"); | |||
| } | |||
| } | |||
| //查询系统配置详情 | |||
| @Override | |||
| public Result<?> queryConfigByParamCode(String paramCode) { | |||
| log.info("开始查询系统配置详情"); | |||
| //返回信息 | |||
| String massege = ""; | |||
| try{ | |||
| AssessmentConfig config = assessmentConfigService | |||
| .lambdaQuery() | |||
| .eq(AssessmentConfig::getParamCode, paramCode) | |||
| .one(); | |||
| log.info("系统配置详情查询结束"); | |||
| return Result.OK("配置详情", config); | |||
| }catch (Exception e){ | |||
| log.error("系统配置详情查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("配置详情查询失败"); | |||
| } | |||
| } | |||
| //首页-查询banner图列表 | |||
| @Override | |||
| public Result<?> queryBannerList(AssessmentBanner assessmentBanner, PageBean pageBean) { | |||
| log.info("开始查询轮播图列表"); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //分页信息 | |||
| Page<AssessmentBanner> page = null; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentBanner> query = null; | |||
| //返回信息 | |||
| Page<AssessmentBanner> pageList = null; | |||
| try{ | |||
| //分页 | |||
| page = new Page<AssessmentBanner>(pageBean.getPageNo(), pageBean.getPageSize()); | |||
| query = assessmentBannerService | |||
| .lambdaQuery(); | |||
| //组装查询条件 | |||
| if(StringUtils.isNotBlank(assessmentBanner.getTitle())){ | |||
| //标题 | |||
| query.like(AssessmentBanner::getTitle, assessmentBanner.getTitle()); | |||
| } | |||
| if(StringUtils.isNotBlank(assessmentBanner.getType())){ | |||
| //分类 | |||
| query.eq(AssessmentBanner::getType, assessmentBanner.getType()); | |||
| } | |||
| //按照排序编号升序排列 | |||
| query.orderByAsc(AssessmentBanner::getOrderNo); | |||
| //获取轮播图列表 | |||
| pageList = query.page(page); | |||
| log.info("轮播图列表查询结束"); | |||
| return Result.OK("轮播图列表", pageList); | |||
| }catch (Exception e){ | |||
| log.info("轮播图列表查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("轮播图列表查询失败"); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,414 @@ | |||
| package org.jeecg.modules.api.service.impl; | |||
| import com.baomidou.mybatisplus.core.toolkit.IdWorker; | |||
| import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang.StringUtils; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.config.shiro.ShiroRealm; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.ExamService; | |||
| import org.jeecg.modules.api.utils.CommonUtils; | |||
| import org.jeecg.modules.assessmentAnswerLog.entity.AssessmentAnswerLog; | |||
| import org.jeecg.modules.assessmentAnswerLog.service.IAssessmentAnswerLogService; | |||
| import org.jeecg.modules.assessmentCategory.entity.AssessmentCategory; | |||
| import org.jeecg.modules.assessmentCategory.service.IAssessmentCategoryService; | |||
| import org.jeecg.modules.assessmentConfig.entity.AssessmentConfig; | |||
| import org.jeecg.modules.assessmentExamLog.entity.AssessmentExamLog; | |||
| import org.jeecg.modules.assessmentExamLog.service.IAssessmentExamLogService; | |||
| import org.jeecg.modules.assessmentExamReport.entity.AssessmentExamReport; | |||
| import org.jeecg.modules.assessmentExamReport.service.IAssessmentExamReportService; | |||
| import org.jeecg.modules.assessmentPayLog.entity.AssessmentPayLog; | |||
| import org.jeecg.modules.assessmentPayLog.service.IAssessmentPayLogService; | |||
| import org.jeecg.modules.assessmentQuestion.entity.AssessmentAnswer; | |||
| import org.jeecg.modules.assessmentQuestion.entity.AssessmentQuestion; | |||
| import org.jeecg.modules.assessmentQuestion.service.IAssessmentAnswerService; | |||
| import org.jeecg.modules.assessmentQuestion.service.IAssessmentQuestionService; | |||
| import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; | |||
| import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; | |||
| import org.jeecg.modules.pay.MpWxPayService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.annotation.Resource; | |||
| import java.math.BigDecimal; | |||
| import java.util.*; | |||
| @Service | |||
| @Slf4j | |||
| public class ExamServiceImpl implements ExamService { | |||
| /******************************************************************************************************************/ | |||
| //支付接口 | |||
| @Autowired | |||
| private MpWxPayService mpWxPayService; | |||
| //权限验证 | |||
| @Resource | |||
| private ShiroRealm shiroRealm; | |||
| //用户信息 | |||
| @Resource | |||
| private IHanHaiMemberService hanHaiMemberService; | |||
| //题库信息 | |||
| @Resource | |||
| private IAssessmentCategoryService assessmentCategoryService; | |||
| //题库题目信息 | |||
| @Resource | |||
| private IAssessmentQuestionService assessmentQuestionService; | |||
| //题目答案信息 | |||
| @Resource | |||
| private IAssessmentAnswerService assessmentAnswerService; | |||
| //用户测评答题记录信息 | |||
| @Resource | |||
| private IAssessmentExamLogService assessmentExamLogService; | |||
| //用户测评答案记录信息 | |||
| @Resource | |||
| private IAssessmentAnswerLogService assessmentAnswerLogService; | |||
| //用户测评答案记录信息 | |||
| @Resource | |||
| private IAssessmentExamReportService assessmentExamReportService; | |||
| //支付记录信息 | |||
| @Resource | |||
| private IAssessmentPayLogService assessmentPayLogService; | |||
| /******************************************************************************************************************/ | |||
| //查询题库列表 | |||
| @Override | |||
| public Result<?> queryCategoryList(PageBean pageBean) { | |||
| log.info("开始查询题库列表"); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //分页信息 | |||
| Page<AssessmentCategory> page = null; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentCategory> query = null; | |||
| //返回信息 | |||
| Page<AssessmentCategory> pageList = null; | |||
| try{ | |||
| //分页 | |||
| page = new Page<AssessmentCategory>(pageBean.getPageNo(), pageBean.getPageSize()); | |||
| query = assessmentCategoryService | |||
| .lambdaQuery(); | |||
| //组装查询条件 | |||
| //按照创建时间降序排列 | |||
| query.orderByDesc(AssessmentCategory::getCreateTime); | |||
| //获取题库列表信息 | |||
| pageList = query.page(page); | |||
| log.info("题库查询结束"); | |||
| return Result.OK("题库列表", pageList); | |||
| }catch (Exception e){ | |||
| log.error("题库查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("题库列表查询失败"); | |||
| } | |||
| } | |||
| //查询答题列表 | |||
| @Override | |||
| public Result<?> queryQuestionList(String token, String categories) { | |||
| log.info("开始查询答题列表"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentQuestion> query = null; | |||
| //返回信息 | |||
| Map<String, Object> map = new HashedMap(); | |||
| List<AssessmentQuestion> pageList = null; | |||
| try{ | |||
| query = assessmentQuestionService.lambdaQuery(); | |||
| //组装查询条件 | |||
| //所属题库 | |||
| if(StringUtils.isNotEmpty(categories)){ | |||
| String[] categoryList = categories.split(";"); | |||
| List<String> ids = Arrays.asList(categoryList); | |||
| query.in(AssessmentQuestion::getCategoryId, ids); | |||
| } | |||
| //随机排列 | |||
| query.orderByDesc(AssessmentQuestion::getCreateTime); | |||
| //获取答题列表列表信息 | |||
| pageList = query.list(); | |||
| //题目答案 | |||
| for (AssessmentQuestion assessmentQuestion : pageList) { | |||
| List<AssessmentAnswer> answerList = assessmentAnswerService.lambdaQuery().eq(AssessmentAnswer::getQuestionId, assessmentQuestion.getId()).list(); | |||
| assessmentQuestion.setAnswerList(answerList); | |||
| } | |||
| //随机排序 | |||
| Collections.shuffle(pageList); | |||
| map.put("pageList", pageList); | |||
| String batchNo = IdWorker.getIdStr();//生成批次标识 | |||
| map.put("batchNo", batchNo); | |||
| //生成用户测评答题记录 | |||
| AssessmentExamLog assessmentExamLog = new AssessmentExamLog(); | |||
| assessmentExamLog.setBatchNo(batchNo);//批次标识 | |||
| assessmentExamLog.setAllNum(pageList.size()); | |||
| assessmentExamLog.setFinishNum(0); | |||
| assessmentExamLog.setRemainNum(pageList.size()); | |||
| assessmentExamLog.setUserId(hanHaiMember.getId()); | |||
| boolean result1 = assessmentExamLogService.save(assessmentExamLog); | |||
| if(!result1){ | |||
| return Result.error("生成用户测评答题记录失败"); | |||
| } | |||
| //生成用户测评答案记录 | |||
| List<AssessmentAnswerLog> assessmentAnswerLogList = new ArrayList<>(); | |||
| for (AssessmentQuestion assessmentQuestion : pageList) { | |||
| AssessmentAnswerLog assessmentAnswerLog = new AssessmentAnswerLog(); | |||
| assessmentAnswerLog.setBatchNo(batchNo); | |||
| assessmentAnswerLog.setQuestionId(assessmentQuestion.getId()); | |||
| assessmentAnswerLog.setUserId(hanHaiMember.getId()); | |||
| assessmentAnswerLogList.add(assessmentAnswerLog); | |||
| } | |||
| boolean result2 = assessmentAnswerLogService.saveBatch(assessmentAnswerLogList); | |||
| if(!result2){ | |||
| return Result.error("生成用户测评答案记录失败"); | |||
| } | |||
| log.info("答题列表查询结束"); | |||
| return Result.OK("答题列表列表", map); | |||
| }catch (Exception e){ | |||
| log.error("答题列表查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("答题列表列表查询失败"); | |||
| } | |||
| } | |||
| //测评-提交答案 | |||
| @Override | |||
| public Result<?> updateAnswer(String token, AssessmentAnswerLog assessmentAnswerLog) { | |||
| log.info("开始修改用户测评答案记录"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);//小程序权限验证 | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| try{ | |||
| //修改用户测评答案记录 | |||
| boolean result = assessmentAnswerLogService | |||
| .lambdaUpdate() | |||
| .eq(AssessmentAnswerLog::getBatchNo, assessmentAnswerLog.getBatchNo()) | |||
| .eq(AssessmentAnswerLog::getQuestionId, assessmentAnswerLog.getQuestionId()) | |||
| .eq(AssessmentAnswerLog::getUserId, hanHaiMember.getId()) | |||
| .set(AssessmentAnswerLog::getAnswerId, assessmentAnswerLog.getAnswerId()) | |||
| .update(); | |||
| if(!result){ | |||
| return Result.error("答题失败"); | |||
| } | |||
| //修改用户测评答题记录 | |||
| AssessmentExamLog assessmentExamLog = assessmentExamLogService | |||
| .lambdaQuery() | |||
| .eq(AssessmentExamLog::getBatchNo, assessmentAnswerLog.getBatchNo()) | |||
| .eq(AssessmentExamLog::getUserId, hanHaiMember.getId()) | |||
| .one(); | |||
| int newFinishNum = assessmentExamLog.getFinishNum() + 1; | |||
| int newRemainNum = assessmentExamLog.getRemainNum() - 1; | |||
| assessmentExamLog.setFinishNum(newFinishNum); | |||
| assessmentExamLog.setRemainNum(newRemainNum); | |||
| assessmentExamLogService.updateById(assessmentExamLog); | |||
| return Result.OK("操作成功"); | |||
| }catch (Exception e){ | |||
| e.printStackTrace(); | |||
| return Result.error("操作失败"); | |||
| } | |||
| } | |||
| //我的-我的答题 | |||
| @Override | |||
| public Result<?> queryExamLogList(String token, String isFinished, PageBean pageBean) { | |||
| log.info("开始查询答题列表"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);//小程序权限验证 | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //分页信息 | |||
| Page<AssessmentExamLog> page = null; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentExamLog> query = null; | |||
| //返回信息 | |||
| Page<AssessmentExamLog> pageList = null; | |||
| try{ | |||
| //分页 | |||
| page = new Page<AssessmentExamLog>(pageBean.getPageNo(), pageBean.getPageSize()); | |||
| query = assessmentExamLogService | |||
| .lambdaQuery(); | |||
| //组装查询条件 | |||
| //关联用户 | |||
| query.eq(AssessmentExamLog::getUserId, hanHaiMember.getId()); | |||
| if(StringUtils.isNotEmpty(isFinished)){ | |||
| if("0".equals(isFinished)){ | |||
| query.eq(AssessmentExamLog::getFinishNum, 0); | |||
| }else { | |||
| query.notIn(AssessmentExamLog::getFinishNum, 0); | |||
| } | |||
| } | |||
| //随机排列 | |||
| query.orderByDesc(AssessmentExamLog::getCreateTime); | |||
| //获取答题列表列表信息 | |||
| pageList = query.page(page); | |||
| log.info("答题列表查询结束"); | |||
| return Result.OK("答题列表", pageList); | |||
| }catch (Exception e){ | |||
| log.error("答题列表查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("答题列表查询失败"); | |||
| } | |||
| } | |||
| //测评-继续答题 | |||
| @Override | |||
| public Result<?> queryExamById(String token, String examId) { | |||
| log.info("开始查询答题列表"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentQuestion> query = null; | |||
| //返回信息 | |||
| Map<String, Object> map = new HashedMap(); | |||
| List<AssessmentQuestion> pageList = null; | |||
| try{ | |||
| //1、查看答题记录 | |||
| if(StringUtils.isEmpty(examId)){ | |||
| return Result.error("答题记录id不能为空"); | |||
| } | |||
| AssessmentExamLog assessmentExamLog = assessmentExamLogService.getById(examId); | |||
| if(null == assessmentExamLog){ | |||
| return Result.error("答题记录不存在,请检查传入id"); | |||
| } | |||
| map.put("batchNo", assessmentExamLog.getBatchNo()); | |||
| //1、查看答案记录 | |||
| List<String> questionIds = new ArrayList<>(); | |||
| List<AssessmentAnswerLog> assessmentAnswerLogList = assessmentAnswerLogService | |||
| .lambdaQuery() | |||
| .eq(AssessmentAnswerLog::getBatchNo, assessmentExamLog.getBatchNo()) | |||
| .eq(AssessmentAnswerLog::getUserId, hanHaiMember.getId()) | |||
| .isNull(AssessmentAnswerLog::getAnswerId) | |||
| .list(); | |||
| for (AssessmentAnswerLog assessmentAnswerLog : assessmentAnswerLogList) { | |||
| questionIds.add(assessmentAnswerLog.getQuestionId()); | |||
| } | |||
| query = assessmentQuestionService.lambdaQuery(); | |||
| //组装查询条件 | |||
| //未答完的题目 | |||
| query.in(AssessmentQuestion::getId, questionIds); | |||
| //随机排列 | |||
| query.orderByDesc(AssessmentQuestion::getCreateTime); | |||
| //获取答题列表列表信息 | |||
| pageList = query.list(); | |||
| //题目答案 | |||
| for (AssessmentQuestion assessmentQuestion : pageList) { | |||
| List<AssessmentAnswer> answerList = assessmentAnswerService.lambdaQuery().eq(AssessmentAnswer::getQuestionId, assessmentQuestion.getId()).list(); | |||
| assessmentQuestion.setAnswerList(answerList); | |||
| } | |||
| //随机排序 | |||
| Collections.shuffle(pageList); | |||
| map.put("pageList", pageList); | |||
| log.info("答题列表查询结束"); | |||
| return Result.OK("答题列表", map); | |||
| }catch (Exception e){ | |||
| log.error("答题列表查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("答题列表查询失败"); | |||
| } | |||
| } | |||
| //支付-创建订单 | |||
| @Override | |||
| public Result<?> createOrder(String token, AssessmentPayLog assessmentPayLog) { | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);//小程序权限验证 | |||
| try{ | |||
| //订单信息 | |||
| String payNo = IdWorker.getIdStr();//生成订单号 | |||
| assessmentPayLog.setId(payNo); | |||
| assessmentPayLog.setUserId(hanHaiMember.getId()); | |||
| //创建订单 | |||
| assessmentPayLogService.save(assessmentPayLog); | |||
| //订单支付 | |||
| //吊起微信支付 | |||
| BigDecimal price = assessmentPayLog.getPayAmount();//价格 | |||
| String s = price.multiply(new BigDecimal(100)).toString(); | |||
| int i1 = Double.valueOf(s).intValue(); | |||
| Object appOrder = mpWxPayService.createOrder( | |||
| "购买"+ "测评报告:" + assessmentPayLog.getBatchNo(), | |||
| "127.0.0.1", | |||
| assessmentPayLog.getId(), | |||
| i1, | |||
| assessmentPayLog.getId(), | |||
| hanHaiMember.getAppletOpenid(), //用户openid(小程序) | |||
| assessmentPayLog.toString()); | |||
| return Result.OK("支付成功",appOrder); | |||
| }catch (Exception e){ | |||
| e.printStackTrace(); | |||
| return Result.error("支付失败"); | |||
| } | |||
| } | |||
| //订单支付回调 | |||
| public Result<?> payOrderNotify(String requestBody){ | |||
| WxPayOrderNotifyResult notify = mpWxPayService.notify(requestBody); | |||
| String outTradeNo = notify.getOutTradeNo(); | |||
| log.info("支付回调订单号码:"+outTradeNo); | |||
| try{ | |||
| //查询订单信息 | |||
| AssessmentPayLog assessmentPayLog = assessmentPayLogService.getById(outTradeNo); | |||
| //如果订单存在则修改订单状态 | |||
| if (null != assessmentPayLog){ | |||
| if("0".equals(assessmentPayLog.getStatus())){ | |||
| assessmentPayLog.setStatus("1");//订单状态 | |||
| assessmentPayLog.setPayTime(CommonUtils.getCurrentTime());//订单支付时间 | |||
| assessmentPayLogService.updateById(assessmentPayLog); | |||
| } | |||
| } | |||
| }catch (Exception e){ | |||
| log.info("支付回调失败,订单号码:"+outTradeNo); | |||
| e.printStackTrace(); | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @ -0,0 +1,174 @@ | |||
| package org.jeecg.modules.api.service.impl; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.constant.CommonConstant; | |||
| import org.jeecg.common.exception.JeecgBootException; | |||
| import org.jeecg.common.system.util.JwtUtil; | |||
| import org.jeecg.common.util.RedisUtil; | |||
| import org.jeecg.modules.api.service.LoginApiService; | |||
| import org.jeecg.modules.bean.HttpConf; | |||
| import org.jeecg.modules.bean.LoginReq; | |||
| import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; | |||
| import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.annotation.Resource; | |||
| import java.io.BufferedReader; | |||
| import java.io.DataOutputStream; | |||
| import java.io.InputStreamReader; | |||
| import java.net.HttpURLConnection; | |||
| import java.net.URL; | |||
| import java.nio.charset.StandardCharsets; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @Service | |||
| @Slf4j | |||
| public class LoginApiServiceImpl implements LoginApiService { | |||
| /******************************************************************************************************************/ | |||
| //微信小程序appid(易税通财税风险检测) | |||
| private static final String mpAppId = "wxb7de5370f825e878"; | |||
| //微信小程序appSecret(易税通财税风险检测) | |||
| private static final String mpAppSecret = "fc9eb58b33fd3b34074417d892e59e6f"; | |||
| @Resource | |||
| private RedisUtil redisUtil; | |||
| @Resource | |||
| private IHanHaiMemberService hanHaiMemberService; | |||
| @Resource | |||
| private HttpConf httpConf; | |||
| /******************************************************************************************************************/ | |||
| @Override | |||
| public Result<?> login(LoginReq loginReq) { | |||
| Result<Object> result = new Result<>(); | |||
| Map<String, Object> map = new HashMap<>(); | |||
| if (StringUtils.isBlank(loginReq.getCode())) { | |||
| throw new JeecgBootException("小程序code为空"); | |||
| } | |||
| String loginUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=" + mpAppId + "&secret=" + mpAppSecret+ "&js_code=" + loginReq.getCode() + "&grant_type=authorization_code"; | |||
| //使用工具类 | |||
| JSONObject json_test = httpConf.getJSONObject(loginUrl); | |||
| String wxOpenid = json_test.getString("openid"); | |||
| String sessionKey = json_test.getString("session_key"); | |||
| if (StringUtils.isBlank(wxOpenid)) { | |||
| throw new JeecgBootException("未获取到openid"); | |||
| } | |||
| HanHaiMember member = hanHaiMemberService.lambdaQuery().eq(HanHaiMember::getAppletOpenid,wxOpenid).one(); | |||
| if (member == null) { | |||
| //如果user等于null说明该用户第一次登录,数据库没有该用户信息。 | |||
| loginReq.setOpenid(wxOpenid); | |||
| loginReq.setSession_key(sessionKey); | |||
| member = new HanHaiMember(); | |||
| // member.setSesssionKey(sessionKey); | |||
| member.setAppletOpenid(wxOpenid); | |||
| member.setNickName(loginReq.getNickName()); | |||
| member.setHeadImage(loginReq.getHeadimgurl()); | |||
| // 生成token返回给小程序端 | |||
| String token = JwtUtil.sign(member.getAppletOpenid(), wxOpenid); | |||
| hanHaiMemberService.save(member); | |||
| redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token); | |||
| // 设置超时时间 | |||
| redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 100); | |||
| map.put("userInfo", member); | |||
| map.put("token", token); | |||
| result.setCode(200); | |||
| result.setResult(map); | |||
| return result; | |||
| } else { | |||
| // member.setHeadImage(loginReq.getHeadimgurl()); | |||
| // member.setSessionKey(sessionKey); | |||
| // memberService.saveOrUpdate(member); | |||
| // 生成token返回给小程序端 | |||
| String token = JwtUtil.sign(member.getAppletOpenid(), wxOpenid); | |||
| redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token); | |||
| // 设置超时时间 | |||
| redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 100); | |||
| map.put("userInfo", member); | |||
| map.put("token", token); | |||
| //用户id做im账号 | |||
| result.setResult(map); | |||
| result.setCode(200); | |||
| // result.setMessage(member.getNickName()+"已于"+member.getCreateTime()+"注册成功!请勿重复注册!"); | |||
| // // 未绑定手机号,跳转授权绑定手机号 | |||
| // if (StringUtils.isBlank(member.getPhone())) { | |||
| // result.setMessage("该微信用户尚未绑定手机号,请授权手机进行绑定"); | |||
| // result.setCode(905); | |||
| // result.setResult(map); | |||
| // return result; | |||
| // } | |||
| } | |||
| return result; | |||
| } | |||
| @Override | |||
| public Result<Object> bindPhone(String phoneCode) { | |||
| try { | |||
| String phoneNumber = this.getPhoneNumber(phoneCode); | |||
| return Result.OK(phoneNumber); | |||
| }catch (Exception e){ | |||
| return Result.error(e.getMessage()); | |||
| } | |||
| } | |||
| private static final String API_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber"; | |||
| public String getPhoneNumber(String code) throws Exception { | |||
| URL url = new URL(API_URL + "?access_token=" + this.getAccessToken()); | |||
| HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |||
| conn.setRequestMethod("POST"); | |||
| conn.setRequestProperty("Content-Type", "application/json; utf-8"); | |||
| conn.setRequestProperty("Accept", "application/json"); | |||
| conn.setDoOutput(true); | |||
| JSONObject jsonInput = new JSONObject(); | |||
| jsonInput.put("code", code); | |||
| try (DataOutputStream os = new DataOutputStream(conn.getOutputStream())) { | |||
| byte[] input = jsonInput.toString().getBytes(StandardCharsets.UTF_8); | |||
| os.write(input, 0, input.length); | |||
| } | |||
| try (BufferedReader br = new BufferedReader( | |||
| new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) { | |||
| StringBuilder response = new StringBuilder(); | |||
| String responseLine; | |||
| while ((responseLine = br.readLine()) != null) { | |||
| response.append(responseLine.trim()); | |||
| } | |||
| //获取手机号码 | |||
| return response.toString(); | |||
| } | |||
| } | |||
| private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"; | |||
| public String getAccessToken() throws Exception { | |||
| String requestUrl = String.format(TOKEN_URL, mpAppId, mpAppSecret); | |||
| URL url = new URL(requestUrl); | |||
| HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |||
| conn.setRequestMethod("GET"); | |||
| try (BufferedReader br = new BufferedReader( | |||
| new InputStreamReader(conn.getInputStream(), "UTF-8"))) { | |||
| StringBuilder response = new StringBuilder(); | |||
| String responseLine; | |||
| while ((responseLine = br.readLine()) != null) { | |||
| response.append(responseLine.trim()); | |||
| } | |||
| org.json.JSONObject jsonResponse = new org.json.JSONObject(response.toString()); | |||
| return jsonResponse.getString("access_token"); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,246 @@ | |||
| package org.jeecg.modules.api.service.impl; | |||
| import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang.StringUtils; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.config.shiro.ShiroRealm; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.ReportService; | |||
| import org.jeecg.modules.api.utils.CommonUtils; | |||
| import org.jeecg.modules.assessmentAnswerLog.entity.AssessmentAnswerLog; | |||
| import org.jeecg.modules.assessmentAnswerLog.service.IAssessmentAnswerLogService; | |||
| import org.jeecg.modules.assessmentExamReport.entity.AssessmentExamReport; | |||
| import org.jeecg.modules.assessmentExamReport.service.IAssessmentExamReportService; | |||
| import org.jeecg.modules.assessmentPayLog.entity.AssessmentPayLog; | |||
| import org.jeecg.modules.assessmentPayLog.service.IAssessmentPayLogService; | |||
| import org.jeecg.modules.assessmentQuestion.entity.AssessmentAnswer; | |||
| import org.jeecg.modules.assessmentQuestion.service.IAssessmentAnswerService; | |||
| import org.jeecg.modules.assessmentReportUser.entity.AssessmentReportUser; | |||
| import org.jeecg.modules.assessmentReportUser.service.IAssessmentReportUserService; | |||
| import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; | |||
| import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.annotation.Resource; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| @Slf4j | |||
| public class ReportServiceImpl implements ReportService { | |||
| /******************************************************************************************************************/ | |||
| //权限验证 | |||
| @Resource | |||
| private ShiroRealm shiroRealm; | |||
| //用户信息 | |||
| @Resource | |||
| private IHanHaiMemberService hanHaiMemberService; | |||
| //测评报告用户基本信息 | |||
| @Resource | |||
| private IAssessmentReportUserService assessmentReportUserService; | |||
| //用户测评报告信息 | |||
| @Resource | |||
| private IAssessmentExamReportService assessmentExamReportService; | |||
| //支付记录信息 | |||
| @Resource | |||
| private IAssessmentPayLogService assessmentPayLogService; | |||
| //用户测评答案记录 | |||
| @Resource | |||
| private IAssessmentAnswerLogService assessmentAnswerLogService; | |||
| //题目答案信息 | |||
| @Resource | |||
| private IAssessmentAnswerService assessmentAnswerService; | |||
| /******************************************************************************************************************/ | |||
| //新增测评报告基本信息 | |||
| @Override | |||
| public Result<?> addReport(String token, AssessmentReportUser assessmentReportUser) { | |||
| log.info("开始新增测评报告基本信息"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| try{ | |||
| //新增测评报告基本信息 | |||
| assessmentReportUser.setUserId(hanHaiMember.getId()); | |||
| String title = CommonUtils.getCurrentDate() + assessmentReportUser.getCompany() + "风险测评报告"; | |||
| assessmentReportUser.setTitle(title); | |||
| boolean result = assessmentReportUserService.save(assessmentReportUser); | |||
| //生成报告信息 | |||
| mergeReport(assessmentReportUser.getBatchNo(), hanHaiMember.getId()); | |||
| if(result){ | |||
| log.info("新增成功"); | |||
| return Result.OK("新增成功"); | |||
| }else { | |||
| log.info("新增失败"); | |||
| return Result.error("新增失败"); | |||
| } | |||
| }catch (Exception e){ | |||
| log.info("新增失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("新增失败"); | |||
| } | |||
| } | |||
| //查看报告列表 | |||
| @Override | |||
| public Result<?> queryReportList(String token, PageBean pageBean) { | |||
| log.info("开始查询测评报告列表"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //分页信息 | |||
| Page<AssessmentReportUser> page = null; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentReportUser> query = null; | |||
| //返回信息 | |||
| Page<AssessmentReportUser> pageList = null; | |||
| try{ | |||
| //分页 | |||
| page = new Page<AssessmentReportUser>(pageBean.getPageNo(), pageBean.getPageSize()); | |||
| query = assessmentReportUserService | |||
| .lambdaQuery(); | |||
| //组装查询条件 | |||
| //所属用户 | |||
| query.eq(AssessmentReportUser::getUserId, hanHaiMember.getId()); | |||
| //支付状态 | |||
| //query.eq(AssessmentPayLog::getStatus, "1"); | |||
| //按照创建时间降序排列 | |||
| query.orderByDesc(AssessmentReportUser::getCreateTime); | |||
| //获取测评报告列表信息 | |||
| pageList = query.page(page); | |||
| log.info("测评报告列表查询结束"); | |||
| return Result.OK("测评报告列表", pageList); | |||
| }catch (Exception e){ | |||
| log.error("测评报告列表查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("测评报告列表查询失败"); | |||
| } | |||
| } | |||
| //查看报告详情 | |||
| @Override | |||
| public Result<?> queryReportById(String token, String batchNo) { | |||
| log.info("开始查询测评报告详情"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentExamReport> query = null; | |||
| //返回信息 | |||
| List<AssessmentExamReport> pageList = null; | |||
| Map map = new HashedMap(); | |||
| try{ | |||
| //分页 | |||
| query = assessmentExamReportService | |||
| .lambdaQuery(); | |||
| //组装查询条件 | |||
| //批次编号 | |||
| query.eq(AssessmentExamReport::getBatchNo, batchNo); | |||
| //所属用户 | |||
| query.eq(AssessmentExamReport::getUserId, hanHaiMember.getId()); | |||
| //按照创建时间降序排列 | |||
| query.orderByDesc(AssessmentExamReport::getCreateTime); | |||
| //获取测评报告列表详情 | |||
| pageList = query.list(); | |||
| map.put("pageList", pageList); | |||
| //风险等级数量 | |||
| long level0Num = assessmentExamReportService.lambdaQuery().eq(AssessmentExamReport::getUserId, hanHaiMember.getId()).eq(AssessmentExamReport::getLevel, "0").count(); | |||
| long level1Num = assessmentExamReportService.lambdaQuery().eq(AssessmentExamReport::getUserId, hanHaiMember.getId()).eq(AssessmentExamReport::getLevel, "1").count(); | |||
| long level2Num = assessmentExamReportService.lambdaQuery().eq(AssessmentExamReport::getUserId, hanHaiMember.getId()).eq(AssessmentExamReport::getLevel, "2").count(); | |||
| long level3Num = assessmentExamReportService.lambdaQuery().eq(AssessmentExamReport::getUserId, hanHaiMember.getId()).eq(AssessmentExamReport::getLevel, "3").count(); | |||
| map.put("level0Num", level0Num); | |||
| map.put("level1Num", level1Num); | |||
| map.put("level2Num", level2Num); | |||
| map.put("level3Num", level3Num); | |||
| map.put("levelAllNum", pageList.size()); | |||
| //测评报告标题 | |||
| AssessmentReportUser report = assessmentReportUserService.lambdaQuery().eq(AssessmentReportUser::getBatchNo, batchNo).eq(AssessmentReportUser::getUserId, hanHaiMember.getId()).one(); | |||
| String title = report.getTitle(); | |||
| map.put("title", title); | |||
| log.info("测评报告查询结束"); | |||
| return Result.OK("测评报告详情", map); | |||
| }catch (Exception e){ | |||
| log.error("测评报告查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("测评报告详情查询失败"); | |||
| } | |||
| } | |||
| //生成测评报告 | |||
| public void mergeReport(String batchNo, String userId){ | |||
| try{ | |||
| //查询答题记录 | |||
| List<AssessmentAnswerLog> assessmentAnswerLogList = assessmentAnswerLogService | |||
| .lambdaQuery() | |||
| .eq(AssessmentAnswerLog::getBatchNo, batchNo) | |||
| .eq(AssessmentAnswerLog::getUserId, userId) | |||
| .list(); | |||
| //获取答案id | |||
| List<String> answerIds = new ArrayList<>(); | |||
| if(assessmentAnswerLogList.size() > 0){ | |||
| for (AssessmentAnswerLog assessmentAnswerLog : assessmentAnswerLogList) { | |||
| answerIds.add(assessmentAnswerLog.getAnswerId()); | |||
| } | |||
| } | |||
| //获取答案信息 | |||
| List<AssessmentAnswer> answerList = assessmentAnswerService | |||
| .lambdaQuery() | |||
| .in(AssessmentAnswer::getId, answerIds) | |||
| .list(); | |||
| //生成测评报告 | |||
| List<AssessmentExamReport> reportList = new ArrayList<>(); | |||
| for (AssessmentAnswer assessmentAnswer : answerList) { | |||
| AssessmentExamReport report = new AssessmentExamReport(); | |||
| report.setBatchNo(batchNo); | |||
| report.setRisk(assessmentAnswer.getRisk()); | |||
| report.setReason(assessmentAnswer.getReason()); | |||
| report.setLevel(assessmentAnswer.getLevel()); | |||
| report.setConsequence(assessmentAnswer.getConsequence()); | |||
| report.setUserId(userId); | |||
| reportList.add(report); | |||
| } | |||
| boolean result = assessmentExamReportService.saveBatch(reportList); | |||
| if(!result){ | |||
| log.info("测评报告生成失败"); | |||
| } | |||
| }catch (Exception e){ | |||
| e.printStackTrace(); | |||
| log.info("测评报告生成失败"); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,169 @@ | |||
| package org.jeecg.modules.api.service.impl; | |||
| import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang.StringUtils; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.config.shiro.ShiroRealm; | |||
| import org.jeecg.modules.api.bean.PageBean; | |||
| import org.jeecg.modules.api.service.UserInfoService; | |||
| import org.jeecg.modules.assessmentFaq.entity.AssessmentFaq; | |||
| import org.jeecg.modules.assessmentFaq.service.IAssessmentFaqService; | |||
| import org.jeecg.modules.assessmentFeedback.entity.AssessmentFeedback; | |||
| import org.jeecg.modules.assessmentFeedback.service.IAssessmentFeedbackService; | |||
| import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; | |||
| import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.annotation.Resource; | |||
| @Service | |||
| @Slf4j | |||
| public class UserInfoServiceImpl implements UserInfoService { | |||
| /******************************************************************************************************************/ | |||
| //权限验证 | |||
| @Resource | |||
| private ShiroRealm shiroRealm; | |||
| //用户信息 | |||
| @Resource | |||
| private IHanHaiMemberService hanHaiMemberService; | |||
| //常见问题 | |||
| @Resource | |||
| private IAssessmentFaqService assessmentFaqService; | |||
| //常见问题 | |||
| @Resource | |||
| private IAssessmentFeedbackService assessmentFeedbackService; | |||
| /******************************************************************************************************************/ | |||
| //查询个人信息 | |||
| @Override | |||
| public Result<?> queryUserInfo(String token){ | |||
| log.info("开始查询个人信息"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| try{ | |||
| log.info("个人信息获取成功"); | |||
| return Result.OK("个人信息", hanHaiMember); | |||
| }catch (Exception e){ | |||
| e.printStackTrace(); | |||
| return Result.error("个人信息获取失败", hanHaiMember); | |||
| } | |||
| } | |||
| //修改个人信息 | |||
| @Override | |||
| public Result<?> updateUserInfo(String token, HanHaiMember member){ | |||
| log.info("开始修改个人信息"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| try{ | |||
| //用户昵称不能为空 | |||
| if(StringUtils.isBlank(member.getNickName())){ | |||
| log.error("用户昵称不能为空"); | |||
| return Result.error("用户昵称不能为空"); | |||
| } | |||
| if(StringUtils.isBlank(member.getNickName())){ | |||
| log.error("头像不能为空"); | |||
| return Result.error("头像不能为空"); | |||
| } | |||
| if(StringUtils.isNotEmpty(member.getPhone())){ | |||
| HanHaiMember one = hanHaiMemberService | |||
| .lambdaQuery() | |||
| .eq(HanHaiMember::getPhone, member.getPhone()) | |||
| .ne(HanHaiMember::getId, hanHaiMember.getId()) | |||
| .one(); | |||
| if(null != one){ | |||
| return Result.error("该号码已经有人使用,不能重复填写"); | |||
| } | |||
| } | |||
| hanHaiMember.setNickName(member.getNickName()); | |||
| hanHaiMember.setPhone(member.getPhone()); | |||
| hanHaiMember.setHeadImage(member.getHeadImage()); | |||
| boolean result = hanHaiMemberService.updateById(hanHaiMember); | |||
| if(result){ | |||
| log.info("个人信息修改成功"); | |||
| return Result.OK("个人信息修改成功"); | |||
| }else { | |||
| log.info("个人信息修改失败"); | |||
| return Result.error("个人信息修改失败"); | |||
| } | |||
| }catch (Exception e){ | |||
| log.info("个人信息修改失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("个人信息修改失败"); | |||
| } | |||
| } | |||
| //客服咨询-常见问题 | |||
| @Override | |||
| public Result<?> queryFaqList(PageBean pageBean) { | |||
| log.info("开始查询系统配置列表"); | |||
| //返回信息 | |||
| String massege = ""; | |||
| //分页信息 | |||
| Page<AssessmentFaq> page = null; | |||
| //查询信息 | |||
| LambdaQueryChainWrapper<AssessmentFaq> query = null; | |||
| //返回信息 | |||
| Page<AssessmentFaq> pageList = null; | |||
| try{ | |||
| //分页 | |||
| page = new Page<AssessmentFaq>(pageBean.getPageNo(), pageBean.getPageSize()); | |||
| query = assessmentFaqService | |||
| .lambdaQuery(); | |||
| //组装查询条件 | |||
| //按照创建时间降序排列 | |||
| query.orderByAsc(AssessmentFaq::getOrderNo); | |||
| //获取系统配置列表信息 | |||
| pageList = query.page(page); | |||
| log.info("系统配置查询结束"); | |||
| return Result.OK("系统配置列表", pageList); | |||
| }catch (Exception e){ | |||
| log.error("系统配置查询失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("系统配置列表查询失败"); | |||
| } | |||
| } | |||
| //意见反馈 | |||
| @Override | |||
| public Result<?> addFeedback(String token, AssessmentFeedback assessmentFeedback) { | |||
| log.info("开始提交意见反馈"); | |||
| //权限验证 | |||
| HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
| //HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); | |||
| try{ | |||
| assessmentFeedback.setUserId(hanHaiMember.getId()); | |||
| boolean result = assessmentFeedbackService.save(assessmentFeedback); | |||
| if(result){ | |||
| log.info("意见反馈提交成功"); | |||
| return Result.OK("意见反馈提交成功"); | |||
| }else { | |||
| log.info("意见反馈提交失败"); | |||
| return Result.error("意见反馈提交失败"); | |||
| } | |||
| }catch (Exception e){ | |||
| log.info("意见反馈提交失败"); | |||
| e.printStackTrace(); | |||
| return Result.error("意见反馈提交失败"); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,45 @@ | |||
| package org.jeecg.modules.api.utils; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| public class CommonUtils { | |||
| //获取当前时间 | |||
| public static Date getCurrentTime(){ | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| Date now = new Date(); | |||
| String formattedDate = sdf.format(now); | |||
| // System.out.println(now); // 输出格式化后的当前时间 | |||
| // System.out.println(formattedDate); // 输出格式化后的当前时间 | |||
| return now; | |||
| } | |||
| //获取当前日期 | |||
| public static String getCurrentDate(){ | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); | |||
| Date now = new Date(); | |||
| String formattedDate = sdf.format(now); | |||
| // System.out.println(now); // 输出格式化后的当前时间 | |||
| // System.out.println(formattedDate); // 输出格式化后的当前时间 | |||
| return formattedDate; | |||
| } | |||
| //获取延长时间 | |||
| public static Date getValidTime(Date oldTime, int month){ | |||
| // 创建Calendar实例 | |||
| Calendar cal = Calendar.getInstance(); | |||
| cal.setTime(oldTime); // 设置当前时间 | |||
| // 在当前时间基础上加n个月 | |||
| cal.add(Calendar.MONTH, month); | |||
| Date newTime = cal.getTime(); | |||
| return newTime; | |||
| } | |||
| public static void main(String[] args) { | |||
| System.out.println(getValidTime(getCurrentTime(), 3)); | |||
| } | |||
| } | |||