优化问题

This commit is contained in:
2025-11-03 15:42:45 +08:00
parent 845f2fd59a
commit a43d7f32b6
10 changed files with 236 additions and 0 deletions

View File

@@ -76,6 +76,12 @@ public class PhotoController {
return AjaxResult.success(photoService.listUrlsByBill(billNo, photoType));
}
@GetMapping("/listData")
public AjaxResult listData(@RequestParam("billNo") String billNo,
@RequestParam(value = "photoType", required = false) String photoType) {
return AjaxResult.success(photoService.listsByBill(billNo, photoType));
}
/**
* 【删除:按 URL 列表】
* @param dto
@@ -87,4 +93,8 @@ public class PhotoController {
Map<String, Object> result = photoService.deleteByUrls(dto.getUrls());
return AjaxResult.success("删除完成", result);
}
@GetMapping("/deleteById")
public AjaxResult deleteById(@RequestParam("id") Integer id){
return AjaxResult.success(photoService.deleteById(id));
}
}

View File

@@ -254,4 +254,26 @@ public class RkInfoController extends BaseController
}
@PostMapping("/pageStatistics")
public Map<String, Object> pageStatistics(@RequestBody(required = false) RkInfoQueryDTO dto) {
if (dto == null) {
dto = new RkInfoQueryDTO();
}
// 使用 PageHelper 分页
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<RkInfo> list = rkInfoService.selectAllRkInfo(dto);
// 统计金额
Long sumMoney = rkInfoService.selectStatistics(dto);
// 统计库位
Long pcdeCount = rkInfoService.selectPcde(dto);
Map<String,Object> dataInfo = new HashMap<>();
dataInfo.put("dataList",getDataTable(list));
dataInfo.put("sumMoney",sumMoney);
dataInfo.put("pcdeCount",pcdeCount);
return dataInfo;
}
}

View File

@@ -234,4 +234,7 @@ public interface RkInfoMapper
* 查询 rk_info 全量明细(仅未删除)
*/
List<RkInfo> selectAllRkInfo(RkInfo query);
Long selectStatistics(RkInfo query);
Long selectPcde(RkInfo query);
}

View File

@@ -33,4 +33,6 @@ public interface StockPhotoMapper {
* @return
*/
int softDeleteByUrls(@Param("urls") List<String> urls);
int DeleteById(Integer id);
}

View File

@@ -1,6 +1,7 @@
package com.zg.project.wisdom.service;
import java.util.List;
import java.util.Map;
import com.zg.project.Inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.vo.ChartDataVO;
@@ -167,4 +168,7 @@ public interface IRkInfoService
*/
List<RkInfo> selectAllRkInfo(RkInfo query);
Long selectStatistics(RkInfo query);
Long selectPcde(RkInfo query);
}

View File

@@ -33,6 +33,7 @@ public interface PhotoService {
* 按 billNo可选 photoType查询照片 URL 列表
*/
List<String> listUrlsByBill(String billNo, String photoType);
List<Map<String, Object>> listsByBill(String billNo, String photoType);
/**
* 按 URL 批量删除(仅数据库软删,不删除磁盘文件)
@@ -41,4 +42,5 @@ public interface PhotoService {
*/
Map<String, Object> deleteByUrls(List<String> urls);
public int deleteById(Integer id);
}

View File

