This commit is contained in:
bai 2023-07-23 12:06:56 +08:00
commit 155a9ff8ac
5 changed files with 51 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.beust.jcommander.internal.Sets;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -35,12 +36,9 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
/**
* @Description: kc_tingke
* @Author: jeecg-boot
* @Date: 2023-03-29
@ -475,5 +473,34 @@ public class KcTingkeController extends JeecgController<KcTingke, IKcTingkeServi
return Result.OK(pageList);
}
@ApiOperation(value="获取当前用户的听课要求及实际听课数量", notes="获取当前用户的听课要求及实际听课数量")
@GetMapping(value = "/getUserTingkeInfo")
public Result<KcTingke> getUserTingkeInfo(KcTingke kcTingke,
HttpServletRequest req) {
KcXqxnHistory common = changeTingKeTongJi.getXqConfig(null);
KcTingke kcTingkePar = new KcTingke();
if(common != null) {
//清洗数据核心
Date startSjDate = common.getStartTime();
Date endSjDate = common.getEndTime();
String startSj = DateUtil.format(startSjDate, DatePattern.NORM_DATETIME_FORMAT);
String endSj = DateUtil.format(endSjDate, DatePattern.NORM_DATETIME_FORMAT);
QueryWrapper<KcTingke> evaQw = new QueryWrapper<>();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if("admin".equals(sysUser.getUsername())){
sysUser.setUsername("2016900057");
}
kcTingke.setUserid(sysUser.getUsername());
kcTingke.setStartTime(startSj.substring(0,10));
kcTingke.setEndTime(endSj.substring(0,10));
List<KcTingke> countTjList = kcTingkeService.getUserTingkeInfo(kcTingke);
if(countTjList!=null&&countTjList.size()>0){
kcTingkePar = countTjList.get(0);
}
}
return Result.OK(kcTingkePar);
}
}

View File

@ -47,4 +47,5 @@ public interface KcTingkeMapper extends BaseMapper<KcTingke> {
IPage<Map<String,Object>> keTangList(Page<KcTingke> page, @Param(Constants.WRAPPER) QueryWrapper<KcTingke> queryWrapper);
List<KcTingke> getUserTingkeInfo(KcTingke kcTingke);
}

View File

@ -896,4 +896,15 @@
</select>
<select id="getUserTingkeInfo" resultType="org.jeecg.modules.kc.tktj.entity.KcTingke">
select xb.gh as userid,xb.xm as username,tkyq.tkyq,count(tk.id) as sjtksl
from xxhbuser xb
LEFT JOIN kc_tksfrzb tksf on xb.gh = tksf.gh
LEFT JOIN kc_tksfyq tkyq on tksf.zwmc = tkyq.zwmc
LEFT JOIN kc_tingke tk on xb.gh = tk.userid
where tk.tingketime >= #{startTime} and tk.tingketime &lt;= concat(#{endTime},' 23:59:59') and tk.userid = #{userid}
ORDER BY tkyq.tkyq desc
</select>
</mapper>

View File

@ -46,4 +46,6 @@ public interface IKcTingkeService extends IService<KcTingke> {
IPage<Map<String,Object>> keTangList(Page<KcTingke> page, QueryWrapper<KcTingke> queryWrapper);
List<KcTingke> getUserTingkeInfo(KcTingke kcTingke);
}

View File

@ -87,4 +87,9 @@ public class KcTingkeServiceImpl extends ServiceImpl<KcTingkeMapper, KcTingke> i
public IPage<Map<String, Object>> keTangList(Page<KcTingke> page, QueryWrapper<KcTingke> queryWrapper) {
return baseMapper.keTangList(page,queryWrapper);
}
@Override
public List<KcTingke> getUserTingkeInfo(KcTingke kcTingke) {
return baseMapper.getUserTingkeInfo(kcTingke);
}
}