Commit 7edd5f25 authored by chenyuxi's avatar chenyuxi

feat: 给移动端临时提供的接口

parent a6559fe8
...@@ -147,6 +147,23 @@ public class TInsuranceUnpurchaseApplyController { ...@@ -147,6 +147,23 @@ public class TInsuranceUnpurchaseApplyController {
return R.ok(tInsuranceUnpurchaseApplyService.getAuditPage(page, unpurchaseApplySearchVo, userId, type)); return R.ok(tInsuranceUnpurchaseApplyService.getAuditPage(page, unpurchaseApplySearchVo, userId, type));
} }
/**
* 审核分页查询(小程序)
*
* @param page 分页对象
* @param unpurchaseApplySearchVo 不购买申请查询信息
* @param type 0待审核、1已处理、2抄送我
*
* @return R
*/
@Operation(description = "审核分页查询(小程序临时)")
@GetMapping("/getAuditPageTemp")
public R<IPage<TInsuranceUnpurchaseApply>> getAuditPageTemp(Page<TInsuranceUnpurchaseApply> page,
TInsuranceUnpurchaseApplySearchVo unpurchaseApplySearchVo,
String type,String userId) {
return R.ok(tInsuranceUnpurchaseApplyService.getAuditPage(page, unpurchaseApplySearchVo, userId, type));
}
/** /**
* 审核数量 * 审核数量
* *
...@@ -154,12 +171,12 @@ public class TInsuranceUnpurchaseApplyController { ...@@ -154,12 +171,12 @@ public class TInsuranceUnpurchaseApplyController {
*/ */
@Operation(description = "审核数量查询") @Operation(description = "审核数量查询")
@GetMapping("/getAuditCount") @GetMapping("/getAuditCount")
public R<Map<String,Integer>> getAuditCount() { public R<Map<String,Integer>> getAuditCount(String userId) {
YifuUser user = SecurityUtils.getUser(); // YifuUser user = SecurityUtils.getUser();
if(null == user){ // if(null == user){
return R.failed(ResultConstants.NO_USER); // return R.failed(ResultConstants.NO_USER);
} // }
String userId = String.valueOf(user.getId()); // String userId = String.valueOf(user.getId());
return R.ok(tInsuranceUnpurchaseApplyService.getAuditCount(userId)); return R.ok(tInsuranceUnpurchaseApplyService.getAuditCount(userId));
} }
...@@ -186,7 +203,7 @@ public class TInsuranceUnpurchaseApplyController { ...@@ -186,7 +203,7 @@ public class TInsuranceUnpurchaseApplyController {
return R.failed(ResultConstants.NO_GETLOCK_DATA); return R.failed(ResultConstants.NO_GETLOCK_DATA);
} }
if (Common.isNotKong(requestId)) { if (Common.isNotKong(requestId)) {
R<String> saveR = tInsuranceUnpurchaseApplyService.commitOne(id); R<String> saveR = tInsuranceUnpurchaseApplyService.commitOne(id, user);
//主动释放锁 //主动释放锁
RedisDistributedLock.unlock(redisKey, requestId); RedisDistributedLock.unlock(redisKey, requestId);
return saveR; return saveR;
...@@ -237,6 +254,46 @@ public class TInsuranceUnpurchaseApplyController { ...@@ -237,6 +254,46 @@ public class TInsuranceUnpurchaseApplyController {
tAuditRecord.getApprovalOpinion(), user); tAuditRecord.getApprovalOpinion(), user);
} }
return R.failed(ResultConstants.REQUEST_LOCK_FAIL); return R.failed(ResultConstants.REQUEST_LOCK_FAIL);
}
/**
* 审核(小程序临时)
* @param tAuditRecord 审批信息
* @return R<String>
**/
@Operation(description = "审核(小程序临时)")
@SysLog("审核(小程序临时)")
@PostMapping("/auditTemp")
public R<String> auditTemp(@RequestBody TAuditRecord tAuditRecord) {
if (Common.isEmpty(tAuditRecord.getApprovalResult())) {
return R.failed("审核结果不能为空!");
}
if (Common.isNotNull(tAuditRecord.getApprovalOpinion()) && tAuditRecord.getApprovalOpinion().length()> 100) {
return R.failed("审核意见不能超过100个字");
}
if (Common.isEmpty(tAuditRecord.getDomainId())) {
return R.failed("id不能为空!");
}
// YifuUser user = SecurityUtils.getUser();
// if (Common.isEmpty(user)){
// return R.failed(CommonConstants.USER_FAIL);
// }
TInsuranceUnpurchaseApply insuranceUnpurchaseApply = tInsuranceUnpurchaseApplyService.getById(tAuditRecord.getDomainId());
if (Common.isEmpty(insuranceUnpurchaseApply)){
return R.failed("该实体信息不存在!");
}
String requestId;
String redisKey = CacheConstants.INSURANCEUNPURCHASE_PROCESS_CACHE.concat(tAuditRecord.getDomainId());
try {
requestId = RedisDistributedLock.tryLockAndTime(redisKey, "10");
} catch (Exception e) {
return R.failed(ResultConstants.REQUEST_LOCK_FAIL);
}
if (Common.isNotKong(requestId)) {
return R.ok("审核完毕");
}
return R.failed(ResultConstants.REQUEST_LOCK_FAIL);
} }
} }
...@@ -54,7 +54,7 @@ public interface TInsuranceUnpurchaseApplyService extends IService<TInsuranceUnp ...@@ -54,7 +54,7 @@ public interface TInsuranceUnpurchaseApplyService extends IService<TInsuranceUnp
* @param id 实体id * @param id 实体id
* @return R<String> * @return R<String>
**/ **/
R<String> commitOne(String id) throws CheckedException; R<String> commitOne(String id,YifuUser user) throws CheckedException;
/** /**
* 审核 * 审核
......
...@@ -418,11 +418,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance ...@@ -418,11 +418,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
**/ **/
@Transactional @Transactional
@Override @Override
public R<String> commitOne(String id) { public R<String> commitOne(String id,YifuUser user) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
TInsuranceUnpurchaseApply entity = this.getById(id); TInsuranceUnpurchaseApply entity = this.getById(id);
if(entity==null){ if(entity==null){
return R.failed(ResultConstants.FAIL_INFO_NO_MODEL); return R.failed(ResultConstants.FAIL_INFO_NO_MODEL);
......
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