@@ -110,6 +110,33 @@ public class PhotoServiceImpl implements PhotoService {
.collect(Collectors.toList());
}
@Override
public List<Map<String, Object>> listsByBill(String billNo, String photoType) {
if (StringUtils.isBlank(billNo)) {
throw new IllegalArgumentException("billNo 不能为空");
}
// return stockPhotoMapper.selectByBillNo(billNo,
// StringUtils.isBlank(photoType) ? null : photoType)
// .stream()
// .map(product -> StockPhotoDTO.builder()
// .id(product.getId())
// .name(product.getName())
// .price(product.getPrice() * 1.1) // 价格增加10%
// .build())
// .collect(Collectors.toList());
List<Map<String, Object>> result = stockPhotoMapper.selectByBillNo(billNo,
StringUtils.isBlank(photoType) ? null : photoType).stream()
.map(photo -> {
Map<String, Object> map = new HashMap<>();
map.put("url", photo.getUrl());
map.put("id", photo.getId());
return map;
})
.collect(Collectors.toList());
return result;
}
/**
* 批量删除
* @param urls 待删URL列表
@@ -129,4 +156,9 @@ public class PhotoServiceImpl implements PhotoService {
ret.put("dbUpdated", dbUpdated);
return ret;
}
@Override
public int deleteById(Integer id){
return stockPhotoMapper.DeleteById(id);
}
}

View File

@@ -1003,4 +1003,18 @@ public class RkInfoServiceImpl implements IRkInfoService
public List<RkInfo> selectAllRkInfo(RkInfo query) {
return rkInfoMapper.selectAllRkInfo(query);
}
@Override
public Long selectStatistics(RkInfo query) {
return rkInfoMapper.selectStatistics(query);
}
@Override
public Long selectPcde(RkInfo query) {
return rkInfoMapper.selectPcde(query);
}
}

View File

@@ -998,4 +998,144 @@
ORDER BY ri.create_time DESC, ri.id DESC
</select>
<select id="selectStatistics" resultType="java.lang.Long" parameterType="java.lang.Object" >
SELECT sum(ri.ht_dj*ri.real_qty)
FROM rk_info ri
<where>
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
<if test="isChuku != null and isChuku != ''">
AND ri.is_chuku = #{isChuku}
</if>
<if test="cangku != null and cangku != ''">
AND ri.cangku = #{cangku}
</if>
<if test="startTime != null">
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null">
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
<if test="lyEndTime != null">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if>
<if test="xmNo != null and xmNo != ''">
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
</if>
<if test="xmMs != null and xmMs != ''">
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
</if>
<if test="wlNo != null and wlNo != ''">
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
</if>
<if test="wlMs != null and wlMs != ''">
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
</if>
<if test="gysNo != null and gysNo != ''">
AND ri.gys_no LIKE CONCAT('%', #{gysNo}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
</if>
<if test="billNo != null and billNo != ''">
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
<if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck LIKE CONCAT('%', #{billNoCk}, '%')
</if>
<if test="ckType != null and ckType != ''">
AND ri.ck_type LIKE CONCAT('%', #{ckType}, '%')
</if>
<if test="pcode != null and pcode != ''">
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
</if>
<if test="fycde1 != null and fycde1 != ''">
AND ri.fycde_1 LIKE CONCAT('%', #{fycde1}, '%')
</if>
<if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 LIKE CONCAT('%', #{fycde2}, '%')
</if>
</where>
</select>
<select id="selectPcde" resultType="java.lang.Long" parameterType="java.lang.Object" >
SELECT count(distinct pcode)
FROM rk_info ri
<where>
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
<if test="isChuku != null and isChuku != ''">
AND ri.is_chuku = #{isChuku}
</if>
<if test="cangku != null and cangku != ''">
AND ri.cangku = #{cangku}
</if>
<if test="startTime != null">
AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null">
AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
<if test="lyEndTime != null">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if>
<if test="xmNo != null and xmNo != ''">
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
</if>
<if test="xmMs != null and xmMs != ''">
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
</if>
<if test="wlNo != null and wlNo != ''">
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
</if>
<if test="wlMs != null and wlMs != ''">
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
</if>
<if test="gysNo != null and gysNo != ''">
AND ri.gys_no LIKE CONCAT('%', #{gysNo}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
</if>
<if test="billNo != null and billNo != ''">
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
<if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck LIKE CONCAT('%', #{billNoCk}, '%')
</if>
<if test="ckType != null and ckType != ''">
AND ri.ck_type LIKE CONCAT('%', #{ckType}, '%')
</if>
<if test="pcode != null and pcode != ''">
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
</if>
<if test="fycde1 != null and fycde1 != ''">
AND ri.fycde_1 LIKE CONCAT('%', #{fycde1}, '%')
</if>
<if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 LIKE CONCAT('%', #{fycde2}, '%')
</if>
</where>
</select>
</mapper>

View File

@@ -67,6 +67,13 @@
#{u}
</foreach>
</update>
<update id="DeleteById" >
UPDATE stock_photo
SET is_delete = '1',
update_time = NOW()
WHERE id = #{Id}
</update>
</mapper>