卡片管理
This commit is contained in:
parent
1bc3bcd67a
commit
25e8e7a67e
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bonus.canteen.core.account.constants;
|
||||||
|
|
||||||
|
public enum CardRecordTypeEnum {
|
||||||
|
APPLY(1, "发卡"),
|
||||||
|
REFUND(2, "退卡"),
|
||||||
|
CHANGE(3, "换卡");
|
||||||
|
|
||||||
|
private final Integer key;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
private CardRecordTypeEnum(Integer key, String desc) {
|
||||||
|
this.key = key;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return this.desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bonus.canteen.core.account.constants;
|
||||||
|
|
||||||
|
public enum CardTypeEnum {
|
||||||
|
IC_CARD(1, "IC卡"),
|
||||||
|
CPU_CARD(2, "CPU卡"),
|
||||||
|
ID_CARD(3, "ID卡"),
|
||||||
|
THIRD_IC_CARD(10, "第三方IC卡");
|
||||||
|
|
||||||
|
private final Integer key;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
private CardTypeEnum(Integer key, String desc) {
|
||||||
|
this.key = key;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return this.desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,6 @@ package com.bonus.canteen.core.account.controller;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.canteen.core.common.annotation.PreventRepeatSubmit;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,12 @@ public class AccCard extends BaseEntity {
|
||||||
/** 卡类型 */
|
/** 卡类型 */
|
||||||
@Excel(name = "卡类型")
|
@Excel(name = "卡类型")
|
||||||
@ApiModelProperty(value = "卡类型")
|
@ApiModelProperty(value = "卡类型")
|
||||||
private Long cardType;
|
private Integer cardType;
|
||||||
|
|
||||||
/** 卡状态 1-正常 4-挂失 */
|
/** 卡状态 1-正常 4-挂失 */
|
||||||
@Excel(name = "卡状态 1-正常 4-挂失")
|
@Excel(name = "卡状态 1-正常 4-挂失")
|
||||||
@ApiModelProperty(value = "卡状态 1-正常 4-挂失")
|
@ApiModelProperty(value = "卡状态 1-正常 4-挂失")
|
||||||
private Long cardStatus;
|
private Integer cardStatus;
|
||||||
|
|
||||||
/** 押金 单位分 */
|
/** 押金 单位分 */
|
||||||
@Excel(name = "押金 单位分")
|
@Excel(name = "押金 单位分")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
package com.bonus.canteen.core.account.service.impl;
|
package com.bonus.canteen.core.account.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.bonus.canteen.core.account.constants.AccStatusEnum;
|
||||||
|
import com.bonus.canteen.core.account.constants.CardStatusEnum;
|
||||||
|
import com.bonus.canteen.core.account.constants.CardTypeEnum;
|
||||||
|
import com.bonus.canteen.core.account.domain.AccInfo;
|
||||||
|
import com.bonus.canteen.core.account.mapper.AccInfoMapper;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -9,6 +17,8 @@ import com.bonus.canteen.core.account.mapper.AccCardMapper;
|
||||||
import com.bonus.canteen.core.account.domain.AccCard;
|
import com.bonus.canteen.core.account.domain.AccCard;
|
||||||
import com.bonus.canteen.core.account.service.IAccCardService;
|
import com.bonus.canteen.core.account.service.IAccCardService;
|
||||||
|
|
||||||
|
import static com.bonus.canteen.core.order.constants.OrderStateEnum.CANCEL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员卡片资料Service业务层处理
|
* 人员卡片资料Service业务层处理
|
||||||
*
|
*
|
||||||
|
|
@ -19,6 +29,8 @@ import com.bonus.canteen.core.account.service.IAccCardService;
|
||||||
public class AccCardServiceImpl implements IAccCardService {
|
public class AccCardServiceImpl implements IAccCardService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccCardMapper accCardMapper;
|
private AccCardMapper accCardMapper;
|
||||||
|
@Autowired
|
||||||
|
AccInfoMapper accInfoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询人员卡片资料
|
* 查询人员卡片资料
|
||||||
|
|
@ -52,12 +64,26 @@ public class AccCardServiceImpl implements IAccCardService {
|
||||||
public int insertAccCard(AccCard accCard) {
|
public int insertAccCard(AccCard accCard) {
|
||||||
accCard.setCreateTime(DateUtils.getNowDate());
|
accCard.setCreateTime(DateUtils.getNowDate());
|
||||||
try {
|
try {
|
||||||
return accCardMapper.insertAccCard(accCard);
|
AccInfo accInfo = accInfoMapper.selectAccInfoById(accCard.getAccId());
|
||||||
|
checkAccInfoAndStatus(accInfo);
|
||||||
|
accCard.setCardStatus(CardStatusEnum.NORMAL.getKey());
|
||||||
|
accCard.setCardType(CardTypeEnum.IC_CARD.getKey());
|
||||||
|
int count = accCardMapper.insertAccCard(accCard);
|
||||||
|
//TODO 卡操作记录
|
||||||
|
return count;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException("错误信息描述, " + e.getMessage());
|
throw new ServiceException("错误信息描述, " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkAccInfoAndStatus(AccInfo accInfoVO) {
|
||||||
|
if (ObjectUtil.isNull(accInfoVO)) {
|
||||||
|
throw new ServiceException("账户不存在");
|
||||||
|
} else if (AccStatusEnum.DEACTIVATE.getKey().equals(accInfoVO.getAccStatus())) {
|
||||||
|
throw new ServiceException("账户已停用");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改人员卡片资料
|
* 修改人员卡片资料
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue