记得上下班打卡 | git大法好,push需谨慎

Commit 64b459bb authored by 胡佳晨's avatar 胡佳晨

提交 验票子账号演出关联关系 vo redis

parent d2ea3b95
......@@ -10,4 +10,7 @@ public class KylinRedisConst {
public static final String TICKET = "kylin:ticket:info";
public static final String TIMES = "kylin:times:id";
public static final String BANNERS = "kylin:banners";
public static final String CHECK_USER = "kylin:checkUser";
public static final String CHECK_USER_RELATION = "kylin:checkUser:relation";
}
package com.liquidnet.service.kylin.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@ApiModel
public class CheckUserPerformanceVo implements Serializable {
@ApiModelProperty(value = "id")
private String checkUserId;
@ApiModelProperty(value = "演出id数组")
private List<String> performanceList;
}
package com.liquidnet.service.kylin.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel
public class CheckUserVo implements Serializable {
@ApiModelProperty(value = "id")
private String checkUserId;
@ApiModelProperty(value = "父类id")
private String merchantId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "手机号")
private String mobile;
@ApiModelProperty(value = "密码")
private String pwd;
@ApiModelProperty(value = "状态")
private String status;
}
package com.liquidnet.service.kylin.service.partner;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dao.ChildPerformanceDao;
import com.liquidnet.service.kylin.entity.KylinCheckUserPerformances;
import com.baomidou.mybatisplus.extension.service.IService;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -18,15 +20,15 @@ import java.util.List;
public interface IKylinCheckUserPerformancesPartnerService extends IService<KylinCheckUserPerformances> {
// 已配置列表
PageInfo<ChildPerformanceDao> childPerformanceList(String merchantId,String checkUserId);
ResponseDto<PageInfo<ChildPerformanceDao>> childPerformanceList(String merchantId,String checkUserId,int page,int size);
// 未配置列表
PageInfo<ChildPerformanceDao> unChildPerformanceList(String merchantId,String checkUserId);
ResponseDto<PageInfo<ChildPerformanceDao>> unChildPerformanceList(String merchantId,String checkUserId,int page,int size);
// 添加配置
String setPerformance(List<String> performanceIds,String checkUserId);
ResponseDto<String> setPerformance(List<String> performanceIds,String checkUserId, String canDownTime);
// 删除配置
String delPerformance(List<String> performanceIds,String checkUserId);
ResponseDto<String> delPerformance(List<String> performanceIds, String checkUserId);
}
......@@ -29,20 +29,18 @@
</select>
<!-- 第三方 验票员未配置 演出 -->
<!-- 第三方 验票员已配置 演出 -->
<select id="unChildPerformanceList" parameterType="java.util.Map" resultMap="childPerformanceDaoResult">
SELECT
p.performances_id ,
p.title ,
p.time_start ,
p.time_end,
cup.can_down_time
FROM
kylin_performances AS p
LEFT JOIN kylin_check_user_performances AS cup ON cup.performance_id = p.performances_id
LEFT JOIN kylin_performance_relations AS pr ON pr.performance_id = p.performances_id
<where>
pr.merchant_id = #{merchantId} AND cup.check_user_id = #{checkUserId}
</where>
SELECT p.performances_id,
p.title,
p.time_start,
p.time_end
FROM kylin_performances AS p
LEFT JOIN kylin_performance_relations AS pr ON pr.performance_id = p.performances_id
WHERE p.performances_id NOT IN (
SELECT performance_id
FROM kylin_check_user_performances
WHERE check_user_id = #{checkUserId}
)
AND pr.merchant_id = #{merchantId}
</select>
</mapper>
package com.liquidnet.service.kylin.controller.partner;
import org.springframework.web.bind.annotation.RequestMapping;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dao.ChildPerformanceDao;
import com.liquidnet.service.kylin.mapper.KylinCheckUserPerformancesMapper;
import com.liquidnet.service.kylin.service.impl.partner.KylinCheckUserPerformancesPartnerServiceImpl;
import com.liquidnet.service.kylin.service.impl.partner.KylinTicketsPartnerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
......@@ -13,8 +24,48 @@ import org.springframework.web.bind.annotation.RestController;
* @author liquidnet
* @since 2021-05-21
*/
@Api(tags = "第三方-验票账号关联演出")
@RestController
@RequestMapping("partner/checkUser/performance")
public class KylinCheckUserPerformancesPartnerController {
@Autowired
private KylinCheckUserPerformancesPartnerServiceImpl userPerformancesPartnerService;
@PostMapping(value = "")
@ApiOperation(value = "添加关联关系", position = 1)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> setPerformance(@RequestParam("performanceIds") List<String> performanceIds,
@RequestParam("checkUserId") String checkUserId,
@RequestParam("canDownTime") String canDownTime) {
return userPerformancesPartnerService.setPerformance(performanceIds, checkUserId, canDownTime);
}
@DeleteMapping(value = "")
@ApiOperation(value = "删除关联关系", position = 1)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> delPerformance(@RequestParam("performanceIds") List<String> performanceIds,
@RequestParam("checkUserId") String checkUserId) {
return userPerformancesPartnerService.delPerformance(performanceIds, checkUserId);
}
@GetMapping(value = "relation")
@ApiOperation(value = "关联演出列表", position = 1)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PageInfo<ChildPerformanceDao>> childPerformanceList(@RequestParam("merchantId") String merchantId,
@RequestParam("checkUserId") String checkUserId,
@RequestParam("page") int page,
@RequestParam("size") int size) {
return userPerformancesPartnerService.childPerformanceList(merchantId, checkUserId, page, size);
}
@GetMapping(value = "unRelation")
@ApiOperation(value = "未关联演出列表", position = 1)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PageInfo<ChildPerformanceDao>> unChildPerformanceList(@RequestParam("merchantId") String merchantId,
@RequestParam("checkUserId") String checkUserId,
@RequestParam("page") int page,
@RequestParam("size") int size) {
return userPerformancesPartnerService.unChildPerformanceList(merchantId, checkUserId, page, size);
}
}
......@@ -3,21 +3,31 @@ package com.liquidnet.service.kylin.service.impl.partner;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dao.ChildDetailsDao;
import com.liquidnet.service.kylin.dao.ChildListDao;
import com.liquidnet.service.kylin.dto.vo.CheckUserVo;
import com.liquidnet.service.kylin.entity.KylinCheckUser;
import com.liquidnet.service.kylin.mapper.KylinCheckUserMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.kylin.service.partner.IKylinCheckUserPartnerService;
import com.mongodb.BasicDBObject;
import org.apache.tomcat.jni.Local;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
/**
......@@ -31,6 +41,12 @@ import java.util.List;
@Service
public class KylinCheckUserPartnerServiceImpl extends ServiceImpl<KylinCheckUserMapper, KylinCheckUser> implements IKylinCheckUserPartnerService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoConverter mongoConverter;
@Autowired
private RedisUtil redisUtil;
@Autowired
private KylinCheckUserMapper checkUserMapper;
......@@ -54,6 +70,16 @@ public class KylinCheckUserPartnerServiceImpl extends ServiceImpl<KylinCheckUser
checkUser.setUpdatedAt(LocalDateTime.now());
checkUser.setStatus(0);
checkUserMapper.update(checkUser, new UpdateWrapper<KylinCheckUser>().eq("check_user_id", checkUserId));
redisUtil.hdel(KylinRedisConst.CHECK_USER, checkUserId);
HashMap<String,Object> map =new HashMap<>();
map.put("status",0);
BasicDBObject obj = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(CheckUserVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("checkUserId").is(checkUserId)).getQueryObject(),
obj
);
return ResponseDto.success("删除成功");
} catch (Exception e) {
return ResponseDto.failure(ErrorMapping.get(20102));
......@@ -72,6 +98,11 @@ public class KylinCheckUserPartnerServiceImpl extends ServiceImpl<KylinCheckUser
checkUser.setMerchantId(merchantId);
checkUser.setStatus(1);
checkUserMapper.insert(checkUser);
CheckUserVo checkUserVo = new CheckUserVo();
BeanUtils.copyProperties(checkUser, checkUserVo);
mongoTemplate.insert(checkUserVo, CheckUserVo.class.getSimpleName());
return ResponseDto.success("添加成功");
} catch (Exception e) {
return ResponseDto.failure(ErrorMapping.get(20101));
......@@ -87,6 +118,12 @@ public class KylinCheckUserPartnerServiceImpl extends ServiceImpl<KylinCheckUser
checkUser.setMobile(mobile);
checkUser.setUpdatedAt(LocalDateTime.now());
checkUserMapper.update(checkUser, new UpdateWrapper<KylinCheckUser>().eq("check_user_id", checkUserId).eq("merchant_id", merchantId));
BasicDBObject obj = new BasicDBObject("$set", mongoConverter.convertToMongoType(checkUser));
mongoTemplate.getCollection(CheckUserVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("checkUserId").is(checkUserId)).getQueryObject(),
obj
);
redisUtil.hdel(KylinRedisConst.CHECK_USER, checkUserId);
return ResponseDto.success("修改成功");
} catch (Exception e) {
return ResponseDto.failure(ErrorMapping.get(20103));
......
package com.liquidnet.service.kylin.service.impl.partner;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dao.ChildPerformanceDao;
import com.liquidnet.service.kylin.dto.vo.CheckUserPerformanceVo;
import com.liquidnet.service.kylin.entity.KylinCheckUserPerformances;
import com.liquidnet.service.kylin.mapper.KylinCheckUserPerformancesMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.kylin.service.partner.IKylinCheckUserPerformancesPartnerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -21,23 +37,86 @@ import java.util.List;
@Service
public class KylinCheckUserPerformancesPartnerServiceImpl extends ServiceImpl<KylinCheckUserPerformancesMapper, KylinCheckUserPerformances> implements IKylinCheckUserPerformancesPartnerService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoConverter mongoConverter;
@Autowired
private RedisUtil redisUtil;
@Autowired
private KylinCheckUserPerformancesMapper checkUserPerformancesMapper;
@Override
public PageInfo<ChildPerformanceDao> childPerformanceList(String merchantId, String checkUserId) {
return null;
public ResponseDto<PageInfo<ChildPerformanceDao>> childPerformanceList(String merchantId, String checkUserId, int page, int size) {
PageInfo<ChildPerformanceDao> pageInfo = null;
try {
PageHelper.startPage(page, size);
List<ChildPerformanceDao> data = checkUserPerformancesMapper.childPerformanceList(merchantId, checkUserId);
pageInfo = new PageInfo(data);
return ResponseDto.success(pageInfo);
} catch (Exception e) {
return ResponseDto.success(pageInfo);
}
}
@Override
public PageInfo<ChildPerformanceDao> unChildPerformanceList(String merchantId, String checkUserId) {
return null;
public ResponseDto<PageInfo<ChildPerformanceDao>> unChildPerformanceList(String merchantId, String checkUserId, int page, int size) {
PageInfo<ChildPerformanceDao> pageInfo = null;
try {
PageHelper.startPage(page, size);
List<ChildPerformanceDao> data = checkUserPerformancesMapper.unChildPerformanceList(merchantId, checkUserId);
pageInfo = new PageInfo(data);
return ResponseDto.success(pageInfo);
} catch (Exception e) {
return ResponseDto.success(pageInfo);
}
}
@Override
public String setPerformance(List<String> performanceIds, String checkUserId) {
return null;
public ResponseDto<String> setPerformance(List<String> performanceIds, String checkUserId, String canDownTime) {
try {
List<String> performanceList = new ArrayList<>();
for (String performanceId : performanceIds) {
KylinCheckUserPerformances checkUserPerformances = new KylinCheckUserPerformances();
checkUserPerformances.setCheckUserId(checkUserId);
checkUserPerformances.setCanDownTime(LocalDateTime.parse(canDownTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
checkUserPerformances.setPerformanceId(performanceId);
checkUserPerformances.setCheckUserPerformanceId(IDGenerator.nextSnowId().toString());
checkUserPerformances.setCreatedAt(LocalDateTime.now());
checkUserPerformances.setStatus(1);
checkUserPerformancesMapper.insert(checkUserPerformances);
performanceList.add(performanceId);
}
CheckUserPerformanceVo userPerformanceVo = new CheckUserPerformanceVo();
userPerformanceVo.setCheckUserId(checkUserId);
userPerformanceVo.setPerformanceList(performanceList);
mongoTemplate.remove(Query.query(Criteria.where("checkUserId").is(checkUserId)),CheckUserPerformanceVo.class,CheckUserPerformanceVo.class.getSimpleName());
mongoTemplate.insert(userPerformanceVo,CheckUserPerformanceVo.class.getSimpleName());
redisUtil.hdel(KylinRedisConst.CHECK_USER_RELATION,checkUserId);
return ResponseDto.success("添加成功");
}catch (Exception e){
return ResponseDto.failure(ErrorMapping.get(20101));
}
}
@Override
public String delPerformance(List<String> performanceIds, String checkUserId) {
return null;
public ResponseDto<String> delPerformance(List<String> performanceIds, String checkUserId) {
try {
List<String> performanceList = new ArrayList<>();
for (String performanceId : performanceIds) {
performanceList.add(performanceId);
checkUserPerformancesMapper.delete(new UpdateWrapper<KylinCheckUserPerformances>().eq("check_user_id", checkUserId).eq("performance_id", performanceId));
}
CheckUserPerformanceVo userPerformanceVo = new CheckUserPerformanceVo();
userPerformanceVo.setCheckUserId(checkUserId);
userPerformanceVo.setPerformanceList(performanceList);
mongoTemplate.remove(Query.query(Criteria.where("checkUserId").is(checkUserId)),CheckUserPerformanceVo.class,CheckUserPerformanceVo.class.getSimpleName());
mongoTemplate.insert(userPerformanceVo,CheckUserPerformanceVo.class.getSimpleName());
redisUtil.hdel(KylinRedisConst.CHECK_USER_RELATION,checkUserId);
return ResponseDto.success("删除成功");
}catch (Exception e){
return ResponseDto.failure(ErrorMapping.get(20102));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment