Browse Source

1.增加对商城客户的订单查询接口

dev-warehouse
pref_mail@163.com 2 years ago
parent
commit
3e076c4cd3
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java
  2. 19
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java
  3. 17
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockArticleVO.java
  4. 87
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java
  5. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java
  6. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  7. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  8. 30
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  9. 62
      blade-service/logpm-distribution/src/main/java/wrapper/DistributionStockArticleWrapper.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java

@ -11,5 +11,7 @@ public class DictBizConstant {
public static final String DEFAULT_MALL_ROLE_ID = "default_mall_role_id";//默认角色
public static final String DEFAULT_DEPT_ID = "default_dept_id";//默认部门ID
public static final String DELIVERY_ORDER_STATUS = "delivery_order_status";//配送订单状态
}

19
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java

@ -136,10 +136,8 @@ public class DistributionStockArticleEntity extends TenantEntity {
@ApiModelProperty(value = "仓库ID")
private Long warehouseId;
@TableField(exist = false)
private String stateName;
@TableField(exist = false)
private String typeName;
/**
* 入库时间
*/
@ -166,12 +164,7 @@ public class DistributionStockArticleEntity extends TenantEntity {
*/
@ApiModelProperty(value = "是否齐套")
private Integer completeSet;
/**
* 是否齐套名称
*/
@ApiModelProperty(value = "是否齐套名称")
@TableField(exist = false)
private String completeSetName;
/**
* 品牌
*/
@ -411,4 +404,10 @@ public class DistributionStockArticleEntity extends TenantEntity {
private String factoryTrain;
/**
* 订单状态 待预约 已预约 待配送 配送中 已配送 已完成
*/
private String orderStatus;
}

17
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockArticleVO.java

@ -16,6 +16,7 @@
*/
package com.logpm.distribution.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import io.swagger.annotations.ApiModelProperty;
import org.springblade.core.tool.node.INode;
@ -53,9 +54,9 @@ public class DistributionStockArticleVO extends DistributionStockArticleEntity {
@ApiModelProperty(value = "托盘")
private String pallet;
/**
* 或为信息
* 货位信息
*/
@ApiModelProperty(value = "或为信息")
@ApiModelProperty(value = "货位信息")
private String goodsAllocation;
/**
* 订单状态
@ -63,4 +64,16 @@ public class DistributionStockArticleVO extends DistributionStockArticleEntity {
@ApiModelProperty(value = "订单状态")
private String stockArticleState;
@ApiModelProperty(value = "服务类型 商 市 自")
private String typeServerName;
@ApiModelProperty(value = "订单状态")
private String orderStateName;
/**
* 是否齐套名称
*/
@ApiModelProperty(value = "是否齐套名称")
private String completeSetName;
}

87
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java

@ -41,6 +41,7 @@ import org.springblade.system.entity.DictBiz;
import org.springblade.system.feign.IDictBizClient;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import wrapper.DistributionStockArticleWrapper;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@ -81,7 +82,7 @@ public class DistributionStockArticleController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入distributionStockArticle")
public R<IPage<DistributionStockArticleEntity>> list(@ApiIgnore @RequestParam Map<String, Object> distributionStockArticle, Query query) {
public R<IPage<DistributionStockArticleVO>> list(@ApiIgnore @RequestParam Map<String, Object> distributionStockArticle, Query query) {
Object o = distributionStockArticle.get("orderSelfNumbering");
distributionStockArticle.remove("orderSelfNumbering");
QueryWrapper<DistributionStockArticleEntity> queryWrapper = Condition.getQueryWrapper(distributionStockArticle, DistributionStockArticleEntity.class);
@ -89,59 +90,32 @@ public class DistributionStockArticleController extends BladeController {
queryWrapper.in("order_self_numbering",String.valueOf(o).split(","));
}
IPage<DistributionStockArticleEntity> pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper);
pages.getRecords().forEach( i ->{
String typeService = i.getTypeService();
//计算在库天数
// SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
long time1 = i.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;
}
i.setStoreTime(days+"天");
switch (i.getCompleteSet()){
case 1:
i.setCompleteSetName("否");
break;
case 2:
i.setCompleteSetName("是");
break;
}
R<List<DictBiz>> distribution_type = dictBizClient.getList("distribution_type");
if(!Objects.isNull(typeService)){
if(Func.isNotEmpty(distribution_type.getData())){
DictBiz dictBiz = distribution_type.getData().get(Integer.parseInt(typeService)-1);
i.setTypeName(dictBiz.getDictValue());
switch (i.getState()){
case 1:
i.setStateName("待预约");
break;
case 2:
i.setStateName("已预约");
break;
case 3:
i.setStateName("待配送");
break;
case 4:
i.setStateName("配送中");
break;
case 5:
i.setStateName("已配送");
break;
case 6:
i.setStateName("已完成");
break;
}
}
return R.data(DistributionStockArticleWrapper.build().pageVO(pages));
}
});
return R.data(pages);
/**
* 配送在库订单--客户版本 分页
*/
@GetMapping("/clientList")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入distributionStockArticle")
public R<IPage<DistributionStockArticleVO>> clientList(@ApiIgnore @RequestParam DistributionStockArticleVO distributionStockArticle, Query query) {
IPage<DistributionStockArticleEntity> pages = distributionStockArticleService.selectClientListPage(Condition.getPage(query), distributionStockArticle);
DistributionStockArticleWrapper.build().pageVO(pages);
return R.data( DistributionStockArticleWrapper.build().pageVO(pages));
}
/**
* 配送在库订单 自定义分页
*/
@ -150,16 +124,7 @@ public class DistributionStockArticleController extends BladeController {
@ApiOperation(value = "分页", notes = "传入distributionStockArticle")
public R<IPage<DistributionStockArticleVO>> page(DistributionStockArticleVO distributionStockArticle, Query query) {
IPage<DistributionStockArticleVO> pages = distributionStockArticleService.selectDistributionStockArticlePage(Condition.getPage(query), distributionStockArticle);
pages.getRecords().forEach( i ->{
switch (i.getState()){
case 1:
i.setStateName("待预约");
break;
case 2:
i.setStateName("已预约");
break;
}
});
return R.data(pages);
}

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java

@ -57,4 +57,17 @@ public interface DistributionStockArticleMapper extends BaseMapper<DistributionS
List<DistributionStockArticleEntity> likeOrderSelfNumbering(@Param("orderSelfNumbering") String orderSelfNumbering);
/**
* 根据当前登录商城用户查询器归属订单
* @param page
* @param distributionStockArticleVO
* @return
*/
List<DistributionStockArticleEntity> selectClientListPage(IPage page, DistributionStockArticleVO distributionStockArticleVO,@Param("loginUserId") Long loginUserId);
}

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -3,7 +3,8 @@
<mapper namespace="com.logpm.distribution.mapper.DistributionStockArticleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="distributionStockArticleResultMap" type="com.logpm.distribution.entity.DistributionStockArticleEntity">
<resultMap id="distributionStockArticleResultMap"
type="com.logpm.distribution.entity.DistributionStockArticleEntity">
<result column="tenant_id" property="tenantId"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
@ -68,4 +69,17 @@
where order_self_numbering like ${orderSelfNumbering}
</select>
<select id="selectClientListPage" resultMap="distributionStockArticleResultMap" >
SELECT * from logpm_distribution_stock_article ldsa where ldsa.mall_id in
(
SELECT client_id from logpm_basicdata_clientuser where user_id =#{loginUserId}
)
and
ldsa.is_deleted = 0 and lds.type_service ='2'
<if test="distributionStockArticleVO.orderSelfNumbering!=null and distributionStockArticleVO.orderSelfNumbering !=''">
and ldsa.order_self_numbering == #{distributionStockArticleVO.orderSelfNumbering}
</if>
<!-- 条件没有写完 -->
</select>
</mapper>

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java

@ -17,6 +17,7 @@
package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.vo.DistributionStockArticleVO;
@ -77,4 +78,12 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
List<DistributionStockArticleEntity> likeOrderSelfNumbering(String orderSelfNumbering);
/**
* 商城客户查询自己的订单列表
* @param page
* @param distributionStockArticle
* @return
*/
IPage<DistributionStockArticleEntity> selectClientListPage(IPage<DistributionStockArticleEntity> page, DistributionStockArticleVO distributionStockArticle);
}

30
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -21,8 +21,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.logpm.basic.feign.IBasicTenantCodeClient;
import com.logpm.basicdata.entity.BasicdataClientUserEntity;
import com.logpm.basicdata.service.IBasicdataClientUserService;
import com.logpm.basicdata.service.IBasicdataStorageServicesService;
import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionStockArticleExcel;
@ -34,11 +38,17 @@ import com.logpm.distribution.vo.DistributionStockArticleVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.entity.User;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import wrapper.DistributionStockArticleWrapper;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
@ -72,11 +82,19 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
private final IBasicTenantCodeClient basicTenantCodeClient;
private final IBasicdataStorageServicesService basicdataStorageServicesService;
private final IBasicdataClientUserService basicdataClientUserService;
@Override
public IPage<DistributionStockArticleVO> selectDistributionStockArticlePage(IPage<DistributionStockArticleVO> page, DistributionStockArticleVO distributionStockArticle) {
return page.setRecords(baseMapper.selectDistributionStockArticlePage(page, distributionStockArticle));
List<DistributionStockArticleVO> distributionStockArticleVOS = baseMapper.selectDistributionStockArticlePage(page, distributionStockArticle);
distributionStockArticleVOS.forEach(t->{
t.setOrderStateName(DictBizCache.getValue(DictBizConstant.DELIVERY_ORDER_STATUS, t.getOrderStatus()));
});
return page.setRecords(distributionStockArticleVOS);
}
@ -186,6 +204,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
/**
* 把包件转库存品
*
* @param distributionStockArticleDTO
* @return
*/
@ -237,7 +256,6 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
}
/**
*
* @param distributionParcelList 包件信息
* @return
*/
@ -312,4 +330,12 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return baseMapper.likeOrderSelfNumbering(orderSelfNumbering);
}
@Override
public IPage<DistributionStockArticleEntity> selectClientListPage(IPage<DistributionStockArticleEntity> page, DistributionStockArticleVO distributionStockArticle) {
// 获取当前登陆人
BladeUser user = AuthUtil.getUser();
List<DistributionStockArticleEntity> result =baseMapper.selectClientListPage(page, distributionStockArticle,user.getUserId());
return page.setRecords(result);
}
}

62
blade-service/logpm-distribution/src/main/java/wrapper/DistributionStockArticleWrapper.java

@ -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…
Cancel
Save