Browse Source

移除福利的逻辑

master
zhangyuan 3 years ago
parent
commit
825895be24
  1. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeWelfareDTO.java
  2. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java
  3. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/ChangeWelfareDao.xml

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeWelfareDTO.java

@ -112,4 +112,8 @@ public class ChangeWelfareDTO implements Serializable {
*/
private String customerId;
/**
* 是否享受福利1是 0否 空是
*/
private String isWelfare;
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -61,7 +62,7 @@ public class ChangeWelfareServiceImpl extends BaseServiceImpl<ChangeWelfareDao,
return ConvertUtils.sourceToTarget(entityList, ChangeWelfareDTO.class);
}
private QueryWrapper<ChangeWelfareEntity> getWrapper(Map<String, Object> params){
private QueryWrapper<ChangeWelfareEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
String name = (String) params.get("name");
String idCard = (String) params.get("idCard");
@ -128,7 +129,7 @@ public class ChangeWelfareServiceImpl extends BaseServiceImpl<ChangeWelfareDao,
@Override
public Result removeWelfare(ChangeWelfareDTO dto) {
if(StringUtils.isBlank(dto.getId())){
if (StringUtils.isBlank(dto.getId())) {
return new Result().error("id不可为空");
}
dto.setRemoveDate(DateUtils.format(new Date()));
@ -139,18 +140,22 @@ public class ChangeWelfareServiceImpl extends BaseServiceImpl<ChangeWelfareDao,
@Override
public Boolean checkWelfareByIdCard(CheckWelfareByIdCardDTO dto) {
ChangeWelfareEntity entity = baseDao.selectByIdCard(dto.getIdCard());
return entity == null? false: true;
return entity != null;
}
@Override
public Result saveWelfareInfo(ChangeWelfareDTO dto) {
dto.setId(StringUtils.EMPTY);
if (NumConstant.ZERO_STR.equals(dto.getIsWelfare())) {
removeWelfare(dto);
return new Result();
}
Map<String, Object> params = new HashMap<>(4);
params.put("idCard", dto.getIdCard());
if (!list(params).isEmpty()) {
return new Result().error("该人员已经迁入福利人口");
}
dto.setJoinDate(DateUtils.format(new Date()));
dto.setId(StringUtils.EMPTY);
ChangeWelfareEntity entity = ConvertUtils.sourceToTarget(dto, ChangeWelfareEntity.class);
insert(entity);
return new Result();

8
epmet-user/epmet-user-server/src/main/resources/mapper/ChangeWelfareDao.xml

@ -34,7 +34,13 @@
set REMOVE_DATE=#{removeDate},
REMOVE_REASON=#{removeReason},
del_flag='1'
where id=#{id}
where del_flag='0'
<if test="id != null and id != ''">
AND ID = #{id}
</if>
<if test="idCard != null and idCard != ''">
AND ID_CARD = #{idCard}
</if>
</update>

Loading…
Cancel
Save