Commit 606bca5a authored by fhj's avatar fhj

Merge remote-tracking branch 'origin/v2' into v2

parents 4a30cdb8 52a2e647
......@@ -11,7 +11,7 @@ import java.util.Arrays;
public enum MemberAppraisalItemStatusEnum {
/**
* 待发布考评表 - 0
* 待考评打分 - 0
*/
WAIT_GRADE(0, "待考评打分"),
......
......@@ -24,11 +24,21 @@ public interface IReportFeignService {
void increaseReport(Integer dataSource, Integer operateType, Long memberId, Long roleId);
/**
* 首页统计增加(数量)
*/
void increaseReport(Integer dataSource, Integer operateType, Long memberId, Long roleId, Integer count);
/**
* 首页统计减少
*/
void reduceReport(Integer dataSource, Integer operateType, Long memberId, Long roleId);
/**
* 首页统计减少(数量)
*/
void reduceReport(Integer dataSource, Integer operateType, Long memberId, Long roleId, Integer count);
/**
* 首页统计一方减少一方增加
*/
void reduceAndIncreaseReport(Integer dataSource, Integer operateType, Long memberId, Long roleId,
......
......@@ -94,9 +94,15 @@ public class ReportFeignServiceImpl implements IReportFeignService {
}
}
@Async
@Override
public void increaseReport(Integer dataSource, Integer operateType, Long memberId, Long roleId) {
this.increaseReport(dataSource, operateType, memberId, roleId, 1);
}
@Async
@Override
public void increaseReport(Integer dataSource, Integer operateType, Long memberId, Long roleId, Integer count) {
List<OperateNoticeVO> operateNoticeVOList = new ArrayList<>();
// 待发送 - 增加
OperateNoticeVO increaseOperateNotice = new OperateNoticeVO();
......@@ -104,7 +110,7 @@ public class ReportFeignServiceImpl implements IReportFeignService {
increaseOperateNotice.setRoleId(roleId);
increaseOperateNotice.setDataSource(dataSource);
increaseOperateNotice.setIncreaseOperateType(operateType);
increaseOperateNotice.setIncreaseCount(1L);
increaseOperateNotice.setIncreaseCount(Long.valueOf(count));
operateNoticeVOList.add(increaseOperateNotice);
try {
......@@ -114,9 +120,15 @@ public class ReportFeignServiceImpl implements IReportFeignService {
}
}
@Async
@Override
public void reduceReport(Integer dataSource, Integer operateType, Long memberId, Long roleId) {
this.reduceReport(dataSource, operateType, memberId, roleId, 1);
}
@Async
@Override
public void reduceReport(Integer dataSource, Integer operateType, Long memberId, Long roleId, Integer count) {
List<OperateNoticeVO> operateNoticeVOList = new ArrayList<>();
// 待整改 - 减少
OperateNoticeVO reduceOperateNotice = new OperateNoticeVO();
......@@ -124,7 +136,7 @@ public class ReportFeignServiceImpl implements IReportFeignService {
reduceOperateNotice.setRoleId(roleId);
reduceOperateNotice.setDataSource(dataSource);
reduceOperateNotice.setReduceOperateType(operateType);
reduceOperateNotice.setReduceCount(1L);
reduceOperateNotice.setReduceCount(Long.valueOf(count));
operateNoticeVOList.add(reduceOperateNotice);
try {
......@@ -134,6 +146,7 @@ public class ReportFeignServiceImpl implements IReportFeignService {
}
}
@Async
@Override
public void reduceAndIncreaseReport(Integer dataSource, Integer operateType, Long memberId, Long roleId, Integer subDataSource, Integer subOperateType, Long subMemberId, Long subRoleId) {
......
......@@ -270,7 +270,7 @@ public class MemberAppraisalServiceImpl implements IMemberAppraisalService {
pageQueryVO.setCompleteDay(DateTimeUtil.formatDate(e.getCompleteTime()));
pageQueryVO.setStatus(e.getStatus());
pageQueryVO.setStatusName(MemberAppraisalStatusEnum.getCodeMessage(e.getStatus()));
pageQueryVO.setSubmitOrUpdate(MemberAppraisalStatusEnum.WAIT_SUBMIT.getCode().equals(e.getStatus()));
pageQueryVO.setSubmitOrUpdate(statusLists.contains(e.getStatus()));
return pageQueryVO;
}).collect(Collectors.toList());
......@@ -942,7 +942,7 @@ public class MemberAppraisalServiceImpl implements IMemberAppraisalService {
// 首页统计
reportFeignService.reduceAndIncreaseReport(OperateDataSourceEnum.MEMBER_KPI.getCode(), MemberKpiOperateTypeEnum.TO_BE_PUBLISH_COUNT.getCode(), memberAppraisalDO.getMember().getId(), memberAppraisalDO.getRole().getId(),
OperateDataSourceEnum.MEMBER_KPI.getCode(), MemberKpiOperateTypeEnum.TO_BE_COMMIT_COUNT.getCode(), memberAppraisalDO.getSubMember().getId(), memberAppraisalDO.getSubRole().getId());
OperateDataSourceEnum.MEMBER_KPI.getCode(), MemberKpiOperateTypeEnum.TO_BE_COMMIT_COUNT.getCode(), memberAppraisalDO.getMember().getId(), memberAppraisalDO.getRole().getId());
// 发送消息
messageFeignService.sendSystemMessage(memberAppraisalDO.getMember().getId(), memberAppraisalDO.getRole().getId(),
......@@ -1020,7 +1020,10 @@ public class MemberAppraisalServiceImpl implements IMemberAppraisalService {
}
// 状态校验
if (!MemberAppraisalStatusEnum.WAIT_SUBMIT.getCode().equals(memberAppraisalDO.getStatus())) {
List<Integer> statusLists = Arrays.asList(MemberAppraisalStatusEnum.WAIT_SUBMIT.getCode(),
MemberAppraisalStatusEnum.WAIT_AUDIT_1_REJECT.getCode(),
MemberAppraisalStatusEnum.WAIT_AUDIT_2_REJECT.getCode());
if (!statusLists.contains(memberAppraisalDO.getStatus())) {
return Wrapper.fail(ResponseCode.MC_MS_DATA_STATUS_INCORRECT_OPERATE_INVALID);
}
......@@ -1029,6 +1032,8 @@ public class MemberAppraisalServiceImpl implements IMemberAppraisalService {
// 根据itemIds查询考评项目
List<Long> itemIdList = submitVO.getItems().stream().map(MemberAppraisalItemSubmitVO::getId).collect(Collectors.toList());
List<MemberAppraisalItemDO> items = memberAppraisalItemRepository.findAllById(itemIdList);
// 未打分的考评打分数量
int notGradeCount = 0;
for (MemberAppraisalItemDO item : items) {
// 判断是否属于同一考评
if (!item.getAppraisal().getId().equals(memberAppraisalDO.getId())) {
......@@ -1041,6 +1046,11 @@ public class MemberAppraisalServiceImpl implements IMemberAppraisalService {
return Wrapper.fail(ResponseCode.MC_MS_APPRAISAL_ITEM_NO_RELATION);
}
// 统计未打分数量
if (MemberAppraisalItemStatusEnum.WAIT_GRADE.getCode().equals(item.getStatus())) {
notGradeCount++;
}
item.setScoreWeight(itemSubmitVO.getScoreWeight());
BigDecimal grade = Objects.isNull(itemSubmitVO.getGrade()) ? BigDecimal.ZERO : itemSubmitVO.getGrade();
item.setGrade(grade);
......@@ -1072,6 +1082,9 @@ public class MemberAppraisalServiceImpl implements IMemberAppraisalService {
// 首页统计
reportFeignService.reduceAndIncreaseReport(OperateDataSourceEnum.MEMBER_KPI.getCode(), MemberKpiOperateTypeEnum.TO_BE_COMMIT_COUNT.getCode(), memberAppraisalDO.getMember().getId(), memberAppraisalDO.getRole().getId(),
OperateDataSourceEnum.MEMBER_KPI.getCode(), MemberKpiOperateTypeEnum.TO_BE_VALIFY_STEP1_COUNT.getCode(), memberAppraisalDO.getMember().getId(), memberAppraisalDO.getRole().getId());
// 减少剩余打分的数量
reportFeignService.reduceReport(OperateDataSourceEnum.MEMBER_KPI.getCode(), MemberKpiOperateTypeEnum.TO_BE_SCORING_COUNT.getCode(),
memberAppraisalDO.getMember().getId(), memberAppraisalDO.getRole().getId(), notGradeCount);
// 发送消息
messageFeignService.sendSystemMessage(memberAppraisalDO.getMember().getId(), memberAppraisalDO.getRole().getId(),
......
......@@ -3,6 +3,7 @@ package com.ssy.lingxi.order.api.fallback;
import com.ssy.lingxi.common.response.ResponseCode;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.api.feign.OrderFeignService;
import com.ssy.lingxi.order.api.model.vo.request.OrderAfterSaleVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderPurchaseProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderTradeProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderPurchaseProcessFeignDetailVO;
......@@ -10,8 +11,10 @@ import com.ssy.lingxi.order.api.model.vo.response.OrderTradeProcessFeignDetailVO
import org.springframework.stereotype.Component;
import javax.validation.Valid;
import java.util.List;
/**
* 订单服务 - OpenFeign接口Fallback类
* @author 万宁
* @version 2.0.0
* @date 2021-07-31
......@@ -39,4 +42,15 @@ public class OrderFeignServiceFallback implements OrderFeignService {
public Wrapper<OrderPurchaseProcessFeignDetailVO> findBuyerPurchaseProcess(@Valid OrderPurchaseProcessFeignVO feignVO) {
return Wrapper.fail(ResponseCode.SERVICE_ORDER_ERROR);
}
/**
* 售后服务 - 更新订单商品的换货、退货、维修数量
*
* @param afterSales 接口参数
* @return 更新结果
*/
@Override
public Wrapper<Void> updateAfterSaleOrderProduct(@Valid List<OrderAfterSaleVO> afterSales) {
return Wrapper.fail(ResponseCode.SERVICE_ORDER_ERROR);
}
}
package com.ssy.lingxi.order.api.feign;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.api.model.vo.request.OrderAfterSaleVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderPurchaseProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderTradeProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderPurchaseProcessFeignDetailVO;
......@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.validation.Valid;
import java.util.List;
/**
* 订单服务 - OpenFeign接口
......@@ -20,7 +22,6 @@ import javax.validation.Valid;
*/
@FeignClient(name = "order-service")
public interface OrderFeignService {
/**
* 查询(供应)会员交易流程规则配置
* @param feignVO 接口参数
......@@ -37,4 +38,12 @@ public interface OrderFeignService {
*/
@RequestMapping(value = "/order/feign/purchase/process/find", method = RequestMethod.POST)
Wrapper<OrderPurchaseProcessFeignDetailVO> findBuyerPurchaseProcess(@RequestBody @Valid OrderPurchaseProcessFeignVO feignVO);
/**
* 售后服务 - 更新订单商品的换货、退货、维修数量
* @param afterSales 接口参数
* @return 更新结果
*/
@RequestMapping(value = "/order/feign/after/sale/update", method = RequestMethod.POST)
Wrapper<Void> updateAfterSaleOrderProduct(@RequestBody @Valid List<OrderAfterSaleVO> afterSales);
}
package com.ssy.lingxi.order.controller.feign;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.api.model.vo.request.OrderAfterSaleVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderPurchaseProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderTradeProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderPurchaseProcessFeignDetailVO;
......@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
* (内部)流程规则配置查询接口
......@@ -22,7 +24,7 @@ import javax.validation.Valid;
*/
@RestController
@RequestMapping("/order/feign")
public class OrderProcessController {
public class OrderFeignController {
@Resource
private IOrderFeignService orderFeignService;
......@@ -46,4 +48,16 @@ public class OrderProcessController {
public Wrapper<OrderPurchaseProcessFeignDetailVO> findBuyerPurchaseProcess(@RequestBody @Valid OrderPurchaseProcessFeignVO feignVO) {
return orderFeignService.findBuyerPurchaseProcess(feignVO);
}
/**
* 售后服务 - 更新订单商品的换货、退货、维修数量
* @param afterSales 接口参数
* @return 更新结果
*/
@RequestMapping(value = "/after/sale/update", method = RequestMethod.POST)
public Wrapper<Void> updateAfterSaleOrderProduct(@RequestBody @Valid List<OrderAfterSaleVO> afterSales) {
return orderFeignService.updateAfterSaleOrderProduct(afterSales);
}
}
package com.ssy.lingxi.order.model.vo.common.response;
import com.ssy.lingxi.common.constant.order.OrderTypeEnum;
import com.ssy.lingxi.order.utils.NumberUtil;
import org.springframework.util.StringUtils;
......@@ -15,9 +16,13 @@ import java.math.BigDecimal;
public class OrderAfterSaleProductDetailVO implements Serializable {
private static final long serialVersionUID = -2975506613066526558L;
public OrderAfterSaleProductDetailVO(String processKey, Long skuId, String productNo, String name, String category, String brand, String unit, String spec, BigDecimal quantity, BigDecimal price, BigDecimal amount, BigDecimal exchangeCount, BigDecimal returnCount, BigDecimal maintainCount) {
public OrderAfterSaleProductDetailVO(Integer orderType, String processKey, Long skuId, String productNo, String name, String category, String brand, String unit, String spec, BigDecimal quantity, BigDecimal price, BigDecimal amount, BigDecimal exchangeCount, BigDecimal returnCount, BigDecimal maintainCount) {
this.processKey = StringUtils.hasLength(processKey) ? processKey : "";
this.productId = StringUtils.hasLength(productNo) ? productNo : String.valueOf(skuId);
if(orderType.equals(OrderTypeEnum.QUERY_PRICE_CONTRACT.getCode()) || orderType.equals(OrderTypeEnum.PRICE_COMPETITION_CONTRACT_PURCHASE.getCode()) || orderType.equals(OrderTypeEnum.PURCHASE_CONTRACT_BIDDING.getCode())) {
this.productId = productNo;
} else {
this.productId = String.valueOf(skuId);
}
this.name = StringUtils.hasLength(spec) ? name.concat("/").concat(spec) : name;
this.category = category;
this.brand = brand;
......
......@@ -19,6 +19,8 @@ import java.util.List;
public interface OrderProductRepository extends JpaRepository<OrderProductDO, Long>, JpaSpecificationExecutor<OrderProductDO> {
List<OrderProductDO> findByOrder(OrderDO order);
List<OrderProductDO> findByOrderIn(List<OrderDO> orders);
@Transactional
void deleteByOrder(OrderDO order);
}
......@@ -7,6 +7,8 @@ import com.ssy.lingxi.order.api.model.vo.request.OrderTradeProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderPurchaseProcessFeignDetailVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderTradeProcessFeignDetailVO;
import java.util.List;
/**
* 订单服务对外OpenFeign接口
* @author 万宁
......@@ -30,8 +32,8 @@ public interface IOrderFeignService {
/**
* 售后服务 - 更新订单商品的换货、退货、维修数量
* @param afterSaleVO 接口参数
* @param afterSales 接口参数
* @return 更新结果
*/
Wrapper<Void> updateAfterSaleOrderProduct(OrderAfterSaleVO afterSaleVO);
Wrapper<Void> updateAfterSaleOrderProduct(List<OrderAfterSaleVO> afterSales);
}
......@@ -39,7 +39,6 @@ import java.util.stream.Collectors;
*/
@Service
public class BaseOrderProductServiceImpl implements IBaseOrderProductService {
@Resource
private OrderProductRepository orderProductRepository;
......@@ -114,6 +113,7 @@ public class BaseOrderProductServiceImpl implements IBaseOrderProductService {
product.setReceived(BigDecimal.ZERO);
product.setExchangeCount(BigDecimal.ZERO);
product.setReturnCount(BigDecimal.ZERO);
product.setMaintainCount(BigDecimal.ZERO);
product.setLeftCount(product.getQuantity());
product.setDifferCount(product.getQuantity());
......@@ -228,6 +228,7 @@ public class BaseOrderProductServiceImpl implements IBaseOrderProductService {
product.setReceived(BigDecimal.ZERO);
product.setExchangeCount(BigDecimal.ZERO);
product.setReturnCount(BigDecimal.ZERO);
product.setMaintainCount(BigDecimal.ZERO);
product.setLeftCount(product.getQuantity());
product.setDifferCount(product.getQuantity());
......
......@@ -15,7 +15,6 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
......@@ -62,8 +61,7 @@ public class OrderDataInitServiceImpl implements IOrderDataInitService {
initCountryArea();
//初始化基础交易流程
//initBaseTradeProcess();
updateBaseTradeProcess();
initBaseTradeProcess();
//初始化基础采购流程
initBasePurchaseProcess();
......@@ -205,128 +203,6 @@ public class OrderDataInitServiceImpl implements IOrderDataInitService {
}
/**
* 新增或修改基础交易流程
*/
private void updateBaseTradeProcess() {
List<BaseTradeProcessDO> existList = baseTradeProcessRepository.findAll();
if(CollectionUtils.isEmpty(existList)) {
initBaseTradeProcess();
return;
}
List<BaseTradeProcessDO> tradeProcesses = new ArrayList<>();
BaseTradeProcessDO process = new BaseTradeProcessDO();
process.setName("订单多次发货流程");
process.setProcessKey("order_direct_delivery");
process.setProcessType(OrderTradeProcessTypeEnum.ORDER_TRADE.getCode());
process.setPayTimes(0);
process.setDescription("1-订单提交-->2-订单发货-->3-订单收货");
process.setProcessKind(WorkflowProcessKindEnum.COMPLEX.getCode());
process.setSkipFirstStep(true);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
//待补充支付流程
process = new BaseTradeProcessDO();
process.setName("一次支付多次发货流程");
process.setProcessKey("order_pay_one_deliveries");
process.setProcessType(OrderTradeProcessTypeEnum.ORDER_TRADE.getCode());
process.setPayTimes(1);
process.setDescription("1-提交订单-->2-订单支付-->3-确认支付结果-->4-订单发货确认-->5-订单收货确认");
process.setProcessKind(WorkflowProcessKindEnum.COMPLEX.getCode());
process.setSkipFirstStep(false);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
process = new BaseTradeProcessDO();
process.setName("售后换货处理流程");
process.setProcessKey("after_sale_replace_goods_outer_verify_ext");
process.setProcessType(OrderTradeProcessTypeEnum.AFTER_SALES_EXCHANGES.getCode());
process.setPayTimes(0);
process.setDescription("1-提交换货申请单-->2-确认换货申请单-->3-新增退货发货单-->4-新增物流单-->5-退货发货-->6-新增退货入库单-->7-退货收货-->8-确认退货回单-->9-新增换货发货单-->10-新增物流单-->11-换货发货-->12-新增换货入库单-->13-换货收货-->14-确认换货回单-->15-确认售后完成");
process.setProcessKind(WorkflowProcessKindEnum.EXTERNAL.getCode());
process.setSkipFirstStep(false);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
process = new BaseTradeProcessDO();
process.setName("售后换货手工发货处理流程");
process.setProcessKey("after_sale_replace_goods_manual_delivery_ext");
process.setProcessType(OrderTradeProcessTypeEnum.AFTER_SALES_EXCHANGES.getCode());
process.setPayTimes(0);
process.setDescription("1-提交换货申请单-->2-确认换货申请单-->3-退货发货-->4-退货收货-->5-换货发货-->6-换货收货-->7-确认售后完成");
process.setProcessKind(WorkflowProcessKindEnum.EXTERNAL.getCode());
process.setSkipFirstStep(false);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
process = new BaseTradeProcessDO();
process.setName("售后退货处理流程");
process.setProcessKey("after_sale_return_goods_outer_verify_ext");
process.setProcessType(OrderTradeProcessTypeEnum.AFTER_SALES_RETURNS.getCode());
process.setPayTimes(0);
process.setDescription("1-提交退货申请单-->2-确认退货申请单-->3-新增退货发货单-->4-新增物流单-->5-退货发货-->6-新增退货入库单-->7-退货收货-->8-确认退货回单-->9-退款-->10-确认退款结果-->11-确认售后完成");
process.setProcessKind(WorkflowProcessKindEnum.EXTERNAL.getCode());
process.setSkipFirstStep(false);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
process = new BaseTradeProcessDO();
process.setName("售后退货手工发货处理流程");
process.setProcessKey("after_sale_return_goods_manual_delivery_ext");
process.setProcessType(OrderTradeProcessTypeEnum.AFTER_SALES_RETURNS.getCode());
process.setPayTimes(0);
process.setDescription("1-提交退货申请单-->2-确认退货申请单-->3-退货发货-->4-退货收货-->5-退款-->6-确认退款结果-->7-确认售后完成");
process.setProcessKind(WorkflowProcessKindEnum.EXTERNAL.getCode());
process.setSkipFirstStep(false);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
process = new BaseTradeProcessDO();
process.setName("加工生产处理流程");
process.setProcessKey("pno_outer_verify_ext");
process.setProcessType(OrderTradeProcessTypeEnum.PRODUCTION.getCode());
process.setPayTimes(0);
process.setDescription("1-提交生产通知单-->2-确认生产通知单-->3-新增加工发货单-->4-新增物流单-->5-生产通知单发货-->6-新增加工入库单-->7-生产通知单收货-->8-确认回单-->9-完成");
process.setProcessKind(WorkflowProcessKindEnum.EXTERNAL.getCode());
process.setSkipFirstStep(false);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
process = new BaseTradeProcessDO();
process.setName("加工生产手工发货处理流程");
process.setProcessKey("pno_manual_delivery_outer_verify_ext");
process.setProcessType(OrderTradeProcessTypeEnum.PRODUCTION.getCode());
process.setPayTimes(0);
process.setDescription("1-提交生产通知单-->2-确认生产通知单-->5-生产通知单发货-->7-生产通知单收货-->9-完成");
process.setProcessKind(WorkflowProcessKindEnum.EXTERNAL.getCode());
process.setSkipFirstStep(false);
process.setStatus(EnableDisableStatus.ENABLE.getCode());
tradeProcesses.add(process);
List<BaseTradeProcessDO> updateOrInsertList = new ArrayList<>();
for (BaseTradeProcessDO tradeProcess : tradeProcesses) {
BaseTradeProcessDO exist = existList.stream().filter(e -> e.getProcessKey().equals(tradeProcess.getProcessKey())).findFirst().orElse(null);
if(exist == null) {
updateOrInsertList.add(tradeProcess);
continue;
}
exist.setName(tradeProcess.getName());
exist.setPayTimes(tradeProcess.getPayTimes());
exist.setProcessType(tradeProcess.getProcessType());
exist.setDescription(tradeProcess.getDescription());
exist.setProcessKind(tradeProcess.getProcessKind());
exist.setSkipFirstStep(tradeProcess.getSkipFirstStep());
updateOrInsertList.add(exist);
}
baseTradeProcessRepository.saveAll(updateOrInsertList);
baseTradeProcessRepository.deleteAll(existList.stream().filter(e -> updateOrInsertList.stream().noneMatch(u -> u.getProcessKey().equals(e.getProcessKey()))).collect(Collectors.toList()));
}
/**
* 初始化基础采购流程
*/
private void initBasePurchaseProcess() {
......@@ -369,7 +245,7 @@ public class OrderDataInitServiceImpl implements IOrderDataInitService {
process = new BasePurchaseProcessDO();
process.setName("售后换货处理流程1");
process.setProcessKey("purchase_bidding_external_outer_verify_ext");
process.setProcessKey("after_sale_replace_goods_contract_manual_delivery_ext");
process.setProcessType(OrderPurchaseProcessTypeEnum.AFTER_SALES_EXCHANGES.getCode());
process.setDescription("1-售后换货单申请-->2-售后换货单审核-->3-售后换货单确认-->4-退货发货处理-->5-退货收货处理-->6-换货发货处理-->7-换货收货处理...");
process.setProcessKind(WorkflowProcessKindEnum.EXTERNAL.getCode());
......
package com.ssy.lingxi.order.serviceimpl.feign;
import com.ssy.lingxi.common.constant.order.OrderTypeEnum;
import com.ssy.lingxi.common.response.ResponseCode;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.api.model.vo.request.OrderAfterSaleVO;
......@@ -8,9 +9,13 @@ import com.ssy.lingxi.order.api.model.vo.request.OrderTradeProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderPurchaseProcessFeignDetailVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderTradeProcessFeignDetailVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderTradeProcessPaymentFeignDetailVO;
import com.ssy.lingxi.order.entity.OrderDO;
import com.ssy.lingxi.order.entity.OrderProductDO;
import com.ssy.lingxi.order.model.bo.OrderProductBO;
import com.ssy.lingxi.order.model.bo.OrderPurchaseProcessBO;
import com.ssy.lingxi.order.model.bo.OrderTradeProcessBO;
import com.ssy.lingxi.order.repository.OrderProductRepository;
import com.ssy.lingxi.order.repository.OrderRepository;
import com.ssy.lingxi.order.service.base.IBaseOrderProcessService;
import com.ssy.lingxi.order.service.feign.IOrderFeignService;
import org.springframework.stereotype.Service;
......@@ -31,6 +36,13 @@ import java.util.stream.Collectors;
public class OrderFeignServiceImpl implements IOrderFeignService {
@Resource
private IBaseOrderProcessService baseOrderProcessService;
@Resource
private OrderRepository orderRepository;
@Resource
private OrderProductRepository orderProductRepository;
/**
* 查询(供应)会员交易流程规则配置
*
......@@ -78,11 +90,54 @@ public class OrderFeignServiceImpl implements IOrderFeignService {
/**
* 售后服务 - 更新订单商品的换货、退货、维修数量
*
* @param afterSaleVO 接口参数
* @param afterSales 接口参数
* @return 更新结果
*/
@Override
public Wrapper<Void> updateAfterSaleOrderProduct(OrderAfterSaleVO afterSaleVO) {
return null;
public Wrapper<Void> updateAfterSaleOrderProduct(List<OrderAfterSaleVO> afterSales) {
if(CollectionUtils.isEmpty(afterSales)) {
return Wrapper.success();
}
List<OrderDO> orders = orderRepository.findAllById(afterSales.stream().map(OrderAfterSaleVO::getOrderId).collect(Collectors.toList()));
if(CollectionUtils.isEmpty(orders)) {
return Wrapper.fail(ResponseCode.ORDER_DOES_NOT_EXIST);
}
List<OrderProductDO> orderProducts = orderProductRepository.findByOrderIn(orders);
List<OrderProductDO> updateList = new ArrayList<>();
orderProducts.forEach(orderProduct -> {
Long orderId = orderProduct.getOrder().getId();
String skuId = String.valueOf(orderProduct.getSkuId());
String productNo = orderProduct.getProductNo();
Integer orderType = orderProduct.getOrder().getOrderType();
OrderAfterSaleVO afterSale = afterSales.stream().filter(a -> a.getOrderId().equals(orderId)).findFirst().orElse(null);
if(afterSale != null) {
//当订单类型为三个“合同”模式,即SRM订单时,传递给售后服务的商品Id为物料编号,否则传递的是商品的SkuId
if(orderType.equals(OrderTypeEnum.QUERY_PRICE_CONTRACT.getCode()) || orderType.equals(OrderTypeEnum.PRICE_COMPETITION_CONTRACT_PURCHASE.getCode()) || orderType.equals(OrderTypeEnum.PURCHASE_CONTRACT_BIDDING.getCode())) {
afterSale.getProducts().stream().filter(afterSaleProduct -> afterSaleProduct.getProductId().equals(productNo)).findFirst().ifPresent(afterSaleProduct -> {
orderProduct.setReturnCount(orderProduct.getReturnCount().add(afterSaleProduct.getReturnCount()));
orderProduct.setExchangeCount(orderProduct.getExchangeCount().add(afterSaleProduct.getExchangeCount()));
orderProduct.setMaintainCount(orderProduct.getMaintainCount().add(afterSaleProduct.getMaintainCount()));
updateList.add(orderProduct);
});
} else {
afterSale.getProducts().stream().filter(afterSaleProduct -> afterSaleProduct.getProductId().equals(skuId)).findFirst().ifPresent(afterSaleProduct -> {
orderProduct.setReturnCount(orderProduct.getReturnCount().add(afterSaleProduct.getReturnCount()));
orderProduct.setExchangeCount(orderProduct.getExchangeCount().add(afterSaleProduct.getExchangeCount()));
orderProduct.setMaintainCount(orderProduct.getMaintainCount().add(afterSaleProduct.getMaintainCount()));
updateList.add(orderProduct);
});
}
}
});
if(CollectionUtils.isEmpty(updateList)) {
return Wrapper.fail(ResponseCode.ORDER_PRODUCT_DOES_NOT_EXIST);
}
orderProductRepository.saveAll(orderProducts);
return Wrapper.success();
}
}
......@@ -169,6 +169,7 @@ public class OrderCommonServiceImpl implements IOrderCommonService {
Map<Long, OrderAfterSalePageQueryVO> transform = query.transform(GroupBy.groupBy(qOrder.id).as(
Projections.constructor(OrderAfterSalePageQueryVO.class, qOrder.id, qOrder.orderNo, qOrder.vendorMemberName, qOrder.orderType, qOrder.createTime, qOrder.outerStatus, qOrderContract.contractId, qOrderContract.contractNo,
GroupBy.list(Projections.constructor(OrderAfterSaleProductDetailVO.class,
qOrder.orderType,
qOrderTradeProcess.processKey,
qOrderProduct.skuId,
qOrderProduct.productNo,
......@@ -249,6 +250,7 @@ public class OrderCommonServiceImpl implements IOrderCommonService {
Map<Long, OrderAfterSalePageQueryVO> transform = query.transform(GroupBy.groupBy(qOrder.id).as(
Projections.constructor(OrderAfterSalePageQueryVO.class, qOrder.id, qOrder.orderNo, qOrder.vendorMemberName, qOrder.orderType, qOrder.createTime, qOrder.outerStatus, qOrderContract.contractId, qOrderContract.contractNo,
GroupBy.list(Projections.constructor(OrderAfterSaleProductDetailVO.class,
qOrder.orderType,
qOrderPurchaseProcess.processKey,
qOrderProduct.skuId,
qOrderProduct.productNo,
......
......@@ -91,4 +91,9 @@ public class CommodityDetailRequest {
* 品牌id
*/
private Long brandId;
/**
* 是否包括阶梯价格
*/
private Boolean isMorePrice;
}
......@@ -57,4 +57,9 @@ public class CommoditySellerRequest {
* 品牌id
*/
private Long brandId;
/**
* 是否包括阶梯价格
*/
private Boolean isMorePrice;
}
......@@ -52,4 +52,9 @@ public class CommonCommodityPlatformRequest extends PageVO implements Serializab
* 供应会员
*/
private String memberName;
/**
* 是否包括阶梯价格
*/
private Boolean isMorePrice;
}
......@@ -68,12 +68,10 @@ public class CommodityCommonController extends BaseController {
//商城类型
Integer shopType = commodityBuyerRequest.getShopType();
if(shopType == ShopTypeEnum.ENTERPRISE.getCode() || shopType == ShopTypeEnum.SCORE.getCode()){
return Wrapper.success(commodityService.getCommodityDetailList(pageVO, commodityDetailRequest, sysUser.getMemberId(), sysUser.getMemberRoleId()));
}else if(shopType == ShopTypeEnum.CHANNEL.getCode() || shopType == ShopTypeEnum.CHANNEL_SELF.getCode() || shopType == ShopTypeEnum.CHANNEL_SCORE.getCode()){
if(ShopTypeEnum.CHANNEL.getCode().equals(shopType) || ShopTypeEnum.CHANNEL_SELF.getCode().equals(shopType) || ShopTypeEnum.CHANNEL_SCORE.getCode().equals(shopType)){
return Wrapper.success(channelCommodityService.getCommodityDetailList(pageVO, commodityDetailRequest, sysUser.getMemberId()));
}else{
return Wrapper.success(new PageData<>(0L, new ArrayList()));
return Wrapper.success(commodityService.getCommodityDetailList(pageVO, commodityDetailRequest, sysUser.getMemberId(), sysUser.getMemberRoleId()));
}
}
......@@ -101,12 +99,10 @@ public class CommodityCommonController extends BaseController {
}
//商城类型
Integer shopType = commoditySellerRequest.getShopType();
if(shopType == ShopTypeEnum.ENTERPRISE.getCode() || shopType == ShopTypeEnum.SCORE.getCode()){
return Wrapper.success(commodityService.getCommodityDetailList(pageVO, commodityDetailRequest, sysUser.getMemberId(), sysUser.getMemberRoleId()));
}else if(shopType == ShopTypeEnum.CHANNEL.getCode() || shopType == ShopTypeEnum.CHANNEL_SELF.getCode() || shopType == ShopTypeEnum.CHANNEL_SCORE.getCode()){
if(ShopTypeEnum.CHANNEL.getCode().equals(shopType) || ShopTypeEnum.CHANNEL_SELF.getCode().equals(shopType) || ShopTypeEnum.CHANNEL_SCORE.getCode().equals(shopType)){
return Wrapper.success(channelCommodityService.getCommodityDetailList(pageVO, commodityDetailRequest, sysUser.getMemberId()));
}else{
return Wrapper.success(new PageData<>(0L, new ArrayList()));
return Wrapper.success(commodityService.getCommodityDetailList(pageVO, commodityDetailRequest, sysUser.getMemberId(), sysUser.getMemberRoleId()));
}
}
......@@ -165,23 +161,23 @@ public class CommodityCommonController extends BaseController {
statusList.add(CommodityStatusEnum.NEVER_Shelf.getCode());
commodityDetailRequest.setStatusList(statusList);
if(shopType == ShopTypeEnum.ENTERPRISE.getCode()){
if(ShopTypeEnum.ENTERPRISE.getCode().equals(shopType)){
List<Integer> priceTypeList = new ArrayList<>();
priceTypeList.add(PriceTypeEnum.Cash.getCode());
priceTypeList.add(PriceTypeEnum.Consult.getCode());
commodityDetailRequest.setPriceTypeList(priceTypeList);
return Wrapper.success(commodityService.getCommodityDetailStockList(pageVO, commodityDetailRequest));
}else if(shopType == ShopTypeEnum.SCORE.getCode()){
}else if(ShopTypeEnum.SCORE.getCode().equals(shopType)){
List<Integer> priceTypeList = new ArrayList<>();
priceTypeList.add(PriceTypeEnum.Score.getCode());
commodityDetailRequest.setPriceTypeList(priceTypeList);
return Wrapper.success(commodityService.getCommodityDetailStockList(pageVO, commodityDetailRequest));
}else if(shopType == ShopTypeEnum.CHANNEL.getCode() || shopType == ShopTypeEnum.CHANNEL_SELF.getCode()){
}else if(ShopTypeEnum.CHANNEL.getCode().equals(shopType) || ShopTypeEnum.CHANNEL_SELF.getCode().equals(shopType)){
List<Integer> priceTypeList = new ArrayList<>();
priceTypeList.add(PriceTypeEnum.Cash.getCode());
commodityDetailRequest.setPriceTypeList(priceTypeList);
return Wrapper.success(channelCommodityService.getCommodityDetailStockList(pageVO, commodityDetailRequest));
}else if(shopType == ShopTypeEnum.CHANNEL_SCORE.getCode()){
}else if(ShopTypeEnum.CHANNEL_SCORE.getCode().equals(shopType)){
List<Integer> priceTypeList = new ArrayList<>();
priceTypeList.add(PriceTypeEnum.Score.getCode());
commodityDetailRequest.setPriceTypeList(priceTypeList);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment