ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
@@ -301,6 +301,7 @@ org.apache.http.HttpResponse response1 = post(LakalaConfig.getServerUrl() + "sit/api/v3/sacs/separate", jsonString, authorization1); String responseStr = IOUtils.toString(response1.getEntity().getContent(), ENCODING); System.err.println(responseStr); JSONObject jsonObject = JSONObject.parseObject(responseStr); if ("成功".equals(jsonObject.getString("msg"))) { @@ -323,6 +324,8 @@ @RequestMapping("/messageSeparateHandle") @ApiOperation(value = "拉卡拉分账信息回调接口") public Object messageSeparateHandle(HttpServletRequest request) throws Exception { System.err.println("拉卡拉分账信息回调接口---------进入"); String body = this.getBody(request); // 先处理支付完成 修改状态 后处理分账 后走分账回调 JSONObject jsonObject1 = JSONObject.parseObject(body); @@ -333,8 +336,9 @@ JSONArray jsonArray = JSONArray.parseArray(detail_datas.toString()); if("SEPARATE".equals(cmd_type.toString())){ TErpProcurement erpProcurement = erpProcurementService.getOne(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getOutSeparateNo, o.toString())); if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()!=1) { if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()==1) { erpProcurement.setRefundStatus(1); erpProcurement.setIsPlatformCommission(1); erpProcurementService.updateById(erpProcurement); // 修改分账状态 List<TErpProcurementGoods> list1 = erpProcurementGoodsService.list(new LambdaQueryWrapper<TErpProcurementGoods>().eq(TErpProcurementGoods::getProcurementId, erpProcurement.getId())); @@ -346,6 +350,7 @@ JSONObject jsonObject = new JSONObject(); jsonObject.put("code", "SUCCESS"); jsonObject.put("message", "执行成功"); System.err.println("拉卡拉分账信息回调接口---------完成"); return jsonObject; } }else if("FALLBACK".equals(cmd_type.toString())){ @@ -371,21 +376,27 @@ String apiPath = "sit/api/v3/rfd/refund_front/refund"; String body1 = "{\n" + "\t\"req_time\": \"" + time + "\",\n" + "\t\"version\": \"3.0\",\n" + "\t\"req_data\": {\n" + "\t\t\"merchant_no\": \""+erpProcurement.getMerchantNo()+"\",\n" + "\t\t\"term_no\": \""+erpProcurement.getTermNo()+"\",\n" + "\t\t\"refund_amount\": " + refund_amount + ",\n" + "\t\t\"out_trade_no\": \"" + outTradeNo + "\",\n" + "\t\t\"refund_amount\": \"" + refund_amount + "\",\n" + "\t\t\"refund_reason\": \"退款\",\n" + "\t\t\"notify_url\": \"" + "http://221.182.45.100:8089/t-sys-order/messageRefundHandle" + "\",\n" + "\t\t\"origin_log_no\": \"" + erpProcurement.getPayTransactionId() + "\",\n" + "\t\t\"origin_out_trade_no\": \"" + erpProcurement.getPayNumber() + "\",\n" + "\t\t\"refund_acc_mode\": \"00\",\n" + "\t\t\"refund_amt_sts\": \"00\",\n" + "\t\t\"location_info\": {\n" + "\t\t\t\"request_ip\": \"" + ipAddr + "\"\n" + "\t\t\t\"request_ip\": \"" + ipAddr + "\",\n" + "\t\t\t\"location\": \"\"\n" + "\t\t}\n" + "\t\t},\n" + "\t\"version\": \"3.0\",\n" + "\t\"req_time\": \"" + time + "\"\n" + "\t}\n" + "}"; String authorization = getAuthorization(body1); org.apache.http.HttpResponse response = post(LakalaConfig.getServerUrl() + apiPath, body1, authorization); if (response.getStatusLine().getStatusCode() != 200) { return R.fail(500, "请求失败,statusCode " + response.getStatusLine() @@ -399,7 +410,7 @@ erpProcurement.setRefundNo(outTradeNo); erpProcurementService.updateById(erpProcurement); System.err.println("拉卡拉分账信息回调接口---------完成"+responseStr); // 响应success @@ -415,6 +426,7 @@ @RequestMapping("/messageRefundHandle") @ApiOperation(value = "拉卡拉退款信息回调接口") public Object messageRefundHandle(HttpServletRequest request) throws Exception { System.err.println("拉卡拉退款信息回调接口---------进入"); String body = this.getBody(request); // 先处理支付完成 修改状态 后处理分账 后走分账回调 JSONObject jsonObject1 = JSONObject.parseObject(body); @@ -452,11 +464,65 @@ erpProcurementService.updateById(erpProcurement); return R.ok("操作成功"); } // 还未分账成功不能退款 if(erpProcurement.getStatus()==null || erpProcurement.getStatus()!=1){ return R.fail("订单处理中,请稍后操作"); } // 判断回退没有回退了直接退款 long count = erpProcurementGoodsService.count(new LambdaQueryWrapper<TErpProcurementGoods>().eq(TErpProcurementGoods::getProcurementId, id).eq(TErpProcurementGoods::getStatus, 1)); if(count==0){ // 发起退款 String time = DateUtils.dateTimeNow(); String ipAddr = IpUtils.getIpAddr(request); // SYMBOLS 随机取4位数 String str = ""; for (int i = 0; i < 6; i++) { str += SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length())); } String outTradeNo = time + str; String refund_amount = erpProcurement.getPayMoney().multiply(BigDecimal.valueOf(100)).intValue() + ""; String apiPath = "sit/api/v3/rfd/refund_front/refund"; String body1 = "{\n" + "\t\"req_data\": {\n" + "\t\t\"merchant_no\": \""+erpProcurement.getMerchantNo()+"\",\n" + "\t\t\"term_no\": \""+erpProcurement.getTermNo()+"\",\n" + "\t\t\"out_trade_no\": \"" + outTradeNo + "\",\n" + "\t\t\"refund_amount\": \"" + refund_amount + "\",\n" + "\t\t\"refund_reason\": \"退款\",\n" + "\t\t\"notify_url\": \"" + "http://221.182.45.100:8089/t-sys-order/messageRefundHandle" + "\",\n" + "\t\t\"origin_out_trade_no\": \"" + erpProcurement.getPayNumber() + "\",\n" + "\t\t\"refund_acc_mode\": \"00\",\n" + "\t\t\"refund_amt_sts\": \"00\",\n" + "\t\t\"location_info\": {\n" + "\t\t\t\"request_ip\": \"" + ipAddr + "\",\n" + "\t\t\t\"location\": \"\"\n" + "\t\t}\n" + "\t\t},\n" + "\t\"version\": \"3.0\",\n" + "\t\"req_time\": \"" + time + "\"\n" + "\t}\n" + "}"; String authorization = getAuthorization(body1); org.apache.http.HttpResponse response = post(LakalaConfig.getServerUrl() + apiPath, body1, authorization); if (response.getStatusLine().getStatusCode() != 200) { return R.fail(500, "请求失败,statusCode " + response.getStatusLine() + IOUtils.toString(response.getEntity().getContent(), ENCODING)); } String responseStr = IOUtils.toString(response.getEntity().getContent(), ENCODING); JSONObject jsonObject = JSONObject.parseObject(responseStr); JSONObject jsonObject2 = jsonObject.getJSONObject("resp_data"); String code = jsonObject2.getString("log_no"); erpProcurement.setRefundLogNo(code); erpProcurement.setRefundNo(outTradeNo); erpProcurementService.updateById(erpProcurement); return R.ok("操作成功"); } // 还未分账成功不能退款 if(erpProcurement.getIsPlatformCommission()==2){ return R.fail("订单处理中,请稍后操作"); } String time = DateUtils.dateTimeNow(); @@ -510,6 +576,7 @@ String responseStr = IOUtils.toString(response1.getEntity().getContent(), ENCODING); // post.body(jsonString); // HttpResponse response = post.execute(); // String responseStr = response.body(); ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
@@ -196,7 +196,10 @@ @PostMapping(value = "/getExchangeRecord") public R<PageInfo<TSysGoodsExchange>> getExchangeRecord(@RequestBody @Valid TSysGoodsExchangeQuery query) { PageInfo<TSysGoodsExchange> page = new PageInfo<>(query.getPageNum(), query.getPageSize()); LambdaQueryWrapper<TSysGoodsExchange> wrapper = new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, query.getId()); LambdaQueryWrapper<TSysGoodsExchange> wrapper = new LambdaQueryWrapper<TSysGoodsExchange>(); if(query.getId()!=null && !query.getId().isEmpty()){ wrapper.eq(TSysGoodsExchange::getGoodsId, query.getId()); } if (query.getClinicName() != null && !query.getClinicName().isEmpty()) { wrapper.like(TSysGoodsExchange::getClinicName, query.getClinicName()); } ruoyi-system/src/main/java/com/ruoyi/system/dto/WarehouseGoodsDto.java
@@ -12,6 +12,7 @@ @ApiModelProperty("1草稿") private Integer status; @ApiModelProperty("商品信息") private List<clinicWarehouseGoodsDto> dtos; } ruoyi-system/src/main/java/com/ruoyi/system/query/TSysGoodsExchangeQuery.java
@@ -12,7 +12,6 @@ public class TSysGoodsExchangeQuery extends BasePage { @ApiModelProperty("商品id") @NotBlank(message = "商品id不能为空") private String id; @ApiModelProperty("诊所名称") private String clinicName; ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
@@ -364,6 +364,12 @@ // Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); // for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { if(dtos.getStatus()==null || dtos.getStatus()!=1 ){ // 草稿-》正式 移除所有草稿 this.baseMapper.delete(new LambdaQueryWrapper<TErpClinicWarehousing>().eq(TErpClinicWarehousing::getClinicId,supplierClinicId).eq(TErpClinicWarehousing::getStatus,1)); } TErpClinicWarehousing tErpClinicWarehousing = new TErpClinicWarehousing(); tErpClinicWarehousing.setClinicId(supplierClinicId); tErpClinicWarehousing.setCreateId(user.getUserId().toString()); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
@@ -570,6 +570,28 @@ String warehousingId1 = tErpSupplierWarehousingBatch1.getWarehousingId(); TErpSupplierWarehousing tErpSupplierWarehousing2 = erpSupplierWarehousingMapper.selectById(warehousingId1); if(inventoryGoodsDto.getDamagedCount()!=null && inventoryGoodsDto.getDamagedCount()>0){ TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound(); tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); tErpSupplierOutbound.setSupplierId(supplierClinicId); tErpSupplierOutbound.setOutboundType(1); tErpSupplierOutbound.setOutboundNumber("G" + s); int count = inventoryGoodsDto.getDamagedCount(); tErpSupplierOutbound.setTotalMoney(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(count))); tErpSupplierOutbound.setGoodsId(tErpSupplierWarehousing2.getGoodsId()); erpSupplierOutboundMapper.insert(tErpSupplierOutbound); TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods(); tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); tErpSupplierOutboundGoods.setWarehousingId(tErpSupplierWarehousing1.getId()); tErpSupplierOutboundGoods.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId()); tErpSupplierOutboundGoods.setOutboundCount(count); tErpSupplierOutboundGoods.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(count))); erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); } TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound(); tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); tErpSupplierOutbound.setSupplierId(supplierClinicId); @@ -638,6 +660,8 @@ TErpClinicWarehousing tErpSupplierWarehousing1 = erpClinicWarehousingMapper.selectById(warehousingId); TErpGoods erpGoods = this.getById(tErpSupplierWarehousingBatch.getGoodsId()); // 盘点是盘亏盘盈 赢 if (inventoryGoodsDto.getNum() < inventoryGoodsDto.getInventoryCount()) { // 添加入库信息 @@ -683,6 +707,26 @@ } else { if(inventoryGoodsDto.getDamagedCount()!=null && inventoryGoodsDto.getDamagedCount()>0){ TErpClinicOutbound tErpSupplierOutbound = new TErpClinicOutbound(); // tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); // tErpSupplierOutbound.setSupplierId(supplierClinicId); tErpSupplierOutbound.setOutboundType(1); tErpSupplierOutbound.setOutboundNumber("G" + s); int count = inventoryGoodsDto.getDamagedCount(); tErpSupplierOutbound.setTotalMoney(erpGoods.getSalesAmount().multiply(new BigDecimal(count))); tErpSupplierOutbound.setInventoryId(tErpSupplierInventory.getId()); erpClinicOutboundMapper.insert(tErpSupplierOutbound); TErpClinicOutboundGoods tErpSupplierOutboundGoods = new TErpClinicOutboundGoods(); tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); tErpSupplierOutboundGoods.setWarehousingId(tErpSupplierWarehousing1.getId()); tErpSupplierOutboundGoods.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId()); tErpSupplierOutboundGoods.setOutboundCount(count); tErpSupplierOutboundGoods.setTotalPrice(erpGoods.getSalesAmount().multiply(new BigDecimal(count))); erpClinicOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); } TErpClinicOutbound tErpSupplierOutbound = new TErpClinicOutbound(); // tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); // tErpSupplierOutbound.setSupplierId(supplierClinicId); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpIssueReportingServiceImpl.java
@@ -38,6 +38,10 @@ @Override public PageInfo<TErpIssueReportingVO> pageList(TErpIssueReportingQuery query) { PageInfo<TErpIssueReportingVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); if(query.getReportStartTime()!=null && !query.getReportStartTime().isEmpty() && query.getReportEndTime()!=null && !query.getReportEndTime().isEmpty()){ query.setReportStartTime(query.getReportStartTime()+" 00:00:00"); query.setReportEndTime(query.getReportEndTime()+" 23:59:59"); } List<TErpIssueReportingVO> list = this.baseMapper.pageList(query,pageInfo); if(CollectionUtils.isEmpty(list)){ return pageInfo; ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java
@@ -46,10 +46,18 @@ private TErpSupplierWarehousingBatchMapper erpSupplierWarehousingBatchMapper; @Resource private TErpClinicWarehousingBatchMapper erpClinicWarehousingBatchMapper; @Resource private TErpSupplierWarehousingMapper erpSupplierWarehousingMapper; @Resource private TErpClinicOutboundGoodsMapper erpClinicOutboundGoodsMapper; @Resource private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper; @Resource private TCrmClinicMapper crmClinicMapper; @@ -125,26 +133,47 @@ String warehousingBatchId = tErpMaintenanceReminder.getWarehousingBatchId(); if(warehousingBatchId != null){ TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(warehousingBatchId); tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(tErpSupplierWarehousingBatch.getWarehousingId()); if(tErpSupplierWarehousing!=null){ String goodsId = tErpSupplierWarehousing.getGoodsId(); if(goodsId != null){ TErpGoods goods = erpGoodsMapper.selectById(goodsId); tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName()); tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber()); tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode()); String packingUnitId = goods.getPackingUnitId(); if(packingUnitId != null){ TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId); tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); if(tErpMaintenanceReminder.getMaintenanceType()==2){ TErpClinicWarehousingBatch tErpSupplierWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(warehousingBatchId); tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); String goodsId = tErpSupplierWarehousingBatch.getGoodsId(); if(goodsId != null){ TErpGoods goods = erpGoodsMapper.selectById(goodsId); tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName()); tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber()); tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode()); String packingUnitId = goods.getPackingUnitId(); if(packingUnitId != null){ TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId); tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); } } List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, warehousingBatchId)); int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum(); tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum); }else { TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(warehousingBatchId); tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(tErpSupplierWarehousingBatch.getWarehousingId()); if(tErpSupplierWarehousing!=null){ String goodsId = tErpSupplierWarehousing.getGoodsId(); if(goodsId != null){ TErpGoods goods = erpGoodsMapper.selectById(goodsId); tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName()); tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber()); tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode()); String packingUnitId = goods.getPackingUnitId(); if(packingUnitId != null){ TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId); tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); } } } List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, warehousingBatchId)); int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum(); tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum); } List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, warehousingBatchId)); int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum(); tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum); } return tErpMaintenanceReminderDetailVo; ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java
@@ -54,7 +54,7 @@ if(sum+dto.getCount()>tSysGoods.getConvertibleQuantity()){ throw new RuntimeException("可兑换数量不足"); } List<TCrmClinicPoints> points = crmClinicPointsMapper.selectList(new LambdaQueryWrapper<TCrmClinicPoints>().eq(TCrmClinicPoints::getClinicId, crmClinic.getId()).ge(TCrmClinicPoints::getExpireTime, new Date()).last(" and points > use_points").orderByAsc(TCrmClinicPoints::getCreateTime)); List<TCrmClinicPoints> points = crmClinicPointsMapper.selectList(new LambdaQueryWrapper<TCrmClinicPoints>().eq(TCrmClinicPoints::getClinicId, crmClinic.getId()).ge(TCrmClinicPoints::getExpireTime, new Date()).last(" and points > use_points ORDER BY create_time ASC")); // 可用积分 int userPoints = points.stream().mapToInt(item -> item.getPoints() - item.getUsePoints()).sum(); if(userPoints<needPoints){ ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysOrderServiceImpl.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.BaseModel; import com.ruoyi.system.dto.TSysOrderDto; import com.ruoyi.system.dto.TSysOrderNextDto; import com.ruoyi.system.mapper.*; ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
@@ -47,10 +47,11 @@ <select id="validityPeriodWarning" resultType="com.ruoyi.system.vo.ValidityPeriodWarningVo"> select t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName, select * from (select t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName, case when t3.id is null then t1.warehousing_number else t1.warehousing_number -t3.outbound_count else t1.warehousing_number -coalesce(sum(t3.outbound_count),0) end as num from t_erp_clinic_warehousing_batch t1 left join t_erp_clinic_warehousing t2 on t1.warehousing_id = t2.id @@ -59,7 +60,6 @@ left join t_erp_goods_type t5 on t4.type_id = t5.id left join t_erp_goods_unit t6 on t4.packing_unit_id = t6.id where #{time} > t1.expiry_date and (t1.warehousing_number - t3.outbound_count > 0 or t3.id is null) <if test="user.roleType !=null and user.roleType ==5"> and t2.clinic_id =#{supplierClinicId} </if> @@ -75,7 +75,10 @@ <if test="query.typeId != null and query.typeId != ''"> and t4.type_id = #{query.typeId} </if> order by t1.expiry_date group by t1.id ) as o where o.num >0 order by o.expiry_date </select> @@ -85,13 +88,17 @@ <select id="pageList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> select * from ( select <include refid="Base_Column_List1"/> COALESCE(sum(t2.purchase_count), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum, SUM(t2.unit_amount * (t2.purchase_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice, COALESCE(sum(t2.warehousing_number), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum, SUM(t2.unit_amount * (t2.warehousing_number - COALESCE(t3.outbound_count, 0))) as allTotalPrice, t3.outbound_count, COALESCE(sum(t3.outbound_count), 0) as outNum,t4.create_time as createTime1 from t_erp_goods t1 left join t_erp_clinic_warehousing_batch t2 on t1.id = t2.goods_id left join t_erp_clinic_warehousing t4 on t2.warehousing_id = t4.id left join t_erp_clinic_outbound_goods t3 on t2.id = t3.warehousing_id left join t_erp_clinic_warehousing t4 on t2.warehousing_id = t4.id left join ( select warehousing_batch_id, sum(outbound_count) as outbound_count from t_erp_clinic_outbound_goods group by warehousing_batch_id ) t3 on t2.id = t3.warehousing_batch_id where t1.disabled = 0 and t2.id is not null <if test="query.goodsName != null and query.goodsName != ''"> and t1.goods_name like concat('%',#{query.goodsName},'%') ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -278,7 +278,7 @@ select * from ( SELECT t1.id,t2.warehouse_no, t3.goods_name, t4.supplier_name, case t3.goods_source when 1 then t4.supplier_name when 2 then t3.supplier_name end as supplierName, t3.type_id, t3.packing_unit_id, t3.quasi_number, @@ -294,19 +294,19 @@ LEFT JOIN t_erp_clinic_warehousing t2 on t1.warehousing_id = t2.id LEFT JOIN t_erp_goods t3 on t1.goods_id = t3.id LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id LEFT JOIN t_erp_clinic_outbound_goods t5 on t5.warehousing_batch_id =t1.id where t2.disabled = 0 and #{endDate} > t1.expiry_date <if test="user.roleType !=null and user.roleType ==4"> and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=1 and t2.clinic_id =#{supplierClinicId} </if> <if test="user.roleType !=null and user.roleType ==5"> and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=2 and t2.clinic_id =#{supplierClinicId} </if> GROUP BY t1.id ) as o where (o.warehousing_number -o.outbound_count) >0 where o.num >0 order by o.create_time desc </select> <select id="getGoodsById" resultType="com.ruoyi.system.model.TErpGoods"> ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml
@@ -38,8 +38,11 @@ <if test="query.status != null"> AND status = #{query.status} </if> <if test="query.reportType != null and query.reportUserId !=null"> AND report_type = #{query.reportType} and report_user_id =#{query.reportUserId} <if test="query.reportType != null "> AND report_type = #{query.reportType} </if> <if test="query.reportUserId !=null"> and report_user_id =#{query.reportUserId} </if> <if test="query.createBy != null and query.createBy != ''"> AND create_by LIKE concat('%',#{query.createBy},'%') ruoyi-system/src/main/resources/mapper/system/TSysAppUserMapper.xml
@@ -36,7 +36,7 @@ left join (select id,app_user_id, max(check_time) as lastInspectionTime from t_sys_inspection limit 1) tsi on tsi.app_user_id = tsau.id <where> <if test="query.phone != null and query.phone != ''"> and tsau.phone = #{query.phone} and tsau.phone like concat('%',#{query.phone},'%') </if> <if test="query.nickName != null and query.nickName != ''"> and tsau.nick_name like concat('%',#{query.nickName},'%') @@ -65,7 +65,7 @@ left join (select id,app_user_id, max(check_time) as lastInspectionTime from t_sys_inspection limit 1) tsi on tsi.app_user_id = tsau.id <where> <if test="query.phone != null and query.phone != ''"> and tsau.phone = #{query.phone} and tsau.phone like concat('%',#{query.phone},'%') </if> <if test="query.nickName != null and query.nickName != ''"> and tsau.nick_name like concat('%',#{query.nickName},'%') ruoyi-system/src/main/resources/mapper/system/TSysOrderMapper.xml
@@ -26,6 +26,7 @@ <include refid="Base_Column_List"/> from t_sys_order where app_user_id = #{appUserId} and disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} order by create_time desc </select>