|
@@ -4,13 +4,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fjhx.constants.logistics.LogisticsConstant;
|
|
import com.fjhx.constants.logistics.LogisticsConstant;
|
|
|
|
+import com.fjhx.entity.apply.ApplyPurchase;
|
|
import com.fjhx.entity.logistics.LogisticsInfo;
|
|
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.mapper.logistics.LogisticsInfoMapper;
|
|
import com.fjhx.params.logistics.LogisticsInfoVo;
|
|
import com.fjhx.params.logistics.LogisticsInfoVo;
|
|
import com.fjhx.service.logistics.LogisticsDetailsService;
|
|
import com.fjhx.service.logistics.LogisticsDetailsService;
|
|
import com.fjhx.service.logistics.LogisticsInfoService;
|
|
import com.fjhx.service.logistics.LogisticsInfoService;
|
|
import com.fjhx.uitl.kd100.KD100Util;
|
|
import com.fjhx.uitl.kd100.KD100Util;
|
|
import com.fjhx.utils.FileClientUtil;
|
|
import com.fjhx.utils.FileClientUtil;
|
|
|
|
+import com.fjhx.utils.UserClientUtil;
|
|
import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
@@ -47,6 +51,38 @@ public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, L
|
|
return page(condition, wrapper);
|
|
return page(condition, wrapper);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 采购入库列表
|
|
|
|
+ *
|
|
|
|
+ * @param condition 查询条件
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Page<LogisticsInfo> getPurchaseInStockPage(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.getPurchaseInStockPage(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;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Override
|
|
@Override
|
|
public void add(LogisticsInfoVo logisticsInfoVo) {
|
|
public void add(LogisticsInfoVo logisticsInfoVo) {
|
|
@@ -62,8 +98,8 @@ public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, L
|
|
KD100Util.subscribe(logisticsInfoVo.getLogisticsCompanyCode(), logisticsInfoVo.getCode());
|
|
KD100Util.subscribe(logisticsInfoVo.getLogisticsCompanyCode(), logisticsInfoVo.getCode());
|
|
}
|
|
}
|
|
logisticsInfoVo.setLogisticsStatus(state);
|
|
logisticsInfoVo.setLogisticsStatus(state);
|
|
-
|
|
|
|
logisticsInfoVo.setStatus(LogisticsConstant.Status.STATUS_0);
|
|
logisticsInfoVo.setStatus(LogisticsConstant.Status.STATUS_0);
|
|
|
|
+ logisticsInfoVo.setInStockStatus(LogisticsConstant.InStockStatus.STATUS_10);
|
|
save(logisticsInfoVo);
|
|
save(logisticsInfoVo);
|
|
|
|
|
|
logisticsInfoVo.getDetails().forEach(o -> {
|
|
logisticsInfoVo.getDetails().forEach(o -> {
|
|
@@ -127,4 +163,20 @@ public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, L
|
|
public void updateStatusByCode(String code, Integer state) {
|
|
public void updateStatusByCode(String code, Integer state) {
|
|
lambdaUpdate().set(LogisticsInfo::getStatus, state).eq(LogisticsInfo::getCode, code).update();
|
|
lambdaUpdate().set(LogisticsInfo::getStatus, state).eq(LogisticsInfo::getCode, code).update();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据业务ID查询物流单号
|
|
|
|
+ *
|
|
|
|
+ * @param businessId 业务ID
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<LogisticsInfo> codeSelectByBusinessId(Long businessId) {
|
|
|
|
+ return lambdaQuery()
|
|
|
|
+ .select(LogisticsInfo::getId, LogisticsInfo::getCode)
|
|
|
|
+ .eq(LogisticsInfo::getBusinessType, 1)
|
|
|
|
+ .eq(LogisticsInfo::getBusinessId, businessId)
|
|
|
|
+ .eq(LogisticsInfo::getStatus, LogisticsConstant.Status.STATUS_0)
|
|
|
|
+ .list();
|
|
|
|
+ }
|
|
}
|
|
}
|