master:档口新增、编辑及档口认证功能提交;

pull/1121/head
liujiang 2025-04-06 14:55:18 +08:00
parent 03f8682ad3
commit 9756e5cc23
24 changed files with 945 additions and 226 deletions

View File

@ -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<StoreCertificate> 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<StoreCertificate> list = storeCertificateService.selectStoreCertificateList(storeCertificate);
ExcelUtil<StoreCertificate> util = new ExcelUtil<StoreCertificate>(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<Integer> 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<StoreCertResVO> 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<Integer> 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));
}
}

View File

@ -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<Integer> 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<Integer> 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));
}
/**
*

View File

@ -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;
}

View File

@ -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<StoreCertFileVO> 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;
}
}

View File

@ -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<StoreFileVO> 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;
}
}

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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())

View File

@ -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())

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<StoreCertFileDTO> 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;
}
}

View File

@ -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<StoreCertFileDTO> 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;
}
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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<StoreCertificate> 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);
}

View File

@ -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);
/**
*

View File

@ -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<StoreCertificate> 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<StoreCertificate>()
.eq(StoreCertificate::getStoreId, storeId).eq(StoreCertificate::getDelFlag, Constants.UNDELETED));
List<SysFile> fileList = Optional.ofNullable(this.fileMapper.selectList(new LambdaQueryWrapper<SysFile>()
.in(SysFile::getId, Arrays.asList(storeCert.getIdCardFaceFileId(), storeCert.getIdCardEmblemFileId(), storeCert.getLicenseFileId()))
.eq(SysFile::getDelFlag, Constants.UNDELETED))).orElseThrow(() -> new ServiceException("文件不存在!", HttpStatus.ERROR));
List<StoreCertResDTO.StoreCertFileDTO> 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<StoreCertificate>()
.eq(StoreCertificate::getId, certDTO.getStoreCertId()).eq(StoreCertificate::getDelFlag, Constants.UNDELETED)
.eq(StoreCertificate::getStoreId, certDTO.getStoreId())))
.orElseThrow(() -> new ServiceException("档口认证不存在!", HttpStatus.ERROR));
// 先将旧的档口认证相关文件置为无效
List<SysFile> oldFileList = Optional.ofNullable(this.fileMapper.selectList(new LambdaQueryWrapper<SysFile>()
.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<Integer, String> typeNameTransMap = certDTO.getFileList().stream().collect(Collectors
.toMap(StoreCertDTO.StoreCertFileDTO::getFileType, StoreCertDTO.StoreCertFileDTO::getFileName));
// 上传的文件列表
final List<StoreCertDTO.StoreCertFileDTO> fileDTOList = certDTO.getFileList();
// 将文件插入到SysFile表中
List<SysFile> fileList = BeanUtil.copyToList(fileDTOList, SysFile.class);
this.fileMapper.insert(fileList);
// 文件名称与文件ID映射
Map<String, Long> 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())));
}
}

View File

@ -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<Store>()
.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);
}
/**
*