Commit 203b23a7 authored by changxiangyu's avatar changxiangyu

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents ced66dd2 fd82a03b
......@@ -80,4 +80,9 @@ public class DPFilterParamDto {
* 设备类别code
*/
private String equCategoryCode;
/**
* 业务状态
*/
private String status;
}
......@@ -103,4 +103,9 @@ public class DPFilterParamForDetailDto {
*/
private String address;
/**
* 业务状态
*/
private String status;
}
......@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.vo.ElevatorModelVo;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
......@@ -320,4 +319,43 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getCylinderInfo(equCode, startTime, endTime, pageParam));
}
/**
* 初始化接口,调用一次,企业许可到期提醒
*
* @return 返回调用成功信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/initEnterpriseLicenseExpirationOnce", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "初始化接口,调用一次,企业许可到期提醒", notes = "初始化接口,调用一次,企业许可到期提醒")
public ResponseModel<String> initEnterpriseLicenseExpirationOnce() {
idxBizJgRegisterInfoService.initEnterpriseLicenseExpirationOnce();
return ResponseHelper.buildResponse("ok");
}
/**
* 初始化接口,调用一次,人员资质过期提醒
*
* @return 返回调用成功信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/initUserExpirationReminderOnce", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "初始化接口,调用一次,人员资质过期提醒", notes = "初始化接口,调用一次,人员资质过期提醒")
public ResponseModel<String> initUserExpirationReminderOnce() {
idxBizJgRegisterInfoService.initUserExpirationReminderOnce();
return ResponseHelper.buildResponse("ok");
}
/**
* 初始化接口,调用一次,检验有效期到期提醒
*
* @return 返回调用成功信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/inspectionExpirationReminderOnce", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "初始化接口,调用一次,检验有效期到期提醒", notes = "初始化接口,调用一次,检验有效期到期提醒")
public ResponseModel<String> inspectionExpirationReminderOnce() {
idxBizJgRegisterInfoService.inspectionExpirationReminderOnce();
return ResponseHelper.buildResponse("ok");
}
}
......@@ -67,4 +67,10 @@ public interface IIdxBizJgRegisterInfoService {
List<Map<String, Object>> getVehicleCylinderInfo(String useCode);
IPage<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, PageParam pageParam);
void initUserExpirationReminderOnce();
void inspectionExpirationReminderOnce();
void initEnterpriseLicenseExpirationOnce();
}
......@@ -38,17 +38,22 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.apache.commons.collections.CollectionUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
......@@ -66,6 +71,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
......@@ -84,6 +90,7 @@ import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
......@@ -234,6 +241,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Value("${add.equip.dict.code.suffix:CATEGORY_LIST_ADD}")
private String equipAddDictCodeSuffix;
@Value("${task.licenseExpiration.enabled:false}")
private boolean licenseExpirationEnabled;
@Autowired
private IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService;
@Autowired
......@@ -272,6 +281,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private RedisTemplate<String, String> redisTemplate;
@Autowired
private TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
@Autowired
private TzsUserInfoMapper tzsUserInfoMapper;
/**
* 将对象的属性由驼峰转为纯大写下划线格式
......@@ -3700,4 +3711,205 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
return result;
}
/**
* 定时任务,每天9点执行一次
* 企业许可到期提醒
*/
@Scheduled(cron = "0 0 9 * * ?")
@SchedulerLock(name="enterpriseLicenseExpirationTask",lockAtMostFor = "PT6H")
public void enterpriseLicenseExpirationTask() {
if (licenseExpirationEnabled) {
this.enterpriseLicenseExpiration("=");
}
}
/**
* 定时任务,每天9点执行一次
* 人员资质到期提醒
*/
@Scheduled(cron = "0 0 9 * * ?")
@SchedulerLock(name="userExpirationReminderTask",lockAtMostFor = "PT6H")
public void userExpirationReminderTask() {
if (licenseExpirationEnabled) {
this.userExpirationReminder("=");
}
}
/**
* 定时任务,每天9点执行一次
* 检验有效期到期提醒
*/
@Scheduled(cron = "0 0 9 * * ?")
@SchedulerLock(name="inspectionExpirationReminderTask",lockAtMostFor = "PT6H")
public void inspectionExpirationReminderTask() {
if (licenseExpirationEnabled) {
this.inspectionExpirationReminder("=");
}
}
/**
* 初始化接口,调用一次,企业许可到期提醒
*/
public void initEnterpriseLicenseExpirationOnce() {
enterpriseLicenseExpiration("<");
}
/**
* 初始化接口,调用一次,人员资质过期提醒
*/
public void initUserExpirationReminderOnce() {
this.userExpirationReminder("<");
}
/**
* 初始化接口,调用一次,检验有效期到期提醒
*/
public void inspectionExpirationReminderOnce() {
this.inspectionExpirationReminder("<");
}
private void enterpriseLicenseExpiration(String operator) {
List<TzBaseEnterpriseInfoDto> enterpriseInfoDtoList = baseEnterpriseInfoMapper.selectExpiringUnits(operator);
if (enterpriseInfoDtoList != null && !enterpriseInfoDtoList.isEmpty()) {
for (TzBaseEnterpriseInfoDto dto : enterpriseInfoDtoList) {
// 获取当前日期并动态生成短信内容
String currentDate = getCurrentFormattedDate();
String content = generateSmsContent(currentDate, "企业许可");
// 构建发送短信的请求
HashMap<String, String> sendSmsMap = buildSmsMap(dto.getUseContact(), content);
// 发送短信
sendSms(sendSmsMap);
}
}
}
private void userExpirationReminder(String operator) {
//查询检验人员,检测人员,从业人员,资质到期时间
List<TzsUserInfoDto> tzsUserInfoDtoList = tzsUserInfoMapper.selectUserPermission(operator, Arrays.asList("66152", "6552", "66151"));
if (tzsUserInfoDtoList != null && !tzsUserInfoDtoList.isEmpty()) {
for (TzsUserInfoDto dto : tzsUserInfoDtoList) {
// 获取当前日期并动态生成短信内容
String currentDate = getCurrentFormattedDate();
String content = generateSmsContent(currentDate, "从业人员资质");
// 构建发送短信的请求
HashMap<String, String> sendSmsMap = buildSmsMap(dto.getPhone(), content);
// 发送短信
sendSms(sendSmsMap);
}
}
}
private void inspectionExpirationReminder(String operator) {
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String param = QueryParser.escape("true");
pBuilder.must(QueryBuilders.matchQuery("IS_INTO_MANAGEMENT", param));
boolMust.must(pBuilder);
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
// 获取今天的开始时间戳
LocalDate today = LocalDate.now();
LocalDateTime startOfDay = today.atStartOfDay();
long todayStartTimestamp = startOfDay.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
// 获取明天的开始时间戳(用于不等于今天的其他数据范围)
LocalDateTime startOfNextDay = today.plusDays(1).atStartOfDay();
long nextDayStartTimestamp = startOfNextDay.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
if ("=".equals(operator)){
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE")
.gte(todayStartTimestamp) // 大于等于今天的开始时间戳
.lt(nextDayStartTimestamp)); // 小于明天的开始时间戳
}else{
// 使用 range 查询来查找 `NEXT_INSPECT_DATE` 小于今天的数据
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE")
.lt(todayStartTimestamp)); // 小于今天的开始时间戳
}
builder.query(boolMust);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
List<String> useUnitCreditCodeList = Arrays.stream(response.getHits().getHits())
.map(hit -> ((JSONObject) JSONObject.toJSON(hit)).getJSONObject("sourceAsMap"))
.map(dto2 -> dto2.getString("USE_UNIT_CREDIT_CODE"))
.filter(Objects::nonNull)
.distinct() // 去除重复的 USE_UNIT_CREDIT_CODE
.collect(Collectors.toList());
if (!useUnitCreditCodeList.isEmpty()) {
List<TzBaseEnterpriseInfoDto> enterpriseInfoDtoList = baseEnterpriseInfoMapper.queryByUseCode(useUnitCreditCodeList);
if (enterpriseInfoDtoList != null && !enterpriseInfoDtoList.isEmpty()) {
for (TzBaseEnterpriseInfoDto dto : enterpriseInfoDtoList) {
// 获取当前日期并动态生成短信内容
String currentDate = getCurrentFormattedDate();
String content = generateSmsContent(currentDate, "下次检验有效期");
// 构建发送短信的请求
HashMap<String, String> sendSmsMap = buildSmsMap("18629351226", content);
// 发送短信
sendSms(sendSmsMap);
}
}
}
} catch (IOException e) {
log.error("Error executing search request: {}", e.getMessage(), e);
throw new RuntimeException("Failed to execute search request", e);
}
}
/**
* 获取当前日期并格式化为 "yyyy年MM月dd日"
*/
private String getCurrentFormattedDate() {
LocalDate now = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
return now.format(formatter);
}
/**
* 动态生成短信内容
*/
private String generateSmsContent(String expiryDate, String content) {
return String.format("尊敬的用户,截止【%s】,您的%s已经到期,请您登录系统查看或处理(电脑端地址:http://sxtzsb.sxsei.com)!", expiryDate, content);
}
/**
* 构建发送短信的参数Map
*/
private HashMap<String, String> buildSmsMap(String mobile, String content) {
HashMap<String, String> sendSmsMap = new HashMap<>();
sendSmsMap.put("mobile", mobile);
sendSmsMap.put("smsCode", "SMS_TZS_0006");
sendSmsMap.put("content", content);
return sendSmsMap;
}
/**
* 发送短信并处理结果
*/
private void sendSms(HashMap<String, String> sendSmsMap) {
FeignClientResult<SmsRecordModel> sendVerifyCodeResult = Systemctl.smsClient.sendCommonSms(sendSmsMap);
if (sendVerifyCodeResult.getStatus() != 200) {
logAndThrowSmsError(sendVerifyCodeResult);
}
}
/**
* 日志记录和异常处理
*/
private void logAndThrowSmsError(FeignClientResult<SmsRecordModel> sendVerifyCodeResult) {
if (log.isErrorEnabled()) {
log.error("调用平台发短信失败:{}", sendVerifyCodeResult.getDevMessage());
}
throw new RuntimeException(sendVerifyCodeResult.getMessage());
}
}
\ No newline at end of file
......@@ -460,6 +460,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjia.status != '6616'
</if>
<if test="dto.status != null and dto.status != '' and dto.status = '6616'">
and tjia.status = '6616'
</if>
group by tjia.sequence_nbr
order by tjia.application_date desc
</select>
......
......@@ -960,6 +960,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and equ_category_code = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1002,6 +1008,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and equ_category = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1044,6 +1056,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and equ_category_code = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1088,6 +1106,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
GROUP BY tn.sequence_nbr
</if>
order by createDate desc
......@@ -1133,6 +1157,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjur.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjur.status = '已完成'
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1177,6 +1207,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjvi.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjvi.status = '已完成'
</if>
GROUP BY tjvi.sequence_nbr
</if>
order by createDate desc
......@@ -1222,6 +1258,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcrr.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcrr.audit_status = '已完成'
</if>
GROUP BY tjcrr.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1267,6 +1309,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcrt.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcrt.audit_status = '已完成'
</if>
GROUP BY tjcrt.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1312,6 +1360,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcru.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcru.status = '已完成'
</if>
GROUP BY tjcru.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1357,6 +1411,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and 1 = 2
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcrn.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcrn.audit_status = '已完成'
</if>
GROUP BY tjcrn.sequence_nbr
</if>
order by createDate desc
......@@ -1404,6 +1464,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjed.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjed.audit_status = '已完成'
</if>
GROUP BY tjed.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1451,6 +1517,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjed.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjed.audit_status = '已完成'
</if>
GROUP BY tjed.sequence_nbr
</if>
order by createDate desc
......@@ -1498,6 +1570,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjsc.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjsc.audit_status = '已完成'
</if>
GROUP BY tjsc.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1545,6 +1623,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjsc.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjsc.audit_status = '已完成'
</if>
GROUP BY tjsc.sequence_nbr
</if>
order by createDate desc
......@@ -1588,6 +1672,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and equ_category_code = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1630,6 +1720,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and equ_category = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1672,6 +1768,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and equ_category_code = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1716,6 +1818,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and notice_status != 6616
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and notice_status = 6616
</if>
GROUP BY tn.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1761,6 +1869,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjur.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjur.status = '已完成'
</if>
</if>
<if test="treeValue != null">
union all
......@@ -1805,6 +1919,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjvi.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjvi.status = '已完成'
</if>
GROUP BY tjvi.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1850,6 +1970,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcrr.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcrr.audit_status = '已完成'
</if>
GROUP BY tjcrr.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1895,6 +2021,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcrt.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcrt.audit_status = '已完成'
</if>
GROUP BY tjcrt.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1940,6 +2072,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcru.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcru.status = '已完成'
</if>
GROUP BY tjcru.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -1985,6 +2123,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and 1 = 2
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjcrn.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjcrn.audit_status = '已完成'
</if>
GROUP BY tjcrn.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -2034,6 +2178,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjed.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjed.audit_status = '已完成'
</if>
GROUP BY tjed.sequence_nbr
</if>
<if test="treeValue != null">
......@@ -2083,6 +2233,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjsc.audit_status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjsc.audit_status = '已完成'
</if>
GROUP BY tjsc.sequence_nbr
</if>
</select>
......
......@@ -3345,6 +3345,7 @@ public class JGDPStatisticsServiceImpl {
filterParamDto.setBusinessTypeCode(dpFilterParamForDetailDto.getBusinessTypeCode());
filterParamDto.setEquCategoryCode(dpFilterParamForDetailDto.getEquCategoryCode());
filterParamDto.setEquListCode(dpFilterParamForDetailDto.getEquListCode());
filterParamDto.setStatus(dpFilterParamForDetailDto.getStatus());
if (null != dpFilterParamForDetailDto.getTimeSearchOne()) {
filterParamDto.setBeginDate(dpFilterParamForDetailDto.getTimeSearchOne().getBeginDate());
filterParamDto.setEndDate(dpFilterParamForDetailDto.getTimeSearchOne().getEndDate());
......
......@@ -1113,6 +1113,7 @@ public class JYJCDPStatisticsServiceImpl {
filterParamDto.setSuperviseUnitName(dpFilterParamForDetailDto.getSuperviseUnitName());
filterParamDto.setEquListCode(dpFilterParamForDetailDto.getEquListCode());
filterParamDto.setEquCategoryCode(dpFilterParamForDetailDto.getEquCategoryCode());
filterParamDto.setStatus(dpFilterParamForDetailDto.getStatus());
if (null != dpFilterParamForDetailDto.getTimeSearchOne()) {
filterParamDto.setBeginDate(dpFilterParamForDetailDto.getTimeSearchOne().getBeginDate());
filterParamDto.setEndDate(dpFilterParamForDetailDto.getTimeSearchOne().getEndDate());
......
......@@ -94,4 +94,6 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
List<TzBaseEnterpriseInfoDto> queryByUseCode(@Param("useCodes") List<String> useCode);
List<TzBaseEnterpriseInfoDto> selectExpiringUnits(@Param("operator")String operator);
}
......@@ -7,7 +7,6 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
......@@ -17,4 +16,6 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
Long countUserByPostAndAreaCode(@Param("orgCode") String orgCode, @Param("post") String post, @Param("regionCode") String regionCode);
List<TzsUserPermissionDto> queryPermissionByUserSeq(@Param("userSeq") Long userSeq, @Param("permissionPost") String permissionPost);
List<TzsUserInfoDto> selectUserPermission(@Param("operator") String operator, @Param("posts") List<String> posts);
}
......@@ -325,4 +325,14 @@
</foreach>
</if>
</select>
<select id="selectExpiringUnits" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto">
SELECT tbei.*
FROM tz_base_unit_licence tbul
JOIN tz_base_enterprise_info tbei ON tbul.unit_Code = tbei.use_unit_code
WHERE 1 = 1
<if test="operator != null and operator !='' ">
AND tbul.expiry_date ${operator} CURRENT_DATE
</if>
</select>
</mapper>
......@@ -71,4 +71,19 @@
user_seq = #{userSeq}
and permission_post like concat(#{permissionPost}, '%')
</select>
<select id="selectUserPermission" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto">
SELECT tup.expiry_date, tui.phone, tui.rec_user_name
FROM tzs_user_permission tup
JOIN tzs_user_info tui ON tup.user_seq = tui.sequence_nbr
WHERE 1 = 1
<if test="operator != null and operator !='' ">
AND tup.expiry_date ${operator} CURRENT_DATE
</if>
AND (
<foreach collection="posts" item="post" separator=" OR ">
tui.new_post LIKE CONCAT('%', #{post}, '%')
</foreach>
)
</select>
</mapper>
\ No newline at end of file
......@@ -175,6 +175,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private static final String LEVEL = "company";
private static final String EQUSTATE = "EQU_STATE";
private static final String USEPLACE = "USE_PLACE";
private static final String REC_DATE = "REC_DATE";
@Autowired
ESEquipmentCategory esEquipmentCategory;
@Autowired
......@@ -2159,13 +2160,20 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
boolMust.must(meBuilder);
}
builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.sort("REC_DATE", Optional.ofNullable(map.getString("sort"))
.map(s -> s.split(","))
.filter(sortParams -> "ascend".equals(sortParams[1]))
.map(s -> SortOrder.ASC)
.orElse(SortOrder.DESC));
builder.from((map.getInteger("number") - 1) * map.getInteger("size"));
builder.size(map.getInteger("size"));
request.source(builder);
List<JSONObject> list = new LinkedList<>();
long totle = 0;
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) {
System.out.println(hit);
......@@ -2176,6 +2184,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String status = EquimentEnum.getName.get(integer);
dto2.put(EQUSTATE, status);
}
dto2.put(REC_DATE, dateFormat.format(dto2.get(REC_DATE)));
list.add(dto2);
}
totle = response.getInternalResponse().hits().getTotalHits().value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment