|
|
@@ -42,6 +42,58 @@ public class WishApi {
|
|
|
@Autowired
|
|
|
private RegUserService regUserService;
|
|
|
|
|
|
+ @ApiOperation(value="我的捐赠列表")
|
|
|
+ @RequestMapping(value = "myWishList",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="status", value="互换状态", required=false, paramType="query"),
|
|
|
+ })
|
|
|
+ public MessageResult myWishList(
|
|
|
+ String status,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ HttpServletRequest request){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+ String subject = (String)request.getAttribute("subject");
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("createBy",subject);
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ searchParams.put("status",status);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ Page<WishInfoUserRecord> page = wishInfoUserRecordService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ for(WishInfoUserRecord wishInfoUserRecord : page.getResult()){
|
|
|
+ wishInfoUserRecord.setWishInfo(wishInfoService.get(wishInfoUserRecord.getWishInfoId()));
|
|
|
+ wishInfoUserRecord.setStudentAspirations(studentAspirationsService.get(wishInfoUserRecord.getStudentAspirationsId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="捐赠详情")
|
|
|
+ @RequestMapping(value = "wishInfoUserRecordEdit",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="id", value="ID", required=true, paramType="query"),
|
|
|
+ })
|
|
|
+ public MessageResult wishInfoUserRecordEdit(String id){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ WishInfoUserRecord wishInfoUserRecord = wishInfoUserRecordService.get(id);
|
|
|
+ wishInfoUserRecord.setWishInfo(wishInfoService.get(wishInfoUserRecord.getWishInfoId()));
|
|
|
+ wishInfoUserRecord.setStudentAspirations(studentAspirationsService.get(wishInfoUserRecord.getStudentAspirationsId()));
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(wishInfoUserRecord);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value="心愿单列表")
|
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
@@ -139,26 +191,33 @@ public class WishApi {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name="wishInfoId", value="心愿信息ID", required=true, paramType="query"),
|
|
|
- @ApiImplicitParam(name="isSpot", value="是否现场互换心愿", required=true, paramType="query"),
|
|
|
+ @ApiImplicitParam(name="isSpot", value="是否现场互换心愿", required=true, paramType="query", dataType = "Boolean"),
|
|
|
+ @ApiImplicitParam(name="studentAspirationsId", value="学员心愿ID", required=true, paramType="query"),
|
|
|
@ApiImplicitParam(name="recipients", value="收件人", required=false, paramType="query"),
|
|
|
@ApiImplicitParam(name="recipientsPhone", value="收件人电话", required=false, paramType="query"),
|
|
|
@ApiImplicitParam(name="recipientsRegion", value="收件人区域", required=false, paramType="query"),
|
|
|
@ApiImplicitParam(name="recipientsAddress", value="收件人地址", required=false, paramType="query"),
|
|
|
})
|
|
|
- public MessageResult<WishInfoUserRecord> add(String wishInfoId, Boolean isSpot,
|
|
|
+ public MessageResult add(String wishInfoId, String studentAspirationsId, Boolean isSpot,
|
|
|
String recipients, String recipientsPhone, String recipientsRegion, String recipientsAddress,
|
|
|
HttpServletRequest request){
|
|
|
- MessageResult<WishInfoUserRecord> msgResult = new MessageResult<>();
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
String subject = (String)request.getAttribute("subject");
|
|
|
|
|
|
try {
|
|
|
+ AddressInfo addressInfo = addressInfoService.get("00000000-0000-0000-0000-000000000000");
|
|
|
+
|
|
|
WishInfoUserRecord wishInfoUserRecord = new WishInfoUserRecord();
|
|
|
wishInfoUserRecord.setId(UUID.randomUUID().toString());
|
|
|
wishInfoUserRecord.setRegUserId(subject);
|
|
|
wishInfoUserRecord.setWishInfoId(wishInfoId);
|
|
|
+ wishInfoUserRecord.setStudentAspirationsId(studentAspirationsId);
|
|
|
wishInfoUserRecord.setIsSpot(isSpot);
|
|
|
wishInfoUserRecord.setStatus("0");
|
|
|
wishInfoUserRecord.setNum(getSerialNumber());
|
|
|
+ wishInfoUserRecord.setSender(addressInfo.getRecipients());
|
|
|
+ wishInfoUserRecord.setSenderPhone(addressInfo.getPhone());
|
|
|
+ wishInfoUserRecord.setSenderAddress(addressInfo.getRegion() + addressInfo.getDetailAddress());
|
|
|
wishInfoUserRecord.setRecipients (recipients);
|
|
|
wishInfoUserRecord.setRecipientsPhone(recipientsPhone);
|
|
|
wishInfoUserRecord.setRecipientsAddress(recipientsRegion + recipientsAddress);
|
|
|
@@ -167,30 +226,10 @@ public class WishApi {
|
|
|
wishInfoUserRecord.setCreateTime(new Date());
|
|
|
wishInfoUserRecordService.insert(wishInfoUserRecord);
|
|
|
|
|
|
- AddressInfo addressInfo = addressInfoService.getByUser(subject);
|
|
|
- if(addressInfo == null) {
|
|
|
- addressInfo = new AddressInfo();
|
|
|
- addressInfo.setRecipients(recipients);
|
|
|
- addressInfo.setPhone(recipientsPhone);
|
|
|
- addressInfo.setRegion(recipientsRegion);
|
|
|
- addressInfo.setDetailAddress(recipientsAddress);
|
|
|
- addressInfo.setRegUserId(subject);
|
|
|
- addressInfo.setDelFlag(false);
|
|
|
- addressInfo.setCreateBy(subject);
|
|
|
- addressInfo.setCreateTime(new Date());
|
|
|
- addressInfoService.insert(addressInfo);
|
|
|
- }
|
|
|
- else {
|
|
|
- addressInfo.setRecipients(recipients);
|
|
|
- addressInfo.setPhone(recipientsPhone);
|
|
|
- addressInfo.setRegion(recipientsRegion);
|
|
|
- addressInfo.setDetailAddress(recipientsAddress);
|
|
|
- addressInfo.setUpdateBy(subject);
|
|
|
- addressInfo.setUpdateTime(new Date());
|
|
|
- addressInfoService.update(addressInfo);
|
|
|
- }
|
|
|
+ setAddress(recipients, recipientsPhone, recipientsRegion, recipientsAddress, request);
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
+ msgResult.setData(wishInfoUserRecord.getId());
|
|
|
}
|
|
|
catch(Exception ex){
|
|
|
logger.error(ex.getMessage(),ex);
|
|
|
@@ -248,6 +287,55 @@ public class WishApi {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="保存地址")
|
|
|
+ @RequestMapping(value = "setAddress",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="recipients", value="收件人", required=true, paramType="query"),
|
|
|
+ @ApiImplicitParam(name="recipientsPhone", value="收件人电话", required=true, paramType="query"),
|
|
|
+ @ApiImplicitParam(name="recipientsRegion", value="收件人区域", required=true, paramType="query"),
|
|
|
+ @ApiImplicitParam(name="recipientsAddress", value="收件人地址", required=true, paramType="query"),
|
|
|
+ })
|
|
|
+ public MessageResult setAddress(String recipients, String recipientsPhone, String recipientsRegion, String recipientsAddress, HttpServletRequest request){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+ String subject = (String)request.getAttribute("subject");
|
|
|
+
|
|
|
+ try {
|
|
|
+ AddressInfo addressInfo = addressInfoService.getByUser(subject);
|
|
|
+ if(addressInfo == null) {
|
|
|
+ addressInfo = new AddressInfo();
|
|
|
+ addressInfo.setId(UUID.randomUUID().toString());
|
|
|
+ addressInfo.setRecipients(recipients);
|
|
|
+ addressInfo.setPhone(recipientsPhone);
|
|
|
+ addressInfo.setRegion(recipientsRegion);
|
|
|
+ addressInfo.setDetailAddress(recipientsAddress);
|
|
|
+ addressInfo.setRegUserId(subject);
|
|
|
+ addressInfo.setDelFlag(false);
|
|
|
+ addressInfo.setCreateBy(subject);
|
|
|
+ addressInfo.setCreateTime(new Date());
|
|
|
+ addressInfoService.insert(addressInfo);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ addressInfo.setRecipients(recipients);
|
|
|
+ addressInfo.setPhone(recipientsPhone);
|
|
|
+ addressInfo.setRegion(recipientsRegion);
|
|
|
+ addressInfo.setDetailAddress(recipientsAddress);
|
|
|
+ addressInfo.setUpdateBy(subject);
|
|
|
+ addressInfo.setUpdateTime(new Date());
|
|
|
+ addressInfoService.update(addressInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
private String getSerialNumber() {
|
|
|
String serialNumber = "";
|
|
|
|