Commit 3c897d11 authored by shiyu's avatar shiyu

修改标签

parent 5730b15f
......@@ -15,6 +15,15 @@ public interface CollectionBookDao {
*/
int insert(CollectionBook collectionBook);
/**
* 更新记录
*
* @param collectionBook
* @return
*/
int update(CollectionBook collectionBook);
/**
* 查询记录
* @param dto
......
......@@ -24,6 +24,12 @@ public class CollectionBookDaoImpl implements CollectionBookDao {
return collectionBookMapper.insert(collectionBook);
}
@Override
public int update(CollectionBook collectionBook) {
return collectionBookMapper.updateByPrimaryKeySelective(collectionBook);
}
@Override
public List<CollectionBook> find(CollectionBookRequestDto dto) {
CollectionBookExample example = new CollectionBookExample();
......
......@@ -6,7 +6,20 @@ import lombok.Data;
@Data
public class SelfPageRequestDto implements Entity {
/**
* 要查看的用户id
*/
private Long targetUserId;
/**
* 发起请求的用户id
*/
private Long userId;
private String shareRecordId;
/**
* 是否主态
*/
private Boolean isMine;
}
......@@ -52,6 +52,25 @@ public class CollectionBookServiceImpl implements CollectionBookService {
return Result.failed();
}
@Override
public Result update(CollectionBookRequestDto dto) {
try {
if (collectionBookDao.isExisted(dto.getUserId(), dto.getTitle())) {
return Result.failed("标签名称已存在");
}
CollectionBook collectionBook = new CollectionBook();
collectionBook.setId(dto.getId());
collectionBook.setTitle(dto.getTitle());
collectionBook.setUpdateTime(new Date());
collectionBookDao.update(collectionBook);
return Result.success();
} catch (Exception e) {
logger.error("修改收藏册 error: {}", e);
}
return Result.failed();
}
@Override
public Result findList(CollectionBookRequestDto dto) {
try {
......
......@@ -155,13 +155,23 @@ public class SelfPageServiceImpl implements SelfPageService {
public Result checkIsMine(SelfPageRequestDto dto) {
try {
Map<String, Object> map = new HashMap<>();
Long itemUserId;
if (dto.getTargetUserId() != null) {
itemUserId = dto.getTargetUserId();
if (itemUserId.longValue() != dto.getUserId()) {
map.put("isMine", false);
} else {
map.put("isMine", true);
}
} else {
CollectionShareRecord collectionShareRecord = collectionShareRecordDao.findById(dto.getShareRecordId());
long itemUserId = collectionShareRecord.getItemUserId();
itemUserId = collectionShareRecord.getItemUserId();
if (itemUserId != dto.getUserId()) {
map.put("isMine", false);
} else {
map.put("isMine", true);
}
}
User user = cacheUtil.getAppletUserById(itemUserId);
map.put("avatar", StringUtils.isEmpty(user.getAvatar()) ? CommConsts.DEFAULT_AVATAR_URL : user.getAvatar());
map.put("name", StringUtils.isEmpty(user.getNickname()) ? "微信用户" : user.getNickname());
......
......@@ -13,6 +13,14 @@ public interface CollectionBookService {
*/
Result create(CollectionBookRequestDto dto);
/**
* 编辑收藏册
* @param dto
* @return
*/
Result update(CollectionBookRequestDto dto);
/**
* 查询收藏册
* @param dto
......
......@@ -33,6 +33,16 @@ public class CollectionBookController {
return collectionBookService.create(dto);
}
@ApiOperation(value = "编辑藏品标签")
@PostMapping("/update")
public Result update(@RequestBody CollectionBookRequestDto dto) {
logger.info("编辑藏品标签,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null || dto.getUserId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return collectionBookService.update(dto);
}
@ApiOperation(value = "查询藏品标签")
@PostMapping("/findList")
......
......@@ -77,7 +77,6 @@ public class SelfPageController {
logger.info("分销商查询自己购买的订单信息,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("userId", "用户id").must().number()
.set("shareRecordId", "分享记录id").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
......
......@@ -88,6 +88,7 @@ public class SupplierItemController {
logger.info("上传藏品,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("name", "商品名称").must().string()
.set("images", "图片").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
......
......@@ -89,12 +89,12 @@ public class WxPayServiceTest {
@Test
public void refund() {
List<String> list = Arrays.asList("DA2403111801535237724");
List<String> list = Arrays.asList("DA2403261800370990846");
list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId);
dto.setAmount("3.0");
dto.setRefundPrice("3.0");
dto.setAmount("1.0");
dto.setRefundPrice("1.0");
Result result = wxPayServiceApi.refund(dto);
logger.info("申请微信支付退款:{}", result);
});
......
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