Merge remote-tracking branch 'origin/dev2.0' into dev2.0

dev2.0
anthonywj 2 years ago
commit 4a8fb12b43

@ -1,24 +1,35 @@
package com.glxp.api.controller.inv;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.annotation.Log;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.constant.FileConstant;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.inv.DeviceAssetCertEntity;
import com.glxp.api.entity.purchase.SupCertEntity;
import com.glxp.api.req.inv.FilterInvCertRequest;
import com.glxp.api.req.purchase.FilterSupCertRequest;
import com.glxp.api.req.inv.PostDeviceCertRequest;
import com.glxp.api.req.system.DeleteDeviceFileRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.inv.DeviceAssetCertService;
import com.glxp.api.service.purchase.SupCertService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.File;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.List;
/**
@ -27,12 +38,14 @@ import java.util.List;
@Slf4j
@RestController
public class DeviceAssetCertController extends BaseController {
@Value("${file_path}")
private String filePath;
@Resource
private DeviceAssetCertService deviceAssetCertService;
// @AuthRuleAnnotation("")
@AuthRuleAnnotation("")
@GetMapping("/inv/device/cert/filter")
public BaseResponse filterDeviceCert(FilterInvCertRequest filterInvCertRequest) {
List<DeviceAssetCertEntity> deviceAssetCertEntityList
= deviceAssetCertService.filterDeviceCert(filterInvCertRequest);
PageInfo<DeviceAssetCertEntity> pageInfo;
@ -43,7 +56,56 @@ public class DeviceAssetCertController extends BaseController {
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/inv/info/insertDeviceCert")
@Log(title = "资质证书", businessType = BusinessType.INSERT)
public BaseResponse insertDeviceCert(@RequestBody DeviceAssetCertEntity deviceAssetCertEntity) {
deviceAssetCertEntity.setCreateTime(LocalDate.now());
deviceAssetCertEntity.setUpdateTime(LocalDate.now());
deviceAssetCertEntity.setStatus(0);
deviceAssetCertEntity.setId(IdUtil.getSnowflakeNextId());
boolean b = deviceAssetCertService.insertDeviceCert(deviceAssetCertEntity);
return ResultVOUtils.success("成功");
}
@AuthRuleAnnotation("")
@PostMapping("/inv/info/deleteDeviceCert")
public BaseResponse deleteDeviceCert(@RequestBody DeleteDeviceFileRequest deleteDeviceFileRequest, BindingResult bindingResult) {
boolean b = deviceAssetCertService.deleteById(deleteDeviceFileRequest.getId());
String URL = filePath + FileConstant.COMMON_FILE_PATH + deleteDeviceFileRequest.getFilePath();
File file = new File(URL);
if (file.exists() && file.isFile()) {
file.delete();
}
return ResultVOUtils.success("成功");
}
@AuthRuleAnnotation("")
@PostMapping("/inv/info/updateDeviceCert")
@Log(title = "资质证书", businessType = BusinessType.UPDATE)
public BaseResponse updateDeviceCert(@RequestBody PostDeviceCertRequest postDeviceCertRequest) {
DeviceAssetCertEntity deviceAssetCertEntity = new DeviceAssetCertEntity();
BeanUtil.copyProperties(postDeviceCertRequest, deviceAssetCertEntity);
LocalDateTime localDateTime1 = postDeviceCertRequest.getVailDate().atStartOfDay();
LocalDateTime localDateTime2= postDeviceCertRequest.getExpireDate().atStartOfDay();
Instant instant = localDateTime1.toInstant(ZoneOffset.UTC);
Instant instant2 = localDateTime2.toInstant(ZoneOffset.UTC);
long milliseconds = instant.toEpochMilli();
long milliseconds2 = instant2.toEpochMilli();
if (postDeviceCertRequest.getVailDate() != null && postDeviceCertRequest.getExpireDate() != null) {
if (milliseconds > milliseconds2) {
return ResultVOUtils.error(999, "生效期不能小于失效期!");
}
}
boolean b = deviceAssetCertService.updateDeviceCert(deviceAssetCertEntity);
if (b){
return ResultVOUtils.success("修改成功");
}else {
return ResultVOUtils.error(999,"修改失败!");
}
}
}

@ -32,7 +32,6 @@ import com.glxp.api.service.purchase.SupProductService;
import com.glxp.api.service.system.SystemPDFModuleService;
import com.glxp.api.service.system.SystemPDFTemplateService;
import com.glxp.api.util.JasperUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;

@ -2,9 +2,7 @@ package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.inv.DeviceAssetCertEntity;
import com.glxp.api.entity.purchase.SupCertEntity;
import com.glxp.api.req.inv.FilterInvCertRequest;
import com.glxp.api.req.purchase.FilterSupCertRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -14,4 +12,14 @@ public interface DeviceAssetCertMapper extends BaseMapper<DeviceAssetCertEntity>
List<DeviceAssetCertEntity> filterCompanyCert(FilterInvCertRequest filterInvCertRequest);
boolean deleteById(String id);
boolean updateDeviceCert(DeviceAssetCertEntity deviceAssetCertEntity);
}

@ -4,11 +4,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.time.LocalDate;
@Data
@TableName(value = "device_asset_cert")
@ -47,13 +47,15 @@ public class DeviceAssetCertEntity implements Serializable {
*
*/
@TableField(value = "vailDate")
private Date vailDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate vailDate;
/**
*
*/
@TableField(value = "expireDate")
private Date expireDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate expireDate;
/**
*
@ -83,7 +85,8 @@ public class DeviceAssetCertEntity implements Serializable {
*
*/
@TableField(value = "createTime")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate createTime;
/**
*
@ -95,7 +98,8 @@ public class DeviceAssetCertEntity implements Serializable {
*
*/
@TableField(value = "updateTime")
private Date updateTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate updateTime;
private static final long serialVersionUID = 1L;
}

