优化
This commit is contained in:
parent
ad39720b45
commit
a8881bf2ae
@ -275,6 +275,7 @@ public class HardWareCallbackController {
|
||||
if (towerCrane == null) {
|
||||
return Result.error("该设备不存在!");
|
||||
}
|
||||
towerCraneCurrentData.setDevId(towerCrane.getId());
|
||||
towerCraneCurrentDataService.saveInfo(towerCraneCurrentData);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -288,6 +289,7 @@ public class HardWareCallbackController {
|
||||
if (towerCrane == null) {
|
||||
return Result.error("该设备不存在!");
|
||||
}
|
||||
towerCraneAlarm.setDevId(towerCrane.getId());
|
||||
towerCraneAlarmService.saveInfo(towerCraneAlarm);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -301,6 +303,7 @@ public class HardWareCallbackController {
|
||||
if (towerCrane == null) {
|
||||
return Result.error("该设备不存在!");
|
||||
}
|
||||
towerCraneWorkCycle.setDevId(towerCrane.getId());
|
||||
towerCraneWorkCycleService.saveInfo(towerCraneWorkCycle);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -314,6 +317,7 @@ public class HardWareCallbackController {
|
||||
if (lifter == null) {
|
||||
return Result.error("该设备不存在!");
|
||||
}
|
||||
lifterAlarm.setDevId(lifter.getId());
|
||||
lifterAlarmService.saveInfo(lifterAlarm);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -327,6 +331,7 @@ public class HardWareCallbackController {
|
||||
if (lifter == null) {
|
||||
return Result.error("该设备不存在!");
|
||||
}
|
||||
lifterCurrentData.setDevId(lifter.getId());
|
||||
lifterCurrentDataService.saveInfo(lifterCurrentData);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -340,6 +345,7 @@ public class HardWareCallbackController {
|
||||
if (lifter == null) {
|
||||
return Result.error("该设备不存在!");
|
||||
}
|
||||
lifterWorkCycle.setDevId(lifter.getId());
|
||||
lifterWorkCycleService.saveInfo(lifterWorkCycle);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
@ -106,9 +107,14 @@ public class TeamInfoController {
|
||||
public Result<TeamInfo> edit(@RequestBody TeamInfo teamInfo) {
|
||||
Result<TeamInfo> result = new Result<TeamInfo>();
|
||||
TeamInfo teamInfoEntity = teamInfoService.getById(teamInfo.getId());
|
||||
if (teamInfoEntity == null) {
|
||||
teamInfoEntity = teamInfoService.getOne(Wrappers.<TeamInfo>lambdaQuery().eq(TeamInfo::getTeamSn, teamInfo.getTeamSn()));
|
||||
if (teamInfoEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
teamInfo.setId(teamInfoEntity.getId());
|
||||
}
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
teamInfo.setProjectSn(user.getSn());
|
||||
boolean ok = teamInfoService.updateById(teamInfo);
|
||||
@ -116,8 +122,6 @@ public class TeamInfoController {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
result.success("操作失败!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,12 @@ package com.zhgd.xmgl.modules.basicdata.controller.project;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.WorkerAttendanceVo;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.WorkerAttendanceDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.AttendanceStatistics;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.WorkerAttendance;
|
||||
@ -16,12 +19,14 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -84,9 +89,72 @@ public class WorkerAttendanceController {
|
||||
DateTime dateTime = DateUtil.parseDate(attendanceStatistics.getDayDate());
|
||||
DateTime beginTime = DateUtil.beginOfDay(dateTime);
|
||||
DateTime endTime = DateUtil.endOfDay(dateTime);
|
||||
List<WorkerAttendanceDto> WorkerAttendanceDto = workerAttendanceService.getList(Wrappers.<WorkerAttendance>query()
|
||||
.eq("w.worker_id", attendanceStatistics.getWorkerId())
|
||||
.between("w.create_time", beginTime, endTime));
|
||||
QueryWrapper<WorkerAttendance> wrapper = Wrappers.<WorkerAttendance>query();
|
||||
if (StringUtils.isNotBlank(attendanceStatistics.getWorkerId())) {
|
||||
wrapper.eq("w.worker_id", attendanceStatistics.getWorkerId());
|
||||
}
|
||||
wrapper.between("w.create_time", beginTime, endTime);
|
||||
List<WorkerAttendanceDto> WorkerAttendanceDto = workerAttendanceService.getList(wrapper);
|
||||
return Result.success(WorkerAttendanceDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人员打卡信息
|
||||
* @param attendanceStatistics
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "人员考勤管理", operType = "查询", operDesc = "获取人员打卡信息")
|
||||
@ApiOperation(value = " 获取人员打卡信息", notes = "获取人员打卡信息" , httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "workerId", value = "人员ID", paramType = "body", dataType = "String"),
|
||||
@ApiImplicitParam(name = "dayDate", value = "日期", paramType = "body", dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/page")
|
||||
public Result<Page<WorkerAttendanceDto>> page(Page page, @RequestBody AttendanceStatistics attendanceStatistics) {
|
||||
DateTime dateTime = DateUtil.parseDate(attendanceStatistics.getDayDate());
|
||||
DateTime beginTime = DateUtil.beginOfDay(dateTime);
|
||||
DateTime endTime = DateUtil.endOfDay(dateTime);
|
||||
QueryWrapper<WorkerAttendance> wrapper = Wrappers.<WorkerAttendance>query();
|
||||
if (StringUtils.isNotBlank(attendanceStatistics.getWorkerId())) {
|
||||
wrapper.eq("w.worker_id", attendanceStatistics.getWorkerId());
|
||||
}
|
||||
wrapper.between("w.create_time", beginTime, endTime);
|
||||
Page<WorkerAttendanceDto> WorkerAttendanceDto = workerAttendanceService.getPageList(page, wrapper);
|
||||
return Result.success(WorkerAttendanceDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加考勤信息
|
||||
* @param workerAttendanceVos
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "人员考勤管理", operType = "新增", operDesc = "添加人员考勤信息")
|
||||
@ApiOperation(value = " 添加人员考勤信息", notes = "添加人员考勤信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/batchAdd")
|
||||
public Result<Object> batchAdd(@RequestBody List<WorkerAttendanceVo> workerAttendanceVos) {
|
||||
List<WorkerAttendance> workerAttendanceList = new ArrayList<>();
|
||||
for (int i = 0; i < workerAttendanceVos.size(); i++) {
|
||||
WorkerAttendanceVo workerAttendanceVo = workerAttendanceVos.get(i);
|
||||
WorkerAttendance workerAttendance = new WorkerAttendance();
|
||||
WorkerInfo workerInfo = workerInfoService.getOne(Wrappers.<WorkerInfo>lambdaQuery()
|
||||
.eq(WorkerInfo::getEngineeringSn, workerAttendanceVo.getEngineeringSn())
|
||||
.eq(WorkerInfo::getTeamSn, workerAttendanceVo.getTeamInfoSn())
|
||||
.eq(WorkerInfo::getIdCard, workerAttendanceVo.getIdCard()));
|
||||
if(workerInfo == null) {
|
||||
continue;
|
||||
}
|
||||
workerAttendance.setWorkerId(workerInfo.getId());
|
||||
workerAttendance.setPassType(workerAttendanceVo.getPassType());
|
||||
workerAttendance.setCreateTime(workerAttendanceVo.getCreateTime());
|
||||
workerAttendance.setDevCode(workerAttendanceVo.getDevCode());
|
||||
workerAttendance.setCardType(workerAttendanceVo.getCardType());
|
||||
workerAttendance.setImageUrl(workerAttendanceVo.getImageUrl());
|
||||
workerAttendance.setPersonType(workerInfo.getPersonType());
|
||||
workerAttendance.setEngineeringSn(workerInfo.getEngineeringSn());
|
||||
workerAttendance.setProjectSn(workerInfo.getProjectSn());
|
||||
workerAttendanceList.add(workerAttendance);
|
||||
}
|
||||
workerAttendanceService.saveBatch(workerAttendanceList);
|
||||
return Result.ok("操作成功");
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,6 +98,13 @@ public class WorkerInfoController {
|
||||
@ApiOperation(value = " 添加人员信息", notes = "添加人员信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody WorkerInfo workerInfo) {
|
||||
WorkerInfo workerInfoEntity = workerInfoService.getOne(Wrappers.<WorkerInfo>lambdaQuery()
|
||||
.eq(WorkerInfo::getCompanySn, workerInfo.getCompanySn())
|
||||
.eq(WorkerInfo::getTeamSn, workerInfo.getTeamSn())
|
||||
.eq(WorkerInfo::getIdCard, workerInfo.getIdCard()));
|
||||
if (workerInfoEntity != null) {
|
||||
return Result.error("人员信息已存在!");
|
||||
}
|
||||
workerInfoService.saveInfo(workerInfo);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -114,9 +121,17 @@ public class WorkerInfoController {
|
||||
public Result<WorkerInfo> edit(@RequestBody WorkerInfo workerInfo) {
|
||||
Result<WorkerInfo> result = new Result<WorkerInfo>();
|
||||
WorkerInfo workerInfoEntity = workerInfoService.getById(workerInfo.getId());
|
||||
if (workerInfoEntity == null) {
|
||||
workerInfoEntity = workerInfoService.getOne(Wrappers.<WorkerInfo>lambdaQuery()
|
||||
.eq(WorkerInfo::getCompanySn, workerInfo.getCompanySn())
|
||||
.eq(WorkerInfo::getTeamSn, workerInfo.getTeamSn())
|
||||
.eq(WorkerInfo::getIdCard, workerInfo.getIdCard()));
|
||||
if (workerInfoEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
workerInfo.setId(workerInfoEntity.getId());
|
||||
}
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
workerInfo.setProjectSn(user.getSn());
|
||||
workerInfo.setAdmitGuid(workerInfoEntity.getAdmitGuid());
|
||||
@ -126,8 +141,6 @@ public class WorkerInfoController {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
result.success("操作失败!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "人员考勤信息同步(VO)", description = "WorkerAttendanceVo")
|
||||
public class WorkerAttendanceVo {
|
||||
|
||||
@ApiModelProperty(value = "工程sn")
|
||||
private String engineeringSn;
|
||||
|
||||
@ApiModelProperty(value="班组sn")
|
||||
private String TeamInfoSn;
|
||||
|
||||
@ApiModelProperty(value="身份证")
|
||||
private String idCard;
|
||||
|
||||
@ApiModelProperty(value="打卡时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "考勤类型 1:进 2出")
|
||||
private Integer passType;
|
||||
|
||||
@ApiModelProperty(value = "考勤图片URL")
|
||||
private String imageUrl;
|
||||
|
||||
@ApiModelProperty(value = "通行设备唯一标识")
|
||||
private String devCode;
|
||||
|
||||
@ApiModelProperty(value = "通行设备唯一标识")
|
||||
private Integer cardType;
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.wisdom.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.WorkerAttendanceDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.WorkerAttendance;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -22,4 +23,6 @@ public interface WorkerAttendanceMapper extends BaseMapper<WorkerAttendance> {
|
||||
Integer getWorkerAttendanceNum(String dateTime);
|
||||
|
||||
List<WorkerAttendanceDto> getList(@Param(Constants.WRAPPER)Wrapper<WorkerAttendance> wrapper);
|
||||
|
||||
Page<WorkerAttendanceDto> getList(Page page, @Param(Constants.WRAPPER)Wrapper<WorkerAttendance> wrapper);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.wisdom.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.WorkerAttendanceDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.WorkerAttendanceStatDto;
|
||||
@ -20,4 +21,6 @@ public interface IWorkerAttendanceService extends IService<WorkerAttendance> {
|
||||
WorkerAttendanceStatDto statistics();
|
||||
|
||||
List<WorkerAttendanceDto> getList(Wrapper<WorkerAttendance> wrapper);
|
||||
|
||||
Page<WorkerAttendanceDto> getPageList(Page page, Wrapper<WorkerAttendance> wrapper);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.WorkerAttendanceDto;
|
||||
import com.zhgd.xmgl.modules.wisdom.dto.WorkerAttendanceStatDto;
|
||||
@ -49,4 +50,9 @@ public class WorkerAttendanceServiceImpl extends ServiceImpl<WorkerAttendanceMap
|
||||
public List<WorkerAttendanceDto> getList(Wrapper<WorkerAttendance> wrapper) {
|
||||
return baseMapper.getList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WorkerAttendanceDto> getPageList(Page page, Wrapper<WorkerAttendance> wrapper) {
|
||||
return baseMapper.getList(page, wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user