List<InvwWarehouse> findBroByParentIdAndStatus(String parentId, EnableStatus status); | List<InvwWarehouse> findBroByParentIdAndStatus(String parentId, EnableStatus status); | ||||
//查询子级仓库 | //查询子级仓库 | ||||
@Query(value = "from InvwWarehouse where parentId = ?1 and status = ?2") | |||||
@Query(value = "from InvwWarehouse where parentId = ?1 and status = ?2 order by code, insertTime ") | |||||
List<InvwWarehouse> findChiByIdAndStatus(String id, EnableStatus status); | List<InvwWarehouse> findChiByIdAndStatus(String id, EnableStatus status); | ||||
//查询父、同级仓库 | //查询父、同级仓库 | ||||
@Query(value = "from InvwWarehouse where parentId = ?1 or id = ?1 and status = ?2 order by code, insertTime ") | |||||
List<InvwWarehouse> findParBroByParentId(String parentId, EnableStatus status); | |||||
@Query(value = "from InvwWarehouse where parentId = ?1 or id = ?2 and status = ?3 order by code, insertTime ") | |||||
List<InvwWarehouse> findParBroByParentId(String parentId, String Id, EnableStatus status); | |||||
//查询同、子级仓库 | //查询同、子级仓库 | ||||
@Query(value = "from InvwWarehouse where parentId = ?1 or parentId = ?2 and status = ?3 order by code, insertTime ") | @Query(value = "from InvwWarehouse where parentId = ?1 or parentId = ?2 and status = ?3 order by code, insertTime ") |
@Setter | @Setter | ||||
@Accessors(chain = true) | @Accessors(chain = true) | ||||
public class InvwWarehouseIdNameRequestDTO extends AbstractStaffBizRequestDTO { | public class InvwWarehouseIdNameRequestDTO extends AbstractStaffBizRequestDTO { | ||||
@ApiModelProperty(value = "仓库ID 空-查所有") | |||||
@ApiModelProperty(value = "仓库ID 与仓库编号二选一 空-查所有") | |||||
private String id; | private String id; | ||||
@ApiModelProperty(value = "仓库编号 与仓库ID号二选一 空-查所有") | |||||
private String code; | |||||
@ApiModelProperty(value = "查询类型 id为空查所有 1-查父 2-查兄 3-查子 4-查父兄 5-查兄子 6-查父子 7-查父兄子") | @ApiModelProperty(value = "查询类型 id为空查所有 1-查父 2-查兄 3-查子 4-查父兄 5-查兄子 6-查父子 7-查父兄子") | ||||
private String type; | private String type; | ||||
} | } |
InvwWarehouseIdNameResponseDTO response = new InvwWarehouseIdNameResponseDTO(); | InvwWarehouseIdNameResponseDTO response = new InvwWarehouseIdNameResponseDTO(); | ||||
InvwWarehouse warehouse = null; | InvwWarehouse warehouse = null; | ||||
if (hasText(req.getId())) { | if (hasText(req.getId())) { | ||||
warehouse = warehouseRepo.findById(req.getId()).orElse(null); | |||||
warehouse = warehouseRepo.findByIdAndStatus(req.getId(), EnableStatus.ENABLE); | |||||
} else if(hasText(req.getCode())){ | |||||
warehouse = warehouseRepo.findByCodeAndStatus(req.getCode(), EnableStatus.ENABLE); | |||||
} else { | } else { | ||||
warehouseList = warehouseRepo.findAllByStatus(EnableStatus.ENABLE); | warehouseList = warehouseRepo.findAllByStatus(EnableStatus.ENABLE); | ||||
} | } | ||||
if(hasText(req.getType())) { | |||||
/** 1-查父 2-查兄 3-查子 4-查父兄 5-查兄子 6-查父子 7-查父兄子*/ | |||||
if(hasText(req.getType()) && (hasText(req.getId()) || hasText(req.getCode()))) { | |||||
switch (req.getType()) { | switch (req.getType()) { | ||||
case "1": | case "1": | ||||
warehouseList = warehouseRepo.findParByParentIdAndStatus(req.getId(), EnableStatus.ENABLE); | |||||
warehouseList = warehouseRepo.findParByParentIdAndStatus(warehouse.getParentId(), EnableStatus.ENABLE); | |||||
break; | break; | ||||
case "2": | case "2": | ||||
if (warehouse != null) { | if (warehouse != null) { | ||||
} | } | ||||
break; | break; | ||||
case "3": | case "3": | ||||
warehouseList = warehouseRepo.findChiByIdAndStatus(req.getId(), EnableStatus.ENABLE); | |||||
warehouseList = warehouseRepo.findChiByIdAndStatus(warehouse.getId(), EnableStatus.ENABLE); | |||||
break; | break; | ||||
case "4": | case "4": | ||||
if (warehouse != null) { | if (warehouse != null) { | ||||
if (hasText(warehouse.getParentId())) { | if (hasText(warehouse.getParentId())) { | ||||
warehouseList = warehouseRepo.findParBroByParentId(warehouse.getParentId(), EnableStatus.ENABLE); | |||||
warehouseList = warehouseRepo.findParBroByParentId(warehouse.getParentId(), warehouse.getParentId(), EnableStatus.ENABLE); | |||||
} | } | ||||
} | } | ||||
break; | break; | ||||
case "5": | case "5": | ||||
if (warehouse != null) { | if (warehouse != null) { | ||||
if (hasText(warehouse.getParentId())) { | |||||
warehouseList = warehouseRepo.findBroChiByParentIdOrId(warehouse.getParentId(), warehouse.getId(), EnableStatus.ENABLE); | |||||
} | |||||
warehouseList = warehouseRepo.findBroChiByParentIdOrId(warehouse.getParentId(), warehouse.getId(), EnableStatus.ENABLE); | |||||
} | } | ||||
break; | break; | ||||
case "6": | case "6": |
//发起退费申请 | //发起退费申请 | ||||
orderFoundApply(orderRefund); | orderFoundApply(orderRefund); | ||||
orderRefund.setStatus(RefundStatus.APPLY); | orderRefund.setStatus(RefundStatus.APPLY); | ||||
orderRefund.setRefundTime(LocalDateTime.now()); | |||||
}else if (RefundOperateType.BANK.equals(orderRefund.getOperateType())){ | }else if (RefundOperateType.BANK.equals(orderRefund.getOperateType())){ | ||||
if (dto.getPaymentBankType() == null){ | if (dto.getPaymentBankType() == null){ | ||||
throw new ManagerException("银行卡退费时付费银行必填!"); | throw new ManagerException("银行卡退费时付费银行必填!"); | ||||
orderRefund.setUpdateTime(now); | orderRefund.setUpdateTime(now); | ||||
orderRefund.setAuditTime(now); | orderRefund.setAuditTime(now); | ||||
orderRefund.setSalesmanOpenId(findOpenIdByToken(dto.getAccessToken())); | orderRefund.setSalesmanOpenId(findOpenIdByToken(dto.getAccessToken())); | ||||
orderRefund.setSettlementOpenId(findOpenIdByToken(dto.getAccessToken())); | |||||
repo.merge(orderRefund); | repo.merge(orderRefund); | ||||
//记录日志 | //记录日志 | ||||
persistOperateLog(OperateType.ORDER_REFUND_CONFIRM,orderRefund.getId(),dto.getOrderSource(),findOpenIdByToken(dto.getAccessToken()),"结算退费审核结果:"+dto.getCensorResult()); | persistOperateLog(OperateType.ORDER_REFUND_CONFIRM,orderRefund.getId(),dto.getOrderSource(),findOpenIdByToken(dto.getAccessToken()),"结算退费审核结果:"+dto.getCensorResult()); |