master:档口认证流程调优;
parent
d5f6e7a085
commit
a5335052c3
|
|
@ -44,11 +44,7 @@ public class StoreCertificateController extends XktBaseController {
|
|||
public R<Integer> add(@Validated @RequestBody StoreCertVO storeCertVO) {
|
||||
Integer count = storeCertService.create(BeanUtil.toBean(storeCertVO, StoreCertDTO.class));
|
||||
if (count > 0) {
|
||||
// 当前登录用户关联档口:更新关联用户缓存
|
||||
LoginUser currentUser = SecurityUtils.getLoginUser();
|
||||
UserInfo currentUserInfo = userService.getUserById(SecurityUtils.getUserId());
|
||||
currentUser.updateByUser(currentUserInfo);
|
||||
tokenService.refreshToken(currentUser);
|
||||
this.refreshUserCache();
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
|
@ -64,8 +60,23 @@ public class StoreCertificateController extends XktBaseController {
|
|||
@ApiOperation(value = "修改档口认证", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "修改档口认证", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Integer> edit(@Validated @RequestBody StoreCertVO storeCertVO) {
|
||||
return R.ok(storeCertService.update(BeanUtil.toBean(storeCertVO, StoreCertDTO.class)));
|
||||
public R<Integer> update(@Validated @RequestBody StoreCertVO storeCertVO) {
|
||||
Integer count = storeCertService.update(BeanUtil.toBean(storeCertVO, StoreCertDTO.class));
|
||||
if (count > 0) {
|
||||
this.refreshUserCache();
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新缓存
|
||||
*/
|
||||
public void refreshUserCache() {
|
||||
// 当前登录用户关联档口:更新关联用户缓存
|
||||
LoginUser currentUser = SecurityUtils.getLoginUser();
|
||||
UserInfo currentUserInfo = userService.getUserById(SecurityUtils.getUserId());
|
||||
currentUser.updateByUser(currentUserInfo);
|
||||
tokenService.refreshToken(currentUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class UserAddressController extends XktBaseController {
|
|||
private IUserAddressService userAddressService;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller')")
|
||||
@ApiOperation("创建用户收货地址")
|
||||
@ApiOperation(value = "创建用户收货地址", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("create")
|
||||
public R<UserAddressInfoVO> create(@Valid @RequestBody UserAddressCreateVO vo) {
|
||||
UserAddressInfoDTO dto = BeanUtil.toBean(vo, UserAddressInfoDTO.class);
|
||||
|
|
@ -42,7 +42,7 @@ public class UserAddressController extends XktBaseController {
|
|||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller')")
|
||||
@ApiOperation("修改用户收货地址")
|
||||
@ApiOperation(value = "修改用户收货地址", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("edit")
|
||||
public R<UserAddressInfoVO> edit(@Valid @RequestBody UserAddressModifyVO vo) {
|
||||
UserAddressInfoDTO dto = BeanUtil.toBean(vo, UserAddressInfoDTO.class);
|
||||
|
|
@ -52,7 +52,7 @@ public class UserAddressController extends XktBaseController {
|
|||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller')")
|
||||
@ApiOperation("复制用户收货地址")
|
||||
@ApiOperation(value = "复制用户收货地址", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("copy")
|
||||
public R<UserAddressInfoVO> copy(@Valid @RequestBody IdVO vo) {
|
||||
userAddressService.checkOwner(vo.getId(), SecurityUtils.getUserId());
|
||||
|
|
@ -61,7 +61,7 @@ public class UserAddressController extends XktBaseController {
|
|||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller')")
|
||||
@ApiOperation("删除用户收货地址")
|
||||
@ApiOperation(value = "删除用户收货地址", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("delete")
|
||||
public R delete(@Valid @RequestBody IdVO vo) {
|
||||
userAddressService.checkOwner(vo.getId(), SecurityUtils.getUserId());
|
||||
|
|
@ -70,7 +70,7 @@ public class UserAddressController extends XktBaseController {
|
|||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller')")
|
||||
@ApiOperation(value = "用户收货地址详情")
|
||||
@ApiOperation(value = "用户收货地址详情", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/{id}")
|
||||
public R<UserAddressInfoVO> getInfo(@PathVariable("id") Long id) {
|
||||
userAddressService.checkOwner(id, SecurityUtils.getUserId());
|
||||
|
|
@ -79,7 +79,7 @@ public class UserAddressController extends XktBaseController {
|
|||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller')")
|
||||
@ApiOperation(value = "用户收货地址列表")
|
||||
@ApiOperation(value = "用户收货地址列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/list")
|
||||
public R<List<UserAddressInfoVO>> list() {
|
||||
List<UserAddressInfoDTO> dtoList = userAddressService.listByUser(SecurityUtils.getUserId());
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
|
|
@ -16,5 +17,7 @@ public class ExpressAddressParseReqVO {
|
|||
|
||||
@NotEmpty
|
||||
@ApiModelProperty(value = "地址,包含地址、姓名、电话等", required = true)
|
||||
@Size(min = 0, max = 200, message = "地址,包含地址、姓名、电话等长度不能超过200个字符!")
|
||||
private String address;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("新增档口认证信息")
|
||||
@ApiModel("档口认证详情")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StoreCertResVO {
|
||||
|
|
|
|||
|
|
@ -25,77 +25,119 @@ import java.util.List;
|
|||
@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 = 0, 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;
|
||||
@Valid
|
||||
@ApiModelProperty(value = "认证文件列表", required = true)
|
||||
@NotNull(message = "认证文件列表不能为空")
|
||||
private List<StoreFileVO> fileList;
|
||||
@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 = 0, 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 = 0, max = 100, message = "登记机关长度必须在1到100个字之间")
|
||||
private String registerOrg;
|
||||
@ApiModelProperty(value = "登记状态", required = true)
|
||||
private Integer registerStatus;
|
||||
@ApiModelProperty(value = "法定代表人/负责人名称", required = true)
|
||||
@NotBlank(message = "法定代表人/负责人名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "法定代表人/负责人名称长度必须在1到30个字之间")
|
||||
private String legalName;
|
||||
@ApiModelProperty(value = "注册资本(万)")
|
||||
private Integer registerCapital;
|
||||
@ApiModelProperty(value = "实际经营地址", required = true)
|
||||
@NotBlank(message = "实际经营地址不能为空")
|
||||
@Size(min = 0, max = 100, message = "实际经营地址长度必须在1到100个字之间")
|
||||
private String realBusinessAddress;
|
||||
@ApiModelProperty(value = "经营范围")
|
||||
@Size(min = 0, 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;
|
||||
@ApiModelProperty(value = "档口认证信息", required = true)
|
||||
@NotNull(message = "档口认证信息不能为空!")
|
||||
private SCStoreCertVO storeCert;
|
||||
@Valid
|
||||
@ApiModelProperty(value = "档口基础信息", required = true)
|
||||
@NotNull(message = "档口基础信息不能为空!")
|
||||
private SCStoreBasicVO storeBasic;
|
||||
|
||||
@Data
|
||||
@ApiModel
|
||||
public static class SCStoreBasicVO {
|
||||
@ApiModelProperty(value = "档口名称")
|
||||
private String storeName;
|
||||
@ApiModelProperty(value = "档口LOGO")
|
||||
private SCStoreFileVO storeLogo;
|
||||
@NotBlank(message = "联系人不能为空!")
|
||||
@ApiModelProperty(value = "联系人", required = true)
|
||||
private String contactName;
|
||||
@NotBlank(message = "联系电话不能为空!")
|
||||
@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 = "档口地址")
|
||||
@Size(min = 0, max = 50, message = "档口地址长度必须在0到50个字之间")
|
||||
private String storeAddress;
|
||||
@ApiModelProperty(value = "工厂地址")
|
||||
@Size(min = 0, max = 50, message = "工厂地址长度必须在0到50个字之间")
|
||||
private String facAddress;
|
||||
@ApiModelProperty(value = "生产规模")
|
||||
private Integer prodScale;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ApiModel
|
||||
public static class SCStoreCertVO {
|
||||
@ApiModelProperty(value = "档口认证ID(新增时不传,编辑必传)")
|
||||
private Long storeCertId;
|
||||
@ApiModelProperty(value = "真实姓名", required = true)
|
||||
@NotBlank(message = "真实姓名不能为空")
|
||||
@Size(min = 0, 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;
|
||||
@Valid
|
||||
@ApiModelProperty(value = "认证文件列表", required = true)
|
||||
@NotNull(message = "认证文件列表不能为空")
|
||||
private List<SCStoreFileVO> fileList;
|
||||
@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 = 0, 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 = 0, max = 100, message = "登记机关长度必须在1到100个字之间")
|
||||
private String registerOrg;
|
||||
@ApiModelProperty(value = "登记状态", required = true)
|
||||
private Integer registerStatus;
|
||||
@ApiModelProperty(value = "法定代表人/负责人名称", required = true)
|
||||
@NotBlank(message = "法定代表人/负责人名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "法定代表人/负责人名称长度必须在1到30个字之间")
|
||||
private String legalName;
|
||||
@ApiModelProperty(value = "注册资本(万)")
|
||||
private Integer registerCapital;
|
||||
@ApiModelProperty(value = "实际经营地址", required = true)
|
||||
@NotBlank(message = "实际经营地址不能为空")
|
||||
@Size(min = 0, max = 100, message = "实际经营地址长度必须在1到100个字之间")
|
||||
private String realBusinessAddress;
|
||||
@ApiModelProperty(value = "经营范围")
|
||||
@Size(min = 0, 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
|
||||
public static class StoreFileVO {
|
||||
public static class SCStoreFileVO {
|
||||
@NotBlank(message = "文件名称不能为空!")
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
|
|
|
|||
|
|
@ -131,14 +131,15 @@ public class XktTask {
|
|||
public void seasonTag() {
|
||||
LocalDate today = LocalDate.now();
|
||||
int month = today.getMonthValue();
|
||||
int day = today.getDayOfMonth();
|
||||
String seasonLabel = "";
|
||||
if (month == 3) {
|
||||
if (month == 3 && day == 1) {
|
||||
seasonLabel = today.getYear() + "年春季";
|
||||
} else if (month == 6) {
|
||||
} else if (month == 6 && day == 1) {
|
||||
seasonLabel = today.getYear() + "年夏季";
|
||||
} else if (month == 9) {
|
||||
} else if (month == 9 && day == 1) {
|
||||
seasonLabel = today.getYear() + "年秋季";
|
||||
} else if (month == 12) {
|
||||
} else if (month == 12 && day == 1) {
|
||||
seasonLabel = today.getYear() + "年冬季";
|
||||
}
|
||||
if (StringUtils.isEmpty(seasonLabel)) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class Store extends XktBaseEntity {
|
|||
/**
|
||||
* 档口LOGO
|
||||
*/
|
||||
private String storeLogo;
|
||||
private Long storeLogoId;
|
||||
|
||||
/**
|
||||
* 品牌名称
|
||||
|
|
|
|||
|
|
@ -90,12 +90,6 @@ public class StoreProduct extends XktBaseEntity {
|
|||
@Excel(name = "上架方式", readConverterExp = "立=即上架、定时上架")
|
||||
private Integer listingWay;
|
||||
|
||||
/**
|
||||
* 下一个生成的条形码尾号
|
||||
*/
|
||||
@Excel(name = "下一个生成的条形码尾号")
|
||||
private Integer nextBarcodeNum;
|
||||
|
||||
/**
|
||||
* 定时发货时间(精确到小时)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
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;
|
||||
|
|
@ -19,62 +19,94 @@ import java.util.List;
|
|||
@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(value = "注册资本(万)")
|
||||
private Integer registerCapital;
|
||||
@ApiModelProperty(value = "实际经营地址", required = true)
|
||||
private String realBusinessAddress;
|
||||
@ApiModelProperty(value = "经营范围")
|
||||
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;
|
||||
@ApiModelProperty(value = "档口认证信息", required = true)
|
||||
private SCStoreCertDTO storeCert;
|
||||
@ApiModelProperty(value = "档口基础信息", required = true)
|
||||
private SCStoreBasicDTO storeBasic;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "档口文件")
|
||||
public static class StoreCertFileDTO {
|
||||
public static class SCStoreBasicDTO {
|
||||
@ApiModelProperty(value = "档口名称")
|
||||
private String storeName;
|
||||
@ApiModelProperty(value = "档口LOGO")
|
||||
private SCStoreFileDTO storeLogo;
|
||||
@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 storeAddress;
|
||||
@ApiModelProperty(value = "工厂地址")
|
||||
private String facAddress;
|
||||
@ApiModelProperty(value = "生产规模")
|
||||
private Integer prodScale;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class SCStoreCertDTO {
|
||||
@ApiModelProperty(value = "档口认证ID(新增时不传,编辑必传)")
|
||||
private Long storeCertId;
|
||||
@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<SCStoreFileDTO> 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(value = "注册资本(万)")
|
||||
private Integer registerCapital;
|
||||
@ApiModelProperty(value = "实际经营地址", required = true)
|
||||
private String realBusinessAddress;
|
||||
@ApiModelProperty(value = "经营范围")
|
||||
private String businessScope;
|
||||
@ApiModelProperty(value = "营业期限开始时间")
|
||||
private Date businessTermStartDate;
|
||||
@ApiModelProperty(value = "营业期限截止时间")
|
||||
private Date businessTermEndDate;
|
||||
@ApiModelProperty(value = "成立日期")
|
||||
private Date establishDate;
|
||||
@ApiModelProperty(value = "核准日期")
|
||||
private Date approvalDate;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class SCStoreFileDTO {
|
||||
@NotBlank(message = "文件名称不能为空!")
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
@NotBlank(message = "文件路径不能为空!")
|
||||
@ApiModelProperty(value = "文件路径", required = true)
|
||||
private String fileUrl;
|
||||
@ApiModelProperty(value = "文件类型(4 人脸照片 5 国徽照片 6档口营业执照)")
|
||||
private Integer fileType;
|
||||
@NotNull(message = "文件大小不能为空!")
|
||||
@ApiModelProperty(value = "文件大小", required = true)
|
||||
private BigDecimal fileSize;
|
||||
@NotNull(message = "文件类型不能为空!")
|
||||
@ApiModelProperty(value = "文件类型", required = true)
|
||||
private Integer fileType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ import com.ruoyi.xkt.enums.StoreStatus;
|
|||
import com.ruoyi.xkt.mapper.*;
|
||||
import com.ruoyi.xkt.service.IAssetService;
|
||||
import com.ruoyi.xkt.service.IStoreCertificateService;
|
||||
import com.ruoyi.xkt.service.IStoreService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
|
@ -66,31 +66,10 @@ public class StoreCertificateServiceImpl implements IStoreCertificateService {
|
|||
// 新增档口认证的文件列表
|
||||
this.handleStoreCertFileList(certDTO, storeCert);
|
||||
// 新增档口
|
||||
this.create();
|
||||
this.createStore(certDTO);
|
||||
return this.storeCertMapper.insert(storeCert);
|
||||
}
|
||||
|
||||
public int create() {
|
||||
Store store = new Store();
|
||||
// 初始化注册时只需绑定用户ID即可
|
||||
store.setUserId(SecurityUtils.getUserId());
|
||||
// 默认档口状态为:待审核
|
||||
store.setStoreStatus(StoreStatus.UN_AUDITED.getValue());
|
||||
// 当前时间往后推1年为试用期时间
|
||||
Date oneYearAfter = Date.from(LocalDate.now().plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
store.setTrialEndTime(oneYearAfter);
|
||||
// 设置档口默认权重 0
|
||||
store.setStoreWeight(Constants.STORE_WEIGHT_DEFAULT_ZERO);
|
||||
int count = this.storeMapper.insert(store);
|
||||
// 创建档口账户
|
||||
assetService.createInternalAccountIfNotExists(store.getId());
|
||||
// 档口用户绑定
|
||||
userService.refreshRelStore(store.getUserId(), ESystemRole.SUPPLIER.getId());
|
||||
// 放到redis中
|
||||
redisCache.setCacheObject(CacheConstants.STORE_KEY + store.getId(), store.getId());
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据档口ID获取档口详情信息
|
||||
*
|
||||
|
|
@ -124,9 +103,9 @@ public class StoreCertificateServiceImpl implements IStoreCertificateService {
|
|||
@Transactional
|
||||
public Integer update(StoreCertDTO certDTO) {
|
||||
// 档口认证ID不能为空
|
||||
Optional.ofNullable(certDTO.getStoreCertId()).orElseThrow(() -> new ServiceException("档口认证ID不能为空!", HttpStatus.ERROR));
|
||||
Optional.ofNullable(certDTO.getStoreCert().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::getId, certDTO.getStoreCert().getStoreCertId()).eq(StoreCertificate::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreCertificate::getStoreId, certDTO.getStoreId())))
|
||||
.orElseThrow(() -> new ServiceException("档口认证不存在!", HttpStatus.ERROR));
|
||||
// 先将旧的档口认证相关文件置为无效
|
||||
|
|
@ -139,9 +118,12 @@ public class StoreCertificateServiceImpl implements IStoreCertificateService {
|
|||
BeanUtil.copyProperties(certDTO, storeCert);
|
||||
// 新增档口认证的文件列表
|
||||
this.handleStoreCertFileList(certDTO, storeCert);
|
||||
// 更新档口信息
|
||||
this.updateStore(certDTO.getStoreId(), certDTO.getStoreBasic());
|
||||
return this.storeCertMapper.updateById(storeCert);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增档口认证文件列表
|
||||
*
|
||||
|
|
@ -150,10 +132,10 @@ public class StoreCertificateServiceImpl implements IStoreCertificateService {
|
|||
*/
|
||||
private void handleStoreCertFileList(StoreCertDTO certDTO, StoreCertificate storeCert) {
|
||||
// 档口认证文件类型与文件名映射
|
||||
Map<Integer, String> typeNameTransMap = certDTO.getFileList().stream().collect(Collectors
|
||||
.toMap(StoreCertDTO.StoreCertFileDTO::getFileType, StoreCertDTO.StoreCertFileDTO::getFileName));
|
||||
Map<Integer, String> typeNameTransMap = certDTO.getStoreCert().getFileList().stream().collect(Collectors
|
||||
.toMap(StoreCertDTO.SCStoreFileDTO::getFileType, StoreCertDTO.SCStoreFileDTO::getFileName));
|
||||
// 上传的文件列表
|
||||
final List<StoreCertDTO.StoreCertFileDTO> fileDTOList = certDTO.getFileList();
|
||||
final List<StoreCertDTO.SCStoreFileDTO> fileDTOList = certDTO.getStoreCert().getFileList();
|
||||
// 将文件插入到SysFile表中
|
||||
List<SysFile> fileList = BeanUtil.copyToList(fileDTOList, SysFile.class);
|
||||
this.fileMapper.insert(fileList);
|
||||
|
|
@ -167,5 +149,62 @@ public class StoreCertificateServiceImpl implements IStoreCertificateService {
|
|||
storeCert.setLicenseFileId(fileMap.get(typeNameTransMap.get(FileType.BUSINESS_LICENSE.getValue())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档口
|
||||
*
|
||||
* @param certDTO
|
||||
*/
|
||||
private void createStore(StoreCertDTO certDTO) {
|
||||
Store store = BeanUtil.toBean(certDTO.getStoreBasic(), Store.class);
|
||||
// 初始化注册时只需绑定用户ID即可
|
||||
store.setUserId(SecurityUtils.getUserId());
|
||||
// 默认档口状态为:待审核
|
||||
store.setStoreStatus(StoreStatus.UN_AUDITED.getValue());
|
||||
// 当前时间往后推1年为试用期时间
|
||||
Date oneYearAfter = Date.from(LocalDate.now().plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
store.setTrialEndTime(oneYearAfter);
|
||||
// 设置档口默认权重 0
|
||||
store.setStoreWeight(Constants.STORE_WEIGHT_DEFAULT_ZERO);
|
||||
// 已使用的档口空间
|
||||
BigDecimal storageUsage = certDTO.getStoreCert().getFileList().stream().map(x -> ObjectUtils.defaultIfNull(x.getFileSize(), BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// 新增档口LOGO
|
||||
if (ObjectUtils.isNotEmpty(certDTO.getStoreBasic().getStoreLogo())) {
|
||||
SysFile file = BeanUtil.toBean(certDTO.getStoreBasic().getStoreLogo(), SysFile.class);
|
||||
this.fileMapper.insert(file);
|
||||
store.setStoreLogoId(file.getId());
|
||||
store.setStorageUsage(storageUsage.add(file.getFileSize()));
|
||||
}
|
||||
this.storeMapper.insert(store);
|
||||
// 创建档口账户
|
||||
assetService.createInternalAccountIfNotExists(store.getId());
|
||||
// 档口用户绑定
|
||||
userService.refreshRelStore(store.getUserId(), ESystemRole.SUPPLIER.getId());
|
||||
// 放到redis中
|
||||
redisCache.setCacheObject(CacheConstants.STORE_KEY + store.getId(), store.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证流程更新档口
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @param storeBasic 档口基本信息
|
||||
*/
|
||||
private void updateStore(Long storeId, StoreCertDTO.SCStoreBasicDTO storeBasic) {
|
||||
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
|
||||
.eq(Store::getId, storeId).eq(Store::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
|
||||
BeanUtil.copyProperties(storeBasic, store);
|
||||
if (ObjectUtils.isNotEmpty(storeBasic.getStoreLogo())) {
|
||||
// 直接新增
|
||||
SysFile file = BeanUtil.toBean(storeBasic.getStoreLogo(), SysFile.class);
|
||||
this.fileMapper.insert(file);
|
||||
store.setStoreLogoId(file.getId());
|
||||
}
|
||||
// 默认档口状态为:待审核
|
||||
store.setStoreStatus(StoreStatus.UN_AUDITED.getValue());
|
||||
this.storeMapper.updateById(store);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue