Browse Source

1、支付后未获取报告,再次获取需要重复支付问题修复

2、补充图片转base64接口
master
Aug 1 week ago
parent
commit
e4fa123d45
14 changed files with 254 additions and 10 deletions
  1. +1
    -1
      admin-hanhai-vue/src/views/assessmentCode/AssessmentCodeList.vue
  2. +7
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentExamLog/entity/AssessmentExamLog.java
  3. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/controller/AssessmentFeedbackController.java
  4. +6
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/entity/AssessmentFeedback.java
  5. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/mapper/AssessmentFeedbackMapper.java
  6. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/service/IAssessmentFeedbackService.java
  7. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/service/impl/AssessmentFeedbackServiceImpl.java
  8. +26
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/vue/AssessmentFeedbackList.vue
  9. +5
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/vue/modules/AssessmentFeedbackForm.vue
  10. +28
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/vue3/AssessmentFeedback.data.ts
  11. +15
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/assessmentController/ConfigController.java
  12. +7
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java
  13. +123
    -4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java
  14. +32
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ExamServiceImpl.java

+ 1
- 1
admin-hanhai-vue/src/views/assessmentCode/AssessmentCodeList.vue View File

@ -20,7 +20,7 @@
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> --> </a-upload> -->
<!-- 高级查询区域 --> <!-- 高级查询区域 -->
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>


+ 7
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentExamLog/entity/AssessmentExamLog.java View File

@ -4,7 +4,10 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -72,4 +75,8 @@ public class AssessmentExamLog implements Serializable {
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") @Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")
@ApiModelProperty(value = "关联用户") @ApiModelProperty(value = "关联用户")
private java.lang.String userId; private java.lang.String userId;
//附加材料列表
@TableField(exist = false)
Boolean isPay = false;
} }

+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/controller/AssessmentFeedbackController.java View File

@ -39,7 +39,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
/** /**
* @Description: 意见反馈表 * @Description: 意见反馈表
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2025-09-19
* @Date: 2025-10-27
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="意见反馈表") @Api(tags="意见反馈表")


+ 6
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/entity/AssessmentFeedback.java View File

@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
/** /**
* @Description: 意见反馈表 * @Description: 意见反馈表
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2025-09-19
* @Date: 2025-10-27
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@ -59,6 +59,11 @@ public class AssessmentFeedback implements Serializable {
@Excel(name = "联系电话", width = 15) @Excel(name = "联系电话", width = 15)
@ApiModelProperty(value = "联系电话") @ApiModelProperty(value = "联系电话")
private java.lang.String phone; private java.lang.String phone;
/**状态*/
@Excel(name = "状态", width = 15, dicCode = "status_feedback")
@Dict(dicCode = "status_feedback")
@ApiModelProperty(value = "状态")
private java.lang.String status;
/**关联用户*/ /**关联用户*/
@Excel(name = "关联用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") @Excel(name = "关联用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") @Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")


