9 changed files with 219 additions and 116 deletions
@ -0,0 +1,62 @@
|
||||
package wrapper; |
||||
|
||||
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
||||
import com.logpm.distribution.vo.DistributionStockArticleVO; |
||||
import org.springblade.common.constant.DictBizConstant; |
||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.system.cache.DictBizCache; |
||||
import org.springblade.system.entity.DictBiz; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 在库订单实体VO 转换 |
||||
*/ |
||||
public class DistributionStockArticleWrapper extends BaseEntityWrapper<DistributionStockArticleEntity |
||||
, DistributionStockArticleVO> { |
||||
|
||||
|
||||
public static DistributionStockArticleWrapper build() { |
||||
return new DistributionStockArticleWrapper(); |
||||
} |
||||
|
||||
@Override |
||||
public DistributionStockArticleVO entityVO(DistributionStockArticleEntity entity) { |
||||
|
||||
DistributionStockArticleVO distributionStockupVO = Objects.requireNonNull(BeanUtil.copy(entity, DistributionStockArticleVO.class)); |
||||
|
||||
//计算在库天数
|
||||
long time1 = entity.getWarehouseEntryTime().getTime(); //入库
|
||||
long time2 = new Date().getTime(); // 现在
|
||||
int days = (int) ((time2 - time1) / (1000 * 60 * 60 * 24)); |
||||
// int hours = (int) ((time2 - time1) / (1000 * 60 * 60));
|
||||
// int minutes = (int) ((time2 - time1) / (1000 * 60));
|
||||
// i.setStoreTime(days+"天"+hours+"小时"+minutes+"分钟");
|
||||
if (days == 0) { |
||||
days = 1; |
||||
} |
||||
distributionStockupVO.setStoreTime(days + "天"); |
||||
switch (entity.getCompleteSet()) { |
||||
case 1: |
||||
distributionStockupVO.setCompleteSetName("否"); |
||||
break; |
||||
case 2: |
||||
distributionStockupVO.setCompleteSetName("是"); |
||||
break; |
||||
} |
||||
|
||||
distributionStockupVO.setTypeServerName(DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, entity.getTypeService())); |
||||
|
||||
|
||||
distributionStockupVO.setOrderStateName(DictBizCache.getValue(DictBizConstant.DELIVERY_ORDER_STATUS, entity.getOrderStatus())); |
||||
|
||||
|
||||
|
||||
return distributionStockupVO; |
||||
} |
||||
} |
Loading…
Reference in new issue