|
@@ -4,13 +4,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.constants.logistics.LogisticsConstant;
|
|
|
+import com.fjhx.entity.apply.ApplyPurchase;
|
|
|
import com.fjhx.entity.logistics.LogisticsInfo;
|
|
|
+import com.fjhx.entity.purchase.Purchase;
|
|
|
+import com.fjhx.enums.purchase.PurchaseStatusEnum;
|
|
|
import com.fjhx.mapper.logistics.LogisticsInfoMapper;
|
|
|
import com.fjhx.params.logistics.LogisticsInfoVo;
|
|
|
import com.fjhx.service.logistics.LogisticsDetailsService;
|
|
|
import com.fjhx.service.logistics.LogisticsInfoService;
|
|
|
import com.fjhx.uitl.kd100.KD100Util;
|
|
|
import com.fjhx.utils.FileClientUtil;
|
|
|
+import com.fjhx.utils.UserClientUtil;
|
|
|
import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
@@ -43,8 +47,26 @@ public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, L
|
|
|
public Page<LogisticsInfo> getPage(Map<String, Object> condition) {
|
|
|
|
|
|
IWrapper<LogisticsInfo> wrapper = IWrapper.getWrapper(condition);
|
|
|
+ wrapper.eq("t1", LogisticsInfo::getStatus, LogisticsConstant.Status.STATUS_1)
|
|
|
+ .lt("t1", LogisticsInfo::getInStockStatus, LogisticsConstant.InStockStatus.STATUS_30)
|
|
|
+ .eq("t1", LogisticsInfo::getBusinessType, 1)
|
|
|
+ .ge("t2", Purchase::getStatus, PurchaseStatusEnum.STATUS_30.getKey())
|
|
|
+ .le("t2", Purchase::getStatus, PurchaseStatusEnum.STATUS_40.getKey())
|
|
|
+ .eq("t1", LogisticsInfo::getInStockStatus)
|
|
|
+ .and(Func.isNotEmpty(condition.get("keyword")), o -> o.apply("instr(t1.`code`, '" + condition.get("keyword") + "') > 0").or().apply("instr(t2.`code`, '" + condition.get("keyword") + "') > 0").or().apply("instr(t3.`name`, '" + condition.get("keyword") + "') > 0"))
|
|
|
+ .orderByDesc("t1", ApplyPurchase::getId);
|
|
|
+
|
|
|
+ Page<LogisticsInfo> page = baseMapper.getPage(createPage(condition), wrapper);
|
|
|
+ if (Func.isNotEmpty(page.getRecords())) {
|
|
|
+ Map<Long, String> userNameMap = UserClientUtil.getUserNameMap(page.getRecords(), LogisticsInfo::getCreateUser);
|
|
|
+ for (LogisticsInfo entity : page.getRecords()) {
|
|
|
+ if (Func.isNotEmpty(userNameMap) && Func.isNotEmpty(userNameMap.get(entity.getCreateUser()))) {
|
|
|
+ entity.setPurchaseName(userNameMap.get(entity.getCreateUser()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return page(condition, wrapper);
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = {Exception.class})
|