Commit c0a991a9 by Administrator

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!110
parents 35c70661 d20c7ad5
......@@ -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
......@@ -151,7 +151,7 @@ public class ClockInController {
String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间
String DKputime = new SimpleDateFormat("HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime);
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"HH:mm");
if (!effectiveDate) {
System.out.println("当前打卡时间不在范围内");
// 手动抛出异常
......
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;
}
/**
* 获取两个日期之间的所有日期
*/
......@@ -218,13 +269,20 @@ public class ClockInTool {
* @return true在时间段内,false不在时间段内
* @throws Exception
*/
public static boolean hourMinuteBetween(String nowDate, String startDate, String endDate) throws Exception {
public static boolean hourMinuteBetween(String nowDate, String startDate, String endDate,String date_format){
SimpleDateFormat format = new SimpleDateFormat("HH:mm");
SimpleDateFormat format = new SimpleDateFormat(date_format);
Date now = format.parse(nowDate);
Date start = format.parse(startDate);
Date end = format.parse(endDate);
Date now = null;
Date start = null;
Date end = null;
try {
now = format.parse(nowDate);
start = format.parse(startDate);
end = format.parse(endDate);
} catch (ParseException e) {
e.printStackTrace();
}
long nowTime = now.getTime();
long startTime = start.getTime();
......@@ -283,6 +341,8 @@ public class ClockInTool {
df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss");
} else if (num == 2) {
df2 = new SimpleDateFormat("HH:mm");
}else if (num == 3) {
df2 = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm");
}
return df2.format(date1);
......
......@@ -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,10 @@ 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);
List<KqglAssoRelationSummary> LeaveInvestigation(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">
......
......@@ -102,8 +102,8 @@
<select id="selectAdditionalList" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
gw.`name` as position
IFNULL(c.name,null) as department,
IFNULL(gw.`name`,null) as position
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
......
......@@ -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,42 @@
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>
<select id="LeaveInvestigation" resultMap="BaseResultMap">
select res.start_time,
res.end_time
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{apptime}
GROUP BY res.start_time,res.end_time;
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary">
......@@ -66,7 +103,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 +135,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 +161,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