Commit f3106cf7 by lal Committed by chenzg

提交

parent bf2c061e
...@@ -4,10 +4,11 @@ import java.math.BigDecimal; ...@@ -4,10 +4,11 @@ import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -19,6 +20,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -19,6 +20,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.timer.api.bean.kqgl.AttendanceWeeklySch;
import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.Schedule;
import cn.timer.api.bean.kqmk.KqglAssoBcsz; import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl; import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkmx; import cn.timer.api.bean.kqmk.KqglAssoDkmx;
...@@ -30,8 +34,15 @@ import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban; ...@@ -30,8 +34,15 @@ import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz; import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException; import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.ScheduleMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper; import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoTeshuMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttLateLate; import cn.timer.api.dto.kqmk.AttLateLate;
import cn.timer.api.dto.kqmk.AttSchedule; import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttendanceCardListDto; import cn.timer.api.dto.kqmk.AttendanceCardListDto;
...@@ -50,6 +61,20 @@ import io.swagger.annotations.ApiOperation; ...@@ -50,6 +61,20 @@ import io.swagger.annotations.ApiOperation;
public class ClockInController { public class ClockInController {
@Autowired @Autowired
private KqglMainKqzMapper kqglmainkqzmapper; private KqglMainKqzMapper kqglmainkqzmapper;
@Autowired
private KqglAssoLeaveBalanceMapper kqglassoleavebalancemapper;
@Autowired
private KqglAssoTeshuMapper kqglassoteshumapper;
@Autowired
private PunchCardDetailsMapper punchcarddetailsmapper;
@Autowired
private AttendanceWeeklySchMapper attendanceweeklyschservice;
@Autowired
private ScheduleMapper scheduleservice;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("EEE");
/** /**
* 考勤打卡 * 考勤打卡
* *
...@@ -244,15 +269,108 @@ public class ClockInController { ...@@ -244,15 +269,108 @@ public class ClockInController {
KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda() KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda()
.eq(KqglAssoMonthPunchSummary::getNum, asUserId).eq(KqglAssoMonthPunchSummary::getOrgCode, user.getOrgCode())); .eq(KqglAssoMonthPunchSummary::getNum, asUserId).eq(KqglAssoMonthPunchSummary::getOrgCode, user.getOrgCode()));
// KqglAssoMonthPunchSummary summary = KqglAssoMonthPunchSummary.builder().name().build(); AdditionalDto kqry = kqglassoleavebalancemapper.selectAdditional(user.getOrgCode(), user.getEmpNum());
/*******************************************************/
int year = Calendar.getInstance().get(Calendar.YEAR);
int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
if(attgro != null){//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
//休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0,actualAttDays = 0;
if(attgro.getPbfs() == 1){
List<KqglAssoTeshu> bxdklist = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), month,1);//当前月 必须打卡日期
int bxdk = bxdklist.size();
List<KqglAssoTeshu> wxdk = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), month,2);//当前月 无需打卡日期
String[] appmaps= new String[wxdk.size()];
int d1 = 0;
for(KqglAssoTeshu spe:wxdk){
appmaps[d1] = spe.getTsrq();
d1++;
}
List<AttendanceWeeklySch> atwek = attendanceweeklyschservice.selectAttendanceMadeByUserid(Integer.valueOf(user.getEmpNum()));
String[] week= new String[atwek.size()];
int e = 0;
for(AttendanceWeeklySch awek : atwek){
week[e] = awek.getWekmc();
e++;
}
String yemo = year + "-" + month;
sdf1.setLenient(false);
int y = 0,q = 0;
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
q++;
y++;
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y = y-1;
}
}
}
}
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size();
daysOff = xiuxi;
daysOnDuty = y+bxdk;
}else if(attgro.getPbfs() == 2){
List<Schedule> ycqs = scheduleservice.getAttendanceShouldList(Integer.valueOf(user.getEmpNum()),startDate,endDate);
int xiuxi = 0;
int shangban = 0;
for(Schedule sc : ycqs){
if(sc.getBcid().equals(0)){
xiuxi++;
}else{
shangban++;
}
}
daysOff = xiuxi;
daysOnDuty = shangban;
}else{
List<AttendanceWeeklySch> atwek = attendanceweeklyschservice.selectAttendanceMadeByUserid(Integer.valueOf(user.getEmpNum()));
String[] week= new String[atwek.size()];
int e = 0;
for(AttendanceWeeklySch awek : atwek){
week[e] = awek.getWekmc();
e++;
}
String yemo = year + "-" + month;
sdf1.setLenient(false);
int y = 0;
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
try {
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
y++;
}
}
} catch (ParseException c) {
c.printStackTrace();
}
}
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - y;
daysOff = xiuxi;
daysOnDuty = y;
}
List<PunchCardDetails> attendance = punchcarddetailsmapper.selectAttendanceDays(Integer.valueOf(user.getEmpNum()), startDate, endDate);//打卡记录
actualAttDays = attendance.size();
}else {
System.out.println("该员工未加入考勤组");
}
/****************************************************/
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次
if(isyessum == null) {//无汇总记录 if(isyessum == null) {//无汇总记录
KqglAssoMonthPunchSummary summary = KqglAssoMonthPunchSummary.builder().name(user.getName()).num(user.getEmpNum()).dept(kqry.getDepartment())
.post(kqry.getPosition()).attGroup(attgro.getId()).shift(shif.getId()).build();
}else { }else {
int id = isyessum.getId();
} }
}else { }else {
System.out.println("当前打卡时间不在范围内"); System.out.println("当前打卡时间不在范围内");
} }
...@@ -308,7 +426,6 @@ public class ClockInController { ...@@ -308,7 +426,6 @@ public class ClockInController {
return ResultUtil.data(null, "打卡成功"); return ResultUtil.data(null, "打卡成功");
} }
@Autowired @Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper; private KqglAssoPbmxMapper kqglassopbmxmapper;
......
...@@ -22,6 +22,19 @@ public class ClockInTool { ...@@ -22,6 +22,19 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
/** /**
* 使用java正则表达式去掉多余的.与0
* @param s
* @return string
*/
public static String replace(String s){
if(null != s && s.indexOf(".") > 0){
s = s.replaceAll("0+?$", "");//去掉多余的0
s = s.replaceAll("[.]$", "");//如最后一位是.则去掉
}
return s;
}
/**
* 根据 年、月 获取对应的月份 的 天数 * 根据 年、月 获取对应的月份 的 天数
*/ */
public static int getDaysByYearMonth(int year, int month) public static int getDaysByYearMonth(int year, int month)
......
...@@ -1838,7 +1838,7 @@ public class TimeCardController { ...@@ -1838,7 +1838,7 @@ public class TimeCardController {
@PostMapping(value = "/leave_balance_list") @PostMapping(value = "/leave_balance_list")
@ApiOperation(value = "45:获取修改的排班明细", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "45:获取假期余额列表数据", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 45) @ApiOperationSupport(order = 45)
public Result<Object> LeaveBalanceList(@CurrentUser UserBean userBean, @Validated @RequestBody AttqueryCriteriaDto attquerycriteriadto) { public Result<Object> LeaveBalanceList(@CurrentUser UserBean userBean, @Validated @RequestBody AttqueryCriteriaDto attquerycriteriadto) {
IPage<EmployeeLeaveBalanceDto> page = new Page<EmployeeLeaveBalanceDto>( IPage<EmployeeLeaveBalanceDto> page = new Page<EmployeeLeaveBalanceDto>(
......
package cn.timer.api.dao.kqmk; package cn.timer.api.dao.kqmk;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -7,6 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -7,6 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance; import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto; import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto; import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
...@@ -19,4 +22,6 @@ import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto; ...@@ -19,4 +22,6 @@ import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBalance> { public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBalance> {
IPage<EmployeeLeaveBalanceDto> selectPageByQueryLeaveBalance(IPage<EmployeeLeaveBalanceDto> page,@Param("param") AttqueryCriteriaDto attquerycriteriadto); IPage<EmployeeLeaveBalanceDto> selectPageByQueryLeaveBalance(IPage<EmployeeLeaveBalanceDto> page,@Param("param") AttqueryCriteriaDto attquerycriteriadto);
AdditionalDto selectAdditional(int orgcode,int empnum);
} }
...@@ -18,4 +18,6 @@ public interface KqglAssoTeshuMapper extends BaseMapper<KqglAssoTeshu> { ...@@ -18,4 +18,6 @@ public interface KqglAssoTeshuMapper extends BaseMapper<KqglAssoTeshu> {
int insertKqglAssoTeshuList(List<KqglAssoTeshu> kqglassoteshu); int insertKqglAssoTeshuList(List<KqglAssoTeshu> kqglassoteshu);
List<KqglAssoTeshu> ShouldSpecialDatessetByKqzid(int kqzid,int 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 AdditionalDto {
@ApiModelProperty(value = "员工工号 ", example = "字段说明")
private Integer empnum;
@ApiModelProperty(value = "员工名称 ", example = "字段说明")
private String empname;
@ApiModelProperty(value = "部门 ", example = "字段说明")
private String department;
@ApiModelProperty(value = "职位 ", example = "字段说明")
private String position;
}
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author lalqq
*
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SpecialDateDto implements Serializable {
private static final long serialVersionUID = 465028562478360263L;
private Integer id;
private Integer kqzid;// 考勤组id
private String tsrq;// 日期
private Integer bcid;// 班次id
private Long lusjTime;// 录入时间
private Integer luryid;// 录入人员
private Integer type;// 类型 1:必须打卡日期;2:不用打卡日期(扩展字段)
private String bcname;
private String sbdk1;
private String xbdk1;
private String sbdk2;
private String xbdk2;
private String sbdk3;
private String xbdk3;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getKqzid() {
return kqzid;
}
public void setKqzid(Integer kqzid) {
this.kqzid = kqzid;
}
public String getTsrq() {
return tsrq;
}
public void setTsrq(String tsrq) {
this.tsrq = tsrq == null ? null : tsrq.trim();
}
public Integer getBcid() {
return bcid;
}
public void setBcid(Integer bcid) {
this.bcid = bcid;
}
public Long getLusjTime() {
return lusjTime;
}
public void setLusjTime(Long lusjTime) {
this.lusjTime = lusjTime;
}
public Integer getLuryid() {
return luryid;
}
public void setLuryid(Integer luryid) {
this.luryid = luryid;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getBcname() {
return bcname;
}
public void setBcname(String bcname) {
this.bcname = bcname;
}
public String getSbdk1() {
return sbdk1;
}
public void setSbdk1(String sbdk1) {
this.sbdk1 = sbdk1;
}
public String getXbdk1() {
return xbdk1;
}
public void setXbdk1(String xbdk1) {
this.xbdk1 = xbdk1;
}
public String getSbdk2() {
return sbdk2;
}
public void setSbdk2(String sbdk2) {
this.sbdk2 = sbdk2;
}
public String getXbdk2() {
return xbdk2;
}
public void setXbdk2(String xbdk2) {
this.xbdk2 = xbdk2;
}
public String getSbdk3() {
return sbdk3;
}
public void setSbdk3(String sbdk3) {
this.sbdk3 = sbdk3;
}
public String getXbdk3() {
return xbdk3;
}
public void setXbdk3(String xbdk3) {
this.xbdk3 = xbdk3;
}
}
\ No newline at end of file
...@@ -28,6 +28,13 @@ ...@@ -28,6 +28,13 @@
</collection> </collection>
</resultMap> </resultMap>
<resultMap id="AdditionalMap" type="cn.timer.api.dto.kqmk.AdditionalDto" >
<result column="empnum" property="empnum" />
<result column="empname" property="empname" />
<result column="department" property="department" />
<result column="position" property="position" />
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, id,
leave_rules_id, leave_rules_id,
...@@ -79,6 +86,19 @@ ...@@ -79,6 +86,19 @@
ORDER BY emp.emp_num DESC ORDER BY emp.emp_num DESC
</select> </select>
<select id="selectAdditional" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
gw.`name` 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
where emp.org_code = #{orgcode}
and emp.emp_num = #{empnum}
</select>
<!-- <!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveBalance"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveBalance">
......
...@@ -58,6 +58,15 @@ ...@@ -58,6 +58,15 @@
) )
</foreach> </foreach>
</insert> </insert>
<select id="ShouldSpecialDatessetByKqzid" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from kqgl_asso_teshu teshu
where teshu.kqzid = #{kqzid}
and substring(teshu.tsrq,6,2) = #{tsrq}
and teshu.type = #{type}
</select>
<!-- <!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoTeshu"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoTeshu">
......
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