Commit df1886f2 by 徐高华

活动预约

parent 97bf19df
......@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.manage.web.qo.offline.PageOfflinePreQO;
import com.gic.haoban.manage.web.qo.offline.WriteOffOfflinePreQO;
......@@ -22,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
/**
* 好办小程序-线下预约
*/
......@@ -39,11 +44,40 @@ public class OfflinePreController {
@RequestMapping("/page-offline-pre")
@ResponseBody
public RestResponse<Page<OfflinePreInfoVO>> pageOfflinePre(@RequestBody PageOfflinePreQO qo){
ServiceResponse<Page<OfflinePreInfoDTO>> offlinePreInfoDTO = offlinePreApiService.pageOfflinePre(JSONObject.parseObject(JSONObject.toJSONString(qo), PageOfflinePreQDTO.class));
return JSONObject.parseObject(JSONObject.toJSONString(offlinePreInfoDTO, SerializerFeature.WriteMapNullValue), RestResponse.class);
ServiceResponse<Page<OfflinePreInfoDTO>> resp = offlinePreApiService.pageOfflinePre(JSONObject.parseObject(JSONObject.toJSONString(qo), PageOfflinePreQDTO.class));
Page<OfflinePreInfoVO> pageVO = new Page<>() ;
pageVO.setCurrentPage(resp.getResult().getCurrentPage());
pageVO.setTotalCount(resp.getResult().getTotalCount());
pageVO.setPageSize(resp.getResult().getPageSize());
if(null != resp.getResult() && null != resp.getResult().getResult()) {
List<OfflinePreInfoDTO> list = resp.getResult().getResult() ;
List<OfflinePreInfoVO> voList = new ArrayList<>() ;
for(OfflinePreInfoDTO dto : list) {
OfflinePreInfoVO vo = EntityUtil.changeEntityByJSON(OfflinePreInfoVO.class,dto) ;
if(null != qo.getType() && qo.getType()==1) {
if ((dto.getPreTime().getTime() < System.currentTimeMillis() || this.getAheadSignFlag(dto.getAheadSignFlag()) == 1)
&& DateUtil.getStartTimeOfDay(dto.getPreTime()).getTime() >= DateUtil.getStartTimeOfDay().getTime()) {
vo.setCanSign(1);
} else {
if (DateUtil.getStartTimeOfDay(dto.getPreTime()).getTime() < DateUtil.getStartTimeOfDay().getTime()) {
vo.setReason("已过期");
} else if (this.getAheadSignFlag(dto.getAheadSignFlag()) == 0 && dto.getPreTime().getTime() > System.currentTimeMillis()) {
vo.setReason("不可提前签到");
}
}
}
voList.add(vo) ;
}
pageVO.setResult(voList);
}
return RestResponse.successResult(pageVO) ;
}
private int getAheadSignFlag(Integer flag) {
if(null == flag) {
return 1 ;
}
return flag ;
}
/**
* 获取预约详情
* @param offlinePreId 预约ID
......
......@@ -156,6 +156,56 @@ public class OfflinePreInfoVO implements Serializable {
*/
private Integer writeOffExchangeNum;
// '支持提前签到1是0否' ,
private Integer aheadSignFlag = 1 ;
private String imgIntegral ;
private String imgCoupon ;
// 是否可以签到
private int canSign ;
// 不能签到原因
private String reason ;
public Integer getAheadSignFlag() {
return aheadSignFlag;
}
public void setAheadSignFlag(Integer aheadSignFlag) {
this.aheadSignFlag = aheadSignFlag;
}
public String getImgIntegral() {
return imgIntegral;
}
public void setImgIntegral(String imgIntegral) {
this.imgIntegral = imgIntegral;
}
public String getImgCoupon() {
return imgCoupon;
}
public void setImgCoupon(String imgCoupon) {
this.imgCoupon = imgCoupon;
}
public int getCanSign() {
return canSign;
}
public void setCanSign(int canSign) {
this.canSign = canSign;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Integer getWriteOffExchangeNum() {
return writeOffExchangeNum;
}
......
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