+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/mapper/AssessmentFeedbackMapper.java View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* @Description: 意见反馈表 * @Description: 意见反馈表
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2025-09-19
* @Date: 2025-10-27
* @Version: V1.0 * @Version: V1.0
*/ */
public interface AssessmentFeedbackMapper extends BaseMapper<AssessmentFeedback> { public interface AssessmentFeedbackMapper extends BaseMapper<AssessmentFeedback> {


+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/service/IAssessmentFeedbackService.java View File

@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* @Description: 意见反馈表 * @Description: 意见反馈表
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2025-09-19
* @Date: 2025-10-27
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IAssessmentFeedbackService extends IService<AssessmentFeedback> { public interface IAssessmentFeedbackService extends IService<AssessmentFeedback> {


+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/service/impl/AssessmentFeedbackServiceImpl.java View File

@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/** /**
* @Description: 意见反馈表 * @Description: 意见反馈表
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2025-09-19
* @Date: 2025-10-27
* @Version: V1.0 * @Version: V1.0
*/ */
@Service @Service


+ 26
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/vue/AssessmentFeedbackList.vue View File

@ -4,6 +4,26 @@
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="联系电话">
<a-input placeholder="请输入联系电话" v-model="queryParam.phone"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="关联用户">
<j-search-select-tag placeholder="请选择关联用户" v-model="queryParam.userId" dict="han_hai_member,nick_name,id"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
</a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
@ -138,6 +158,11 @@
align:"center", align:"center",
dataIndex: 'phone' dataIndex: 'phone'
}, },
{
title:'状态',
align:"center",
dataIndex: 'status_dictText'
},
{ {
title:'关联用户', title:'关联用户',
align:"center", align:"center",
@ -180,6 +205,7 @@
fieldList.push({type:'Text',value:'content',text:'反馈内容',dictCode:''}) fieldList.push({type:'Text',value:'content',text:'反馈内容',dictCode:''})
fieldList.push({type:'Text',value:'image',text:'图片',dictCode:''}) fieldList.push({type:'Text',value:'image',text:'图片',dictCode:''})
fieldList.push({type:'string',value:'phone',text:'联系电话',dictCode:''}) fieldList.push({type:'string',value:'phone',text:'联系电话',dictCode:''})
fieldList.push({type:'string',value:'status',text:'状态',dictCode:'status_feedback'})
fieldList.push({type:'sel_search',value:'userId',text:'关联用户',dictTable:"han_hai_member", dictText:'nick_name', dictCode:'id'}) fieldList.push({type:'sel_search',value:'userId',text:'关联用户',dictTable:"han_hai_member", dictText:'nick_name', dictCode:'id'})
this.superFieldList = fieldList this.superFieldList = fieldList
} }


+ 5
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/vue/modules/AssessmentFeedbackForm.vue View File

@ -18,6 +18,11 @@
<a-input v-model="model.phone" placeholder="请输入联系电话" ></a-input> <a-input v-model="model.phone" placeholder="请输入联系电话" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24">
<a-form-model-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<j-dict-select-tag type="list" v-model="model.status" dictCode="status_feedback" placeholder="请选择状态" />
</a-form-model-item>
</a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="关联用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> <a-form-model-item label="关联用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId">
<j-search-select-tag v-model="model.userId" dict="han_hai_member,nick_name,id" /> <j-search-select-tag v-model="model.userId" dict="han_hai_member,nick_name,id" />


+ 28
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/assessmentFeedback/vue3/AssessmentFeedback.data.ts View File

@ -20,6 +20,11 @@ export const columns: BasicColumn[] = [
align:"center", align:"center",
dataIndex: 'phone' dataIndex: 'phone'
}, },
{
title: '状态',
align:"center",
dataIndex: 'status_dictText'
},
{ {
title: '关联用户', title: '关联用户',
align:"center", align:"center",
@ -28,6 +33,21 @@ export const columns: BasicColumn[] = [
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{
label: "联系电话",
field: "phone",
component: 'Input',
colProps: {span: 6},
},
{
label: "关联用户",
field: "userId",
component: 'JSearchSelect',
componentProps:{
dict:"han_hai_member,nick_name,id"
},
colProps: {span: 6},
},
]; ];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
@ -54,6 +74,14 @@ export const formSchema: FormSchema[] = [
]; ];
}, },
}, },
{
label: '状态',
field: 'status',
component: 'JDictSelectTag',
componentProps:{
dictCode:"status_feedback"
},
},
{ {
label: '关联用户', label: '关联用户',
field: 'userId', field: 'userId',


+ 15
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/assessmentController/ConfigController.java View File

@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.awt.image.BufferedImage;
import java.math.BigDecimal; import java.math.BigDecimal;
@Api(tags="系统配置-相关接口") @Api(tags="系统配置-相关接口")
@ -62,4 +63,18 @@ public class ConfigController {
return configService.queryCount(); return configService.queryCount();
} }
//图片转base64
@ApiOperation(value="其他-图片转base64", notes="其他-图片转base64")
@RequestMapping(value = "/imageToBase64", method = {RequestMethod.GET})
public Result<?> imageToBase64(String imagePath){
return configService.imageToBase64(imagePath);
}
// //base转图片
// @ApiOperation(value="其他-base64转图片", notes="其他-base64转图片")
// @RequestMapping(value = "/base64ToImage", method = {RequestMethod.GET})
// public Result<?> base64ToImage(String base64, String savePath){
// return configService.base64ToImage(base64, savePath);
// }
} }

+ 7
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java View File

