release-厂牌注册

release-2024-08-08
pikaqiudeshujia 7 months ago
parent ec837bcbd7
commit adec59589e

@ -1,8 +1,8 @@
package com.luoo.user.controller;
import api.Result;
import com.luoo.user.dto.ArtistRegisterDto;
import com.luoo.user.dto.ArtistUserBindDto;
import com.luoo.user.dto.artist.ArtistRegisterDto;
import com.luoo.user.dto.artist.ArtistUserBindDto;
import com.luoo.user.service.ArtistService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@ -0,0 +1,40 @@
package com.luoo.user.controller;
import api.Result;
import com.luoo.user.dto.band.BandRegisterDto;
import com.luoo.user.service.BandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
* @Author: yawei.huang
* @Package: com.luoo.user.controller
* @Project: luoo_parent
* @Date: 2024/4/26 8:45
* @Filename: BandController
* @Describe:
*/
@Api(tags = "BandController")
@RestController
@RequestMapping("/band")
public class BandController {
@Autowired
private BandService bandService;
@ApiOperation(value = "厂牌注册", notes = "厂牌注册")
@PostMapping("/register")
public Result<Void> register(@ApiParam(value = "注册对象", required = true) @Valid @RequestBody BandRegisterDto bandRegisterDto) {
bandService.bandRegister(bandRegisterDto);
return Result.success();
}
}

@ -1,4 +1,4 @@
package com.luoo.user.dto;
package com.luoo.user.dto.artist;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ -1,10 +1,8 @@
package com.luoo.user.dto;
package com.luoo.user.dto.artist;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@ -0,0 +1,75 @@
package com.luoo.user.dto.band;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author: yawei.huang
* @Package: com.luoo.user.dto.band
* @Project: luoo_parent
* @Date: 2024/4/26 8:48
* @Filename: BandRegisterDto
* @Describe:
*/
@Data
public class BandRegisterDto implements Serializable {
@ApiModelProperty("用户名")
@NotBlank(message = "用户名不能为空")
private String userName;
@ApiModelProperty("密码")
@NotBlank(message = "密码不能为空")
private String password;
@ApiModelProperty("厂牌名称/昵称")
@NotBlank(message = "厂牌名称不能为空")
private String nickName;
@ApiModelProperty("所在地区")
@NotBlank(message = "所在地区不能为空")
private String address;
@ApiModelProperty("统一社会信用代码")
@NotBlank(message = "统一社会信用代码不能为空")
private String companyCode;
@ApiModelProperty("公司名称")
@NotBlank(message = "公司名称不能为空")
private String CompanyName;
@ApiModelProperty("法人")
@NotBlank(message = "法人不能为空")
private String legalPerson;
@ApiModelProperty("营业执照")
private String businessLicense;
@ApiModelProperty("运营者真实姓名")
@NotBlank(message = "运营者真实姓名不能为空")
private String name;
@ApiModelProperty("手机号码")
@NotBlank(message = "手机号码不能为空")
private String mobile;
@ApiModelProperty("身份证号")
@NotBlank(message = "身份证号不能为空")
private String idCard;
@ApiModelProperty("联系邮箱")
@NotBlank(message = "联系邮箱不能为空")
private String email;
@ApiModelProperty("运营者授权书")
@NotBlank(message = "运营者授权书不能为空")
private String authorization;
@ApiModelProperty("作品清单")
@NotBlank(message = "作品清单不能为空")
private String works;
}

@ -1,8 +1,8 @@
package com.luoo.user.service;
import com.luoo.user.dao.*;
import com.luoo.user.dto.ArtistRegisterDto;
import com.luoo.user.dto.ArtistUserBindDto;
import com.luoo.user.dto.artist.ArtistRegisterDto;
import com.luoo.user.dto.artist.ArtistUserBindDto;
import com.luoo.user.pojo.ArtistInfo;
import com.luoo.user.pojo.ArtistResponsible;
import com.luoo.user.pojo.ArtistUser;
@ -103,7 +103,7 @@ public class ArtistService {
/**
* -
*
* @param artistUserBindDto
* @param artistUserBindDto
*/
@Transactional(rollbackFor = Exception.class)
public void bindArtistAndMember(ArtistUserBindDto artistUserBindDto) {
@ -123,7 +123,7 @@ public class ArtistService {
/**
* -
* @param artistUserBindDto
* @param artistUserBindDto
*/
public void unBindArtistAndMember(ArtistUserBindDto artistUserBindDto) {
ArtistUser artistUser = artistUserDao.findArtistUserByArtistIdAndUserId(artistUserBindDto.getArtistId(), artistUserBindDto.getUserId());

@ -0,0 +1,84 @@
package com.luoo.user.service;
import com.luoo.user.dao.BandInfoDao;
import com.luoo.user.dao.BandOperatorDao;
import com.luoo.user.dao.UserInfoDao;
import com.luoo.user.dto.band.BandRegisterDto;
import com.luoo.user.pojo.BandInfo;
import com.luoo.user.pojo.BandOperator;
import com.luoo.user.pojo.UserInfo;
import constants.Constants;
import enums.UserStatusEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import util.IdWorker;
import java.util.Date;
/**
* @Author: yawei.huang
* @Package: com.luoo.user.service
* @Project: luoo_parent
* @Date: 2024/4/26 8:46
* @Filename: BandService
* @Describe:
*/
@Service
public class BandService {
@Autowired
private BandInfoDao bandInfoDao;
@Autowired
private BandOperatorDao bandOperatorDao;
@Autowired
private UserInfoDao userInfoDao;
@Autowired
private IdWorker idWorker;
@Autowired
private BCryptPasswordEncoder encoder;
@Transactional(rollbackFor = Exception.class)
public void bandRegister(BandRegisterDto bandRegisterDto) {
UserInfo userInfoByUserName = userInfoDao.findUserInfoByUserName(bandRegisterDto.getUserName());
if(userInfoByUserName != null) {
throw new RuntimeException("该用户名已存在,请重新输入!");
}
// 新增用户基本信息
UserInfo userInfo = UserInfo.builder()
.id(String.valueOf(idWorker.nextId()))
.nickName(bandRegisterDto.getNickName())
.joinTime(new Date())
.status(UserStatusEnum.UNAPPROVED.getStatus())
.thumbnail(Constants.DEFAULT_USER_THUMBNAIL)
.signature(Constants.DEFAULT_USER_SIGNATURE)
.userName(bandRegisterDto.getUserName())
.password(encoder.encode(bandRegisterDto.getPassword()))
.build();
userInfoDao.save(userInfo);
// 新增厂牌基础信息
BandInfo bandInfo = new BandInfo();
BeanUtils.copyProperties(bandRegisterDto, bandInfo);
bandInfo.setId(String.valueOf(idWorker.nextId()));
bandInfoDao.save(bandInfo);
// 新增厂牌基础信息
BandOperator bandOperator = new BandOperator();
BeanUtils.copyProperties(bandRegisterDto, bandOperator);
bandOperator.setId(String.valueOf(idWorker.nextId()));
bandOperatorDao.save(bandOperator);
}
}
Loading…
Cancel
Save