| | |
| | | package com.ks.vip.service.remote; |
| | | |
| | | |
| | | import com.ks.vip.exception.VipCenterException; |
| | | import com.ks.vip.mapper.VipCenterMapper; |
| | | import com.ks.vip.mapper.VipCenterRecordMapper; |
| | | import com.ks.vip.mapper.VipComboMapper; |
| | |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.yeshi.utils.DateUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | |
| | | } |
| | | return vipGradeService.selectByPrimaryKey(list.get(0).getGradeId()).getIdentity(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveManageWeb(VipCenter t) throws VipCenterException { |
| | | if (t== null || StringUtil.isNullOrEmpty(t.getUid())) { |
| | | throw new VipCenterException(1, "用户ID不存在"); |
| | | } |
| | | |
| | | if (t.getGradeId() == null) { |
| | | throw new VipCenterException(1, "请选择用户等级"); |
| | | } |
| | | |
| | | if (t.getStartTime() == null) { |
| | | throw new VipCenterException(1, "请选择开始时间"); |
| | | } |
| | | |
| | | if (t.getEndTime() == null) { |
| | | throw new VipCenterException(1, "请选择结束时间"); |
| | | } |
| | | |
| | | VipCenter vipCenter = vipCenterMapper.selectForUpdate(t.getUid()); |
| | | if (vipCenter == null) { |
| | | t.setCreateTime(new Date()); |
| | | vipCenterMapper.insertSelective(t); |
| | | } else { |
| | | t.setUpdateTime(new Date()); |
| | | vipCenterMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | |
| | | // 保存记录 |
| | | VipCenterRecord record = new VipCenterRecord(); |
| | | record.setStartTime(t.getStartTime()); |
| | | record.setEndTime(t.getEndTime()); |
| | | record.setUid(t.getUid()); |
| | | record.setGradeId(t.getGradeId()); |
| | | record.setCreateTime(new Date()); |
| | | vipCenterRecordService.insertSelective(record); |
| | | } |
| | | |
| | | |
| | | |
| | | } |