Commit 308ddd7e by lal

提交考勤报表

parent 3c13519b
......@@ -51,13 +51,19 @@ public class KqglAssoRelationSummary extends Model<KqglAssoRelationSummary> {
@ApiModelProperty(value = "时长 时长", example = "101")
private double duration;
@ApiModelProperty(value="假期类型id",example="101")
private Integer leaveTypeId;
@ApiModelProperty(value="加班类型id",example="101")
private Integer overtimeTypeId;
@ApiModelProperty(value="加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费",example="101")
private Integer compensateId;
@ApiModelProperty(value = "假期类型id", example = "101")
private Integer leaveTypeId;
@ApiModelProperty(value = "加班类型id", example = "101")
private Integer overtimeTypeId;
@ApiModelProperty(value = "加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费", example = "101")
private Integer compensateId;
@ApiModelProperty(value = "开始时间 ", example = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间 ", example = "结束时间")
private String endTime;
}
\ No newline at end of file
package cn.timer.api.controller.kqgl;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -9,6 +8,7 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
......@@ -21,6 +21,57 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
// 数组容量的扩容,当空间(.length)不够的时候,增加一
public static String[] arrycopy(String[] ss) {
// TODO Auto-generated method stub
String[] ii = new String[ss.length + 1];
System.arraycopy(ss, 0, ii, 0, ss.length);
return ii;
}
public static String[] replaceNull(String[] str) {
// 用StringBuffer来存放数组中的非空元素,用“;”分隔
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length; i++) {
if ("".equals(str[i])) {
continue;
}
sb.append(str[i]);
if (i != str.length - 1) {
sb.append(";");
}
}
// 用String的split方法分割,得到数组
str = sb.toString().split(";");
return str;
}
/**
* 删除数组中的指定值 或者数组中的元素包含指定值
*
* @param filters 数组
* @param target 指定值
* @return
*/
public static String[] doChinFilters(String[] filters, String target) {
String[] res = null;
if (filters.length > 0) {
List<String> tempList = Arrays.asList(filters);
// Arrays.asList(filters) 迭代器实现类 不支持remove() 删除,多一步转化
List<String> arrList = new ArrayList<String>(tempList);
Iterator<String> it = arrList.iterator();
while (it.hasNext()) {
String x = it.next();
if (x.indexOf(target) != -1) {
it.remove();
}
}
res = new String[arrList.size()];
arrList.toArray(res);
}
return res;
}
/**
* 获取两个日期之间的所有日期
*/
......
......@@ -928,9 +928,6 @@ public class TimeCardController {
return ResultUtil.data(yggl);
}
//用户和考勤组关系
@Autowired
private UserAttendanceRelMapper userattendancerelservice;
//用户与设备关系表
@Autowired
private UserEquiRelationMapper userequirelationmapper;
......
......@@ -33,16 +33,15 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public boolean attleaveapproval(AttLeaveApprovalDto leaveappr) {
String startdate = new SimpleDateFormat("yyyy-MM-dd").format(leaveappr.getStarttime());
String enddate = new SimpleDateFormat("yyyy-MM-dd").format(leaveappr.getEndtime());
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(leaveappr.getUserid()).appTime(num).approvalId(leaveappr.getLeaveid()).approvalType(2).duration(leaveappr.getDuration())
.leaveTypeId(leaveappr.getLeavetype()).build().insert();
.leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).build().insert();
}
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()));
int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, leaveappr.getUserid())
......@@ -50,10 +49,8 @@ public class KqglServiceImpl implements KqglService {
if(balan != null) {
modifynumber = balan.getModifyNumber()+1;
}
KqglAssoLeaveBalance.builder().leaveRulesId(leaveappr.getLeavetype()).userid(leaveappr.getUserid()).modifyAction(2).balanceDays("-"+leaveappr.getDuration())
.reason("系统按照规则自动").modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
return true;
}
......@@ -62,7 +59,6 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public boolean attovertimeapproval(AttOvertimeApprovalDto overappr) {
String startdate = new SimpleDateFormat("yyyy-MM-dd").format(overappr.getStarttime());
String enddate = new SimpleDateFormat("yyyy-MM-dd").format(overappr.getEndtime());
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
......@@ -70,11 +66,9 @@ public class KqglServiceImpl implements KqglService {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(overappr.getUserid()).appTime(num).approvalId(overappr.getOvertimeid()).approvalType(1).duration(overappr.getDuration())
.overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).build().insert();
.overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getEndtime())).build().insert();
}
return true;
}
......@@ -89,7 +83,8 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3).build().insert();
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3)
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime())).build().insert();
}
}else { //外出
String startdate = new SimpleDateFormat("yyyy-MM-dd").format(evecappr.getStarttime());
......@@ -97,7 +92,8 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(";");
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4).build().insert();
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4)
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime())).build().insert();
}
}
return true;
......@@ -108,12 +104,9 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public boolean attrepairapproval(AttRepairApprovalDto repaappr) {
String cardrepltime = new SimpleDateFormat("yyyy-MM-dd").format(repaappr.getCardrepltime());//补卡时间
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(repaappr.getUserid()).appTime(cardrepltime).approvalId(repaappr.getRepairid()).approvalType(5).build().insert();
KqglAssoRelationSummary.builder().userId(repaappr.getUserid()).appTime(cardrepltime).approvalId(repaappr.getRepairid()).approvalType(5).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(repaappr.getCardrepltime())).build().insert();
return true;
}
......
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoDkmx;
import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
/**
* 打卡明细表
......@@ -12,5 +14,6 @@ import cn.timer.api.bean.kqmk.KqglAssoDkmx;
*/
@Repository
public interface KqglAssoDkmxMapper extends BaseMapper<KqglAssoDkmx> {
AttSubsidiaryDto subsidiary(int userid, String data);
}
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
/**
......@@ -12,5 +15,8 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
*/
@Repository
public interface KqglAssoRelationSummaryMapper extends BaseMapper<KqglAssoRelationSummary> {
KqglAssoRelationSummary SecondaryValue(int userid, int approvaltype, String time);
List<KqglAssoRelationSummary> SpecificLeave(int userid,int approvaltype,String apptime);
}
......@@ -18,6 +18,6 @@ public interface KqglAssoTeshuMapper extends BaseMapper<KqglAssoTeshu> {
int insertKqglAssoTeshuList(List<KqglAssoTeshu> kqglassoteshu);
List<KqglAssoTeshu> ShouldSpecialDatessetByKqzid(int kqzid,int tsrq,int type);
List<KqglAssoTeshu> ShouldSpecialDatessetByKqzid(int kqzid,String tsrq,int type);
}
package cn.timer.api.dto.kqmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttSubsidiaryDto {
@ApiModelProperty(value = "工作总时长", example = "字段说明")
private double gzsctotalgzsc;
@ApiModelProperty(value = "严重迟到总次数", example = "字段说明")
private double yzcdcstotal;
@ApiModelProperty(value = "严重迟到总时长(分钟) ", example = "字段说明")
private double yzcdsctotal;
@ApiModelProperty(value = "旷工迟到总次数", example = "字段说明")
private double kgcdfzstotal;
}
......@@ -27,6 +27,13 @@
<result column="yzcdsc" property="yzcdsc" />
<result column="kgcdfzs" property="kgcdfzs" />
</resultMap>
<resultMap id="AttSubsidiary" type="cn.timer.api.dto.kqmk.AttSubsidiaryDto" >
<result column="gzsctotalgzsc" property="gzsctotalgzsc" />
<result column="yzcdcstotal" property="yzcdcstotal" />
<result column="yzcdsctotal" property="yzcdsctotal" />
<result column="kgcdfzstotal" property="kgcdfzstotal" />
</resultMap>
<sql id="Base_Column_List">
id,
......@@ -78,6 +85,17 @@
kgcdfzs KqglAssoDkmx_kgcdfzs
</sql>
<select id="subsidiary" resultMap="AttSubsidiary">
select SUM(dk.gzsc) as gzsctotalgzsc,
SUM(dk.yzcdcs) as yzcdcstotal,
SUM(dk.yzcdsc) as yzcdsctotal,
SUM(dk.kgcdfzs) as kgcdfzstotal
from kqgl_asso_dkmx dk
where dk.userid = #{userid}
and SUBSTR(dk.`data`,1,7) = #{data}
GROUP BY dk.userid
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx">
......
......@@ -13,6 +13,8 @@
<result column="leave_type_id" property="leaveTypeId" />
<result column="overtime_type_id" property="overtimeTypeId" />
<result column="compensate_id" property="compensateId" />
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
</resultMap>
<sql id="Base_Column_List">
......@@ -24,7 +26,9 @@
duration,
leave_type_id,
overtime_type_id,
compensate_id
compensate_id,
start_time,
end_time
</sql>
<sql id="Base_Column_List_Alias">
......@@ -36,9 +40,31 @@
duration KqglAssoRelationSummary_duration,
leave_type_id KqglAssoRelationSummary_leave_type_id,
overtime_type_id KqglAssoRelationSummary_overtime_type_id,
compensate_id KqglAssoRelationSummary_compensate_id
compensate_id KqglAssoRelationSummary_compensate_id,
start_time KqglAssoRelationSummary_start_time,
end_time KqglAssoRelationSummary_end_time
</sql>
<select id="SecondaryValue" resultMap="BaseResultMap">
select a.user_id,
SUM(a.duration) as duration
from (select res.user_id,res.duration
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{time}
GROUP BY res.approval_id) as a
GROUP BY a.user_id
</select>
<select id="SpecificLeave" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{apptime}
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary">
......@@ -66,7 +92,13 @@
overtime_type_id,
</if>
<if test ='null != compensateId'>
compensate_id
compensate_id,
</if>
<if test ='null != startTime'>
start_time,
</if>
<if test ='null != endTime'>
end_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -92,7 +124,13 @@
#{overtimeTypeId},
</if>
<if test ='null != compensateId'>
#{compensateId}
#{compensateId},
</if>
<if test ='null != startTime'>
#{startTime},
</if>
<if test ='null != endTime'>
#{endTime}
</if>
</trim>
</insert>
......@@ -112,7 +150,9 @@
<if test ='null != duration'>duration = #{duration},</if>
<if test ='null != leaveTypeId'>leave_type_id = #{leaveTypeId},</if>
<if test ='null != overtimeTypeId'>overtime_type_id = #{overtimeTypeId},</if>
<if test ='null != compensateId'>compensate_id = #{compensateId}</if>
<if test ='null != compensateId'>compensate_id = #{compensateId},</if>
<if test ='null != startTime'>start_time = #{startTime},</if>
<if test ='null != endTime'>end_time = #{endTime}</if>
</set>
WHERE id = #{id}
</update>
......
......@@ -63,7 +63,7 @@
select <include refid="Base_Column_List" />
from kqgl_asso_teshu teshu
where teshu.kqzid = #{kqzid}
and substring(teshu.tsrq,6,2) = #{tsrq}
and SUBSTR(teshu.tsrq,1,7) = #{tsrq}
and teshu.type = #{type}
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment