This commit is contained in:
jiang 2025-07-15 16:39:12 +08:00
parent f68a0c3a25
commit f607dcacaa
4 changed files with 41 additions and 3 deletions

View File

@ -173,4 +173,6 @@ public interface PurchaseMapper {
int getJsData(@Param("planId") String planId);
int deleteDetail(Long id);
int updateDetail(Long id);
}

View File

@ -525,6 +525,7 @@ public class PurchaseServiceImpl implements PurchaseService {
public AjaxResult deleteDetail(Long id) {
try {
int i = mapper.deleteDetail(id);
mapper.updateDetail(id);
return i > 0 ? AjaxResult.success("撤销成功") : AjaxResult.error();
} catch (Exception e) {
log.error(e.toString(), e);

View File

@ -238,7 +238,7 @@ public class PlanApplyServiceImpl implements PlanApplyService {
log.warn("单元格为空");
data.setTimes("");
}
data.setRemarks(row.getCell(7).getStringCellValue()); //备注
data.setRemarks(getCellStringValue(row.getCell(7)));//备注
dataList.add(data);
}
workbook.close();
@ -267,6 +267,34 @@ public class PlanApplyServiceImpl implements PlanApplyService {
return ServerResponse.createError("导入失败,请检查表格数据",dataList);
}
private String getCellStringValue(Cell cell) {
if (cell == null) return "";
switch (cell.getCellType()) {
case STRING:
return cell.getStringCellValue().trim();
case NUMERIC:
// 如果是整数避免小数点
double value = cell.getNumericCellValue();
if (value == (long) value) {
return String.valueOf((long) value);
} else {
return String.valueOf(value);
}
case BOOLEAN:
return String.valueOf(cell.getBooleanCellValue());
case FORMULA:
try {
return cell.getStringCellValue();
} catch (IllegalStateException e) {
return String.valueOf(cell.getNumericCellValue());
}
case BLANK:
return "";
default:
return "";
}
}
private static String getCode(int num) {
num++;
String year = DateTimeHelper.getNowYMD();

View File

@ -27,8 +27,8 @@
<delete id="deleteDetail">
delete
from st_plan_apply
WHERE id = #{id}
from st_plan_out
WHERE apply_id=#{id}
</delete>
<!--查询详情数据-->
@ -71,6 +71,13 @@
<update id="updatePlanData">
update st_plan_apply set ck_num=#{cgNum},lk_num=#{lkNum},fh_day=#{fhDay} where id=#{planId}
</update>
<update id="updateDetail">
update st_plan_apply
set ck_num=0,
lk_num=0,
fh_day=null
where id = #{id}
</update>
<select id="getProPurchaseList" resultType="com.bonus.aqgqj.business.backstage.entity.PurchaseVo">