| | |
| | | package com.yeshi.fanli.service.impl.order.dividents;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsRecordMapper;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsRecordException;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class TeamDividentsRecordServiceImpl implements TeamDividentsRecordService {
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsRecordMapper teamDividentsRecordMapper;
|
| | |
|
| | | @Override
|
| | | public void addTeamDividentsRecord(TeamDividentsRecord record)
|
| | | throws TeamDividentsRecordException, ParamsException {
|
| | | // 验证参数完整性
|
| | | if (record == null || StringUtil.isNullOrEmpty(record.getDay()) || record.getMoney() == null
|
| | | || record.getState() == null || record.getUid() == null)
|
| | | throw new ParamsException(1, "参数不完整");
|
| | |
|
| | | // 判断是否存在
|
| | | TeamDividentsRecord old = teamDividentsRecordMapper.selectByUidAndDayForUpdate(record.getUid(),
|
| | | record.getDay());
|
| | | if (old != null)
|
| | | throw new TeamDividentsRecordException(TeamDividentsRecordException.CODE_EXIST, "记录已存在");
|
| | | // 加入记录
|
| | |
|
| | | if (record.getCreateTime() == null)
|
| | | record.setCreateTime(new Date());
|
| | | teamDividentsRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.order.dividents; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsRecordMapper; |
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord; |
| | | import com.yeshi.fanli.exception.ParamsException; |
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsRecordException; |
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsRecordService; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | @Service |
| | | public class TeamDividentsRecordServiceImpl implements TeamDividentsRecordService { |
| | | |
| | | @Resource |
| | | private TeamDividentsRecordMapper teamDividentsRecordMapper; |
| | | |
| | | @Override |
| | | public void addTeamDividentsRecord(TeamDividentsRecord record) |
| | | throws TeamDividentsRecordException, ParamsException { |
| | | // 验证参数完整性 |
| | | if (record == null || StringUtil.isNullOrEmpty(record.getDay()) || record.getMoney() == null |
| | | || record.getState() == null || record.getUid() == null) |
| | | throw new ParamsException(1, "参数不完整"); |
| | | |
| | | // 判断是否存在 |
| | | TeamDividentsRecord old = teamDividentsRecordMapper.selectByUidAndDayAndTypeForUpdate(record.getUid(), |
| | | record.getDay(),record.getType()); |
| | | if (old != null) |
| | | throw new TeamDividentsRecordException(TeamDividentsRecordException.CODE_EXIST, "记录已存在"); |
| | | // 加入记录 |
| | | if (record.getCreateTime() == null) |
| | | record.setCreateTime(new Date()); |
| | | teamDividentsRecordMapper.insertSelective(record); |
| | | } |
| | | |
| | | } |