diff --git a/src/main/java/com/gxwebsoft/clinic/controller/业务中台-排班信息接口对接文档20251114(2).docx b/src/main/java/com/gxwebsoft/clinic/controller/业务中台-排班信息接口对接文档20251114(2).docx new file mode 100644 index 0000000..8b21716 Binary files /dev/null and b/src/main/java/com/gxwebsoft/clinic/controller/业务中台-排班信息接口对接文档20251114(2).docx differ diff --git a/src/main/java/com/gxwebsoft/common/core/controller/TranslateController.java b/src/main/java/com/gxwebsoft/common/core/controller/TranslateController.java new file mode 100644 index 0000000..7fe1400 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/TranslateController.java @@ -0,0 +1,160 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.utils.AliyunTranslateUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 翻译控制器 + * 提供文本翻译和批量翻译功能 + */ +@Slf4j +@Tag(name = "翻译管理") +@RestController +@RequestMapping("/api/translate") +public class TranslateController extends BaseController { + + @Resource + private AliyunTranslateUtil translateUtil; + + @Operation(summary = "单文本翻译") + @PostMapping("/text") + public ApiResult translateText(@RequestBody TranslateRequest request) { + try { + String translated = translateUtil.translate( + request.getText(), + request.getTargetLang(), + request.getSourceLang() != null ? request.getSourceLang() : "auto" + ); + + TranslateResponse response = new TranslateResponse(); + response.setSourceText(request.getText()); + response.setTranslatedText(translated); + response.setSourceLang(request.getSourceLang()); + response.setTargetLang(request.getTargetLang()); + + return success("翻译成功", response); + } catch (Exception e) { + log.error("翻译失败", e); + return new ApiResult<>(1, "翻译失败: " + e.getMessage()); + } + } + + @Operation(summary = "批量翻译") + @PostMapping("/batch") + public ApiResult batchTranslate(@RequestBody BatchTranslateRequest request) { + try { + log.info("收到批量翻译请求: {}", request); + + // 参数校验 + if (request.getTexts() == null || request.getTexts().isEmpty()) { + return new ApiResult<>(1, "待翻译文本列表不能为空"); + } + + if (request.getTargetLang() == null || request.getTargetLang().isEmpty()) { + return new ApiResult<>(1, "目标语言不能为空"); + } + + List results = new ArrayList<>(); + + for (String text : request.getTexts()) { + if (text == null || text.trim().isEmpty()) { + continue; // 跳过空文本 + } + + String translated = translateUtil.translate( + text, + request.getTargetLang(), + request.getSourceLang() != null ? request.getSourceLang() : "auto" + ); + + TranslateResponse response = new TranslateResponse(); + response.setSourceText(text); + response.setTranslatedText(translated); + response.setSourceLang(request.getSourceLang()); + response.setTargetLang(request.getTargetLang()); + + results.add(response); + } + + BatchTranslateResponse batchResponse = new BatchTranslateResponse(); + batchResponse.setResults(results); + batchResponse.setTotal(results.size()); + + return success("批量翻译成功", batchResponse); + } catch (Exception e) { + log.error("批量翻译失败,请求参数: {}", request, e); + return new ApiResult<>(1, "批量翻译失败: " + e.getMessage()); + } + } + + /** + * 单文本翻译请求 + */ + @Data + public static class TranslateRequest { + @Parameter(description = "待翻译文本") + private String text; + + @Parameter(description = "目标语言(如:en, zh, ja, ko)") + private String targetLang; + + @Parameter(description = "源语言(如:zh, en, auto)默认auto自动检测") + private String sourceLang; + } + + /** + * 批量翻译请求 + */ + @Data + public static class BatchTranslateRequest { + @Parameter(description = "待翻译文本列表") + private List texts; + + @Parameter(description = "目标语言(如:en, zh, ja, ko)") + private String targetLang; + + @Parameter(description = "源语言(如:zh, en, auto)默认auto自动检测") + private String sourceLang; + } + + /** + * 翻译响应 + */ + @Data + public static class TranslateResponse { + @Parameter(description = "原文") + private String sourceText; + + @Parameter(description = "译文") + private String translatedText; + + @Parameter(description = "源语言") + private String sourceLang; + + @Parameter(description = "目标语言") + private String targetLang; + } + + /** + * 批量翻译响应 + */ + @Data + public static class BatchTranslateResponse { + @Parameter(description = "翻译结果列表") + private List results; + + @Parameter(description = "总数") + private Integer total; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/AliyunTranslateUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/AliyunTranslateUtil.java new file mode 100644 index 0000000..8ba568f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/AliyunTranslateUtil.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.common.core.utils; + +import com.aliyun.alimt20181012.Client; +import com.aliyun.alimt20181012.models.TranslateGeneralRequest; +import com.aliyun.alimt20181012.models.TranslateGeneralResponse; +import com.aliyun.teaopenapi.models.Config; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 阿里云机器翻译工具类 + */ +@Component +public class AliyunTranslateUtil { + + @Value("${aliyun.translate.access-key-id:}") + private String accessKeyId; + + @Value("${aliyun.translate.access-key-secret:}") + private String accessKeySecret; + + @Value("${aliyun.translate.endpoint:mt.cn-hangzhou.aliyuncs.com}") + private String endpoint; + + /** + * 创建客户端 + */ + private Client createClient() throws Exception { + Config config = new Config() + .setAccessKeyId(accessKeyId) + .setAccessKeySecret(accessKeySecret) + .setEndpoint(endpoint); + return new Client(config); + } + + /** + * 翻译文本 + * + * @param text 待翻译文本 + * @param targetLang 目标语言(如:en, zh, ja, ko等) + * @param sourceLang 源语言(如:zh, en, auto等,auto表示自动检测) + * @return 翻译后的文本 + */ + public String translate(String text, String targetLang, String sourceLang) { + try { + Client client = createClient(); + TranslateGeneralRequest request = new TranslateGeneralRequest() + .setFormatType("text") + .setSourceLanguage(sourceLang) + .setTargetLanguage(targetLang) + .setSourceText(text) + .setScene("general"); + + TranslateGeneralResponse response = client.translateGeneral(request); + return response.getBody().getData().getTranslated(); + } catch (Exception e) { + e.printStackTrace(); + return text; + } + } + + /** + * 翻译文本(自动检测源语言) + * + * @param text 待翻译文本 + * @param targetLang 目标语言 + * @return 翻译后的文本 + */ + public String translate(String text, String targetLang) { + return translate(text, targetLang, "auto"); + } +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java new file mode 100644 index 0000000..82b4661 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java @@ -0,0 +1,291 @@ +package com.gxwebsoft.credit.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserImportParam; +import com.gxwebsoft.credit.param.CreditUserParam; +import com.gxwebsoft.credit.service.CreditUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; + +/** + * 赊账客户表控制器 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:04 + */ +@Tag(name = "赊账客户表管理") +@RestController +@RequestMapping("/api/credit/credit-user") +public class CreditUserController extends BaseController { + private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + @Resource + private CreditUserService creditUserService; + + @Operation(summary = "分页查询赊账客户表") + @GetMapping("/page") + public ApiResult> page(CreditUserParam param) { + // 使用关联查询 + return success(creditUserService.pageRel(param)); + } + + @Operation(summary = "查询全部赊账客户表") + @GetMapping() + public ApiResult> list(CreditUserParam param) { + // 使用关联查询 + return success(creditUserService.listRel(param)); + } + + @Operation(summary = "根据id查询赊账客户表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditUserService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditUser:save')") + @OperationLog + @Operation(summary = "添加赊账客户表") + @PostMapping() + public ApiResult save(@RequestBody CreditUser creditUser) { + if (creditUserService.save(creditUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:update')") + @OperationLog + @Operation(summary = "修改赊账客户表") + @PutMapping() + public ApiResult update(@RequestBody CreditUser creditUser) { + if (creditUserService.updateById(creditUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:remove')") + @OperationLog + @Operation(summary = "删除赊账客户表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:save')") + @OperationLog + @Operation(summary = "批量添加赊账客户表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:update')") + @OperationLog + @Operation(summary = "批量修改赊账客户表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditUserService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:remove')") + @OperationLog + @Operation(summary = "批量删除赊账客户表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 批量导入赊账客户 + * Excel表头格式:客户名称、唯一标识、类型、企业角色、上级ID、信息类型、所在国家、所在省份、所在城市、所在辖区、街道地址、招采单位名称、中标单位名称、中标金额、备注、是否推荐、到期时间、排序、状态、用户ID、租户ID + */ + @PreAuthorize("hasAuthority('credit:creditUser:save')") + @Operation(summary = "批量导入赊账客户") + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + List errorMessages = new ArrayList<>(); + int successCount = 0; + + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), CreditUserImportParam.class, importParams); + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + + for (int i = 0; i < list.size(); i++) { + CreditUserImportParam param = list.get(i); + try { + CreditUser item = convertImportParamToEntity(param); + System.out.println("item = " + item); + + // 设置默认值 + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getType() == null) { + item.setType(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + // 验证必填字段 + if (item.getName() == null || item.getName().trim().isEmpty()) { + errorMessages.add("第" + (i + 1) + "行:客户名称不能为空"); + continue; + } + if (item.getCode() == null || item.getCode().trim().isEmpty()) { + errorMessages.add("第" + (i + 1) + "行:唯一标识不能为空"); + continue; + } + + if (creditUserService.save(item)) { + successCount++; + } else { + errorMessages.add("第" + (i + 1) + "行:保存失败"); + } + } catch (Exception e) { + errorMessages.add("第" + (i + 1) + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载赊账客户导入模板 + */ + @Operation(summary = "下载赊账客户导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditUserImportParam example = new CreditUserImportParam(); + example.setName("示例客户"); + example.setCode("CUS001"); + example.setType(0); + example.setRole("采购方"); + example.setParentId(0); + example.setInfoType("企业"); + example.setCountry("中国"); + example.setProvince("广西"); + example.setCity("南宁"); + example.setRegion("青秀区"); + example.setAddress("民族大道1号"); + example.setProcurementName("示例招采单位"); + example.setWinningName("示例中标单位"); + example.setWinningPrice("100000"); + example.setComments("这是示例数据,请删除后填入真实数据"); + example.setRecommend(0); + example.setExpirationTime("2025-12-31 23:59:59"); + example.setSortNumber(1); + example.setStatus(0); + example.setUserId(1); + example.setTenantId(1); + templateList.add(example); + + ExportParams exportParams = new ExportParams("赊账客户导入模板", "赊账客户"); + + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditUserImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_user_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + /** + * 将CreditUserImportParam转换为CreditUser实体 + */ + private CreditUser convertImportParamToEntity(CreditUserImportParam param) { + CreditUser entity = new CreditUser(); + + entity.setName(param.getName()); + entity.setCode(param.getCode()); + entity.setType(param.getType()); + entity.setRole(param.getRole()); + entity.setParentId(param.getParentId()); + entity.setInfoType(param.getInfoType()); + entity.setCountry(param.getCountry()); + entity.setProvince(param.getProvince()); + entity.setCity(param.getCity()); + entity.setRegion(param.getRegion()); + entity.setAddress(param.getAddress()); + entity.setProcurementName(param.getProcurementName()); + entity.setWinningName(param.getWinningName()); + entity.setWinningPrice(param.getWinningPrice()); + entity.setComments(param.getComments()); + entity.setRecommend(param.getRecommend()); + entity.setSortNumber(param.getSortNumber()); + entity.setStatus(param.getStatus()); + entity.setUserId(param.getUserId()); + entity.setTenantId(param.getTenantId()); + + if (param.getExpirationTime() != null && !param.getExpirationTime().trim().isEmpty()) { + try { + entity.setExpirationTime(LocalDateTime.parse(param.getExpirationTime().trim(), DATE_TIME_FORMATTER)); + } catch (Exception e) { + throw new RuntimeException("到期时间格式错误,应为yyyy-MM-dd HH:mm:ss"); + } + } + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java b/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java new file mode 100644 index 0000000..8ccbb2b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java @@ -0,0 +1,105 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 赊账客户表 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditUser对象", description = "赊账客户表") +public class CreditUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Schema(description = "客户名称") + private String name; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "类型, 0普通用户, 1招投标") + private Integer type; + + @Schema(description = "企业角色") + private String role; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "信息类型") + private String infoType; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "招采单位名称") + private String procurementName; + + @Schema(description = "中标单位名称") + private String winningName; + + @Schema(description = "中标单位名称") + private String winningPrice; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java new file mode 100644 index 0000000..e867176 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 赊账客户表Mapper + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +public interface CreditUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml new file mode 100644 index 0000000..b283980 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml @@ -0,0 +1,102 @@ + + + + + + + SELECT a.* + FROM credit_user a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type = #{param.type} + + + AND a.role LIKE CONCAT('%', #{param.role}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.info_type LIKE CONCAT('%', #{param.infoType}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.procurement_name LIKE CONCAT('%', #{param.procurementName}, '%') + + + AND a.winning_name LIKE CONCAT('%', #{param.winningName}, '%') + + + AND a.winning_price LIKE CONCAT('%', #{param.winningPrice}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java new file mode 100644 index 0000000..f132a35 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.credit.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 赊账客户表查询参数 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditUserParam对象", description = "赊账客户表查询参数") +public class CreditUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "客户名称") + private String name; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "类型, 0普通用户, 1招投标") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "企业角色") + private String role; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "信息类型") + private String infoType; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "招采单位名称") + private String procurementName; + + @Schema(description = "中标单位名称") + private String winningName; + + @Schema(description = "中标单位名称") + private String winningPrice; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java b/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java new file mode 100644 index 0000000..f7a382e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserParam; + +import java.util.List; + +/** + * 赊账客户表Service + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +public interface CreditUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditUserParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditUser + */ + CreditUser getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java new file mode 100644 index 0000000..3f7ad37 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.credit.mapper.CreditUserMapper; +import com.gxwebsoft.credit.service.CreditUserService; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 赊账客户表Service实现 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +@Service +public class CreditUserServiceImpl extends ServiceImpl implements CreditUserService { + + @Override + public PageResult pageRel(CreditUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditUser getByIdRel(Integer id) { + CreditUserParam param = new CreditUserParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 7d65970..663edc6 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -56,3 +56,10 @@ certificate: private-key-file: "apiclient_key.pem" apiclient-cert-file: "apiclient_cert.pem" wechatpay-cert-file: "wechatpay_cert.pem" + +# 阿里云翻译配置 +aliyun: + translate: + access-key-id: LTAI5tEsyhW4GCKbds1qsopg + access-key-secret: zltFlQrYVAoq2KMFDWgLa3GhkMNeyO + endpoint: mt.cn-hangzhou.aliyuncs.com diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 1cedf13..1ecfc14 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -71,3 +71,9 @@ payment: key-prefix: "Payment:1" # 缓存过期时间(小时) expire-hours: 24 +# 阿里云翻译配置 +aliyun: + translate: + access-key-id: LTAI5tEsyhW4GCKbds1qsopg + access-key-secret: zltFlQrYVAoq2KMFDWgLa3GhkMNeyO + endpoint: mt.cn-hangzhou.aliyuncs.com