Browse Source

值班导入验证

develop
wangsixiang 5 months ago
parent
commit
39fbc79c58
  1. 2
      zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java
  2. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java
  3. 3
      zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

2
zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java

@ -75,6 +75,8 @@ public interface DcShiftsMapper
List<HashMap<String,Object>> selectEmp(@Param("organizationId")Long organizationId,@Param("name") String name);
//根据创建时间获取信息
public DcShifts selectDcShiftsByCreateTime(Long id);
//查询具体人员在某天是否存在值班
public DcShifts selectDcShiftsDay(DcShifts dcShifts);
//
/**
* 查询值班

5
zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java

@ -302,6 +302,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
String contactNumber = dcShifts.getContactNumber();//手机号
String organizationName = dcShifts.getOrganizationName();//驻点
String scheduling = dcShifts.getScheduling();//排班
Date date = dcShifts.getDate();//值班日期
if (contactNumber == null || contactNumber.equals(UniversalEnum.EMPTY_STRING.getValue())) {
msg = UniversalEnum.THE_PHONE_NUMBER_IS_EMPTY.getValue();
throw new ServiceException(msg);
@ -338,6 +339,10 @@ public class DcShiftsServiceImpl implements IDcShiftsService
Long id = (Long) map.get("id");
dcShifts.setEmployeesId(id);
dcShifts.setCreateTime(DateUtils.getNowDate());
DcShifts dcShiftsDay = dcShiftsMapper.selectDcShiftsDay(dcShifts);//查看值班是否存在
if (dcShiftsDay!=null){ //值班存在不在继续查询,执行下一个
continue;
}
int shifts = dcShiftsMapper.insertDcShifts(dcShifts);
if (shifts == UniversalEnum.ZERO.getNumber()) {
msg = "添加值班信息‘" + dcShifts.getName() + "’失败,请检查后重新导入";

3
zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

@ -128,6 +128,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by shifts.date desc
</select>
<select id="selectDcShiftsDay" resultType="com.zc.business.domain.DcShifts">
select id from dc_shifts where employees_id=#{employeesId} and date = #{date} and scheduling=#{scheduling} and station=#{station}
</select>
<insert id="insertDcShifts" parameterType="DcShifts" useGeneratedKeys="true" keyProperty="id">

Loading…
Cancel
Save