@ -8,6 +8,7 @@ import org.jeecg.modules.assessmentBanner.entity.AssessmentBanner;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import java.awt.image.BufferedImage;
import java.math.BigDecimal; import java.math.BigDecimal;
public interface ConfigService { public interface ConfigService {
@ -27,4 +28,10 @@ public interface ConfigService {
//数量统计接口 //数量统计接口
public Result<?> queryCount(); public Result<?> queryCount();
//图片转base64
public Result<?> imageToBase64(String image);
//base64转图片
public Result<?> base64ToImage(String base64, String savePath);
} }

+ 123
- 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java View File

@ -21,15 +21,18 @@ import org.jeecg.modules.assessmentReportUser.service.IAssessmentReportUserServi
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import sun.misc.BASE64Encoder;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URL;
import java.net.URLConnection;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service @Service
@Slf4j @Slf4j
@ -307,6 +310,122 @@ public class ConfigServiceImpl implements ConfigService {
} }
} }
/******************************************************************************************************************/
//图片转base64
@Override
public Result<?> imageToBase64(String imgPath) {
try {
byte[] imageData = readImageData(imgPath);
if (imageData != null && imageData.length > 0) {
String base64 = Base64.getEncoder().encodeToString(imageData);
System.out.println("转换成功: " + imageData.length + " 字节 -> " + base64.length() + " 字符");
return Result.OK("base64", base64);
}
return Result.error("图片转base64失败");
} catch (Exception e) {
e.printStackTrace();
return Result.error("图片转base64失败", e.getMessage());
}
}
/**
* Base64转图片文件
*/
public Result<?> base64ToImage(String base64Str, String savePath) {
if (base64Str == null || base64Str.isEmpty()) {
return Result.error("Base64字符串为空");
}
try (FileOutputStream fos = new FileOutputStream(savePath)) {
// 清理Base64字符串
String cleanBase64 = cleanBase64String(base64Str);
// 解码并保存
byte[] imageBytes = Base64.getDecoder().decode(cleanBase64);
fos.write(imageBytes);
log.info("图片保存成功: " + savePath + " (" + imageBytes.length + " 字节)");
return Result.OK("Base64转图片成功", savePath);
} catch (Exception e) {
e.printStackTrace();
return Result.OK("Base64转图片失败", e.getMessage());
}
}
/**
* 读取图片数据
*/
private static byte[] readImageData(String imgPath) throws IOException {
InputStream inputStream = null;
ByteArrayOutputStream outputStream = null;
try {
// 创建输入流
if (imgPath.startsWith("http")) {
URL url = new URL(imgPath);
URLConnection connection = url.openConnection();
connection.setConnectTimeout(10000);
connection.setReadTimeout(30000);
connection.setRequestProperty("User-Agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36");
inputStream = connection.getInputStream();
} else {
inputStream = new FileInputStream(imgPath);
}
// 读取数据
outputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[8192];
int bytesRead;
int totalBytes = 0;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
totalBytes += bytesRead;
}
System.out.println("图片数据读取完成: " + totalBytes + " 字节");
return outputStream.toByteArray();
} finally {
// 关闭流
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* 清理Base64字符串
*/
private static String cleanBase64String(String base64Str) {
String[] prefixes = {
"data:image/png;base64,", "data:image/jpeg;base64,",
"data:image/jpg;base64,", "data:image/gif;base64,",
"data:image/bmp;base64,"
};
for (String prefix : prefixes) {
if (base64Str.startsWith(prefix)) {
return base64Str.substring(prefix.length());
}
}
return base64Str;
}
} }

+ 32
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ExamServiceImpl.java View File

@ -294,6 +294,17 @@ public class ExamServiceImpl implements ExamService {
//获取答题列表列表信息 //获取答题列表列表信息
pageList = query.page(page); pageList = query.page(page);
//已支付但未获取报告的答题列表补充支付标志
List<AssessmentPayLog> payLogList = assessmentPayLogService.lambdaQuery().eq(AssessmentPayLog::getUserId, hanHaiMember.getId()).list();
for (AssessmentExamLog record : pageList.getRecords()) {
for (AssessmentPayLog assessmentPayLog : payLogList) {
if(record.getBatchNo().equals(assessmentPayLog.getBatchNo())){
record.setIsPay(true);
continue;
}
}
}
log.info("答题列表查询结束"); log.info("答题列表查询结束");
return Result.OK("答题列表", pageList); return Result.OK("答题列表", pageList);
}catch (Exception e){ }catch (Exception e){
@ -423,6 +434,27 @@ public class ExamServiceImpl implements ExamService {
assessmentPayLog.setId(payNo); assessmentPayLog.setId(payNo);
assessmentPayLog.setUserId(hanHaiMember.getId()); assessmentPayLog.setUserId(hanHaiMember.getId());
//判断支付金额是否小于等于0
if(assessmentPayLog.getPayAmount().compareTo(BigDecimal.ZERO) < 1){
assessmentPayLog.setPayAmount(BigDecimal.ZERO);
assessmentPayLog.setStatus("1");
assessmentPayLog.setPayTime(CommonUtils.getCurrentTime());//支付时间
//创建订单
assessmentPayLogService.save(assessmentPayLog);
//修改兑换码信息
if(StringUtils.isNotEmpty(assessmentPayLog.getCode())){
AssessmentCode code = assessmentCodeService.lambdaQuery().eq(AssessmentCode::getCode, assessmentPayLog.getCode()).one();
code.setBatchNo(assessmentPayLog.getBatchNo());
code.setIsUse("1");
code.setUseTime(CommonUtils.getCurrentTime());
code.setUserId(assessmentPayLog.getUserId());
assessmentCodeService.updateById(code);
}
return Result.OK("免费获取报告", null);
}
//创建订单 //创建订单
assessmentPayLogService.save(assessmentPayLog); assessmentPayLogService.save(assessmentPayLog);


Loading…
Cancel
Save