兴安优化临时访客
This commit is contained in:
@@ -342,31 +342,6 @@ public class SysFileController
|
||||
@PostMapping("uploadMinio3")
|
||||
public R<SysFile> uploadMinio3(MultipartFile file, String fileName) {
|
||||
try {
|
||||
//判断压缩图片
|
||||
if ((1024 * 1024 * 0.1) <= file.getSize()) {
|
||||
// 小于 1M 的
|
||||
try {
|
||||
String fileNames1 = file.getOriginalFilename();
|
||||
File newFile = new File(fileNames1);
|
||||
if ((1024 * 1024 * 0.1) <= file.getSize() && file.getSize() <= (1024 * 1024)) {
|
||||
Thumbnails.of(file.getInputStream()).scale(1f).outputQuality(0.4f).toFile(newFile);
|
||||
}
|
||||
// 1 - 2M 的
|
||||
else if ((1024 * 1024) < file.getSize() && file.getSize() <= (1024 * 1024 * 2)) {
|
||||
Thumbnails.of(file.getInputStream()).scale(1f).outputQuality(0.2f).toFile(newFile);
|
||||
}
|
||||
// 2M 以上的
|
||||
else if ((1024 * 1024 * 2) < file.getSize()) {
|
||||
Thumbnails.of(file.getInputStream()).scale(1f).outputQuality(0.1f).toFile(newFile);
|
||||
}
|
||||
// 转为 MultipartFile
|
||||
file = PictureUtils.getMultipartFile(newFile);
|
||||
newFile.delete();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 上传并返回访问地址
|
||||
String fileNames = FileUploadUtils.uploadMinio(file, this.bucketName1, fileName);
|
||||
SysFile sysFile = new SysFile();
|
||||
|
||||
@@ -503,6 +503,7 @@ public class VisitorController extends BaseController {
|
||||
@PostMapping("/app/add")
|
||||
@Transactional
|
||||
public AjaxResult appAdd(@RequestBody Visitor visitor) throws Exception {
|
||||
log.info("appAdd-入参:{}", JSON.toJSONString(visitor));
|
||||
if (visitor.getStartTime().getTime() > visitor.getEndTime().getTime()) {
|
||||
throw new ServiceException("您输入的开始时间不能大于结束时间");
|
||||
}
|
||||
@@ -513,8 +514,9 @@ public class VisitorController extends BaseController {
|
||||
phones = visitor.getItemList().stream().map(Visitor::getPhone).collect(Collectors.toList());
|
||||
}
|
||||
phones.add(visitor.getPhone());
|
||||
if (visitorService.addVisitorCheck(phones, visitor.getStartTime()) > 0) {
|
||||
throw new ServiceException("该时间段已有申请,请更换预约时间");
|
||||
List<String> strings = visitorService.addVisitorCheck(phones, visitor.getStartTime());
|
||||
if (CollUtil.isNotEmpty(strings)) {
|
||||
throw new ServiceException("手机号:" + strings.get(0) + "在该时间段已有申请");
|
||||
}
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
@@ -545,17 +547,8 @@ public class VisitorController extends BaseController {
|
||||
}
|
||||
|
||||
// 保存附件
|
||||
if (!CollectionUtils.isEmpty(visitor.getInsurancePolicyList())) {
|
||||
int j = 1;
|
||||
List<SysFileVo> files = new ArrayList<>();
|
||||
for (String url : visitor.getInsurancePolicyList()) {
|
||||
SysFileVo sysFileVo = new SysFileVo();
|
||||
sysFileVo.setUrl(url);
|
||||
sysFileVo.setFileName("保险单" + j);
|
||||
files.add(sysFileVo);
|
||||
j++;
|
||||
}
|
||||
saveSysFile(files, String.valueOf(visitor.getId()));
|
||||
if(!CollectionUtils.isEmpty(visitor.getFileList())) {
|
||||
saveSysFile(visitor.getFileList(), String.valueOf(visitor.getId()));
|
||||
}
|
||||
|
||||
// 审核通知企微发送消息(小程序来源)
|
||||
|
||||
@@ -255,5 +255,5 @@ public interface VisitorMapper
|
||||
|
||||
void deleteVisitorReviewProcess(@Param("id") Long id);
|
||||
|
||||
int addVisitorCheck(@Param("phones") List<String> phones,@Param("startTime") Date startTime);
|
||||
List<String> addVisitorCheck(@Param("phones") List<String> phones,@Param("startTime") Date startTime);
|
||||
}
|
||||
|
||||
@@ -267,5 +267,5 @@ public interface IVisitorService
|
||||
|
||||
void cancel(Visitor visitor);
|
||||
|
||||
int addVisitorCheck(List<String> phones, Date startTime);
|
||||
List<String> addVisitorCheck(List<String> phones, Date startTime);
|
||||
}
|
||||
|
||||
@@ -820,7 +820,7 @@ public class VisitorServiceImpl implements IVisitorService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addVisitorCheck(List<String> phones, Date startTime) {
|
||||
public List<String> addVisitorCheck(List<String> phones, Date startTime) {
|
||||
return visitorMapper.addVisitorCheck(phones, startTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -387,9 +387,9 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="addVisitorCheck" resultType="java.lang.Integer">
|
||||
<select id="addVisitorCheck" resultType="java.lang.String">
|
||||
select
|
||||
count(*)
|
||||
phone
|
||||
from vis_visitor
|
||||
where
|
||||
end_time <![CDATA[ >= ]]> #{startTime}
|
||||
@@ -397,6 +397,7 @@
|
||||
<foreach item="phone" collection="phones" open="(" separator="," close=")">
|
||||
#{phone}
|
||||
</foreach>
|
||||
and examine_state != '2'
|
||||
</select>
|
||||
|
||||
<update id="updateVisitor" parameterType="Visitor">
|
||||
|
||||
Reference in New Issue
Block a user