You've already forked FrameTour-BE
Compare commits
3 Commits
581efa327c
...
c03678bd93
Author | SHA1 | Date | |
---|---|---|---|
c03678bd93 | |||
ce7e055ada | |||
e694aac928 |
@@ -5,6 +5,8 @@ import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginOldRespVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginReq;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginRespVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicRegisterReq;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicRegisterRespVO;
|
||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||
@@ -63,6 +65,13 @@ public class AppScenicAccountController {
|
||||
return ApiResponse.success(vo);
|
||||
}
|
||||
|
||||
// 注册
|
||||
@PostMapping("/register")
|
||||
@IgnoreToken
|
||||
public ApiResponse<ScenicRegisterRespVO> register(@RequestBody ScenicRegisterReq scenicRegisterReq) {
|
||||
return scenicService.register(scenicRegisterReq);
|
||||
}
|
||||
|
||||
@GetMapping("/myScenicList")
|
||||
public ApiResponse<List<ScenicRespVO>> myScenicList() {
|
||||
List<ScenicRespVO> list;
|
||||
|
@@ -39,6 +39,13 @@ public class ScenicAccountController {
|
||||
return result > 0 ? ApiResponse.success("更新成功") : ApiResponse.fail("更新失败");
|
||||
}
|
||||
|
||||
// 激活/停用景区账号
|
||||
@PostMapping("/updateActiveStatus/{id}")
|
||||
public ApiResponse updateActiveStatus(@PathVariable Long id) {
|
||||
int result = service.updateActiveStatus(id);
|
||||
return result > 0 ? ApiResponse.success("操作成功") : ApiResponse.fail("操作失败");
|
||||
}
|
||||
|
||||
// 更新景区账号
|
||||
@PostMapping("/update")
|
||||
public ApiResponse updateScenicAccount(@RequestBody ScenicAccountEntity entity) {
|
||||
|
@@ -14,6 +14,7 @@ public interface ScenicAccountMapper {
|
||||
int update(ScenicAccountEntity scenicAccount);
|
||||
int deleteById(Long id);
|
||||
int updateStatus(Long id);
|
||||
int updateActiveStatus(Long id);
|
||||
int deleteByScenicId(Long scenicId);
|
||||
|
||||
ScenicAccountEntity findAccountById(String id);
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package com.ycwl.basic.model.mobile.scenic.account;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 景区账号注册请求
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/28 10:00
|
||||
*/
|
||||
@Data
|
||||
public class ScenicRegisterReq {
|
||||
private String phone;
|
||||
private String password;
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.ycwl.basic.model.mobile.scenic.account;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 景区账号注册响应
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/28 10:00
|
||||
*/
|
||||
@Data
|
||||
public class ScenicRegisterRespVO {
|
||||
private Long id;
|
||||
private String account;
|
||||
private String phone;
|
||||
private Integer isActive;
|
||||
private String message;
|
||||
}
|
@@ -17,6 +17,7 @@ public class ScenicAccountEntity {
|
||||
private String account;
|
||||
private String password;
|
||||
private Integer status;
|
||||
private Integer isActive;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
|
@@ -213,7 +213,8 @@ public class VoucherPrintServiceImpl implements VoucherPrintService {
|
||||
private void printTicket(VoucherPrintRecord record) throws Exception {
|
||||
FaceEntity face = faceRepository.getFace(record.getFaceId());
|
||||
MpConfigEntity scenicMpConfig = scenicRepository.getScenicMpConfig(face.getScenicId());
|
||||
String urlLink = WxMpUtil.generateUrlLink(scenicMpConfig.getAppId(), scenicMpConfig.getAppSecret(), "pages/videoSynthesis/index", "code=" + record.getVoucherCode() + "&faceId=" + face.getId());
|
||||
String urlLink = WxMpUtil.generateUrlLink(scenicMpConfig.getAppId(), scenicMpConfig.getAppSecret(), "pages/videoSynthesis/index", "code=" + record.getVoucherCode() + "&scenicId=" + face.getScenicId() + "&faceId=" + face.getId());
|
||||
urlLink = urlLink + "?cq=T"+record.getVoucherCode();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM月dd日");
|
||||
log.info(" 调用打印机打印小票,记录ID: {}, 券码: {}", record.getId(), record.getVoucherCode());
|
||||
|
@@ -6,6 +6,8 @@ import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicIndexVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginReq;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginRespVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicRegisterReq;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicRegisterRespVO;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||
@@ -26,6 +28,8 @@ public interface AppScenicService {
|
||||
|
||||
ApiResponse<ScenicLoginRespVO> login(ScenicLoginReq scenicLoginReq) throws Exception;
|
||||
|
||||
ApiResponse<ScenicRegisterRespVO> register(ScenicRegisterReq scenicRegisterReq);
|
||||
|
||||
List<ScenicAppVO> scenicListByLnLa(ScenicIndexVO scenicIndexVO);
|
||||
|
||||
ApiResponse<List<DeviceRespVO>> getDevices(Long scenicId);
|
||||
|
@@ -11,6 +11,8 @@ import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicIndexVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginReq;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginRespVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicRegisterReq;
|
||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicRegisterRespVO;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||
@@ -90,6 +92,9 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
if (scenicAccount.getStatus() == 0) {
|
||||
return ApiResponse.fail("账号已被禁用");
|
||||
}
|
||||
if (scenicAccount.getIsActive() == null || scenicAccount.getIsActive() != 1) {
|
||||
return ApiResponse.fail("账号未激活");
|
||||
}
|
||||
if (!scenicAccount.getPassword().equals(scenicLoginReq.getPassword())) {
|
||||
return ApiResponse.fail("密码错误");
|
||||
}
|
||||
@@ -113,6 +118,57 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
return ApiResponse.success(scenicLoginRespVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<ScenicRegisterRespVO> register(ScenicRegisterReq scenicRegisterReq) {
|
||||
// 验证手机号格式
|
||||
if (scenicRegisterReq.getPhone() == null || !scenicRegisterReq.getPhone().matches("^1[3-9]\\d{9}$")) {
|
||||
return ApiResponse.fail("手机号格式不正确");
|
||||
}
|
||||
|
||||
// 验证密码不能为空
|
||||
if (scenicRegisterReq.getPassword() == null || scenicRegisterReq.getPassword().trim().isEmpty()) {
|
||||
return ApiResponse.fail("密码不能为空");
|
||||
}
|
||||
|
||||
// 检查手机号是否已存在
|
||||
try {
|
||||
ScenicAccountEntity existingAccount = scenicAccountService.getScenicAccountByAccount(scenicRegisterReq.getPhone());
|
||||
if (existingAccount != null) {
|
||||
return ApiResponse.fail("该手机号已注册");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果抛出异常说明账号不存在,可以继续注册
|
||||
}
|
||||
|
||||
// 创建新账号
|
||||
ScenicAccountEntity newAccount = new ScenicAccountEntity();
|
||||
newAccount.setAccount(scenicRegisterReq.getPhone());
|
||||
newAccount.setPhone(scenicRegisterReq.getPhone());
|
||||
newAccount.setPassword(scenicRegisterReq.getPassword());
|
||||
newAccount.setIsActive(0); // 未激活状态
|
||||
newAccount.setStatus(1); // 正常状态
|
||||
newAccount.setCreateTime(new Date());
|
||||
newAccount.setUpdateTime(new Date());
|
||||
|
||||
try {
|
||||
int result = scenicAccountService.addScenicAccount(newAccount);
|
||||
if (result > 0) {
|
||||
ScenicRegisterRespVO response = new ScenicRegisterRespVO();
|
||||
response.setId(newAccount.getId());
|
||||
response.setAccount(newAccount.getAccount());
|
||||
response.setPhone(newAccount.getPhone());
|
||||
response.setIsActive(newAccount.getIsActive());
|
||||
response.setMessage("注册成功,请等待后台激活");
|
||||
return ApiResponse.success(response);
|
||||
} else {
|
||||
return ApiResponse.fail("注册失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("注册失败", e);
|
||||
return ApiResponse.fail("注册失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScenicAppVO> scenicListByLnLa(ScenicIndexVO scenicIndexVO) {
|
||||
List<ScenicAppVO> scenicAppVOS = scenicMapper.scenicListByLnLa(scenicIndexVO);
|
||||
|
@@ -17,5 +17,7 @@ public interface ScenicAccountService {
|
||||
|
||||
int updateStatus(Long id);
|
||||
|
||||
int updateActiveStatus(Long id);
|
||||
|
||||
ScenicAccountEntity getScenicAccountByAccount(String account);
|
||||
}
|
@@ -72,6 +72,11 @@ public class ScenicAccountServiceImpl implements ScenicAccountService {
|
||||
return mapper.updateStatus(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateActiveStatus(Long id) {
|
||||
return mapper.updateActiveStatus(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScenicAccountEntity getScenicAccountByAccount(String account) {
|
||||
ScenicAccountEntity accountEntity = mapper.getByAccount(account);
|
||||
|
@@ -141,6 +141,6 @@ public class WxMpUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3978838215909052416", "dhg_t.jpg");
|
||||
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3930324797233434624&morphId=22", "zt_p_t.jpg");
|
||||
}
|
||||
}
|
@@ -2,8 +2,8 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.ycwl.basic.mapper.ScenicAccountMapper">
|
||||
<insert id="add">
|
||||
insert into scenic_account(id, is_super, name, phone, account, password, create_time, update_time)
|
||||
values (#{id}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, now(), now())
|
||||
insert into scenic_account(id, is_super, name, phone, account, password, is_active, create_time, update_time)
|
||||
values (#{id}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, #{isActive}, now(), now())
|
||||
</insert>
|
||||
<insert id="addAccountScenicRelation">
|
||||
insert into account_scenic(account_id, scenic_id, is_admin)
|
||||
@@ -24,6 +24,9 @@
|
||||
<if test="password != null and password != ''">
|
||||
password = #{password},
|
||||
</if>
|
||||
<if test="isActive != null">
|
||||
is_active = #{isActive},
|
||||
</if>
|
||||
update_time = now()
|
||||
</set>
|
||||
where id = #{id}
|
||||
@@ -39,6 +42,17 @@
|
||||
END)
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateActiveStatus">
|
||||
update scenic_account
|
||||
set is_active = (CASE
|
||||
WHEN is_active = 1 THEN
|
||||
0
|
||||
WHEN is_active = 0 THEN
|
||||
1
|
||||
ELSE 1
|
||||
END)
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="deleteById">
|
||||
delete from scenic_account where id = #{id}
|
||||
</delete>
|
||||
@@ -53,12 +67,12 @@
|
||||
</delete>
|
||||
<select id="getSuperAccountOfScenic"
|
||||
resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
|
||||
select a.id, b.scenic_id, b.is_admin as isSuper, a.name, a.phone, a.account, a.password, a.create_time, a.update_time
|
||||
select a.id, b.scenic_id, b.is_admin as isSuper, a.name, a.phone, a.account, a.password, a.status, a.is_active, a.create_time, a.update_time
|
||||
from scenic_account a left join account_scenic b on a.id = b.account_id
|
||||
where b.scenic_id = #{scenicId} and b.is_admin = 1
|
||||
</select>
|
||||
<select id="getByAccount" resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
|
||||
select id, scenic_id, is_super, name, phone, account, password, status,create_time, update_time
|
||||
select id, scenic_id, is_super, name, phone, account, password, status, is_active, create_time, update_time
|
||||
from scenic_account
|
||||
where account = #{account}
|
||||
</select>
|
||||
|
Reference in New Issue
Block a user