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

Commit 16811f77 authored by Tice's avatar Tice

申请驳回后删除

parent 6469c3c4
...@@ -13,6 +13,8 @@ public interface IMerchantFieldsService { ...@@ -13,6 +13,8 @@ public interface IMerchantFieldsService {
String apply(String uid, MerchantFieldApplyParam parameter); String apply(String uid, MerchantFieldApplyParam parameter);
void applyDel(String uid, String fieldApplyId);
void editIsCheck(String uid, String fieldId, int isCheck); void editIsCheck(String uid, String fieldId, int isCheck);
......
...@@ -5,5 +5,5 @@ import com.liquidnet.service.merchant.dto.param.MerchantSponsorApplyParam; ...@@ -5,5 +5,5 @@ import com.liquidnet.service.merchant.dto.param.MerchantSponsorApplyParam;
public interface IMerchantSponsorsService { public interface IMerchantSponsorsService {
String apply(String uid, MerchantSponsorApplyParam parameter); String apply(String uid, MerchantSponsorApplyParam parameter);
void applyDel(String uid, String sponsorApplyId);
} }
...@@ -57,6 +57,17 @@ public class MerchantFieldsController { ...@@ -57,6 +57,17 @@ public class MerchantFieldsController {
} }
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 12)
@ApiOperation(value = "申请场地驳回后删除")
@PostMapping("apply/del")
public ResponseDto<Object> applyDel(@RequestParam(required = true) String fieldApplyId) {
String currentUid = CurrentUtil.getCurrentUid();
merchantFieldsService.applyDel(currentUid, fieldApplyId);
return ResponseDto.success();
}
@ApiOperationSupport(order = 21)
@ApiOperation(value = "更改场地是否审核演出") @ApiOperation(value = "更改场地是否审核演出")
@PostMapping("editIsCheck") @PostMapping("editIsCheck")
public ResponseDto<Object> editIsCheck(@RequestParam(required = true) String fieldId, public ResponseDto<Object> editIsCheck(@RequestParam(required = true) String fieldId,
...@@ -68,7 +79,7 @@ public class MerchantFieldsController { ...@@ -68,7 +79,7 @@ public class MerchantFieldsController {
return ResponseDto.success(); return ResponseDto.success();
} }
@ApiOperationSupport(order = 13) @ApiOperationSupport(order = 22)
@ApiOperation(value = "默认验票员列表") @ApiOperation(value = "默认验票员列表")
@GetMapping("checkers") @GetMapping("checkers")
public ResponseDto<List<MerchantFieldCheckersVo>> checkers(@RequestParam(required = true) String fieldId) { public ResponseDto<List<MerchantFieldCheckersVo>> checkers(@RequestParam(required = true) String fieldId) {
...@@ -77,7 +88,7 @@ public class MerchantFieldsController { ...@@ -77,7 +88,7 @@ public class MerchantFieldsController {
return ResponseDto.success(merchantFieldsService.checkers(currentUid, fieldId)); return ResponseDto.success(merchantFieldsService.checkers(currentUid, fieldId));
} }
@ApiOperationSupport(order = 14) @ApiOperationSupport(order = 23)
@ApiOperation(value = "添加默认验票员") @ApiOperation(value = "添加默认验票员")
@PostMapping("checker/add") @PostMapping("checker/add")
public ResponseDto<Object> checkerAdd(@RequestParam(required = true) String fieldId, public ResponseDto<Object> checkerAdd(@RequestParam(required = true) String fieldId,
...@@ -91,7 +102,7 @@ public class MerchantFieldsController { ...@@ -91,7 +102,7 @@ public class MerchantFieldsController {
return ResponseDto.success(); return ResponseDto.success();
} }
@ApiOperationSupport(order = 15) @ApiOperationSupport(order = 24)
@ApiOperation(value = "移除默认验票员") @ApiOperation(value = "移除默认验票员")
@PostMapping("checker/del") @PostMapping("checker/del")
public ResponseDto<Object> checkerDel(@RequestParam(required = true) String fieldId, public ResponseDto<Object> checkerDel(@RequestParam(required = true) String fieldId,
......
...@@ -11,10 +11,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -11,10 +11,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -46,5 +43,15 @@ public class MerchantSponsorsController { ...@@ -46,5 +43,15 @@ public class MerchantSponsorsController {
return ResponseDto.success(merchantSponsorsService.apply(currentUid, parameter)); return ResponseDto.success(merchantSponsorsService.apply(currentUid, parameter));
} }
@ApiOperationSupport(order = 12)
@ApiOperation(value = "申请主办驳回后删除")
@PostMapping("apply/del")
public ResponseDto<Object> applyDel(@RequestParam(required = true) String sponsorApplyId) {
String currentUid = CurrentUtil.getCurrentUid();
merchantSponsorsService.applyDel(currentUid, sponsorApplyId);
return ResponseDto.success();
}
} }
...@@ -50,6 +50,14 @@ public class MerchantRdmService { ...@@ -50,6 +50,14 @@ public class MerchantRdmService {
return redisUtil.set(MerchantRedisConst.INFO_FIELD_APPLIES.concat(uid), vos); return redisUtil.set(MerchantRedisConst.INFO_FIELD_APPLIES.concat(uid), vos);
} }
public boolean delFieldAppliesVoByUid(String uid, List<MerchantFieldAppliesVo> vos, MerchantFieldAppliesVo vo) {
if (CollectionUtils.isEmpty(vos)) {
return true;
}
vos.removeIf(r -> r.getFieldApplyId().equals(vo.getFieldApplyId()));
return redisUtil.set(MerchantRedisConst.INFO_FIELD_APPLIES.concat(uid), vos);
}
public List<MerchantFieldCheckersVo> getFieldCheckersVosByFieldId(String fieldId) { public List<MerchantFieldCheckersVo> getFieldCheckersVosByFieldId(String fieldId) {
String key = MerchantRedisConst.INFO_FIELD_CHECKERS.concat(fieldId); String key = MerchantRedisConst.INFO_FIELD_CHECKERS.concat(fieldId);
...@@ -91,4 +99,12 @@ public class MerchantRdmService { ...@@ -91,4 +99,12 @@ public class MerchantRdmService {
vos.add(vo); vos.add(vo);
return redisUtil.set(MerchantRedisConst.INFO_SPONSOR_APPLIES.concat(uid), vos); return redisUtil.set(MerchantRedisConst.INFO_SPONSOR_APPLIES.concat(uid), vos);
} }
public boolean delSponsorAppliesVoByUid(String uid, List<MerchantSponsorAppliesVo> vos, MerchantSponsorAppliesVo vo) {
if (CollectionUtils.isEmpty(vos)) {
return true;
}
vos.removeIf(r -> r.getSponsorApplyId().equals(vo.getSponsorApplyId()));
return redisUtil.set(MerchantRedisConst.INFO_SPONSOR_APPLIES.concat(uid), vos);
}
} }
...@@ -172,13 +172,57 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService { ...@@ -172,13 +172,57 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService {
} }
@Override @Override
public void editIsCheck(String uid, String fieldId, int isCheck) { public void applyDel(String uid, String fieldApplyId) {
// 当前用户是否管理该场地 // 查找场地申请,是否存在且已经驳回
MerchantFieldsVo fieldsVo = merchantRdmService.getFieldsVoByFieldId(fieldId); List<MerchantFieldAppliesVo> fieldAppliesVos = merchantRdmService.getFieldAppliesVosByUid(uid);
if (null == fieldsVo || !fieldsVo.getUid().equals(uid)) { if (CollectionUtils.isEmpty(fieldAppliesVos)) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("13001"); ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("13004");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
int idx = IntStream.range(0, fieldAppliesVos.size())
.filter(i -> fieldAppliesVos.get(i).getFieldApplyId().equals(fieldApplyId))
.findFirst()
.orElse(-1);
if (idx < 0) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("13004");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage()); throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
} }
MerchantFieldAppliesVo fieldAppliesVo = fieldAppliesVos.get(idx);
if (fieldAppliesVo.getApplyStatus() != 2) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("13005");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
LocalDateTime now = LocalDateTime.now();
fieldAppliesVo.setUpdatedAt(now);
fieldAppliesVo.setDeletedAt(now);
// 场地默认验票员 redis
long s = System.currentTimeMillis();
merchantRdmService.delFieldAppliesVoByUid(uid, fieldAppliesVos, fieldAppliesVo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
// 场地默认验票员 sql
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> fieldAppliesUpdateObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("merchant_field_applies.update"));
fieldAppliesUpdateObjs.add(new Object[]{
fieldAppliesVo.getUpdatedAt(), fieldAppliesVo.getDeletedAt(), fieldAppliesVo.getFieldApplyId()
});
// mq
s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(
MQConst.MerchantQueue.SQL_MERCHANT_FIELD.getKey(),
SqlMapping.gets(toMqSqls, fieldAppliesUpdateObjs)
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
}
@Override
public void editIsCheck(String uid, String fieldId, int isCheck) {
// 当前用户是否管理该场地
MerchantFieldsVo fieldsVo = this.checkFieldAccount(uid, fieldId);
// 场地 vo 更改是否自动审核 // 场地 vo 更改是否自动审核
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
...@@ -220,8 +264,7 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService { ...@@ -220,8 +264,7 @@ public class MerchantFieldsServiceImpl implements IMerchantFieldsService {
List<MerchantFieldCheckersVo> fieldCheckersVos = merchantRdmService.getFieldCheckersVosByFieldId(fieldId); List<MerchantFieldCheckersVo> fieldCheckersVos = merchantRdmService.getFieldCheckersVosByFieldId(fieldId);
return fieldCheckersVos;
return null;
} }
@Override @Override
......
...@@ -20,6 +20,7 @@ import org.springframework.util.CollectionUtils; ...@@ -20,6 +20,7 @@ import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.IntStream;
@Slf4j @Slf4j
@Service @Service
...@@ -101,4 +102,52 @@ public class MerchantSponsorsServiceImpl implements IMerchantSponsorsService { ...@@ -101,4 +102,52 @@ public class MerchantSponsorsServiceImpl implements IMerchantSponsorsService {
return sponsorAppliesVo.getSponsorApplyId(); return sponsorAppliesVo.getSponsorApplyId();
} }
@Override
public void applyDel(String uid, String sponsorApplyId) {
// 查找场地申请,是否存在且已经驳回
List<MerchantSponsorAppliesVo> sponsorAppliesVos = merchantRdmService.getSponsorAppliesVosByUid(uid);
if (CollectionUtils.isEmpty(sponsorAppliesVos)) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("13023");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
int idx = IntStream.range(0, sponsorAppliesVos.size())
.filter(i -> sponsorAppliesVos.get(i).getSponsorApplyId().equals(sponsorApplyId))
.findFirst()
.orElse(-1);
if (idx < 0) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("13023");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
MerchantSponsorAppliesVo sponsorAppliesVo = sponsorAppliesVos.get(idx);
if (sponsorAppliesVo.getApplyStatus() != 2) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("13024");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
LocalDateTime now = LocalDateTime.now();
sponsorAppliesVo.setUpdatedAt(now);
sponsorAppliesVo.setDeletedAt(now);
// 场地默认验票员 redis
long s = System.currentTimeMillis();
merchantRdmService.delSponsorAppliesVoByUid(uid, sponsorAppliesVos, sponsorAppliesVo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
// 场地默认验票员 sql
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sponsorAppliesUpdateObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("merchant_sponsor_applies.update"));
sponsorAppliesUpdateObjs.add(new Object[]{
sponsorAppliesVo.getUpdatedAt(), sponsorAppliesVo.getDeletedAt(), sponsorAppliesVo.getSponsorApplyId()
});
// mq
s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(
MQConst.MerchantQueue.SQL_MERCHANT_SPONSOR.getKey(),
SqlMapping.gets(toMqSqls, sponsorAppliesUpdateObjs)
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
}
} }
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
13001=场地不存在,请核实 13001=场地不存在,请核实
13002=场地已被认领 13002=场地已被认领
13003=场地申请已达到上限 13003=场地申请已达到上限
13004=场地申请不存在,请核实
13005=场地申请未驳回,不能删除
13011=验票员已存在 13011=验票员已存在
13012=验票员不存在 13012=验票员不存在
...@@ -14,3 +17,5 @@ ...@@ -14,3 +17,5 @@
13021=主办申请已经达到上限 13021=主办申请已经达到上限
13022=主办公司信息不能为空 13022=主办公司信息不能为空
13023=场地申请不存在,请核实
13024=场地申请未驳回,不能删除
\ No newline at end of file
...@@ -3,11 +3,13 @@ merchant_fields.update_claim_status=UPDATE merchant_fields SET claim_status = ?, ...@@ -3,11 +3,13 @@ merchant_fields.update_claim_status=UPDATE merchant_fields SET claim_status = ?,
merchant_fields.update_is_check=UPDATE merchant_fields SET is_check = ?, updated_at = ? WHERE field_id = ? merchant_fields.update_is_check=UPDATE merchant_fields SET is_check = ?, updated_at = ? WHERE field_id = ?
# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
merchant_field_applies.insert=INSERT INTO merchant_field_applies (field_apply_id, apply_status, apply_type, reject, uid, field_id, name, logo, background, description, built_date, province_id, province_name, city_id, city_name, district_id, district_name, address, longitude, latitude, contact_name, contact_email, company_name, license_code, license_img, legal_name, legal_identity, legal_identity_obverse, legal_identity_reverse, created_at) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) merchant_field_applies.insert=INSERT INTO merchant_field_applies (field_apply_id, apply_status, apply_type, reject, uid, field_id, name, logo, background, description, built_date, province_id, province_name, city_id, city_name, district_id, district_name, address, longitude, latitude, contact_name, contact_email, company_name, license_code, license_img, legal_name, legal_identity, legal_identity_obverse, legal_identity_reverse, created_at) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
merchant_field_applies.update=UPDATE merchant_field_applies SET updated_at = ?, delete_at = ? WHERE field_apply_id = ?
# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
merchant_field_checkers.insert=INSERT INTO merchant_field_checkers (field_checker_id, field_id, uid, mobile, name, cuid, created_at) VALUE (?, ?, ?, ?, ?, ?, ?) merchant_field_checkers.insert=INSERT INTO merchant_field_checkers (field_checker_id, field_id, uid, mobile, name, cuid, created_at) VALUE (?, ?, ?, ?, ?, ?, ?)
merchant_field_checkers.update=UPDATE merchant_field_checkers SET cuid = ?, updated_at = ?, delete_at = ? WHERE field_checker_id = ? merchant_field_checkers.update=UPDATE merchant_field_checkers SET cuid = ?, updated_at = ?, delete_at = ? WHERE field_checker_id = ?
# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
merchant_sponsor_applies.insert=INSERT INTO merchant_sponsor_applies (sponsor_apply_id, apply_status, apply_type, reject, uid, name, logo, background, description, contact_name, contact_identity, contact_identity_obverse, contact_identity_reverse, contact_email, company_name, license_code, license_img, legal_name, legal_identity, legal_identity_obverse, legal_identity_reverse, created_at) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) merchant_sponsor_applies.insert=INSERT INTO merchant_sponsor_applies (sponsor_apply_id, apply_status, apply_type, reject, uid, name, logo, background, description, contact_name, contact_identity, contact_identity_obverse, contact_identity_reverse, contact_email, company_name, license_code, license_img, legal_name, legal_identity, legal_identity_obverse, legal_identity_reverse, created_at) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
merchant_sponsor_applies.update=UPDATE merchant_sponsor_applies SET updated_at = ?, delete_at = ? WHERE sponsor_apply_id = ?
......
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