This commit is contained in:
mashuai 2025-11-12 17:33:07 +08:00
parent d867cc27df
commit 2851805852
7 changed files with 79 additions and 63 deletions

View File

@ -224,21 +224,19 @@ public class MachineServiceImpl implements IMachineService
//查询ma_machine表安全工器具
list = machineMapper.getElectronicLabel(machine);
}
for (Machine dto : list){
Date nextCheckTime = dto.getNextCheckTime();
Date todayStart = new Date(); // 获取当前时间
// todayStart 设置为当天的开始时间00:00:00
todayStart = Date.from(todayStart.toInstant().atZone(ZoneId.systemDefault())
.withHour(0).withMinute(0).withSecond(0).withNano(0)
.toInstant());
if (nextCheckTime != null && nextCheckTime.before(todayStart)) {
type=1;
throw new RuntimeException("该工器具已临近下次检验时间,请及时退还至机具(物流)分公司!");
}
}
if (CollectionUtils.isNotEmpty(list)) {
for (Machine dto : list) {
Date nextCheckTime = dto.getNextCheckTime();
Date todayStart = new Date(); // 获取当前时间
// todayStart 设置为当天的开始时间00:00:00
todayStart = Date.from(todayStart.toInstant().atZone(ZoneId.systemDefault())
.withHour(0).withMinute(0).withSecond(0).withNano(0)
.toInstant());
if (nextCheckTime != null && nextCheckTime.before(todayStart)) {
type=1;
throw new RuntimeException("该工器具已临近下次检验时间,请及时退还至机具(物流)分公司!");
}
// 根据typeId查询信息
Machine info = machineMapper.selectHouse(dto);
if (info != null) {

View File

@ -1,18 +1,20 @@
package com.bonus.material.push.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.biz.utils.AesEncryptUtils;
import com.bonus.common.biz.utils.HttpHelper;
import com.bonus.common.biz.utils.StringHelper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo;
import com.bonus.material.push.domain.IwsCostPushBean;
import com.bonus.material.push.domain.vo.IwsCostPushExportVo;
import com.bonus.material.push.service.IwsCostPushService;
@ -25,7 +27,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -55,10 +56,11 @@ public class IwsCostPushController extends BaseController {
*/
@ApiOperation("查询协议推送匹配列表--分页")
@GetMapping("/findAgreementPushMatchList")
public TableDataInfo findAgreementPushMatchList(IwsCostPushBean obj) {
startPage();
public AjaxResult findAgreementPushMatchList(IwsCostPushBean obj) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
List<IwsCostPushBean> list = iwsCostPushService.findAgreement(obj);
return getDataTable(list);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**

View File

@ -144,7 +144,7 @@ public class IwsCostPushBean implements Serializable {
// 是否匹配
@Excel(name = "是否匹配", readConverterExp = "0=未匹配,1=已匹配", sort = 5)
private Byte isMatch = 0;
private Byte isMatch;
private String userName;

View File

@ -68,15 +68,21 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
public List<IwsCostPushBean> findAgreement(IwsCostPushBean o) {
List<IwsCostPushBean> pushBeanList = iwsCostPushMapper.findAgreement(o);
// 使用流式操作过滤掉null值并设置isMatch属性
return pushBeanList.stream()
.filter(Objects::nonNull)
.peek(bean -> {
if (StringUtils.isNotBlank(bean.getProjectId()) && StringUtils.isNotBlank(bean.getProjectCode())) {
bean.setIsMatch((byte) 1);
}
})
.collect(Collectors.toList());
pushBeanList.forEach(bean -> {
if (bean != null) {
if (StringUtils.isNotBlank(bean.getProjectId()) && StringUtils.isNotBlank(bean.getProjectCode())) {
bean.setIsMatch((byte) 1);
} else {
bean.setIsMatch((byte) 0);
}
}
});
if (o.getIsMatch() != null) {
pushBeanList = pushBeanList.stream().filter(bean -> bean.getIsMatch().equals(o.getIsMatch())).collect(Collectors.toList());
}
return pushBeanList;
}
/**

View File

@ -432,6 +432,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
JOIN ma_type_keeper mtk ON mtk.type_id = lod.type_id AND mtk.user_id = #{userId}
</if>
WHERE lod.parent_id = #{id}
<if test="publishTask != null and publishTask != ''">
AND lod.publish_task = #{publishTask}
</if>
<if test="typeIdList != null and typeIdList.size() > 0">
and mt4.type_id in
<foreach item="item" collection="typeIdList" open="(" separator="," close=")">

View File

@ -518,40 +518,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getByMaCode" resultType="com.bonus.material.ma.domain.Machine">
SELECT
mi.id as maId,
mi.ma_name as materialName,
mi.ma_model as materialModel,
mi.ma_code as maCode,
LEFT(mi.this_check_time, 10) AS thisCheckTime,
LEFT(mi.next_check_time, 10) AS nextCheckTime,
mi.repair_man as repairMan,
mi.check_man as checkMan,
mi.phone,
mi.result,null AS reportCode,null AS reportUrl,
mi.type,
'1' as devType
FROM
ws_ma_info mi
WHERE mi.ma_code LIKE CONCAT('%',#{maCode},'%')
UNION
SELECT
mm.ma_id AS id,
mt2.type_name as maName,
mt.type_name as maModel,
mm.ma_code as maCode,
LEFT(mm.this_check_time, 10) AS thisCheckTime,
LEFT(mm.next_check_time, 10) AS nextCheckTime,
mm.check_man as repairMan,
ifnull(mm.inspect_man,"高民") as checkMan,
"0551-63703966" as phone,
"合格" as result,mm.ex_code AS reportCode,mm.ex_url AS reportUrl,
is_jj as type,
'2' as devType
FROM ma_machine mm
LEFT JOIN ma_type mt on mm.type_id = mt.type_id
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
WHERE mm.ma_code LIKE CONCAT('%',#{maCode},'%') and mt.MANAGE_TYPE =0
SELECT *
FROM (
SELECT mi.id as maId,
mi.ma_name as materialName,
mi.ma_model as materialModel,
mi.ma_code as maCode,
DATE_FORMAT(STR_TO_DATE(LEFT(mi.this_check_time, 10), '%Y-%c-%e'), '%Y-%m-%d') AS thisCheckTime,
DATE_FORMAT(STR_TO_DATE(LEFT(mi.next_check_time, 10), '%Y-%c-%e'), '%Y-%m-%d') AS nextCheckTime,
mi.repair_man as repairMan,
mi.check_man as checkMan,
mi.phone,
mi.result,
null AS reportCode,
null AS reportUrl,
mi.type,
'1' as devType
FROM ws_ma_info mi
WHERE mi.ma_code LIKE CONCAT('%', #{maCode}, '%')
UNION
SELECT mm.ma_id AS id,
mt2.type_name as maName,
mt.type_name as maModel,
mm.ma_code as maCode,
DATE_FORMAT(STR_TO_DATE(LEFT(mm.this_check_time, 10), '%Y-%c-%e'), '%Y-%m-%d') AS thisCheckTime,
DATE_FORMAT(STR_TO_DATE(LEFT(mm.next_check_time, 10), '%Y-%c-%e'), '%Y-%m-%d') AS nextCheckTime,
mm.check_man as repairMan,
ifnull(mm.inspect_man, "高民") as checkMan,
"0551-63703966" as phone,
"合格" as result,
mm.ex_code AS reportCode,
mm.ex_url AS reportUrl,
is_jj as type,
'2' as devType
FROM ma_machine mm
LEFT JOIN ma_type mt on mm.type_id = mt.type_id
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
WHERE mm.ma_code LIKE CONCAT('%', #{maCode}, '%')
and mt.MANAGE_TYPE = 0
) AS combined_result LIMIT 100;
</select>
<delete id="deleteMachineByMaCodeAndTypeId">

View File

@ -329,8 +329,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.lease_price as leasePrice,
sai.num as num,
DATE(sai.start_time) as startTime,
DATE(sai.end_time) as endTime,
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
IF(sai.end_time is null, if(sai.is_slt = 1, sai.slt_time, CURDATE()) ,sai.end_time) as endTime,
DATEDIFF(IF(sai.end_time is null, if(sai.is_slt = 1, sai.slt_time, CURDATE()) ,sai.end_time), sai.start_time) + 1 as leaseDays
from slt_agreement_info sai
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id