Commit 8e421bd6 by 朱亚洁

feat:[1005479]关联书刊时自动冻结书刊收益

parent 543852d4
...@@ -69,4 +69,5 @@ public interface BookFreezeBiz { ...@@ -69,4 +69,5 @@ public interface BookFreezeBiz {
BookFreezeDto getById(Long bookId); BookFreezeDto getById(Long bookId);
Boolean setBookFreeze(Long bookId);
} }
...@@ -236,4 +236,30 @@ public class BookFreezeBizImpl implements BookFreezeBiz { ...@@ -236,4 +236,30 @@ public class BookFreezeBizImpl implements BookFreezeBiz {
public BookFreezeDto getById(Long bookId) { public BookFreezeDto getById(Long bookId) {
return bookFreezeDao.getInfoById(bookId); return bookFreezeDao.getInfoById(bookId);
} }
@Override
public Boolean setBookFreeze(Long bookId) {
if (null == bookId) {
return false;
}
BookFreezeDto bookFreezeDto = this.getBaseById(bookId);
if (bookFreezeDto != null) {
LOGGER.info("该图书已有冻结记录"+bookId);
return true;
}
BookFreeze bookFreeze = new BookFreeze();
bookFreeze.setBookId(bookId);
Date tomorrow = DateUtils.getDayStart(DateUtils.addDay(new Date(), 1));
bookFreeze.setFreezetime(DateUtils.formatDate(tomorrow, DateUtils.DATE_FORMAT_DATETIME));
bookFreeze.setCreatedUser(0L);
// 校验冻结参数
this.checkFundParam(bookFreeze);
try {
bookFreezeDao.insert(bookFreeze);
} catch (Exception e) {
LOGGER.error("【图书收益冻结(ERP)】冻结收益,<ERROR>.[bookFreezeDao.insert]" + e.getMessage(), e);
return false;
}
return true;
}
} }
...@@ -13,16 +13,14 @@ import com.pcloud.common.utils.cookie.Cookie; ...@@ -13,16 +13,14 @@ import com.pcloud.common.utils.cookie.Cookie;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/** /**
* 图书冻结接口实现类 * 图书冻结接口实现类
...@@ -94,4 +92,10 @@ public class BookFreezeFacadeImpl implements BookFreezeFacade { ...@@ -94,4 +92,10 @@ public class BookFreezeFacadeImpl implements BookFreezeFacade {
return new ResponseDto<>(freeze); return new ResponseDto<>(freeze);
} }
@ApiOperation("设置书刊冻结")
@GetMapping("setBookFreeze")
public ResponseDto<?> setBookFreeze(@RequestParam(value = "bookId") Long bookId)
throws BizException, PermissionException, JsonParseException {
return new ResponseDto<>(bookFreezeBiz.setBookFreeze(bookId));
}
} }
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