package com.hai.service.impl; import com.hai.dao.HighGasOrderMapper; import com.hai.entity.HighGasOrder; import com.hai.entity.HighGasOrderExample; import com.hai.service.HighGasOrderService; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.List; import java.util.Map; /** * @className: HighGasOrderServiceImpl * @author: HuRui * @date: 2022/9/6 **/ @Service("gasOrderService") public class HighGasOrderServiceImpl implements HighGasOrderService { @Resource private HighGasOrderMapper gasOrderMapper; @Override public void addGasOrder(HighGasOrder gasOrder) { gasOrder.setCreateTime(new Date()); gasOrderMapper.insert(gasOrder); } @Override public void updateGasOrder(HighGasOrder gasOrder) { gasOrderMapper.updateByPrimaryKeySelective(gasOrder); } @Override public HighGasOrder getDetailByChildOrderNo(String childOrderNo) { HighGasOrderExample example = new HighGasOrderExample(); example.createCriteria().andChildOrderNoEqualTo(childOrderNo); List list = gasOrderMapper.selectByExample(example); if (list.size() > 0) { return list.get(0); } return null; } @Override public List getGasOrderList(Map param) { HighGasOrderExample example = new HighGasOrderExample(); HighGasOrderExample.Criteria criteria = example.createCriteria(); if (MapUtils.getLong(param, "companyId") != null) { } if (MapUtils.getLong(param, "merId") != null) { criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId")); } if (MapUtils.getLong(param, "storeId") != null) { criteria.andStoreIdEqualTo(MapUtils.getLong(param, "storeId")); } if (StringUtils.isNotBlank(MapUtils.getString(param, "storeName"))) { criteria.andStoreNameLike("%"+MapUtils.getString(param, "storeName")+"%"); } if (StringUtils.isNotBlank(MapUtils.getString(param, "orderNo"))) { criteria.andOrderNoLike("%"+MapUtils.getString(param, "orderNo")+"%"); } if (StringUtils.isNotBlank(MapUtils.getString(param, "childOrderNo"))) { criteria.andChildOrderNoLike("%"+MapUtils.getString(param, "childOrderNo")+"%"); } if (StringUtils.isNotBlank(MapUtils.getString(param, "memPhone"))) { criteria.andMemPhoneLike("%"+MapUtils.getString(param, "memPhone")+"%"); } if (MapUtils.getInteger(param, "gasOilType") != null) { criteria.andGasOilTypeEqualTo(MapUtils.getInteger(param, "storeId")); } if (StringUtils.isNotBlank(MapUtils.getString(param, "gasOilNo"))) { criteria.andGasOilNoEqualTo(MapUtils.getString(param, "gasOilNo")); } if (MapUtils.getInteger(param, "status") != null) { criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); } if (MapUtils.getLong(param, "createTimeS") != null) { criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS"))); } if (MapUtils.getLong(param, "createTimeE") != null) { criteria.andCreateTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeE"))); } if (MapUtils.getLong(param, "payTimeS") != null) { criteria.andPayTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "payTimeS"))); } if (MapUtils.getLong(param, "payTimeE") != null) { criteria.andPayTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "payTimeE"))); } if (MapUtils.getLong(param, "refundTimeS") != null) { criteria.andRefundTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "refundTimeS"))); } if (MapUtils.getLong(param, "refundTimeE") != null) { criteria.andRefundTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "refundTimeE"))); } example.setOrderByClause("create_time desc"); return gasOrderMapper.selectByExample(example); } }