You've already forked FrameTour-BE
后台部分修改
This commit is contained in:
@ -0,0 +1,15 @@
|
||||
package com.ycwl.basic.mapper.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ScenicAccountMapper {
|
||||
ScenicAccountEntity getByAccount(String account);
|
||||
int add(ScenicAccountEntity scenicAccount);
|
||||
ScenicAccountEntity getSuperAccountOfScenic(Long scenicId);
|
||||
int update(ScenicAccountEntity scenicAccount);
|
||||
int deleteById(Long id);
|
||||
int updateStatus(Long id);
|
||||
int deleteByScenicId(Long scenicId);
|
||||
}
|
@ -20,6 +20,7 @@ public class BrokerEntity {
|
||||
* 推客名称
|
||||
*/
|
||||
private String name;
|
||||
private String phone;
|
||||
/**
|
||||
* 专属优惠码,新建时生成
|
||||
*/
|
||||
@ -30,4 +31,8 @@ public class BrokerEntity {
|
||||
private Integer status;
|
||||
private Date createAt;
|
||||
private Date updateAt;
|
||||
private Integer brokerOrderCount;
|
||||
private Integer brokerOrderAmount;
|
||||
private Date firstBrokerDate;
|
||||
private Date lastBrokerDate;
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ public class BrokerReqQuery extends BaseQueryParameterReq {
|
||||
private Long id;
|
||||
@ApiModelProperty("推客名称")
|
||||
private String name;
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
@ApiModelProperty("专属优惠码")
|
||||
private String promoCode;
|
||||
@ApiModelProperty("状态,0禁用,1启用")
|
||||
|
@ -0,0 +1,19 @@
|
||||
package com.ycwl.basic.model.pc.scenic.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("scenic_account")
|
||||
public class ScenicAccountEntity {
|
||||
private Long id;
|
||||
private Long scenicId;
|
||||
private Integer isSuper;
|
||||
private String name;
|
||||
private String account;
|
||||
private String password;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
@ -22,6 +22,11 @@ public class ScenicAddOrUpdateReq {
|
||||
*/
|
||||
@ApiModelProperty("景区名称")
|
||||
private String name;
|
||||
/**
|
||||
* 景区电话
|
||||
*/
|
||||
@ApiModelProperty("联系电话")
|
||||
private String phone;
|
||||
/**
|
||||
* 景区介绍
|
||||
*/
|
||||
@ -75,4 +80,9 @@ public class ScenicAddOrUpdateReq {
|
||||
private ScenicConfigEntity scenicConfig;
|
||||
@ApiModelProperty("景区源素材价格,元")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("账号")
|
||||
private String account;
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
}
|
||||
|
@ -23,6 +23,16 @@ public class ScenicRespVO {
|
||||
*/
|
||||
@ApiModelProperty("景区名称")
|
||||
private String name;
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@ApiModelProperty("账号")
|
||||
private String account;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@ApiModelProperty("联系电话")
|
||||
private String phone;
|
||||
/**
|
||||
* 景区介绍
|
||||
*/
|
||||
|
@ -8,6 +8,7 @@ import com.ycwl.basic.model.pc.renderWorker.req.RenderWorkerReqQuery;
|
||||
import com.ycwl.basic.service.pc.RenderWorkerService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -44,6 +45,10 @@ public class RenderWorkerServiceImpl implements RenderWorkerService {
|
||||
@Override
|
||||
public ApiResponse<Integer> add(RenderWorkerEntity renderWorker) {
|
||||
renderWorker.setId(SnowFlakeUtil.getLongId());
|
||||
if (StringUtils.isEmpty(renderWorker.getAccessKey())) {
|
||||
renderWorker.setAccessKey(SnowFlakeUtil.getId());
|
||||
}
|
||||
renderWorker.setStatus(0);
|
||||
int add = renderWorkerMapper.add(renderWorker);
|
||||
if (add == 0) {
|
||||
return ApiResponse.fail("渲染机添加失败");
|
||||
|
@ -2,7 +2,9 @@ package com.ycwl.basic.service.impl.pc;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.mapper.pc.ScenicAccountMapper;
|
||||
import com.ycwl.basic.mapper.pc.ScenicMapper;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicAddOrUpdateReq;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
@ -10,6 +12,7 @@ import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||
import com.ycwl.basic.service.pc.ScenicService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -24,6 +27,8 @@ import java.util.List;
|
||||
public class ScenicServiceImpl implements ScenicService {
|
||||
@Autowired
|
||||
private ScenicMapper scenicMapper;
|
||||
@Autowired
|
||||
private ScenicAccountMapper scenicAccountMapper;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<ScenicRespVO>> pageQuery(ScenicReqQuery scenicReqQuery) {
|
||||
@ -46,9 +51,21 @@ public class ScenicServiceImpl implements ScenicService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResponse<Boolean> add(ScenicAddOrUpdateReq scenicAddReq) {
|
||||
ScenicAccountEntity scenicAccount = scenicAccountMapper.getByAccount(scenicAddReq.getAccount());
|
||||
if (scenicAccount != null) {
|
||||
return ApiResponse.fail("账号已存在");
|
||||
}
|
||||
Long scenicId = SnowFlakeUtil.getLongId();
|
||||
scenicAddReq.setId(scenicId);
|
||||
int add = scenicMapper.add(scenicAddReq);
|
||||
ScenicAccountEntity account = new ScenicAccountEntity();
|
||||
account.setId(SnowFlakeUtil.getLongId());
|
||||
account.setScenicId(scenicId);
|
||||
account.setName(scenicAddReq.getName() + "管理员");
|
||||
account.setAccount(scenicAddReq.getAccount());
|
||||
account.setPassword(scenicAddReq.getPassword());
|
||||
account.setIsSuper(1);
|
||||
scenicAccountMapper.add(account);
|
||||
if (add > 0) {
|
||||
return ApiResponse.success(true);
|
||||
}else {
|
||||
@ -62,6 +79,7 @@ public class ScenicServiceImpl implements ScenicService {
|
||||
int i = scenicMapper.deleteById(id);
|
||||
if (i > 0) {
|
||||
scenicMapper.deleteConfigByscenicId(id);
|
||||
scenicAccountMapper.deleteByScenicId(id);
|
||||
return ApiResponse.success(true);
|
||||
}else {
|
||||
return ApiResponse.fail("景区删除失败");
|
||||
@ -70,6 +88,29 @@ public class ScenicServiceImpl implements ScenicService {
|
||||
|
||||
@Override
|
||||
public ApiResponse<Boolean> update(ScenicAddOrUpdateReq scenicUpdateReq) {
|
||||
if (StringUtils.isNotBlank(scenicUpdateReq.getAccount()) && StringUtils.isNotBlank(scenicUpdateReq.getPassword())) {
|
||||
ScenicAccountEntity scenicAccount = scenicAccountMapper.getByAccount(scenicUpdateReq.getAccount());
|
||||
if (scenicAccount != null) {
|
||||
if (!scenicAccount.getScenicId().equals(scenicUpdateReq.getId())) {
|
||||
return ApiResponse.fail("账号已存在");
|
||||
}
|
||||
}
|
||||
ScenicAccountEntity account = scenicAccountMapper.getSuperAccountOfScenic(scenicUpdateReq.getId());
|
||||
if (account != null) {
|
||||
account.setAccount(scenicUpdateReq.getAccount());
|
||||
account.setPassword(scenicUpdateReq.getPassword());
|
||||
scenicAccountMapper.update(account);
|
||||
} else {
|
||||
account = new ScenicAccountEntity();
|
||||
account.setId(SnowFlakeUtil.getLongId());
|
||||
account.setScenicId(scenicUpdateReq.getId());
|
||||
account.setName(scenicUpdateReq.getName() + "管理员");
|
||||
account.setAccount(scenicUpdateReq.getAccount());
|
||||
account.setPassword(scenicUpdateReq.getPassword());
|
||||
account.setIsSuper(1);
|
||||
scenicAccountMapper.add(account);
|
||||
}
|
||||
}
|
||||
int i = scenicMapper.update(scenicUpdateReq);
|
||||
if (i > 0) {
|
||||
return ApiResponse.success(true);
|
||||
|
Reference in New Issue
Block a user