diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java index d3ca80a76..78abe1e92 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java @@ -1,91 +1,65 @@ package com.ruoyi.web.controller.xkt; +import cn.hutool.core.bean.BeanUtil; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.XktBaseController; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.xkt.domain.StoreCertificate; +import com.ruoyi.web.controller.xkt.vo.storeCertificate.StoreCertResVO; +import com.ruoyi.web.controller.xkt.vo.storeCertificate.StoreCertVO; +import com.ruoyi.xkt.dto.storeCertificate.StoreCertDTO; import com.ruoyi.xkt.service.IStoreCertificateService; -import org.springframework.beans.factory.annotation.Autowired; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - /** * 档口认证Controller * * @author ruoyi * @date 2025-03-26 */ +@Api(tags = "档口认证") @RestController +@RequiredArgsConstructor @RequestMapping("/rest/v1/store-certs") public class StoreCertificateController extends XktBaseController { - @Autowired - private IStoreCertificateService storeCertificateService; + + final IStoreCertificateService storeCertService; /** - * 查询档口认证列表 + * 新增档口认证 */ - @PreAuthorize("@ss.hasPermi('system:certificate:list')") - @GetMapping("/list") - public TableDataInfo list(StoreCertificate storeCertificate) { - startPage(); - List list = storeCertificateService.selectStoreCertificateList(storeCertificate); - return getDataTable(list); - } - - /** - * 导出档口认证列表 - */ - @PreAuthorize("@ss.hasPermi('system:certificate:export')") - @Log(title = "档口认证", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, StoreCertificate storeCertificate) { - List list = storeCertificateService.selectStoreCertificateList(storeCertificate); - ExcelUtil util = new ExcelUtil(StoreCertificate.class); - util.exportExcel(response, list, "档口认证数据"); + @PreAuthorize("@ss.hasPermi('system:certificate:add')") + @ApiOperation(value = "新增档口认证", httpMethod = "POST", response = R.class) + @Log(title = "新增档口认证", businessType = BusinessType.INSERT) + @PostMapping + public R add(@Validated @RequestBody StoreCertVO storeCertVO) { + return R.ok(storeCertService.create(BeanUtil.toBean(storeCertVO, StoreCertDTO.class))); } /** * 获取档口认证详细信息 */ @PreAuthorize("@ss.hasPermi('system:certificate:query')") - @GetMapping(value = "/{storeCertId}") - public R getInfo(@PathVariable("storeCertId") Long storeCertId) { - return success(storeCertificateService.selectStoreCertificateByStoreCertId(storeCertId)); - } - - /** - * 新增档口认证 - */ - @PreAuthorize("@ss.hasPermi('system:certificate:add')") - @Log(title = "档口认证", businessType = BusinessType.INSERT) - @PostMapping - public R add(@RequestBody StoreCertificate storeCertificate) { - return success(storeCertificateService.insertStoreCertificate(storeCertificate)); + @ApiOperation(value = "获取档口认证详细信息", httpMethod = "GET", response = R.class) + @GetMapping(value = "/{storeId}") + public R getInfo(@PathVariable("storeId") Long storeId) { + return R.ok(BeanUtil.toBean(storeCertService.getInfo(storeId), StoreCertResVO.class)); } /** * 修改档口认证 */ @PreAuthorize("@ss.hasPermi('system:certificate:edit')") - @Log(title = "档口认证", businessType = BusinessType.UPDATE) + @ApiOperation(value = "修改档口认证", httpMethod = "PUT", response = R.class) + @Log(title = "修改档口认证", businessType = BusinessType.UPDATE) @PutMapping - public R edit(@RequestBody StoreCertificate storeCertificate) { - return success(storeCertificateService.updateStoreCertificate(storeCertificate)); + public R edit(@Validated @RequestBody StoreCertVO storeCertVO) { + return R.ok(storeCertService.update(BeanUtil.toBean(storeCertVO, StoreCertDTO.class))); } - /** - * 删除档口认证 - */ - @PreAuthorize("@ss.hasPermi('system:certificate:remove')") - @Log(title = "档口认证", businessType = BusinessType.DELETE) - @DeleteMapping("/{storeCertIds}") - public R remove(@PathVariable Long[] storeCertIds) { - return success(storeCertificateService.deleteStoreCertificateByStoreCertIds(storeCertIds)); - } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreController.java index ee0961c63..1cdf46b1b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreController.java @@ -1,15 +1,23 @@ package com.ruoyi.web.controller.xkt; +import cn.hutool.core.bean.BeanUtil; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.XktBaseController; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.web.controller.xkt.vo.store.StoreUpdateVO; import com.ruoyi.xkt.domain.Store; +import com.ruoyi.xkt.dto.store.StoreCreateDTO; +import com.ruoyi.xkt.dto.store.StoreUpdateDTO; import com.ruoyi.xkt.service.IStoreService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -21,11 +29,47 @@ import java.util.List; * @author ruoyi * @date 2025-03-26 */ +@Api(tags = "档口") @RestController +@RequiredArgsConstructor @RequestMapping("/rest/v1/stores") public class StoreController extends XktBaseController { - @Autowired - private IStoreService storeService; + + final IStoreService storeService; + + /** + * 新增档口 + */ + @PreAuthorize("@ss.hasPermi('system:store:edit')") + @Log(title = "新增档口", businessType = BusinessType.UPDATE) + @PostMapping + public R create(@Validated @RequestBody StoreCreateDTO createDTO) { + return R.ok(storeService.create(createDTO)); + } + + /** + * 修改档口基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:store:edit')") + @ApiOperation(value = "修改档口基本信息", httpMethod = "PUT", response = R.class) + @Log(title = "修改档口基本信息", businessType = BusinessType.UPDATE) + @PutMapping + public R edit(@Validated @RequestBody StoreUpdateVO storeUpdateVO) { + return R.ok(storeService.updateStore(BeanUtil.toBean(storeUpdateVO, StoreUpdateDTO.class))); + } + + + + + + + + + + + + + /** * 查询档口列表 @@ -59,25 +103,7 @@ public class StoreController extends XktBaseController { return success(storeService.selectStoreByStoreId(storeId)); } - /** - * 新增档口 - */ - @PreAuthorize("@ss.hasPermi('system:store:add')") - @Log(title = "档口", businessType = BusinessType.INSERT) - @PostMapping - public R add(@RequestBody Store store) { - return success(storeService.insertStore(store)); - } - /** - * 修改档口 - */ - @PreAuthorize("@ss.hasPermi('system:store:edit')") - @Log(title = "档口", businessType = BusinessType.UPDATE) - @PutMapping - public R edit(@RequestBody Store store) { - return success(storeService.updateStore(store)); - } /** * 删除档口 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/store/StoreUpdateVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/store/StoreUpdateVO.java new file mode 100644 index 000000000..0f1efc3db --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/store/StoreUpdateVO.java @@ -0,0 +1,56 @@ +package com.ruoyi.web.controller.xkt.vo.store; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("更改档口基本信息") +@Data +@Accessors(chain = true) +public class StoreUpdateVO { + + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空") + private Long storeId; + @ApiModelProperty(value = "档口名称", required = true) + @NotBlank(message = "档口名称不能为空") + private String storeName; + @ApiModelProperty(value = "品牌名称", required = true) + @NotBlank(message = "品牌名称不能为空") + private String brandName; + @ApiModelProperty(value = "联系人", required = true) + @NotBlank(message = "联系人不能为空") + private String contactName; + @ApiModelProperty(value = "联系电话", required = true) + @NotBlank(message = "联系电话不能为空") + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,请输入有效的中国大陆手机号") + private String contactPhone; + @ApiModelProperty(value = "备选联系电话") + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "备选联系电话格式不正确,请输入有效的中国大陆手机号") + private String contactBackPhone; + @ApiModelProperty(value = "微信账号") + private String wechatAccount; + @ApiModelProperty(value = "QQ账号") + private String qqAccount; + @ApiModelProperty(value = "支付宝账号") + private String alipayAccount; + @ApiModelProperty(value = "经营年限") + private Integer operateYears; + @ApiModelProperty(name = "档口地址") + private String storeAddress; + @ApiModelProperty(name = "工厂地址") + private String facAddress; + @ApiModelProperty(name = "生产规模") + private Integer prodScale; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCertificate/StoreCertResVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCertificate/StoreCertResVO.java new file mode 100644 index 000000000..a6a69a2a6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCertificate/StoreCertResVO.java @@ -0,0 +1,82 @@ +package com.ruoyi.web.controller.xkt.vo.storeCertificate; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("新增档口认证信息") +@Data +@Accessors(chain = true) +public class StoreCertResVO { + + @ApiModelProperty(value = "档口认证ID") + private Long storeCertId; + @ApiModelProperty(value = "档口ID") + private Long storeId; + @ApiModelProperty(value = "真实姓名") + private String realName; + @ApiModelProperty(value = "联系电话") + private String phone; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(name = "档口认证文件") + List fileList; + @ApiModelProperty(value = "统一社会信用代码") + private String socialCreditCode; + @ApiModelProperty(value = "经营类型") + private Integer soleProprietorshipType; + @ApiModelProperty(value = "营业执照名称") + private String licenseName; + @ApiModelProperty(value = "市场主体类型") + private Integer marketEntryType; + @ApiModelProperty(value = "登记机关") + private String registerOrg; + @ApiModelProperty(value = "登记状态") + private Integer registerStatus; + @ApiModelProperty(value = "法定代表人/负责人名称") + private String legalName; + @ApiModelProperty(name = "注册资本(万)") + private Integer registerCapital; + @ApiModelProperty(value = "实际经营地址") + private String realBusinessAddress; + @ApiModelProperty(value = "经营范围") + private String businessScope; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "营业期限开始时间") + private Date businessTermStartDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "营业期限截止时间") + private Date businessTermEndDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "成立日期") + private Date establishDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "核准日期") + private Date approvalDate; + + @Data + @ApiModel(value = "档口文件") + public static class StoreCertFileVO { + @ApiModelProperty(value = "文件名称") + private String fileName; + @ApiModelProperty(value = "文件路径") + private String fileUrl; + @ApiModelProperty(value = "文件类型(4 人脸照片 5 国徽照片 6档口营业执照)") + private Integer fileType; + @ApiModelProperty(value = "文件大小") + private BigDecimal fileSize; + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCertificate/StoreCertVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCertificate/StoreCertVO.java new file mode 100644 index 000000000..bd207560b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCertificate/StoreCertVO.java @@ -0,0 +1,123 @@ +package com.ruoyi.web.controller.xkt.vo.storeCertificate; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("新增档口认证信息") +@Data +@Accessors(chain = true) +public class StoreCertVO { + + @ApiModelProperty(value = "档口认证ID(新增时不传,编辑必传)") + private Long storeCertId; + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空") + private Long storeId; + @ApiModelProperty(value = "真实姓名", required = true) + @NotBlank(message = "真实姓名不能为空") + @Size(min = 1, max = 30, message = "真实姓名长度必须在1到30个字之间") + private String realName; + @ApiModelProperty(value = "联系电话", required = true) + @NotBlank(message = "联系电话不能为空") + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,请输入有效的中国大陆手机号") + private String phone; + @ApiModelProperty(value = "身份证号", required = true) + @NotBlank(message = "身份证号不能为空") + @Pattern(regexp = "(^\\d{15}$)|(^\\d{17}([0-9]|X|x)$)", message = "身份证号格式不正确,请输入有效的15位或18位身份证号") + private String idCard; + + @ApiModelProperty(value = "认证文件列表", required = true) + @NotNull(message = "认证文件列表不能为空") + private List fileList; + + /* @ApiModelProperty(value = "身份证人脸照片", required = true) + @NotNull(message = "身份证人脸照片不能为空") + private StoreFileVO idCardFace; + @ApiModelProperty(value = "身份证国徽照片", required = true) + @NotNull(message = "身份证国徽照片不能为空") + private StoreFileVO idCardFEmblem; + @ApiModelProperty(value = "营业执照照片", required = true) + @NotNull(message = "营业执照照片不能为空") + private StoreFileVO licenseFile;*/ + @ApiModelProperty(value = "统一社会信用代码", required = true) + @NotBlank(message = "统一社会信用代码不能为空") + @Pattern(regexp = "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$", + message = "统一社会信用代码格式不正确,请输入有效的18位代码") + private String socialCreditCode; + @ApiModelProperty(value = "经营类型", required = true) + @NotNull(message = "经营类型不能为空") + private Integer soleProprietorshipType; + @ApiModelProperty(value = "营业执照名称", required = true) + @NotBlank(message = "营业执照名称不能为空") + @Size(min = 1, max = 100, message = "营业执照名称长度必须在1到100个字之间") + private String licenseName; + @ApiModelProperty(value = "市场主体类型", required = true) + @NotNull(message = "市场主体类型不能为空") + private Integer marketEntryType; + @ApiModelProperty(value = "登记机关", required = true) + @NotBlank(message = "登记机关不能为空") + @Size(min = 1, max = 100, message = "登记机关长度必须在1到100个字之间") + private String registerOrg; + @ApiModelProperty(value = "登记状态", required = true) + private Integer registerStatus; + @ApiModelProperty(value = "法定代表人/负责人名称", required = true) + @NotBlank(message = "法定代表人/负责人名称不能为空") + @Size(min = 1, max = 30, message = "法定代表人/负责人名称长度必须在1到30个字之间") + private String legalName; + @ApiModelProperty(value = "注册资本(万)") + private Integer registerCapital; + @ApiModelProperty(value = "实际经营地址", required = true) + @NotBlank(message = "实际经营地址不能为空") + @Size(min = 1, max = 100, message = "实际经营地址长度必须在1到100个字之间") + private String realBusinessAddress; + @ApiModelProperty(value = "经营范围") + @Size(min = 1, max = 500, message = "经营范围长度必须在1到500个字之间") + private String businessScope; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "营业期限开始时间") + private Date businessTermStartDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "营业期限截止时间") + private Date businessTermEndDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "成立日期") + private Date establishDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "核准日期") + private Date approvalDate; + + + @Data + @ApiModel(value = "档口文件") + public static class StoreFileVO { + @NotBlank(message = "文件名称不能为空!") + @ApiModelProperty(value = "文件名称", required = true) + private String fileName; + @NotBlank(message = "文件路径不能为空!") + @ApiModelProperty(value = "文件路径", required = true) + private String fileUrl; + @NotNull(message = "文件大小不能为空!") + @ApiModelProperty(value = "文件大小", required = true) + private BigDecimal fileSize; + @NotNull(message = "文件类型不能为空!") + @ApiModelProperty(value = "文件类型", required = true) + private Integer fileType; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCusProdDiscount/StoreCusProdDiscountVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCusProdDiscount/StoreCusProdDiscountVO.java index db9d15a3f..9a5da02be 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCusProdDiscount/StoreCusProdDiscountVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCusProdDiscount/StoreCusProdDiscountVO.java @@ -7,6 +7,7 @@ import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; import java.math.BigDecimal; /** @@ -28,6 +29,7 @@ public class StoreCusProdDiscountVO { @ApiModelProperty(value = "客户名称", required = true) private String storeCusName; @ApiModelProperty(value = "客户联系电话") + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,请输入有效的中国大陆手机号") private String phone; @NotNull(message = "优惠金额不能为空!") @ApiModelProperty(value = "优惠金额", required = true) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCustomer/StoreCusVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCustomer/StoreCusVO.java index 53c62ef11..ed808275a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCustomer/StoreCusVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeCustomer/StoreCusVO.java @@ -7,6 +7,7 @@ import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; /** * @author liujiang @@ -27,6 +28,7 @@ public class StoreCusVO { @ApiModelProperty(value = "客户名称", required = true) private String cusName; @ApiModelProperty(value = "客户联系电话") + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,请输入有效的中国大陆手机号") private String phone; @ApiModelProperty(value = "备注") private String remark; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeFactory/StoreFactoryVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeFactory/StoreFactoryVO.java index 3be674d57..dcca1d2d4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeFactory/StoreFactoryVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeFactory/StoreFactoryVO.java @@ -7,6 +7,7 @@ import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; /** * @author liujiang @@ -29,6 +30,7 @@ public class StoreFactoryVO { @ApiModelProperty(value = "工厂地址") private String facAddress; @ApiModelProperty(value = "工厂联系电话") + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,请输入有效的中国大陆手机号") private String facPhone; @ApiModelProperty(value = "备注") private String remark; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java index 610c71cfc..e4b98ae12 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java @@ -34,14 +34,14 @@ public class StoreProdVO { @NotNull(message = "商品分类ID不能为空!") private Long prodCateId; @ApiModelProperty(value = "工厂货号") - @Size(max = 15, message = "工厂货号不能超过60个字!") + @Size(min = 1, max = 15, message = "工厂货号不能超过60个字!") private String factoryArtNum; @ApiModelProperty(value = "商品货号", required = true) - @Size(max = 15, message = "商品货号不能超过60个字!") + @Size(min = 1, max = 15, message = "商品货号不能超过60个字!") @NotBlank(message = "商品货号不能为空!") private String prodArtNum; @ApiModelProperty(value = "商品标题", required = true) - @Size(max = 60, message = "商品标题不能超过60个字!") + @Size(min = 1, max = 60, message = "商品标题不能超过60个字!") @NotBlank(message = "商品标题不能为空!") private String prodTitle; @ApiModelProperty(value = "商品重量") @@ -53,10 +53,10 @@ public class StoreProdVO { @ApiModelProperty(value = "发货时效") private Integer deliveryTime; @ApiModelProperty(value = "上架方式:1 立即上架 2 定时上架", required = true) - @NotBlank(message = "上架方式不能为空!") + @NotNull(message = "上架方式不能为空!") private Integer listingWay; @ApiModelProperty(value = "商品状态:1.未发布 2. 在售 3. 尾货 4.已下架 4. 已删除", required = true) - @NotBlank(message = "商品状态不能为空!") + @NotNull(message = "商品状态不能为空!") private Integer prodStatus; @ApiModelProperty(value = "定时发货时间(精确到小时)") @JsonFormat(pattern = "yyyy-MM-dd HH") @@ -105,7 +105,7 @@ public class StoreProdVO { @NotNull(message = "文件大小不能为空!") @ApiModelProperty(value = "文件大小", required = true) private BigDecimal fileSize; - @NotBlank(message = "文件类型不能为空!") + @NotNull(message = "文件类型不能为空!") @ApiModelProperty(value = "文件类型", required = true) private Integer fileType; @ApiModelProperty(value = "排序", required = true) @@ -145,7 +145,7 @@ public class StoreProdVO { @ApiModelProperty(value = "商品尺码", required = true) @NotNull(message = "档口商品定价不能为空!") private Integer size; - @NotBlank(message = "是否是标准尺码不能为空!") + @NotNull(message = "是否是标准尺码不能为空!") @ApiModelProperty(value = "是否是标准尺码", required = true) private Integer standard; } diff --git a/xkt/src/main/java/com/ruoyi/xkt/domain/Store.java b/xkt/src/main/java/com/ruoyi/xkt/domain/Store.java index 2a6c57260..8e33d24ec 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/domain/Store.java +++ b/xkt/src/main/java/com/ruoyi/xkt/domain/Store.java @@ -21,6 +21,7 @@ import java.util.Date; @EqualsAndHashCode(callSuper = true) @Data public class Store extends XktBaseEntity { + private static final long serialVersionUID = 1L; /** @@ -47,12 +48,6 @@ public class Store extends XktBaseEntity { @Excel(name = "品牌名称") private String brandName; - /** - * 登录账号 - */ - @Excel(name = "登录账号") - private String loginAccount; - /** * 联系人 */ @@ -111,7 +106,7 @@ public class Store extends XktBaseEntity { * 生产规模 */ @Excel(name = "生产规模") - private Long prodScale; + private Integer prodScale; /** * 保证金 @@ -136,7 +131,7 @@ public class Store extends XktBaseEntity { * 档口状态 */ @Excel(name = "档口状态") - private String storeStatus; + private Integer storeStatus; /** * 档口模板ID @@ -152,7 +147,6 @@ public class Store extends XktBaseEntity { .append("userId", getUserId()) .append("storeName", getStoreName()) .append("brandName", getBrandName()) - .append("loginAccount", getLoginAccount()) .append("contactName", getContactName()) .append("contactPhone", getContactPhone()) .append("contactBackPhone", getContactBackPhone()) diff --git a/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCertificate.java b/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCertificate.java index 6eaa69818..0772e1ccb 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCertificate.java +++ b/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCertificate.java @@ -6,6 +6,7 @@ import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.XktBaseEntity; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -19,6 +20,7 @@ import java.util.Date; */ @EqualsAndHashCode(callSuper = true) @Data +@Accessors(chain = true) public class StoreCertificate extends XktBaseEntity { private static final long serialVersionUID = 1L; @@ -56,13 +58,13 @@ public class StoreCertificate extends XktBaseEntity { * 身份证人脸文件ID */ @Excel(name = "身份证人脸文件ID") - private Long idCardFrontFileId; + private Long idCardFaceFileId; /** * 身份证国徽文件ID */ @Excel(name = "身份证国徽文件ID") - private Long idCardBackFileId; + private Long idCardEmblemFileId; /** * 营业执照文件ID @@ -74,19 +76,19 @@ public class StoreCertificate extends XktBaseEntity { * 统一社会信用代码 */ @Excel(name = "统一社会信用代码") - private String socialCreditCode; + private Integer socialCreditCode; /** * 经营类型 */ @Excel(name = "经营类型") - private Long soleProprietorshipType; + private Integer soleProprietorshipType; /** * 市场主体类型 */ @Excel(name = "市场主体类型") - private Long marketEntryType; + private Integer marketEntryType; /** * 营业执照名称 @@ -104,7 +106,7 @@ public class StoreCertificate extends XktBaseEntity { * 登记状态 */ @Excel(name = "登记状态") - private String registerStatus; + private Integer registerStatus; /** * 法定代表人/负责人名称 @@ -158,13 +160,6 @@ public class StoreCertificate extends XktBaseEntity { @Excel(name = "核准日期", width = 30, dateFormat = "yyyy-MM-dd") private Date approvalDate; - /** - * 档口认证状态 - */ - @Excel(name = "档口认证状态") - private String certStatus; - - @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) @@ -173,8 +168,6 @@ public class StoreCertificate extends XktBaseEntity { .append("realName", getRealName()) .append("phone", getPhone()) .append("idCard", getIdCard()) - .append("idCardFrontFileId", getIdCardFrontFileId()) - .append("idCardBackFileId", getIdCardBackFileId()) .append("licenseFileId", getLicenseFileId()) .append("socialCreditCode", getSocialCreditCode()) .append("soleProprietorshipType", getSoleProprietorshipType()) @@ -190,7 +183,6 @@ public class StoreCertificate extends XktBaseEntity { .append("businessTermStartDate", getBusinessTermStartDate()) .append("businessTermEndDate", getBusinessTermEndDate()) .append("approvalDate", getApprovalDate()) - .append("certStatus", getCertStatus()) .append("version", getVersion()) .append("delFlag", getDelFlag()) .append("createBy", getCreateBy()) diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/store/StoreCreateDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/store/StoreCreateDTO.java new file mode 100644 index 000000000..0e920c618 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/store/StoreCreateDTO.java @@ -0,0 +1,21 @@ +package com.ruoyi.xkt.dto.store; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("创建档口") +@Data +@Accessors(chain = true) +public class StoreCreateDTO { + + @ApiModelProperty(value = "档口绑定的用户") + private Long userId; + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/store/StoreUpdateDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/store/StoreUpdateDTO.java new file mode 100644 index 000000000..a46ebba85 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/store/StoreUpdateDTO.java @@ -0,0 +1,48 @@ +package com.ruoyi.xkt.dto.store; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("更改档口基本信息") +@Data +@Accessors(chain = true) +public class StoreUpdateDTO { + + @ApiModelProperty(value = "档口ID", required = true) + private Long storeId; + @ApiModelProperty(value = "档口名称", required = true) + private String storeName; + @ApiModelProperty(value = "品牌名称", required = true) + private String brandName; + @ApiModelProperty(value = "联系人", required = true) + private String contactName; + @ApiModelProperty(value = "联系电话", required = true) + private String contactPhone; + @ApiModelProperty(value = "备选联系电话") + private String contactBackPhone; + @ApiModelProperty(value = "微信账号") + private String wechatAccount; + @ApiModelProperty(value = "QQ账号") + private String qqAccount; + @ApiModelProperty(value = "支付宝账号") + private String alipayAccount; + @ApiModelProperty(value = "经营年限") + private Integer operateYears; + @ApiModelProperty(name = "档口地址") + private String storeAddress; + @ApiModelProperty(name = "工厂地址") + private String facAddress; + @ApiModelProperty(name = "生产规模") + private Integer prodScale; + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeCertificate/StoreCertDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeCertificate/StoreCertDTO.java new file mode 100644 index 000000000..6f3059418 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeCertificate/StoreCertDTO.java @@ -0,0 +1,83 @@ +package com.ruoyi.xkt.dto.storeCertificate; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("新增档口认证信息") +@Data +@Accessors(chain = true) +public class StoreCertDTO { + + @ApiModelProperty(value = "档口ID") + private Long storeCertId; + @ApiModelProperty(value = "档口ID", required = true) + private Long storeId; + @ApiModelProperty(value = "真实姓名", required = true) + private String realName; + @ApiModelProperty(value = "联系电话", required = true) + private String phone; + @ApiModelProperty(value = "身份证号", required = true) + private String idCard; + @ApiModelProperty(value = "认证文件列表", required = true) + private List fileList; + @ApiModelProperty(value = "统一社会信用代码", required = true) + private String socialCreditCode; + @ApiModelProperty(value = "经营类型", required = true) + private Integer soleProprietorshipType; + @ApiModelProperty(value = "营业执照名称", required = true) + private String licenseName; + @ApiModelProperty(value = "市场主体类型", required = true) + private Integer marketEntryType; + @ApiModelProperty(value = "登记机关", required = true) + private String registerOrg; + @ApiModelProperty(value = "登记状态", required = true) + private Integer registerStatus; + @ApiModelProperty(value = "法定代表人/负责人名称", required = true) + private String legalName; + @ApiModelProperty(name = "注册资本(万)") + private Integer registerCapital; + @ApiModelProperty(value = "实际经营地址", required = true) + private String realBusinessAddress; + @ApiModelProperty(value = "经营范围") + private String businessScope; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "营业期限开始时间") + private Date businessTermStartDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "营业期限截止时间") + private Date businessTermEndDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "成立日期") + private Date establishDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "核准日期") + private Date approvalDate; + + @Data + @ApiModel(value = "档口文件") + public static class StoreCertFileDTO { + @ApiModelProperty(value = "文件名称", required = true) + private String fileName; + @ApiModelProperty(value = "文件路径", required = true) + private String fileUrl; + @ApiModelProperty(value = "文件类型(4 人脸照片 5 国徽照片 6档口营业执照)") + private Integer fileType; + @ApiModelProperty(value = "文件大小", required = true) + private BigDecimal fileSize; + } + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeCertificate/StoreCertResDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeCertificate/StoreCertResDTO.java new file mode 100644 index 000000000..1023984bc --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeCertificate/StoreCertResDTO.java @@ -0,0 +1,83 @@ +package com.ruoyi.xkt.dto.storeCertificate; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("新增档口认证信息") +@Data +@Accessors(chain = true) +public class StoreCertResDTO { + + @ApiModelProperty(value = "档口认证ID") + private Long storeCertId; + @ApiModelProperty(value = "档口ID") + private Long storeId; + @ApiModelProperty(value = "真实姓名") + private String realName; + @ApiModelProperty(value = "联系电话") + private String phone; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(name = "档口认证文件") + List fileList; + @ApiModelProperty(value = "统一社会信用代码") + private String socialCreditCode; + @ApiModelProperty(value = "经营类型") + private Integer soleProprietorshipType; + @ApiModelProperty(value = "营业执照名称") + private String licenseName; + @ApiModelProperty(value = "市场主体类型") + private Integer marketEntryType; + @ApiModelProperty(value = "登记机关") + private String registerOrg; + @ApiModelProperty(value = "登记状态") + private Integer registerStatus; + @ApiModelProperty(value = "法定代表人/负责人名称") + private String legalName; + @ApiModelProperty(name = "注册资本(万)") + private Integer registerCapital; + @ApiModelProperty(value = "实际经营地址") + private String realBusinessAddress; + @ApiModelProperty(value = "经营范围") + private String businessScope; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "营业期限开始时间") + private Date businessTermStartDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "营业期限截止时间") + private Date businessTermEndDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "成立日期") + private Date establishDate; + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(name = "核准日期") + private Date approvalDate; + + @Data + @ApiModel(value = "档口文件") + @Accessors(chain = true) + public static class StoreCertFileDTO { + @ApiModelProperty(value = "文件名称") + private String fileName; + @ApiModelProperty(value = "文件路径") + private String fileUrl; + @ApiModelProperty(value = "文件类型") + private Integer fileType; + @ApiModelProperty(value = "文件大小") + private BigDecimal fileSize; + } + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/enums/FileType.java b/xkt/src/main/java/com/ruoyi/xkt/enums/FileType.java index 18ad5827b..89fa923e7 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/enums/FileType.java +++ b/xkt/src/main/java/com/ruoyi/xkt/enums/FileType.java @@ -13,7 +13,12 @@ public enum FileType { MAIN_PIC(1, "商品主图"), MAIN_PIC_VIDEO(2, "商品主图视频"), - DOWNLOAD(3, "商品下载图片包"); + DOWNLOAD(3, "商品下载图片包"), + ID_CARD_FACE(4, "身份证人脸"), + ID_CARD_EMBLEM(5, "身份证国徽"), + BUSINESS_LICENSE(6, "档口营业执照"), + + ; private final Integer value; private final String label; diff --git a/xkt/src/main/java/com/ruoyi/xkt/enums/MarketEntryType.java b/xkt/src/main/java/com/ruoyi/xkt/enums/MarketEntryType.java new file mode 100644 index 000000000..370c149be --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/enums/MarketEntryType.java @@ -0,0 +1,35 @@ +package com.ruoyi.xkt.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 营业执照 市场主体类型 + * @author 刘江 + * @date 2025-04-02 23:42 + */ +@Getter +@AllArgsConstructor +public enum MarketEntryType { + + ENTERPRISE (1, "企业"), + FARMER_COOPERATIVE (2, "农民专业合作社"), + SOLE_PROPRIETORSHIP (3, "个体工商户"), + NATURAL_PERSON (4, "自然人"), + GOVERNMENT_INSTITUTION (5, "机关事业单位"), + OTHER (0, "其它"), + + ; + + private final Integer value; + private final String label; + + public static MarketEntryType of(Integer value) { + for (MarketEntryType e : MarketEntryType.values()) { + if (e.getValue().equals(value)) { + return e; + } + } + return null; + } +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/enums/RegisterStatus.java b/xkt/src/main/java/com/ruoyi/xkt/enums/RegisterStatus.java new file mode 100644 index 000000000..9cc210cb8 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/enums/RegisterStatus.java @@ -0,0 +1,36 @@ +package com.ruoyi.xkt.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 登记状态 + * @author 刘江 + * @date 2025-04-02 23:42 + */ +@Getter +@AllArgsConstructor +public enum RegisterStatus { + + IN_EXISTENCE(1, "存续(在营、开业、在册)"), + REVOKED_NOT_DEREGISTER(2, "吊销,未注销"), + REVOKED_DEREGISTER(3, "吊销,已注销"), + DEREGISTER(4, "注销"), + REVOKED(5, "撤销"), + MOVED_OUT(6, "迁出"), + OTHER(7, "其它"), + + ; + + private final Integer value; + private final String label; + + public static RegisterStatus of(Integer value) { + for (RegisterStatus e : RegisterStatus.values()) { + if (e.getValue().equals(value)) { + return e; + } + } + return null; + } +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/enums/SoleProprietorshipType.java b/xkt/src/main/java/com/ruoyi/xkt/enums/SoleProprietorshipType.java new file mode 100644 index 000000000..43ba7aa1f --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/enums/SoleProprietorshipType.java @@ -0,0 +1,31 @@ +package com.ruoyi.xkt.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 营业执照 经营类型 + * @author 刘江 + * @date 2025-04-02 23:42 + */ +@Getter +@AllArgsConstructor +public enum SoleProprietorshipType { + + SOLO_PROPRIETORSHIP(1, "个人独资企业"), + SOLO_PROPRIETORSHIP_BRANCH(2, "个人独资企业分支机构"), + + ; + + private final Integer value; + private final String label; + + public static SoleProprietorshipType of(Integer value) { + for (SoleProprietorshipType e : SoleProprietorshipType.values()) { + if (e.getValue().equals(value)) { + return e; + } + } + return null; + } +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/enums/StoreStatus.java b/xkt/src/main/java/com/ruoyi/xkt/enums/StoreStatus.java new file mode 100644 index 000000000..7d1794dc9 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/enums/StoreStatus.java @@ -0,0 +1,36 @@ +package com.ruoyi.xkt.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liangyq + * @date 2025-04-02 23:42 + */ +@Getter +@AllArgsConstructor +public enum StoreStatus { + + REGISTERED(1, "已注册"), + AUTH_LICENSE(2, "认证营业执照"), + AUTH_BASE_INFO(3, "认证基本信息"), + UN_AUDITED(4, "待审核"), + AUDIT_REJECTED(5, "审核驳回"), + TRIAL_PERIOD(6, "试用期"), + FORMAL_USE(7, "正式使用"), + CLEARANCE(8, "强制清退") + + ; + + private final Integer value; + private final String label; + + public static StoreStatus of(Integer value) { + for (StoreStatus e : StoreStatus.values()) { + if (e.getValue().equals(value)) { + return e; + } + } + return null; + } +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCertificateService.java b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCertificateService.java index 46063a49d..b553f7753 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCertificateService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCertificateService.java @@ -1,8 +1,7 @@ package com.ruoyi.xkt.service; -import com.ruoyi.xkt.domain.StoreCertificate; - -import java.util.List; +import com.ruoyi.xkt.dto.storeCertificate.StoreCertDTO; +import com.ruoyi.xkt.dto.storeCertificate.StoreCertResDTO; /** * 档口认证Service接口 @@ -11,51 +10,29 @@ import java.util.List; * @date 2025-03-26 */ public interface IStoreCertificateService { - /** - * 查询档口认证 - * - * @param storeCertId 档口认证主键 - * @return 档口认证 - */ - public StoreCertificate selectStoreCertificateByStoreCertId(Long storeCertId); - - /** - * 查询档口认证列表 - * - * @param storeCertificate 档口认证 - * @return 档口认证集合 - */ - public List selectStoreCertificateList(StoreCertificate storeCertificate); /** * 新增档口认证 * - * @param storeCertificate 档口认证 - * @return 结果 + * @param certDTO 档口认证入参 + * @return int */ - public int insertStoreCertificate(StoreCertificate storeCertificate); + Integer create(StoreCertDTO certDTO); /** - * 修改档口认证 + * 根据档口ID获取档口详情信息 * - * @param storeCertificate 档口认证 - * @return 结果 + * @param storeId 档口ID + * @return StoreCertResDTO */ - public int updateStoreCertificate(StoreCertificate storeCertificate); + StoreCertResDTO getInfo(Long storeId); /** - * 批量删除档口认证 + * 编辑档口认证信息 * - * @param storeCertIds 需要删除的档口认证主键集合 - * @return 结果 + * @param certDTO 档口认证信息 + * @return Integer */ - public int deleteStoreCertificateByStoreCertIds(Long[] storeCertIds); + Integer update(StoreCertDTO certDTO); - /** - * 删除档口认证信息 - * - * @param storeCertId 档口认证主键 - * @return 结果 - */ - public int deleteStoreCertificateByStoreCertId(Long storeCertId); } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreService.java b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreService.java index 3c94c9686..add84e719 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreService.java @@ -1,6 +1,8 @@ package com.ruoyi.xkt.service; import com.ruoyi.xkt.domain.Store; +import com.ruoyi.xkt.dto.store.StoreCreateDTO; +import com.ruoyi.xkt.dto.store.StoreUpdateDTO; import java.util.List; @@ -11,6 +13,33 @@ import java.util.List; * @date 2025-03-26 */ public interface IStoreService { + + /** + * 更新档口数据 + * @param storeUpdateDTO 更新数据入参 + * @return int + */ + public int updateStore(StoreUpdateDTO storeUpdateDTO); + + + + + + + + + + + + + + /** + * 注册时新增档口信息 + * @param createDTO 新增DTO + * @return int + */ + public int create(StoreCreateDTO createDTO); + /** * 查询档口 * @@ -35,13 +64,6 @@ public interface IStoreService { */ public int insertStore(Store store); - /** - * 修改档口 - * - * @param store 档口 - * @return 结果 - */ - public int updateStore(Store store); /** * 批量删除档口 diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCertificateServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCertificateServiceImpl.java index 16fbeb173..45e3e96c0 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCertificateServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCertificateServiceImpl.java @@ -1,14 +1,24 @@ package com.ruoyi.xkt.service.impl; -import com.ruoyi.common.utils.DateUtils; +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.xkt.domain.StoreCertificate; +import com.ruoyi.xkt.domain.SysFile; +import com.ruoyi.xkt.dto.storeCertificate.StoreCertDTO; +import com.ruoyi.xkt.dto.storeCertificate.StoreCertResDTO; +import com.ruoyi.xkt.enums.FileType; import com.ruoyi.xkt.mapper.StoreCertificateMapper; +import com.ruoyi.xkt.mapper.SysFileMapper; import com.ruoyi.xkt.service.IStoreCertificateService; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * 档口认证Service业务层处理 @@ -17,81 +27,99 @@ import java.util.List; * @date 2025-03-26 */ @Service +@RequiredArgsConstructor public class StoreCertificateServiceImpl implements IStoreCertificateService { - @Autowired - private StoreCertificateMapper storeCertificateMapper; - /** - * 查询档口认证 - * - * @param storeCertId 档口认证主键 - * @return 档口认证 - */ - @Override - @Transactional(readOnly = true) - public StoreCertificate selectStoreCertificateByStoreCertId(Long storeCertId) { - return storeCertificateMapper.selectStoreCertificateByStoreCertId(storeCertId); - } - - /** - * 查询档口认证列表 - * - * @param storeCertificate 档口认证 - * @return 档口认证 - */ - @Override - @Transactional(readOnly = true) - public List selectStoreCertificateList(StoreCertificate storeCertificate) { - return storeCertificateMapper.selectStoreCertificateList(storeCertificate); - } + final StoreCertificateMapper storeCertMapper; + final SysFileMapper fileMapper; /** * 新增档口认证 * - * @param storeCertificate 档口认证 - * @return 结果 + * @param certDTO 档口认证入参 + * @return int */ @Override @Transactional - public int insertStoreCertificate(StoreCertificate storeCertificate) { - storeCertificate.setCreateTime(DateUtils.getNowDate()); - return storeCertificateMapper.insertStoreCertificate(storeCertificate); + public Integer create(StoreCertDTO certDTO) { + StoreCertificate storeCert = BeanUtil.toBean(certDTO, StoreCertificate.class); + // 新增档口认证的文件列表 + this.handleStoreCertFileList(certDTO, storeCert); + return this.storeCertMapper.insert(storeCert); } /** - * 修改档口认证 + * 根据档口ID获取档口详情信息 * - * @param storeCertificate 档口认证 - * @return 结果 + * @param storeId 档口ID + * @return */ @Override - @Transactional - public int updateStoreCertificate(StoreCertificate storeCertificate) { - storeCertificate.setUpdateTime(DateUtils.getNowDate()); - return storeCertificateMapper.updateStoreCertificate(storeCertificate); + @Transactional(readOnly = true) + public StoreCertResDTO getInfo(Long storeId) { + StoreCertificate storeCert = this.storeCertMapper.selectOne(new LambdaQueryWrapper() + .eq(StoreCertificate::getStoreId, storeId).eq(StoreCertificate::getDelFlag, Constants.UNDELETED)); + List fileList = Optional.ofNullable(this.fileMapper.selectList(new LambdaQueryWrapper() + .in(SysFile::getId, Arrays.asList(storeCert.getIdCardFaceFileId(), storeCert.getIdCardEmblemFileId(), storeCert.getLicenseFileId())) + .eq(SysFile::getDelFlag, Constants.UNDELETED))).orElseThrow(() -> new ServiceException("文件不存在!", HttpStatus.ERROR)); + List fileDTOList = fileList.stream().map(x -> BeanUtil.toBean(x, StoreCertResDTO.StoreCertFileDTO.class) + .setFileType(Objects.equals(x.getId(), storeCert.getIdCardFaceFileId()) ? 4 : + (Objects.equals(x.getId(), storeCert.getIdCardEmblemFileId()) ? 5 : 6))).collect(Collectors.toList()); + return BeanUtil.toBean(storeCert, StoreCertResDTO.class).setStoreCertId(storeCert.getId()).setFileList(fileDTOList); } /** - * 批量删除档口认证 + * 编辑档口认证信息 * - * @param storeCertIds 需要删除的档口认证主键 - * @return 结果 + * @param certDTO 档口认证信息 + * @return Integer */ @Override @Transactional - public int deleteStoreCertificateByStoreCertIds(Long[] storeCertIds) { - return storeCertificateMapper.deleteStoreCertificateByStoreCertIds(storeCertIds); + public Integer update(StoreCertDTO certDTO) { + // 档口认证ID不能为空 + Optional.ofNullable(certDTO.getStoreCertId()).orElseThrow(() -> new ServiceException("档口认证ID不能为空!", HttpStatus.ERROR)); + StoreCertificate storeCert = Optional.ofNullable(this.storeCertMapper.selectOne(new LambdaQueryWrapper() + .eq(StoreCertificate::getId, certDTO.getStoreCertId()).eq(StoreCertificate::getDelFlag, Constants.UNDELETED) + .eq(StoreCertificate::getStoreId, certDTO.getStoreId()))) + .orElseThrow(() -> new ServiceException("档口认证不存在!", HttpStatus.ERROR)); + // 先将旧的档口认证相关文件置为无效 + List oldFileList = Optional.ofNullable(this.fileMapper.selectList(new LambdaQueryWrapper() + .eq(SysFile::getDelFlag, Constants.UNDELETED).in(SysFile::getId, + Arrays.asList(storeCert.getIdCardFaceFileId(), storeCert.getIdCardEmblemFileId(), storeCert.getLicenseFileId())))) + .orElseThrow(() -> new ServiceException("档口认证相关文件不存在!", HttpStatus.ERROR)); + this.fileMapper.updateById(oldFileList.stream().peek(x -> x.setDelFlag(Constants.DELETED)).collect(Collectors.toList())); + // 更新属性 + BeanUtil.copyProperties(certDTO, storeCert); + // 新增档口认证的文件列表 + this.handleStoreCertFileList(certDTO, storeCert); + return this.storeCertMapper.updateById(storeCert); } /** - * 删除档口认证信息 + * 新增档口认证文件列表 * - * @param storeCertId 档口认证主键 - * @return 结果 + * @param certDTO 档口认证文件入参 + * @param storeCert 档口认证对象 */ - @Override - @Transactional - public int deleteStoreCertificateByStoreCertId(Long storeCertId) { - return storeCertificateMapper.deleteStoreCertificateByStoreCertId(storeCertId); + private void handleStoreCertFileList(StoreCertDTO certDTO, StoreCertificate storeCert) { + // 档口认证文件类型与文件名映射 + Map typeNameTransMap = certDTO.getFileList().stream().collect(Collectors + .toMap(StoreCertDTO.StoreCertFileDTO::getFileType, StoreCertDTO.StoreCertFileDTO::getFileName)); + // 上传的文件列表 + final List fileDTOList = certDTO.getFileList(); + // 将文件插入到SysFile表中 + List fileList = BeanUtil.copyToList(fileDTOList, SysFile.class); + this.fileMapper.insert(fileList); + // 文件名称与文件ID映射 + Map fileMap = fileList.stream().collect(Collectors.toMap(SysFile::getFileName, SysFile::getId)); + // 设置身份证人脸文件ID + storeCert.setIdCardFaceFileId(fileMap.get(typeNameTransMap.get(FileType.ID_CARD_FACE.getValue()))); + // 设置身份证国徽文件ID + storeCert.setIdCardEmblemFileId(fileMap.get(typeNameTransMap.get(FileType.ID_CARD_EMBLEM.getValue()))); + // 设置营业执照文件ID + storeCert.setLicenseFileId(fileMap.get(typeNameTransMap.get(FileType.BUSINESS_LICENSE.getValue()))); } + + } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java index 19d1f629c..580b8f0bd 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java @@ -1,14 +1,27 @@ package com.ruoyi.xkt.service.impl; +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.xkt.domain.Store; +import com.ruoyi.xkt.dto.store.StoreCreateDTO; +import com.ruoyi.xkt.dto.store.StoreUpdateDTO; +import com.ruoyi.xkt.enums.StoreStatus; import com.ruoyi.xkt.mapper.StoreMapper; import com.ruoyi.xkt.service.IStoreService; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.Date; import java.util.List; +import java.util.Objects; +import java.util.Optional; /** * 档口Service业务层处理 @@ -17,9 +30,78 @@ import java.util.List; * @date 2025-03-26 */ @Service +@RequiredArgsConstructor public class StoreServiceImpl implements IStoreService { - @Autowired - private StoreMapper storeMapper; + + final StoreMapper storeMapper; + + /** + * 注册时新增档口数据 + * + * @param createDTO 档口基础数据 + * @return 结果 + */ + @Override + @Transactional + public int create(StoreCreateDTO createDTO) { + Store store = new Store(); + // 初始化注册时只需绑定用户ID即可 + store.setUserId(createDTO.getUserId()); + // 默认档口状态为:已注册 + store.setStoreStatus(StoreStatus.REGISTERED.getValue()); + // 当前时间往后推1年为试用期时间 + Date oneYearAfter = Date.from(LocalDate.now().plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant()); + store.setTrialEndTime(oneYearAfter); + return this.storeMapper.insert(store); + } + + /** + * 修改档口基本信息 + * + * @param storeUpdateDTO 档口 + * @return 结果 + */ + @Override + @Transactional + public int updateStore(StoreUpdateDTO storeUpdateDTO) { + Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper() + .eq(Store::getId, storeUpdateDTO.getStoreId()).eq(Store::getDelFlag, Constants.UNDELETED))) + .orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR)); + BeanUtil.copyProperties(storeUpdateDTO, store); + // 如果当前状态为认证营业执照 + if (Objects.equals(store.getStoreStatus(), StoreStatus.AUTH_LICENSE.getValue())) { + // 将档口状态更改为:认证基本信息 + store.setStoreStatus(StoreStatus.AUTH_BASE_INFO.getValue()); + } + return storeMapper.updateById(store); + } + + + + + + + + + + + + + + + + /** + * 新增档口 + * + * @param store 档口 + * @return 结果 + */ + @Override + @Transactional + public int insertStore(Store store) { + store.setCreateTime(DateUtils.getNowDate()); + return storeMapper.insertStore(store); + } /** * 查询档口 @@ -45,29 +127,8 @@ public class StoreServiceImpl implements IStoreService { return storeMapper.selectStoreList(store); } - /** - * 新增档口 - * - * @param store 档口 - * @return 结果 - */ - @Override - public int insertStore(Store store) { - store.setCreateTime(DateUtils.getNowDate()); - return storeMapper.insertStore(store); - } - /** - * 修改档口 - * - * @param store 档口 - * @return 结果 - */ - @Override - public int updateStore(Store store) { - store.setUpdateTime(DateUtils.getNowDate()); - return storeMapper.updateStore(store); - } + /** * 批量删除档口