用户的打卡统计

master
382696293@qq.com 2 years ago
parent ddbe949363
commit 3f2a9fe314

@ -1,6 +1,7 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxClockLog;
import com.flossom.common.core.domain.ret.WxClockLogRet;
import java.util.List;
@ -60,4 +61,6 @@ public interface WxClockLogMapper {
public int deleteWxClockLogByIds(Long[] ids);
Integer selectCountByUserId(WxClockLog queryClockLog);
List<WxClockLogRet> selectWxClockImgRetList(WxClockLog queryClockLog);
}

@ -15,6 +15,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
</resultMap>
<resultMap type="WxClockLogRet" id="WxClockLogRetResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="instrumentId" column="instrument_id" />
<result property="instrumentName" column="instrument_name" />
<result property="clockContent" column="clock_content" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxClockLogVo">
select id, user_id, instrument_id, instrument_name, clock_content, status, create_by, create_time from wx_clock_log
</sql>
@ -49,7 +59,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWxClockLogVo"/>
where id = #{id}
</select>
<select id="selectWxClockImgRetList" parameterType="WxClockLog" resultMap="WxClockLogRetResult">
<include refid="selectWxClockLogVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="instrumentId != null and instrumentId != ''"> and instrument_id = #{instrumentId}</if>
<if test="instrumentName != null and instrumentName != ''"> and instrument_name like concat('%', #{instrumentName}, '%')</if>
<if test="clockContent != null and clockContent != ''"> and clock_content = #{clockContent}</if>
<if test="status != null "> and status = #{status}</if>
<if test="params != null and params.beginTime != null">
and create_time &gt;= #{params.beginTime}
</if>
<if test="params != null and params.endTime != null">
and create_time &lt;= #{params.endTime}
</if>
</where>
order by create_time desc
</select>
<insert id="insertWxClockLog" parameterType="WxClockLog" useGeneratedKeys="true" keyProperty="id">
<selectKey keyProperty="id" resultType="Long" order="AFTER">
SELECT LAST_INSERT_ID()

@ -3,9 +3,13 @@ package com.flossom.miniProgram.controller;
import com.flossom.common.core.constant.Constants;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.SysFile;
import com.flossom.common.core.domain.entity.WxClockLog;
import com.flossom.common.core.domain.entity.WxNursingLog;
import com.flossom.common.core.domain.req.WxClockLogReq;
import com.flossom.common.core.domain.ret.WxClockLogRet;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.miniProgram.service.IWxClockLogService;
import com.flossom.system.api.RemoteFileService;
import org.apache.commons.lang3.StringUtils;
@ -16,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
* Controller
@ -43,11 +48,21 @@ public class WxClockLogController extends BaseController {
}
/**
*
*
*/
@GetMapping("/getClockByUserId")
public R getClockByUserId() {
return R.ok(wxClockLogService.getClockByUserId());
@GetMapping("/latestClockRecord")
public R latestClockRecord() {
return R.ok(wxClockLogService.latestClockRecord());
}
/**
*
*/
@GetMapping("/list")
public TableDataInfo list() {
startPage();
List<WxClockLogRet> list = wxClockLogService.selectWxClockLogList();
return getDataTable(list);
}
/**

@ -1,14 +1,19 @@
package com.flossom.miniProgram.service;
import com.flossom.common.core.domain.entity.WxClockLog;
import com.flossom.common.core.domain.req.WxClockLogReq;
import com.flossom.common.core.domain.ret.WxClockLogRet;
import java.util.List;
public interface IWxClockLogService {
public void insertWxClockLog(WxClockLogReq wxClockLogReq);
void addClockInstrument(Long instrumentId);
WxClockLogRet getClockByUserId();
WxClockLogRet latestClockRecord();
List<WxClockLogRet> selectWxClockLogList();
}

@ -148,8 +148,7 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
}
@Override
public WxClockLogRet getClockByUserId() {
// 查询今天是否有打卡,存在打卡,则将仪器添加到最近一条打卡记录上
public WxClockLogRet latestClockRecord() {
WxClockLog queryClockLog = new WxClockLog();
queryClockLog.setUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
LocalDateTime now = LocalDateTime.now();
@ -172,4 +171,23 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
}
return wxClockLogRet;
}
@Override
public List<WxClockLogRet> selectWxClockLogList() {
WxClockLog queryClockLog = new WxClockLog();
queryClockLog.setUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
List<WxClockLogRet> list = wxClockLogMapper.selectWxClockImgRetList(queryClockLog);
if (list != null && list.size() > 0) {
for (WxClockLogRet wxClockLogRet : list) {
WxClockImg wxClockImg = new WxClockImg();
wxClockImg.setUserClockId(wxClockLogRet.getId());
List<WxClockImg> wxClockImgs = wxClockImgMapper.selectWxClockImgList(wxClockImg);
if (wxClockImgs!=null && wxClockImgs.size()>0) {
List<String> collect = wxClockImgs.stream().map(WxClockImg::getClockImg).collect(Collectors.toList());
wxClockLogRet.setClockImg(collect);
}
}
}
return list;
}
}

Loading…
Cancel
Save