Commit 669022be authored by kongfm's avatar kongfm

更新告知书相关接口

parent a548c586
......@@ -130,4 +130,22 @@ public class EquipmentInformDto extends BaseDto {
@TableField(exist = false)
private Map<String, List<AttachmentDto>> attachments;
@ApiModelProperty(value = "设备数量")
private Integer equipmentNum;
@ApiModelProperty(value = "开始-施工告知日期")
private String productInformDateStart;
@ApiModelProperty(value = "结束-施工告知日期")
private String productInformDateEnd;
@ApiModelProperty(value = "开始-计划施工日期")
private String planProductDateStart;
@ApiModelProperty(value = "结束-计划施工日期")
private String planProductDateEnd;
@ApiModelProperty(value = "施工区域")
private String productArea;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 设备告知单 Mapper 接口
......@@ -11,4 +17,17 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface EquipmentInformMapper extends BaseMapper<EquipmentInform> {
Page<List<EquipmentInformDto>> queryDtoList(Page<EquipmentInformDto> page,
@Param("productCode") String productCode,
@Param("productInformDateStart") String productInformDateStart,
@Param("productInformDateEnd") String productInformDateEnd,
@Param("productUnitId") Long productUnitId,
@Param("regionCode") String regionCode,
@Param("address") String address,
@Param("planProductDateStart") String planProductDateStart,
@Param("planProductDateEnd") String planProductDateEnd,
@Param("acceptUnitId") Long acceptUnitId,
@Param("informStatus") String informStatus,
@Param("sortParam") String sortParam,
@Param("sortRule") String sortRule);
}
......@@ -16,4 +16,6 @@ import java.util.List;
public interface UnitInfoMapper extends BaseMapper<UnitInfo> {
List<UnitInfoDto> getUnitByType(@Param("typeCode") String typeCode);
List<UnitInfoDto> getAllUnit();
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import java.util.List;
/**
* 设备告知单接口类
*
......@@ -13,4 +16,7 @@ public interface IEquipmentInformService {
EquipmentInformDto createEquipmentInform(EquipmentInformDto model);
Page<EquipmentInformDto> queryDtoList(Page<EquipmentInformDto> page, EquipmentInformDto equipmentInformDto, String sortParam, String sortRule);
Boolean batchDelete(List<Long> sequenceNbrList);
}
......@@ -38,4 +38,6 @@ public interface IUnitInfoService {
List<UnitInfoDto> getInspectionUnit();
List<UnitInfoDto> getUseUnit();
List<UnitInfoDto> getAllUnit();
}
......@@ -2,4 +2,69 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentInformMapper">
<select id="queryDtoList" resultType="java.util.Map">
SELECT
a.sequence_nbr AS sequenceNbr,
a.product_code AS productCode,
a.product_unit AS productUnit,
CONCAT(a.province,a.city,a.district) AS productArea,
CONCAT(a.stree,a.community,a.address) AS address,
a.plan_product_date AS planProductDate,
a.product_inform_date AS productInformDate,
a.accept_unit AS acceptUnit,
CASE
a.inform_status
WHEN 0 THEN
'暂存'
WHEN 1 THEN
'未接收'
WHEN 9 THEN
'已接收'
ELSE
''
END AS informStatus,
IFNULL(t.equipmentNum, 0) as equipmentNum
FROM
tz_equipment_inform a
LEFT JOIN (select count(e.sequence_nbr) as equipmentNum, e.inform_id from tcb_inform_equipment e GROUP BY e.inform_id ) t on t.inform_id = a.sequence_nbr
WHERE a.is_delete = 0
<if test="productCode != null and productCode != ''">
AND a.product_code like CONCAT('%',#{productCode},'%')
</if>
<if test="productUnitId != null ">
AND a.product_unit_id = #{productUnitId}
</if>
<if test="regionCode != null and regionCode != ''">
AND a.region_code like CONCAT('%',#{regionCode},'%')
</if>
<if test="address != null and address != ''">
AND ( a.stree like CONCAT('%',#{address},'%')
or a.community like CONCAT('%',#{address},'%')
or a.address like CONCAT('%',#{address},'%') )
</if>
<if test="productInformDateStart != null and productInformDateStart != ''">
and #{productInformDateStart} <![CDATA[ <= ]]> a.product_inform_date
</if>
<if test="productInformDateEnd != null and productInformDateEnd != ''">
and a.product_inform_date <![CDATA[ <= ]]> #{productInformDateEnd}
</if>
<if test="planProductDateStart != null and planProductDateStart != ''">
and #{planProductDateStart} <![CDATA[ <= ]]> a.plan_product_date
</if>
<if test="planProductDateEnd != null and planProductDateEnd != ''">
and a.plan_product_date <![CDATA[ <= ]]> #{planProductDateEnd}
</if>
<if test="acceptUnitId != null ">
AND a.accept_unit_id = #{acceptUnitId}
</if>
<if test="informStatus != null and informStatus != ''">
AND a.inform_status = #{informStatus}
</if>
<if test="sortParam != null and sortParam != '' and sortRule != null and sortRule != '' ">
ORDER BY ${sortParam} ${sortRule}
</if>
</select>
</mapper>
......@@ -12,5 +12,14 @@
AND a.unit_type_code LIKE CONCAT('%', #{typeCode}, '%')
</select>
<select id="getAllUnit" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto">
select
a.*
from tz_flc_unit_info a
where a.is_delete = 0
AND
(a.unit_status = '1' or a.is_change = 1)
</select>
</mapper>
......@@ -7,8 +7,10 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.MaintenanceUnitDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
......@@ -302,4 +304,7 @@ public class BeanDtoVoUtils {
}
});
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -74,25 +82,13 @@ public class EquipmentInformController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@PutMapping(value = "/updateEquipmentInform")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新设备告知单", notes = "根据sequenceNbr更新设备告知单")
public ResponseModel<EquipmentInformDto> updateBySequenceNbrEquipmentInform(@RequestBody EquipmentInformDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentInformServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除设备告知单", notes = "根据sequenceNbr删除设备告知单")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(equipmentInformServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
......@@ -107,37 +103,59 @@ public class EquipmentInformController extends BaseController {
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
* 列表分页查询
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "设备告知单分页查询", notes = "设备告知单分页查询")
public ResponseModel<Page<EquipmentInformDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EquipmentInformDto> page = new Page<EquipmentInformDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryForEquipmentInformPage(page));
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "告知书列表查询", notes = "告知书列表查询")
public ResponseModel<Page<EquipmentInformDto>> queryForPage(@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort , EquipmentInformDto equipmentInformDto) {
Page<EquipmentInformDto> page = new Page<EquipmentInformDto>();
page.setCurrent(pageNum);
page.setSize(pageSize);
String sortParam = "";
String sortRule = "";
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
sortParam = RedisKey.humpToLine(date[0]);
sortRule = "asc";
}else {
sortParam =RedisKey.humpToLine(date[0]);
sortRule = "desc";
}
}else {
sortParam = "rec_date";
sortRule = "desc";
}
Page<EquipmentInformDto> pageBean = equipmentInformServiceImpl.queryDtoList(page,equipmentInformDto,sortParam,sortRule);
Page<EquipmentInformDto> result = new Page<EquipmentInformDto>(pageNum,pageSize);
long totle = pageBean.getTotal();
result.setRecords(pageBean.getRecords());
result.setTotal(totle);
return ResponseHelper.buildResponse(result);
}
/**
* 列表全部数据查询
*
* 根据sequenceNbr删除
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "设备告知单列表全部数据查询", notes = "设备告知单列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentInformDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryForEquipmentInformList());
@DeleteMapping(value = "/delete_batch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除告知书信息", notes = "批量删除告知书信息")
public ResponseModel<Boolean> deleteBySequenceNbr(@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){
return ResponseHelper.buildResponse(equipmentInformServiceImpl.batchDelete(sequenceNbrList));
}
}
......@@ -470,6 +470,17 @@ public class UnitInfoController extends BaseController {
return ResponseHelper.buildResponse(result);
}
/**
* 获取所有单位列表
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAllUnit")
@ApiOperation(httpMethod = "GET", value = "获取所有单位列表", notes = "获取所有单位列表")
public ResponseModel<List<UnitInfoDto>> getAllUnit() {
List<UnitInfoDto> result = unitInfoServiceImpl.getAllUnit();
return ResponseHelper.buildResponse(result);
}
}
......@@ -302,8 +302,8 @@ public class UnitPersonController extends BaseController {
/**
* 根据sequenceNbr删除
*
* @return
*/
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/delete_batch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除人员信息", notes = "批量删除人员信息")
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
......@@ -102,8 +105,30 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
return model;
}
@Override
public Page<EquipmentInformDto> queryDtoList(Page<EquipmentInformDto> page, EquipmentInformDto equipmentInformDto, String sortParam, String sortRule) {
Page<List<EquipmentInformDto>>list = baseMapper.queryDtoList(page,equipmentInformDto.getProductCode(),equipmentInformDto.getProductInformDateStart(),equipmentInformDto.getProductInformDateEnd(),
equipmentInformDto.getProductUnitId(),equipmentInformDto.getRegionCode(),equipmentInformDto.getAddress(),equipmentInformDto.getPlanProductDateStart(),equipmentInformDto.getPlanProductDateEnd(),
equipmentInformDto.getAcceptUnitId(),equipmentInformDto.getInformStatus(),sortParam,sortRule);
Page<EquipmentInformDto> page1 = new Page<>();
List<EquipmentInformDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(list.getRecords()),EquipmentInformDto.class);
page1.setCurrent(page.getCurrent());
page1.setSize(page.getSize());
page1.setTotal(list.getTotal());
page1.setRecords(resultDtoList);
return page1;
}
@Transactional
@Override
public Boolean batchDelete(List<Long> sequenceNbrList) {
for(Long sequenceNbr : sequenceNbrList) {
if(! this.update(new LambdaUpdateWrapper<EquipmentInform>().eq(EquipmentInform::getSequenceNbr,sequenceNbr).set(EquipmentInform::getIsDelete,true))) {
throw new BadRequest("删除" + sequenceNbr +"告知书失败");
}
}
return true;
}
// 保存附件信息
public void saveSourceFile(EquipmentInformDto model) {
......
......@@ -556,4 +556,9 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
public List<UnitInfoDto> getUseUnit() {
return baseMapper.getUnitByType(TzsCommonParam.USE_UNIT_CODE);
}
@Override
public List<UnitInfoDto> getAllUnit() {
return baseMapper.getAllUnit();
}
}
\ No newline at end of file
spring.application.name=TZS-kfm
spring.application.name=TZS
server.servlet.context-path=/tzs
server.port=11000
spring.profiles.active=jd
......
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