parent
c375ffeb5d
commit
ac904bd24e
@ -0,0 +1,98 @@ |
||||
package com.ruoyi.platform.controller; |
||||
|
||||
import com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.common.core.page.TableDataInfo; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
import com.ruoyi.platform.domain.PlatformStoreAccount; |
||||
import com.ruoyi.platform.domain.vo.PlatformStoreAccountVo; |
||||
import com.ruoyi.platform.service.IPlatformStoreAccountService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 店家账号Controller |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-02-10 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/platform/store/account") |
||||
public class PlatformStoreAccountController extends BaseController { |
||||
@Autowired |
||||
private IPlatformStoreAccountService platformStoreAccountService; |
||||
|
||||
|
||||
@PostMapping("register") |
||||
public AjaxResult register(@RequestBody PlatformStoreAccountVo account) { |
||||
return success(platformStoreAccountService.register(account)); |
||||
} |
||||
|
||||
/** |
||||
* 查询店家账号列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:account:list')") |
||||
@GetMapping("/list") |
||||
public TableDataInfo list(PlatformStoreAccount platformStoreAccount) { |
||||
startPage(); |
||||
List<PlatformStoreAccount> list = platformStoreAccountService.selectPlatformStoreAccountList(platformStoreAccount); |
||||
return getDataTable(list); |
||||
} |
||||
|
||||
/** |
||||
* 导出店家账号列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:account:export')") |
||||
@Log(title = "店家账号", businessType = BusinessType.EXPORT) |
||||
@PostMapping("/export") |
||||
public void export(HttpServletResponse response, PlatformStoreAccount platformStoreAccount) { |
||||
List<PlatformStoreAccount> list = platformStoreAccountService.selectPlatformStoreAccountList(platformStoreAccount); |
||||
ExcelUtil<PlatformStoreAccount> util = new ExcelUtil<PlatformStoreAccount>(PlatformStoreAccount.class); |
||||
util.exportExcel(response, list, "店家账号数据"); |
||||
} |
||||
|
||||
/** |
||||
* 获取店家账号详细信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:account:query')") |
||||
@GetMapping(value = "/{storeid}") |
||||
public AjaxResult getInfo(@PathVariable("storeid") Long storeid) { |
||||
return success(platformStoreAccountService.selectPlatformStoreAccountByStoreid(storeid)); |
||||
} |
||||
|
||||
/** |
||||
* 新增店家账号 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:account:add')") |
||||
@Log(title = "店家账号", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@RequestBody PlatformStoreAccount platformStoreAccount) { |
||||
return toAjax(platformStoreAccountService.insertPlatformStoreAccount(platformStoreAccount)); |
||||
} |
||||
|
||||
/** |
||||
* 修改店家账号 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:account:edit')") |
||||
@Log(title = "店家账号", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@RequestBody PlatformStoreAccount platformStoreAccount) { |
||||
return toAjax(platformStoreAccountService.updatePlatformStoreAccount(platformStoreAccount)); |
||||
} |
||||
|
||||
/** |
||||
* 删除店家账号 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:account:remove')") |
||||
@Log(title = "店家账号", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{storeids}") |
||||
public AjaxResult remove(@PathVariable Long[] storeids) { |
||||
return toAjax(platformStoreAccountService.deletePlatformStoreAccountByStoreids(storeids)); |
||||
} |
||||
} |
@ -0,0 +1,161 @@ |
||||
package com.ruoyi.platform.domain; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 店家账号对象 platform_store_account |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-02-10 |
||||
*/ |
||||
public class PlatformStoreAccount extends BaseEntity { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* $column.columnComment |
||||
*/ |
||||
@TableId(type = IdType.AUTO) |
||||
private Long storeid; |
||||
|
||||
/** |
||||
* 中国大陆手机号 |
||||
*/ |
||||
@Excel(name = "中国大陆手机号") |
||||
private String mobile; |
||||
|
||||
/** |
||||
* HS512 加密 |
||||
*/ |
||||
@Excel(name = "HS512 加密") |
||||
private String password; |
||||
|
||||
/** |
||||
* 枚举值、详看数据字典编码 |
||||
*/ |
||||
@Excel(name = "枚举值、详看数据字典编码") |
||||
private Long status; |
||||
|
||||
/** |
||||
* yyyy-MM-dd |
||||
*/ |
||||
@Excel(name = "yyyy-MM-dd") |
||||
private Date registerdate; |
||||
|
||||
/** |
||||
* 待确定格式 |
||||
*/ |
||||
@Excel(name = "待确定格式") |
||||
private String nickname; |
||||
|
||||
/** |
||||
* 枚举值、详看数据字典编码 |
||||
*/ |
||||
@Excel(name = "枚举值、详看数据字典编码") |
||||
private Long sex; |
||||
|
||||
/** |
||||
* 待确定存储格式 |
||||
*/ |
||||
@Excel(name = "待确定存储格式") |
||||
private String avatar; |
||||
|
||||
/** |
||||
* yyyy-MM-dd |
||||
*/ |
||||
@Excel(name = "yyyy-MM-dd") |
||||
private Date logindate; |
||||
|
||||
public void setStoreid(Long storeid) { |
||||
this.storeid = storeid; |
||||
} |
||||
|
||||
public Long getStoreid() { |
||||
return storeid; |
||||
} |
||||
|
||||
public void setMobile(String mobile) { |
||||
this.mobile = mobile; |
||||
} |
||||
|
||||
public String getMobile() { |
||||
return mobile; |
||||
} |
||||
|
||||
public void setPassword(String password) { |
||||
this.password = password; |
||||
} |
||||
|
||||
public String getPassword() { |
||||
return password; |
||||
} |
||||
|
||||
public void setStatus(Long status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Long getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setRegisterdate(Date registerdate) { |
||||
this.registerdate = registerdate; |
||||
} |
||||
|
||||
public Date getRegisterdate() { |
||||
return registerdate; |
||||
} |
||||
|
||||
public void setNickname(String nickname) { |
||||
this.nickname = nickname; |
||||
} |
||||
|
||||
public String getNickname() { |
||||
return nickname; |
||||
} |
||||
|
||||
public void setSex(Long sex) { |
||||
this.sex = sex; |
||||
} |
||||
|
||||
public Long getSex() { |
||||
return sex; |
||||
} |
||||
|
||||
public void setAvatar(String avatar) { |
||||
this.avatar = avatar; |
||||
} |
||||
|
||||
public String getAvatar() { |
||||
return avatar; |
||||
} |
||||
|
||||
public void setLogindate(Date logindate) { |
||||
this.logindate = logindate; |
||||
} |
||||
|
||||
public Date getLogindate() { |
||||
return logindate; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("storeid", getStoreid()) |
||||
.append("mobile", getMobile()) |
||||
.append("password", getPassword()) |
||||
.append("status", getStatus()) |
||||
.append("registerdate", getRegisterdate()) |
||||
.append("nickname", getNickname()) |
||||
.append("sex", getSex()) |
||||
.append("avatar", getAvatar()) |
||||
.append("logindate", getLogindate()) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.ruoyi.platform.domain.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotBlank; |
||||
|
||||
@Data |
||||
public class PlatformStoreAccountVo { |
||||
@NotBlank |
||||
private String mobile; |
||||
@NotBlank |
||||
private String password; |
||||
@NotBlank |
||||
private String verificationCode; |
||||
} |
@ -0,0 +1,56 @@ |
||||
package com.ruoyi.platform.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ruoyi.platform.domain.PlatformStoreAccount; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface PlatformStoreAccountMapper extends BaseMapper<PlatformStoreAccount> { |
||||
/** |
||||
* 查询店家账号 |
||||
* |
||||
* @param storeid 店家账号主键 |
||||
* @return 店家账号 |
||||
*/ |
||||
public PlatformStoreAccount selectPlatformStoreAccountByStoreid(Long storeid); |
||||
|
||||
/** |
||||
* 查询店家账号列表 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 店家账号集合 |
||||
*/ |
||||
public List<PlatformStoreAccount> selectPlatformStoreAccountList(PlatformStoreAccount platformStoreAccount); |
||||
|
||||
/** |
||||
* 新增店家账号 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertPlatformStoreAccount(PlatformStoreAccount platformStoreAccount); |
||||
|
||||
/** |
||||
* 修改店家账号 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 结果 |
||||
*/ |
||||
public int updatePlatformStoreAccount(PlatformStoreAccount platformStoreAccount); |
||||
|
||||
/** |
||||
* 删除店家账号 |
||||
* |
||||
* @param storeid 店家账号主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deletePlatformStoreAccountByStoreid(Long storeid); |
||||
|
||||
/** |
||||
* 批量删除店家账号 |
||||
* |
||||
* @param storeids 需要删除的数据主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deletePlatformStoreAccountByStoreids(Long[] storeids); |
||||
} |
@ -0,0 +1,64 @@ |
||||
package com.ruoyi.platform.service; |
||||
|
||||
import com.ruoyi.platform.domain.PlatformStoreAccount; |
||||
import com.ruoyi.platform.domain.vo.PlatformStoreAccountVo; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 店家账号Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-02-10 |
||||
*/ |
||||
public interface IPlatformStoreAccountService { |
||||
/** |
||||
* 查询店家账号 |
||||
* |
||||
* @param storeid 店家账号主键 |
||||
* @return 店家账号 |
||||
*/ |
||||
public PlatformStoreAccount selectPlatformStoreAccountByStoreid(Long storeid); |
||||
|
||||
/** |
||||
* 查询店家账号列表 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 店家账号集合 |
||||
*/ |
||||
public List<PlatformStoreAccount> selectPlatformStoreAccountList(PlatformStoreAccount platformStoreAccount); |
||||
|
||||
/** |
||||
* 新增店家账号 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertPlatformStoreAccount(PlatformStoreAccount platformStoreAccount); |
||||
|
||||
/** |
||||
* 修改店家账号 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 结果 |
||||
*/ |
||||
public int updatePlatformStoreAccount(PlatformStoreAccount platformStoreAccount); |
||||
|
||||
/** |
||||
* 批量删除店家账号 |
||||
* |
||||
* @param storeids 需要删除的店家账号主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deletePlatformStoreAccountByStoreids(Long[] storeids); |
||||
|
||||
/** |
||||
* 删除店家账号信息 |
||||
* |
||||
* @param storeid 店家账号主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deletePlatformStoreAccountByStoreid(Long storeid); |
||||
|
||||
public String register(PlatformStoreAccountVo account); |
||||
} |
@ -0,0 +1,127 @@ |
||||
package com.ruoyi.platform.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.ruoyi.common.utils.SecurityUtils; |
||||
import com.ruoyi.platform.domain.PlatformStoreAccount; |
||||
import com.ruoyi.platform.domain.vo.PlatformStoreAccountVo; |
||||
import com.ruoyi.platform.mapper.PlatformStoreAccountMapper; |
||||
import com.ruoyi.platform.service.IPlatformSmsService; |
||||
import com.ruoyi.platform.service.IPlatformStoreAccountService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 店家账号Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-02-10 |
||||
*/ |
||||
@Service |
||||
public class PlatformStoreAccountServiceImpl implements IPlatformStoreAccountService { |
||||
@Autowired |
||||
private PlatformStoreAccountMapper platformStoreAccountMapper; |
||||
|
||||
@Autowired |
||||
private IPlatformSmsService platformSmsService; |
||||
|
||||
/** |
||||
* 查询店家账号 |
||||
* |
||||
* @param storeid 店家账号主键 |
||||
* @return 店家账号 |
||||
*/ |
||||
@Override |
||||
public PlatformStoreAccount selectPlatformStoreAccountByStoreid(Long storeid) { |
||||
return platformStoreAccountMapper.selectPlatformStoreAccountByStoreid(storeid); |
||||
} |
||||
|
||||
/** |
||||
* 查询店家账号列表 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 店家账号 |
||||
*/ |
||||
@Override |
||||
public List<PlatformStoreAccount> selectPlatformStoreAccountList(PlatformStoreAccount platformStoreAccount) { |
||||
return platformStoreAccountMapper.selectPlatformStoreAccountList(platformStoreAccount); |
||||
} |
||||
|
||||
/** |
||||
* 新增店家账号 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertPlatformStoreAccount(PlatformStoreAccount platformStoreAccount) { |
||||
return platformStoreAccountMapper.insertPlatformStoreAccount(platformStoreAccount); |
||||
} |
||||
|
||||
/** |
||||
* 修改店家账号 |
||||
* |
||||
* @param platformStoreAccount 店家账号 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updatePlatformStoreAccount(PlatformStoreAccount platformStoreAccount) { |
||||
return platformStoreAccountMapper.updatePlatformStoreAccount(platformStoreAccount); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除店家账号 |
||||
* |
||||
* @param storeids 需要删除的店家账号主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deletePlatformStoreAccountByStoreids(Long[] storeids) { |
||||
return platformStoreAccountMapper.deletePlatformStoreAccountByStoreids(storeids); |
||||
} |
||||
|
||||
/** |
||||
* 删除店家账号信息 |
||||
* |
||||
* @param storeid 店家账号主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deletePlatformStoreAccountByStoreid(Long storeid) { |
||||
return platformStoreAccountMapper.deletePlatformStoreAccountByStoreid(storeid); |
||||
} |
||||
|
||||
//检查手机号是否已注册
|
||||
public boolean exist(String mobile) { |
||||
LambdaQueryWrapper<PlatformStoreAccount> wrapper = new LambdaQueryWrapper<>(); |
||||
wrapper.select(PlatformStoreAccount::getStoreid).eq(PlatformStoreAccount::getMobile, mobile); |
||||
return platformStoreAccountMapper.selectOne(wrapper) != null; |
||||
} |
||||
|
||||
@Override |
||||
public String register(PlatformStoreAccountVo account) { |
||||
//检查验证码是否有效
|
||||
if (platformSmsService.existsSms(account.getMobile(), account.getVerificationCode())) { |
||||
if (exist(account.getMobile())) { |
||||
return "手机号已注册"; |
||||
} else { |
||||
PlatformStoreAccount newAccount = new PlatformStoreAccount(); |
||||
newAccount.setMobile(account.getMobile()); |
||||
newAccount.setPassword(SecurityUtils.encryptPassword(account.getPassword())); |
||||
newAccount.setStatus(1L); |
||||
newAccount.setRegisterdate(new Date()); |
||||
newAccount.setNickname(newAccount.getMobile()); |
||||
newAccount.setSex(0L); |
||||
if (platformStoreAccountMapper.insert(newAccount) > 0) { |
||||
return "注册成功"; |
||||
} else { |
||||
return "注册失败"; |
||||
} |
||||
} |
||||
} else { |
||||
return "无效验证码"; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue