Merge remote-tracking branch 'origin/cc_20241008_sysBuildAndAdjust' into cc_20241008_sysBuildAndAdjust
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package com.cool.store.request.license;
|
||||
|
||||
import com.cool.store.entity.LicenseTransactDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2024/10/9 16:01
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class BusinessLicenseRequest {
|
||||
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
private Long shopId;
|
||||
|
||||
@ApiModelProperty("营业执照拍照上传")
|
||||
private String licenseUrl;
|
||||
|
||||
@ApiModelProperty("营业执照名称")
|
||||
private String licenseName;
|
||||
|
||||
@ApiModelProperty("营业执照类型 0.个体工商户 1.有限责任公司 2.独资企业 3.自然人经营")
|
||||
private Integer licenseType;
|
||||
|
||||
@ApiModelProperty("营业执照上的法人")
|
||||
private String licenseLegalPerson;
|
||||
|
||||
@ApiModelProperty("统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@ApiModelProperty("发证日期")
|
||||
private Date issueTime;
|
||||
|
||||
@ApiModelProperty("营业执照经营场所")
|
||||
private String licenseAddress;
|
||||
|
||||
@ApiModelProperty("有效期类型 0:长期有效(不用传validity) 1:效期内")
|
||||
private Integer validityType;
|
||||
|
||||
@ApiModelProperty("有效期")
|
||||
private Date validity;
|
||||
|
||||
@ApiModelProperty("营业执照备注")
|
||||
private String businessLicenseRemark;
|
||||
|
||||
@ApiModelProperty("0:保存 1:提交到待审核")
|
||||
private Integer submitStatus;
|
||||
|
||||
public LicenseTransactDO toLicenseTransactDO(LicenseTransactDO licenseTransactDO) {
|
||||
if (Objects.isNull(licenseTransactDO)){
|
||||
licenseTransactDO = new LicenseTransactDO();
|
||||
}
|
||||
licenseTransactDO.setId(licenseTransactDO.getId());
|
||||
licenseTransactDO.setLicenseType(this.licenseType);
|
||||
licenseTransactDO.setLicenseLegalPerson(this.licenseLegalPerson);
|
||||
licenseTransactDO.setLicenseAddress(this.licenseAddress);
|
||||
licenseTransactDO.setIssueTime(this.issueTime);
|
||||
licenseTransactDO.setBusinessLicenseRemark(this.businessLicenseRemark);
|
||||
licenseTransactDO.setShopId(this.shopId);
|
||||
licenseTransactDO.setBusinessLicense(this.licenseName);
|
||||
licenseTransactDO.setCreditCode(this.socialCreditCode);
|
||||
licenseTransactDO.setCreditUrl(this.licenseUrl);
|
||||
if (this.validityType == 0){
|
||||
licenseTransactDO.setValidity(null);
|
||||
}else if (this.validityType == 1){
|
||||
licenseTransactDO.setValidity(this.validity);
|
||||
}
|
||||
return licenseTransactDO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.cool.store.request.license;
|
||||
|
||||
import com.cool.store.entity.LicenseTransactDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2024/10/9 16:01
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class FoodLicenseRequest {
|
||||
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
private Long shopId;
|
||||
|
||||
@ApiModelProperty("食品经营许可证图片上传")
|
||||
private String foodLicenseUrl;
|
||||
|
||||
@ApiModelProperty("经营者")
|
||||
private String operator;
|
||||
|
||||
@ApiModelProperty("食品经营许可证上的法人")
|
||||
private String foodLicenseLegalPerson;
|
||||
|
||||
@ApiModelProperty("食营经营场所")
|
||||
private String businessPremises;
|
||||
|
||||
@ApiModelProperty("主体业态")
|
||||
private String mainBusiness;
|
||||
|
||||
@ApiModelProperty("经营项目")
|
||||
private String businessProject;
|
||||
|
||||
@ApiModelProperty("许可证编号")
|
||||
private String foodLicenseCode;
|
||||
|
||||
@ApiModelProperty("许可证开始时间")
|
||||
private Date foodLicenseStartTime;
|
||||
|
||||
@ApiModelProperty("许可证截止时间")
|
||||
private Date foodLicenseEndTime;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String foodLicenseRemark;
|
||||
|
||||
@ApiModelProperty("0:保存 1:提交到待审核")
|
||||
private Integer submitStatus;
|
||||
|
||||
|
||||
public LicenseTransactDO toLicenseTransactDO(LicenseTransactDO licenseTransactDO) {
|
||||
licenseTransactDO.setMainBusiness(this.mainBusiness);
|
||||
licenseTransactDO.setOperator(this.operator);
|
||||
licenseTransactDO.setFoodLicenseLegalPerson(this.foodLicenseLegalPerson);
|
||||
licenseTransactDO.setBusinessProject(this.businessProject);
|
||||
licenseTransactDO.setFoodLicenseRemark(this.foodLicenseRemark);
|
||||
licenseTransactDO.setShopId(this.shopId);
|
||||
licenseTransactDO.setFoodBusinessLicenseCode(this.foodLicenseCode);
|
||||
licenseTransactDO.setFoodLicenseAddress(this.businessPremises);
|
||||
licenseTransactDO.setFoodBusinessStartTime(this.foodLicenseStartTime);
|
||||
licenseTransactDO.setFoodBusinessEndTime(this.foodLicenseEndTime);
|
||||
licenseTransactDO.setFoodBusinessLicenseUrl(this.foodLicenseUrl);
|
||||
return licenseTransactDO;
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,39 @@ package com.cool.store.service;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.request.LicenseListRequest;
|
||||
import com.cool.store.request.SubmitLicenseRequest;
|
||||
import com.cool.store.request.license.BusinessLicenseRequest;
|
||||
import com.cool.store.request.license.FoodLicenseRequest;
|
||||
import com.cool.store.response.LicenseListResponse;
|
||||
import com.cool.store.response.SubmitLicenseResponse;
|
||||
import com.cool.store.vo.PartnerUserInfoVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
public interface ApplyLicenseService {
|
||||
|
||||
|
||||
/**
|
||||
* 加盟商提交营业执照
|
||||
* @param request
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
Boolean submitBusinessLicense(BusinessLicenseRequest request, PartnerUserInfoVO user);
|
||||
|
||||
/**
|
||||
* 加盟商提交食品许可证
|
||||
* @param request
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
Boolean submitFoodLicense(FoodLicenseRequest request, PartnerUserInfoVO user);
|
||||
|
||||
|
||||
/**
|
||||
* 提交证照信息
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
Boolean submitLicense(SubmitLicenseRequest request, PartnerUserInfoVO user);
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,8 @@ import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.*;
|
||||
import com.cool.store.request.LicenseListRequest;
|
||||
import com.cool.store.request.SubmitLicenseRequest;
|
||||
import com.cool.store.request.license.BusinessLicenseRequest;
|
||||
import com.cool.store.request.license.FoodLicenseRequest;
|
||||
import com.cool.store.response.GetStoreInfoByCodeResponse;
|
||||
import com.cool.store.response.LicenseListResponse;
|
||||
import com.cool.store.response.SubmitLicenseResponse;
|
||||
@@ -94,6 +96,62 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
|
||||
UserAuthMappingService userAuthMappingService;
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean submitBusinessLicense(BusinessLicenseRequest request, PartnerUserInfoVO user) {
|
||||
log.info("submitBusinessLicense request:{}", JSONObject.toJSONString(request));
|
||||
if (Objects.isNull(request)) {
|
||||
return false;
|
||||
}
|
||||
String lockKey = "submitBusinessLicense:" + request.getShopId();
|
||||
String lockValue = UUID.randomUUID().toString();
|
||||
boolean acquired = Boolean.FALSE;
|
||||
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.ONE_SECONDS);
|
||||
if (!acquired) {
|
||||
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
|
||||
}
|
||||
//防止一直在页面提交
|
||||
LicenseTransactDO license = applyLicenseMapper.selectByShopId(request.getShopId());
|
||||
LicenseTransactDO licenseTransactDO = request.toLicenseTransactDO(license);
|
||||
if (licenseTransactDO.getId() == null) {
|
||||
applyLicenseMapper.insertSelective(licenseTransactDO);
|
||||
} else {
|
||||
applyLicenseMapper.updateByPrimaryKey(licenseTransactDO);
|
||||
}
|
||||
if (Constants.ONE_INTEGER.equals(request.getSubmitStatus())) {
|
||||
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33, null);
|
||||
preparationService.licenseCompleted(request.getShopId());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean submitFoodLicense(FoodLicenseRequest request, PartnerUserInfoVO user) {
|
||||
log.info("submitBusinessLicense request:{}", JSONObject.toJSONString(request));
|
||||
if (Objects.isNull(request)) {
|
||||
return false;
|
||||
}
|
||||
String lockKey = "submitBusinessLicense:" + request.getShopId();
|
||||
String lockValue = UUID.randomUUID().toString();
|
||||
boolean acquired = Boolean.FALSE;
|
||||
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.ONE_SECONDS);
|
||||
if (!acquired) {
|
||||
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
|
||||
}
|
||||
//防止一直在页面提交
|
||||
LicenseTransactDO license = applyLicenseMapper.selectByShopId(request.getShopId());
|
||||
LicenseTransactDO licenseTransactDO = request.toLicenseTransactDO(license);
|
||||
if (licenseTransactDO.getId() == null) {
|
||||
applyLicenseMapper.insertSelective(licenseTransactDO);
|
||||
} else {
|
||||
applyLicenseMapper.updateByPrimaryKey(licenseTransactDO);
|
||||
}
|
||||
if (Constants.ONE_INTEGER.equals(request.getSubmitStatus())) {
|
||||
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_43, null);
|
||||
preparationService.licenseCompleted(request.getShopId());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean submitLicense(SubmitLicenseRequest request, PartnerUserInfoVO user) {
|
||||
@@ -171,24 +229,6 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
|
||||
SubmitLicenseResponse submitLicenseResponse = new SubmitLicenseResponse();
|
||||
if (Objects.nonNull(result)) {
|
||||
submitLicenseResponse = SubmitLicenseResponse.from(result);
|
||||
List<ShopAuditInfoVO> listByShopIdAndType = shopAuditInfoMapper.getListByShopIdAndType(shopId, AuditTypeEnum.LICENSE_APPROVAL.getCode());
|
||||
List<String> userIds = listByShopIdAndType.stream().map(ShopAuditInfoVO::getSubmittedUserId).collect(Collectors.toList());
|
||||
List<EnterpriseUserDO> userInfoByUserIds;
|
||||
if (CollectionUtils.isNotEmpty(userIds)) {
|
||||
userInfoByUserIds = userMapper.getUserInfoByUserIds(userIds);
|
||||
Map<String, String> userAvatarMap = userInfoByUserIds.stream()
|
||||
.filter(item -> StringUtil.isNotBlank(item.getUserId()) && StringUtil.isNotBlank(item.getAvatar()))
|
||||
.collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getAvatar));
|
||||
listByShopIdAndType.forEach(item -> {
|
||||
String avatar = userAvatarMap.get(item.getSubmittedUserId());
|
||||
if (StringUtils.isBlank(avatar)) {
|
||||
item.setAvatar(Constants.AVATAR_DEFAULT);
|
||||
} else {
|
||||
item.setAvatar(avatar);
|
||||
}
|
||||
});
|
||||
}
|
||||
submitLicenseResponse.setProcessRecords(listByShopIdAndType);
|
||||
}
|
||||
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
|
||||
if (shopInfoDO!=null&&shopInfoDO.getSupervisorUserId()!=null){
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.context.PartnerUserHolder;
|
||||
import com.cool.store.request.SubmitLicenseRequest;
|
||||
import com.cool.store.request.license.BusinessLicenseRequest;
|
||||
import com.cool.store.request.license.FoodLicenseRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.response.SubmitLicenseResponse;
|
||||
import com.cool.store.service.ApplyLicenseService;
|
||||
@@ -29,8 +31,26 @@ public class ApplyLicenseController {
|
||||
@Resource
|
||||
ApplyLicenseService applyLicenseService;
|
||||
|
||||
|
||||
@ApiOperation("证照办理提交-营业执照")
|
||||
@PostMapping("/submitBusinessLicense")
|
||||
public ResponseResult submitBusinessLicense(@RequestBody BusinessLicenseRequest request) {
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
return ResponseResult.success(applyLicenseService.submitBusinessLicense(request,user));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("证照办理提交-食品许可证")
|
||||
@PostMapping("/submitFoodLicense")
|
||||
public ResponseResult submitFoodLicense(@RequestBody FoodLicenseRequest request) {
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
return ResponseResult.success(applyLicenseService.submitFoodLicense(request,user));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("证照办理提交")
|
||||
@PostMapping("/submit")
|
||||
@Deprecated
|
||||
public ResponseResult submitLicense(@RequestBody SubmitLicenseRequest request) {
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
return ResponseResult.success(applyLicenseService.submitLicense(request,user));
|
||||
|
||||
Reference in New Issue
Block a user