代码提交

This commit is contained in:
itcast 2025-12-17 16:49:24 +08:00
parent a551af86dd
commit 7592bfb47c
2 changed files with 69 additions and 0 deletions

View File

@ -24,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
@ -1010,7 +1012,22 @@ public class DevChangeServiceImpl implements DevChangeService {
*/
@Override
public List<CsDeviceChangeVo> getDevChangeList(CsDeviceChangeVo vo) {
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
try {
// 核心逻辑 endTime 1 仅当 endTime 非空时处理
String originalEndTime = vo.getEndTime();
if (originalEndTime != null && !originalEndTime.trim().isEmpty()) {
// 1. 去除首尾空格避免前端传参带空格导致解析失败
String endTime = originalEndTime.trim();
// 2. 解析字符串为 LocalDateyyyy-MM-dd 格式
LocalDate endLocalDate = LocalDate.parse(endTime, dateFormatter);
// 3. 日期加 1
LocalDate endTimeAfterAddOneDay = endLocalDate.plusDays(1);
// 4. 重新格式化为字符串设置回 VO关键传给 Mapper
vo.setEndTime(endTimeAfterAddOneDay.format(dateFormatter));
}
return mapper.getDevChangeList(vo);
} catch (Exception e) {
log.error(e.getMessage());

View File

@ -256,6 +256,58 @@
WHERE
is_active = 1
AND dcd.change_id = #{id}
UNION ALL
SELECT
tl.id AS devId,
tt1.type_name AS devName,
ifnull (tl.tool_code,'/') AS devCode,
NULL AS json_data,
DATE(tl.production_date) AS productDate,
tl.origin_cost AS buyPrice,
NULL AS brand,
tl.next_check_date AS nextDate,
tl.type_id AS typeId,
tt.unit_name AS unit,
NULL AS maintenance_alarm_day,
NULL AS proType,
tt.`level` AS `LEVEL`,
tt4.type_name AS mainGx,
tt3.type_name AS childGx,
tt2.type_name AS devCategory,
tt1.type_name AS devSubcategory,
tt.type_name AS devModel,
dcd.dev_type AS type,
dcd.num AS devNum,
dcd.use_start_time AS useStartTime,
dcd.use_end_time AS useEndTime,
bci.company_name AS compName,
bci.operate_address AS orgName,
-- 工具无项目关联,默认显示'-'
IFNULL(dc.pro_name, '-') proName,
dc.pro_code AS proId,
'' AS workingHours,
'' AS maxWorkingHours
FROM
cs_device_change_details dcd -- 关联工具台账(变更详情的设备编码 = 工具编码)
LEFT JOIN cs_device_change dc on dc.id=dcd.change_id
LEFT JOIN tool_ledger tl
ON dcd.dev_type = '2'
AND dcd.dev_type_id = tl.type_id
AND (dcd.dev_code = '/' OR dcd.dev_code = tl.tool_code)
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
LEFT JOIN tool_type tt1 on tt.parent_id=tt1.type_id
LEFT JOIN tool_type tt2 on tt1.parent_id=tt2.type_id
LEFT JOIN tool_type tt3 on tt2.parent_id=tt3.type_id
LEFT JOIN tool_type tt4 on tt3.parent_id=tt4.type_id
AND tt.del_flag = '0' -- 关联公司信息(工具所属公司)
LEFT JOIN bm_company_info bci ON tl.company_id = bci.company_id
WHERE
dcd.change_id = #{id}
and dcd.dev_type='2'
</select>
<select id="getDevChangeDetailsList" resultType="com.bonus.material.devchange.domain.DevChangeDetailsVo">