@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
// 拦截API异常
@ExceptionHandler(value = JsonException.class)
public BaseResponse handlerJsonException(JsonException e) {
@ -25,9 +25,10 @@ public class GlobalExceptionHandler {
// 拦截API异常
@ExceptionHandler(value = RuntimeException.class)
public BaseResponse handlerRuntimeException(RuntimeException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
// 返回对应的错误信息
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
}

@ -0,0 +1,11 @@
package com.glxp.api.req.inv;
import com.glxp.api.entity.inv.DeviceAssetCertEntity;
import lombok.Data;
@Data
public class PostDeviceCertRequest extends DeviceAssetCertEntity {
private int repeatUpload;
}

@ -0,0 +1,11 @@
package com.glxp.api.req.system;
import lombok.Data;
@Data
public class DeleteDeviceFileRequest {
String id;
String filePath;
String filePath2;
}

@ -1,10 +1,9 @@
package com.glxp.api.service.inv;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.inv.DeviceAssetCertEntity;
import com.glxp.api.req.inv.FilterInvCertRequest;
import org.springframework.stereotype.Service;
import com.glxp.api.entity.inv.DeviceAssetCertEntity;
import java.util.List;
@ -12,6 +11,24 @@ import java.util.List;
public interface DeviceAssetCertService extends IService<DeviceAssetCertEntity> {
List<DeviceAssetCertEntity> filterDeviceCert(FilterInvCertRequest filterInvCertRequest);
boolean insertDeviceCert(DeviceAssetCertEntity deviceAssetCertEntity);
boolean deleteById(String id);
boolean updateDeviceCert(DeviceAssetCertEntity deviceAssetCertEntity);
}

@ -34,4 +34,21 @@ public class DeviceAssetCertServiceImpl extends ServiceImpl<DeviceAssetCertMappe
}
return deviceAssetCertMapper.filterCompanyCert(filterInvCertRequest);
}
@Override
public boolean insertDeviceCert(DeviceAssetCertEntity deviceAssetCertEntity) {
return deviceAssetCertMapper.insert(deviceAssetCertEntity) > 0 ? true : false;
}
@Override
public boolean deleteById(String id) {
return deviceAssetCertMapper.deleteById(id);
}
@Override
public boolean updateDeviceCert(DeviceAssetCertEntity deviceAssetCertEntity) {
return deviceAssetCertMapper.updateDeviceCert(deviceAssetCertEntity);
}
}

@ -0,0 +1,60 @@
server:
port: 9991
spring:
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy:mysql://192.168.0.66:3364/udi_wms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: Glxp@6066
hikari:
connection-timeout: 60000
maximum-pool-size: 20
minimum-idle: 10
redis:
database: 8
host: 127.0.0.1
port: 6379
# password: 123456
timeout: 300
jedis:
pool:
max-active: 8
max-wait: -1
max-idle: 8
min-idle: 0
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
servlet:
multipart:
max-file-size: 500MB
max-request-size: 500MB
ok:
http:
connect-timeout: 3000
read-timeout: 3000
write-timeout: 3000
max-idle-connections: 200
keep-alive-duration: 300
logging:
level:
com.glxp.api.dao: debug
file_path: E:/udi/udiwms/udiwmsfile/
file_lpath: /udiwms/image/register/file/getImage
file_url: http://127.0.0.1:9991
UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df
UDI_SERVER_URL: https://www.udims.com/UDI_DL_Server_test
SPMS_KEY: lCOdWCBKS6Kw45wdnnqUTELXyuSKnXEs
back_file_path: E:/share/udisps/back/
SPMS_WEBSOCKET_TOKEN: 07rKFDFkQvBkbxgc7aUBlONo4gWNdx8b
API_KEY: 1101
API_SECRET: zBITspLNvuoEd4FaamlSoqxRHmNsmQ6L
WEB_TITLE: 平潭协和医院

@ -29,9 +29,10 @@
resultType="com.glxp.api.entity.inv.DeviceAssetCertEntity">
select * from device_asset_cert
<where>
<if test="devCodeFk != '' and devCodeFk!=null">
and devCodeFk = #{devCodeFk}
</if>
devCodeFk = #{devCodeFk}
<!-- <if test="devCodeFk != '' and devCodeFk!=null">-->
<!-- and devCodeFk = #{devCodeFk}-->
<!-- </if>-->
<if test="name != '' and name!=null">
and name = #{name}
</if>
@ -50,4 +51,29 @@
ORDER BY id DESC
</select>
<delete id="deleteById" parameterType="Map">
DELETE
FROM device_asset_cert
WHERE id = #{id}
</delete>
<update id="updateDeviceCert" parameterType="com.glxp.api.entity.inv.DeviceAssetCertEntity">
UPDATE device_asset_cert
<trim prefix="set" suffixOverrides=",">
<if test="name != null">name=#{name},</if>
<if test="devCodeFk != null">devCodeFk=#{devCodeFk},</if>
<if test="filePath != null">filePath=#{filePath},</if>
<if test="remark != null">remark=#{remark},</if>
vailDate=#{vailDate},
expireDate=#{expireDate},
<if test="type != null">`type`=#{type},</if>
<if test="code != null">`code`=#{code},</if>
<if test="status != null">`status`=#{status},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>

Loading…
Cancel
Save