|
@@ -7,6 +7,7 @@ import com.fjhx.mapper.apply.ApplyPurchaseMapper;
|
|
|
import com.fjhx.params.apply.ApplyPurchaseVo;
|
|
|
import com.fjhx.service.apply.ApplyPurchaseService;
|
|
|
import com.fjhx.uitl.code.CodeEnum;
|
|
|
+import com.fjhx.utils.UserClientUtil;
|
|
|
import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.redis.lock.RedisLockClient;
|
|
@@ -39,7 +40,28 @@ public class ApplyPurchaseServiceImpl extends ServiceImpl<ApplyPurchaseMapper, A
|
|
|
|
|
|
IWrapper<ApplyPurchase> wrapper = IWrapper.getWrapper(condition);
|
|
|
|
|
|
- return page(condition, wrapper);
|
|
|
+ wrapper.eq("t1", ApplyPurchase::getReceiptWarehouseId, condition.get("warehouseId"))
|
|
|
+ .eq("t1", ApplyPurchase::getStatus)
|
|
|
+ .apply(Func.isNotEmpty(condition.get("code")), "instr(t1.`code`, '" + condition.get("code") + "') > 0")
|
|
|
+ .apply(Func.isNotEmpty(condition.get("goodsCode")), "instr(t2.`code`, '" + condition.get("goodsCode") + "') > 0")
|
|
|
+ .apply(Func.isNotEmpty(condition.get("goodsName")), "instr(t2.`name`, '" + condition.get("goodsName") + "') > 0")
|
|
|
+ .eq("t1", ApplyPurchase::getCreateUser, condition.get("applyUserId"))
|
|
|
+ .ge("t1", ApplyPurchase::getCreateTime, condition.get("startTime"))
|
|
|
+ .le("t1", ApplyPurchase::getCreateTime, condition.get("endTime"))
|
|
|
+ .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(t2.`name`, '" + condition.get("keyword") + "') > 0"))
|
|
|
+ .orderByDesc("t1", ApplyPurchase::getCreateTime);
|
|
|
+
|
|
|
+ Page<ApplyPurchase> page = baseMapper.getPage(createPage(condition), wrapper);
|
|
|
+ if (Func.isNotEmpty(page.getRecords())) {
|
|
|
+ Map<Long, String> userNameMap = UserClientUtil.getUserNameMap(page.getRecords(), ApplyPurchase::getCreateUser);
|
|
|
+ for (ApplyPurchase record : page.getRecords()) {
|
|
|
+ if (Func.isNotEmpty(userNameMap) && Func.isNotEmpty(userNameMap.get(record.getCreateUser()))) {
|
|
|
+ record.setCreateName(userNameMap.get(record.getCreateUser()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
@Override
|