用户打卡

master
382696293@qq.com 2 years ago
parent ead2a0cc88
commit d95cf290f9

@ -24,7 +24,7 @@ public class WxClockLogReq {
/**
*
*/
List<String> clockImageList;
List<String> clockImageList = new ArrayList<>();
public String getClockContent() {
return clockContent;

@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, user_id, instrument_id, instrument_name, clock_content, status, create_by, create_time from wx_clock_log
</sql>
<select id="selectCountByUserId" parameterType="WxClockLog" resultType="Long">
<select id="selectCountByUserId" parameterType="WxClockLog" resultType="Integer">
select count(1) from wx_clock_log
where
user_id = #{userId}

@ -8,6 +8,7 @@ import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.miniProgram.service.IWxClockLogService;
import com.flossom.system.api.RemoteFileService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -59,36 +60,52 @@ public class WxClockLogController extends BaseController {
@RequestParam(value = "secondClockImg") MultipartFile secondClockImg,
@RequestParam(value = "thirdClockImg") MultipartFile thirdClockImg,
@Validated WxClockLogReq wxClockLogReq) {
wxClockLogReq.setClockImageList(new ArrayList<>());
if (firstClockImg != null) {
if (firstClockImg != null && StringUtils.isNotBlank(firstClockImg.getOriginalFilename())) {
R<SysFile> result = remoteFileService.upload(firstClockImg);
if (result.getCode() != Constants.SUCCESS) {
logger.error("上传打卡图片失败");
throw new ServiceException("上传打卡图片失败");
}
wxClockLogReq.getClockImageList().add(result.getData().getUrl());
if (wxClockLogReq.getClockImageList() != null && wxClockLogReq.getClockImageList().size() > 0) {
wxClockLogReq.getClockImageList().set(0, result.getData().getUrl());
} else {
wxClockLogReq.getClockImageList().add(result.getData().getUrl());
}
}
if (secondClockImg != null) {
if (secondClockImg != null && StringUtils.isNotBlank(secondClockImg.getOriginalFilename())) {
R<SysFile> result = remoteFileService.upload(secondClockImg);
if (result.getCode() != Constants.SUCCESS) {
logger.error("上传打卡图片失败");
throw new ServiceException("上传打卡图片失败");
}
wxClockLogReq.getClockImageList().add(result.getData().getUrl());
if (wxClockLogReq.getClockImageList() != null && wxClockLogReq.getClockImageList().size() > 1) {
wxClockLogReq.getClockImageList().set(1, result.getData().getUrl());
} else {
wxClockLogReq.getClockImageList().add(result.getData().getUrl());
}
}
if (thirdClockImg != null) {
if (thirdClockImg != null && StringUtils.isNotBlank(thirdClockImg.getOriginalFilename())) {
R<SysFile> result = remoteFileService.upload(thirdClockImg);
if (result.getCode() != Constants.SUCCESS) {
logger.error("上传打卡图片失败");
throw new ServiceException("上传打卡图片失败");
}
wxClockLogReq.getClockImageList().add(result.getData().getUrl());
if (wxClockLogReq.getClockImageList() != null && wxClockLogReq.getClockImageList().size() > 2
&& StringUtils.isNotBlank(wxClockLogReq.getClockImageList().get(2))) {
wxClockLogReq.getClockImageList().set(2, result.getData().getUrl());
} else {
wxClockLogReq.getClockImageList().add(result.getData().getUrl());
}
}
if (wxClockLogReq.getClockImageList() == null || wxClockLogReq.getClockImageList().size() == 0) {
logger.error("请上传打卡图片");
throw new ServiceException("请上传打卡图片");
}
if (wxClockLogReq.getClockImageList().size() > 3) {
logger.error("打卡图片只能上传3张以下");
throw new ServiceException("打卡图片只能上传3张以下");
}
wxClockLogService.insertWxClockLog(wxClockLogReq);
return R.ok();
}

Loading…
Cancel
Save