Commit c4297182 by Java - 段鹏举

航线论证数据统计剩余天数修改

parent 9c32b05c
/** /**
* *
*/ */
package com.ejweb.modules.airport.service; package com.ejweb.modules.airport.service;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ejweb.core.base.BaseService; import com.ejweb.core.base.BaseService;
import com.ejweb.core.base.PageEntity; import com.ejweb.core.base.PageEntity;
import com.ejweb.modules.airport.bean.StatisticalBean; import com.ejweb.modules.airport.bean.StatisticalBean;
...@@ -19,67 +13,78 @@ import com.ejweb.modules.verify.dao.AirlineVerifiedDao; ...@@ -19,67 +13,78 @@ import com.ejweb.modules.verify.dao.AirlineVerifiedDao;
import com.ejweb.modules.verify.dao.AirlineVerifyDao; import com.ejweb.modules.verify.dao.AirlineVerifyDao;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/** /**
*
* @team suzhou
* @author huhy * @author huhy
* @version 1.0 * @version 1.0
* @time 2016年9月8日 * @team suzhou
* @time 2016年9月8日
*/ */
@Service @Service
public class StatisticalService extends BaseService<StatisticalDao> { public class StatisticalService extends BaseService<StatisticalDao> {
@Autowired @Autowired
private AirlineVerifiedDao airlineVerifiedDao; private AirlineVerifiedDao airlineVerifiedDao;
@Autowired @Autowired
private AirlineVerifyDao verifdao; private AirlineVerifyDao verifdao;
public PageEntity<StatisticalEntity> getStatisticalList(StatisticalBean bean) { public PageEntity<StatisticalEntity> getStatisticalList(StatisticalBean bean) {
PageInfo<StatisticalEntity> pageInfo = null; PageInfo<StatisticalEntity> pageInfo = null;
// 必须紧贴dao的查询方法 // 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize()); PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
AirlineVerifiedAddBean abean = new AirlineVerifiedAddBean(); AirlineVerifiedAddBean abean = new AirlineVerifiedAddBean();
abean.setUserCode(bean.getUserCode()); abean.setUserCode(bean.getUserCode());
if(StringUtils.isEmpty(bean.getSort())){ if (StringUtils.isEmpty(bean.getSort())) {
PageHelper.orderBy("source,routeNo DESC"); PageHelper.orderBy("source,routeNo DESC");
} } else
else PageHelper.orderBy("source," + bean.getSort());
PageHelper.orderBy("source,"+bean.getSort());
List<StatisticalEntity> lists = dao.getStatisticalList(bean); List<StatisticalEntity> lists = dao.getStatisticalList(bean);
String departId = airlineVerifiedDao.findDepartId(abean); String departId = airlineVerifiedDao.findDepartId(abean);
for(StatisticalEntity e : lists ){ for (StatisticalEntity e : lists) {
String typelist=verifdao.getTypeList1(e.getVerifId()); String typelist = verifdao.getTypeList1(e.getVerifId());
if(StringUtils.isNoneBlank(typelist)) if (StringUtils.isNoneBlank(typelist))
e.setTypeName(e.getTypeName()+":"+typelist); e.setTypeName(e.getTypeName() + ":" + typelist);
e.setTypeList(verifdao.getTypeList(e.getVerifId())); e.setTypeList(verifdao.getTypeList(e.getVerifId()));
if(departId.equals(e.getDepartId())) if (departId.equals(e.getDepartId()))
e.setReStart(true); e.setReStart(true);
else else
e.setReStart(false); e.setReStart(false);
if("06".equals(e.getVerifType())||"07".equals(e.getVerifType()) if ("06".equals(e.getVerifType()) || "07".equals(e.getVerifType())
||"08".equals(e.getVerifType())){ || "08".equals(e.getVerifType())) {
e.setExpiryDate("长期有效"); e.setExpiryDate("长期有效");
}else{ } else {
Integer day = dao.getDay(e); Integer day = dao.getDay(e);
if(day!=null){ if (day != null) {
if(day<=0)day=0; if (day > 180) {
// day=180-day; day = 180 - day;
Integer cha= Integer.parseInt(e.getExpiryDate()==null?"0":e.getExpiryDate()) ; e.setExpiryDate(day + "");
} else {
if(cha<day){ if (day <= 0) {
day=cha; day = 0;
} }
day=180-day; // day=180-day;
e.setExpiryDate(day+""); Integer cha = Integer.parseInt(e.getExpiryDate() == null ? "0" : e.getExpiryDate());
}else if(StringUtils.isNoneBlank(e.getExpiryDate())){
if (cha < day) {
day=Integer.parseInt(e.getExpiryDate()) ; day = cha;
day=180-day; }
e.setExpiryDate(day+""); day = 180 - day;
e.setExpiryDate(day + "");
}
} else if (StringUtils.isNoneBlank(e.getExpiryDate())) {
day = Integer.parseInt(e.getExpiryDate());
day = 180 - day;
e.setExpiryDate(day + "");
} }
} }
} }
pageInfo = new PageInfo<StatisticalEntity>(lists); pageInfo = new PageInfo<StatisticalEntity>(lists);
......
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