|
@@ -2,17 +2,24 @@ package com.goafanti.voucher.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.dao.JtVoucherDetailMapper;
|
|
import com.goafanti.common.dao.JtVoucherDetailMapper;
|
|
|
|
|
|
|
|
-import com.goafanti.common.model.JtVoucher;
|
|
|
|
|
import com.goafanti.common.model.JtVoucherDetail;
|
|
import com.goafanti.common.model.JtVoucherDetail;
|
|
|
|
|
+import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.voucher.bo.JtVoucherDetailListBo;
|
|
import com.goafanti.voucher.bo.JtVoucherDetailListBo;
|
|
|
-import com.goafanti.voucher.bo.JtVoucherListBo;
|
|
|
|
|
import com.goafanti.voucher.service.VoucherDetailService;
|
|
import com.goafanti.voucher.service.VoucherDetailService;
|
|
|
@Service
|
|
@Service
|
|
|
public class VoucherDetailServiceImpl extends BaseMybatisDao<JtVoucherDetailMapper> implements VoucherDetailService {
|
|
public class VoucherDetailServiceImpl extends BaseMybatisDao<JtVoucherDetailMapper> implements VoucherDetailService {
|
|
@@ -27,28 +34,41 @@ public class VoucherDetailServiceImpl extends BaseMybatisDao<JtVoucherDetailMapp
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int updateVoucherDetail(JtVoucherDetail voucher) {
|
|
public int updateVoucherDetail(JtVoucherDetail voucher) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
|
|
- return 0;
|
|
|
|
|
|
|
+ return jtVoucherDetailMapper.updateByPrimaryKeySelective(voucher);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int delectVoucherDetail(String id) {
|
|
public int delectVoucherDetail(String id) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
|
|
- return 0;
|
|
|
|
|
|
|
+ return jtVoucherDetailMapper.deleteByPrimaryKey(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public JtVoucher selectVoucherDetail(String id) {
|
|
|
|
|
- // TODO Auto-generated method stub
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ public JtVoucherDetail selectVoucherDetail(String id) {
|
|
|
|
|
+ return jtVoucherDetailMapper.selectByPrimaryKey(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
@Override
|
|
@Override
|
|
|
- public Pagination<JtVoucherDetailListBo> selectVoucherDetailList(String name, Integer limitUse, String userMobile,
|
|
|
|
|
|
|
+ public Pagination<JtVoucherDetailListBo> selectVoucherDetailList(String name, Integer status, String userMobile,
|
|
|
Integer source, Integer pageNo, Integer pageSize) {
|
|
Integer source, Integer pageNo, Integer pageSize) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ Map<String,Object> params = new HashMap<>();
|
|
|
|
|
+ if (pageNo==null||pageNo<1) pageNo=1;
|
|
|
|
|
+ if (pageSize==null||pageSize<1) pageSize=10;
|
|
|
|
|
+ if (StringUtils.isNotBlank(name)) params.put("name", name);
|
|
|
|
|
+ if (null != status) params.put("status", status);
|
|
|
|
|
+ if (null != userMobile) params.put("userMobile", userMobile);
|
|
|
|
|
+ if (null != source) params.put("source", source);
|
|
|
|
|
+ Pagination<JtVoucherDetailListBo> pagination= (Pagination<JtVoucherDetailListBo>) findPage("selectVoucherDetailList", "selectVoucherDetailCount",params,
|
|
|
|
|
+ pageNo, pageSize);
|
|
|
|
|
+ List<JtVoucherDetailListBo> list=(List<JtVoucherDetailListBo>) pagination.getList();
|
|
|
|
|
+ for (JtVoucherDetailListBo b : list) {
|
|
|
|
|
+ if (b!=null&&b.getDurationDay()!=null&&b.getReceiveTime()!=null&&b.getDurationDay()!=null) {
|
|
|
|
|
+ b.setStarTime(DateFormatUtils.format(b.getReceiveTime(), AFTConstants.YYYYMMDDHHMMSS));
|
|
|
|
|
+ b.setEndTime(DateFormatUtils.format(DateUtils.getDateAdd(b.getReceiveTime(),b.getDurationDay()), AFTConstants.YYYYMMDDHHMMSS));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return pagination;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|