diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java index 79fbd49b9..82727202c 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java +++ b/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";//配送订单状态 + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java index 90af3bef2..5b0fabd64 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java +++ b/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; + + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockArticleVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockArticleVO.java index 641f9b5c5..4c9d48854 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockArticleVO.java +++ b/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; + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java index d812f134b..df272fe40 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java +++ b/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> list(@ApiIgnore @RequestParam Map distributionStockArticle, Query query) { + public R> list(@ApiIgnore @RequestParam Map distributionStockArticle, Query query) { Object o = distributionStockArticle.get("orderSelfNumbering"); distributionStockArticle.remove("orderSelfNumbering"); QueryWrapper 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 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> 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(pages); + + return R.data(DistributionStockArticleWrapper.build().pageVO(pages)); + } + + + /** + * 配送在库订单--客户版本 分页 + */ + @GetMapping("/clientList") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入distributionStockArticle") + public R> clientList(@ApiIgnore @RequestParam DistributionStockArticleVO distributionStockArticle, Query query) { + + + IPage 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> page(DistributionStockArticleVO distributionStockArticle, Query query) { IPage 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); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java index 0bafb5523..3c96cfd82 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java @@ -57,4 +57,17 @@ public interface DistributionStockArticleMapper extends BaseMapper likeOrderSelfNumbering(@Param("orderSelfNumbering") String orderSelfNumbering); + + /** + * 根据当前登录商城用户查询器归属订单 + * @param page + * @param distributionStockArticleVO + * @return + */ + List selectClientListPage(IPage page, DistributionStockArticleVO distributionStockArticleVO,@Param("loginUserId") Long loginUserId); + + + + + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml index 9cc4541ae..3eae21590 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml @@ -3,7 +3,8 @@ - + @@ -40,8 +41,8 @@ - - + + @@ -54,11 +55,11 @@ SELECT * FROM logpm_distribution_stock_article ${ew.customSqlSegment} - + update logpm_distribution_stock_article set hand_quantity = hand_quantity + #{num} where id = #{id} - + update logpm_distribution_stock_article set hand_quantity = hand_quantity - #{allNum} where id = #{articleId} and hand_quantity - #{allNum} >= 0 @@ -68,4 +69,17 @@ where order_self_numbering like ${orderSelfNumbering} + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java index b9750430a..e33daa8d1 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java +++ b/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 likeOrderSelfNumbering(String orderSelfNumbering); + + /** + * 商城客户查询自己的订单列表 + * @param page + * @param distributionStockArticle + * @return + */ + IPage selectClientListPage(IPage page, DistributionStockArticleVO distributionStockArticle); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index 7f029b0aa..605273285 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/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 selectDistributionStockArticlePage(IPage page, DistributionStockArticleVO distributionStockArticle) { - return page.setRecords(baseMapper.selectDistributionStockArticlePage(page, distributionStockArticle)); + List distributionStockArticleVOS = baseMapper.selectDistributionStockArticlePage(page, distributionStockArticle); + distributionStockArticleVOS.forEach(t->{ + t.setOrderStateName(DictBizCache.getValue(DictBizConstant.DELIVERY_ORDER_STATUS, t.getOrderStatus())); + + }); + return page.setRecords(distributionStockArticleVOS); } @@ -92,21 +110,21 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl list1 = distributionParcelListService.list(Wrappers.query().lambda() .in(DistributionParcelListEntity::getStockArticleId, ids.split(",")) ); - if(list1.size() > 0){ - list1.forEach( i ->{ + if (list1.size() > 0) { + list1.forEach(i -> { //查询库存品里面有没有一样的 // List list = distributionStockListService.list(Wrappers.query().lambda() // .eq(DistributionStockListEntity::getServiceNumber,i.getServiceNumber()) // .eq(DistributionStockListEntity::getMaterial,i.getMaterial()) // ); - // 添加库存品信息 - addStockList(i,1); + // 添加库存品信息 + addStockList(i, 1); }); String[] split = ids.split(","); for (int i = 0; i < split.length; i++) { @@ -120,8 +138,8 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl addIncrement(Map addvalueInfo) { boolean result = false; - if (Func.isNotEmpty(addvalueInfo)){ + if (Func.isNotEmpty(addvalueInfo)) { String id = (String) addvalueInfo.get("id"); Integer relatedId = (Integer) addvalueInfo.get("relatedId"); DistributionDeliveryListEntity distributionDeliveryListEntity = null; - DistributionStockArticleEntity distributionStockArticleEntity =null; - if (relatedId==2){ + DistributionStockArticleEntity distributionStockArticleEntity = null; + if (relatedId == 2) { SqlHelper.retBool(distributionAddvalueMapper.deleteAddvalueByDelivery(id)); distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(Long.parseLong(id)); - }else { + } else { SqlHelper.retBool(distributionAddvalueMapper.deleteAddvalueByStockArticle(id)); distributionStockArticleEntity = baseMapper.selectById(Long.parseLong(id)); } // //获取配送单增值服务费用 - if (Func.isNotEmpty(distributionStockArticleEntity) || Func.isNotEmpty(distributionDeliveryListEntity)){ - List> addvalueEntities = (List>) addvalueInfo.get("addvalue"); - if (!Func.isEmpty(addvalueEntities)){ + if (Func.isNotEmpty(distributionStockArticleEntity) || Func.isNotEmpty(distributionDeliveryListEntity)) { + List> addvalueEntities = (List>) addvalueInfo.get("addvalue"); + if (!Func.isEmpty(addvalueEntities)) { BigDecimal sum = BigDecimal.ZERO; for (Map addvalueEntityInfo : addvalueEntities) { //这里需要针对增值服务类型的价格进行查询并且进行累加,这里目前采取使用用户填写的方式 @@ -153,11 +171,11 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl list1 = distributionStockListService.list(Wrappers.query().lambda() .eq(DistributionStockListEntity::getStockArticleId, distributionStockArticleDTO.getId()) ); - if(list1.size() > 0){ + if (list1.size() > 0) { //存在 - }else{ + } else { //不存在 - addStockList(one,2); + addStockList(one, 2); } // String s1 = basicTenantCodeClient.shelfCode(AuthUtil.getTenantId(), "7"); @@ -233,15 +252,14 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl> getStockArticleInfo(String ids) { - if (Func.isBlank(ids)){ - log.error("参数异常:+["+ids+"]"); + if (Func.isBlank(ids)) { + log.error("参数异常:+[" + ids + "]"); return R.fail("操作失败!!!"); } List l = Func.toLongList(ids); List distributionStockArticleEntityList = new ArrayList<>(); //这里进行订单查询 - l.forEach(id->{ + l.forEach(id -> { DistributionStockArticleEntity distributionStockArticleEntity = this.baseMapper.selectById(id); DistributionStockArticleVO distributionStockArticleVO = Func.copy(distributionStockArticleEntity, DistributionStockArticleVO.class); distributionStockArticleEntityList.add(distributionStockArticleVO); @@ -299,12 +317,12 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl selectClientListPage(IPage page, DistributionStockArticleVO distributionStockArticle) { + // 获取当前登陆人 + BladeUser user = AuthUtil.getUser(); + List result =baseMapper.selectClientListPage(page, distributionStockArticle,user.getUserId()); + return page.setRecords(result); + + } } diff --git a/blade-service/logpm-distribution/src/main/java/wrapper/DistributionStockArticleWrapper.java b/blade-service/logpm-distribution/src/main/java/wrapper/DistributionStockArticleWrapper.java new file mode 100644 index 000000000..79eb828da --- /dev/null +++ b/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 { + + + 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; + } +}