| | |
| | | package com.yeshi.fanli.service.impl.money.extract;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractAuditRecordMapper;
|
| | | import com.yeshi.fanli.dao.user.count.CountUserInfoDao;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.dto.money.ExtractOrderStatisticDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo.CountUserEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class ExtractAuditRecordServiceImpl implements ExtractAuditRecordService {
|
| | |
|
| | | @Resource
|
| | | private ExtractAuditRecordMapper extractAuditRecordMapper;
|
| | | |
| | | @Resource
|
| | | private CountUserInfoDao countUserInfoDao;
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime) {
|
| | | return extractAuditRecordMapper.getList((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getCount(String key, String startTime, String endTime) {
|
| | | return extractAuditRecordMapper.getCount(key, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize, String key, Integer state,
|
| | | Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedAllList((pageIndex - 1) * pageSize, pageSize, key, state, adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedAllCount(String key, Integer state, Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedAllCount(key, state, adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize, String key, Integer state,
|
| | | Long adminId, Integer days) {
|
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getMyAuditedTimeSlotList((pageIndex - 1) * pageSize,
|
| | | pageSize, key, state, adminId, days);
|
| | | Gson gson = new Gson();
|
| | | if (list != null)
|
| | | for (ExtractAuditRecord record : list) {
|
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) {
|
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class));
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedTimeSlotCount(String key, Integer state, Long adminId, Integer days) {
|
| | | return extractAuditRecordMapper.getMyAuditedTimeSlotCount(key, state, adminId, days);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedCountWeek(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountWeek(adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedCountMonth(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountMonth(adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMyAuditedCountToday(Long adminId) {
|
| | | return extractAuditRecordMapper.getMyAuditedCountToday(adminId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getByUidList(int pageIndex, int pageSize, Long uid) {
|
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getByUidList((pageIndex - 1) * pageSize, pageSize, uid);
|
| | | |
| | | Gson gson = new Gson();
|
| | | if (list != null)
|
| | | for (ExtractAuditRecord record : list) {
|
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) {
|
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class));
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getByUidCount(Long key) {
|
| | | return extractAuditRecordMapper.getByUidCount(key);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getListbyExtractId(Long extractId) {
|
| | | return extractAuditRecordMapper.getListbyExtractId(extractId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getbyExtractId(Long extractId) {
|
| | | return extractAuditRecordMapper.getbyExtractId(extractId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> getAuditCount(Date startTime, Date endTime, Integer state) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initAuditCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractAuditNumber, startTime, endTime, state);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | @Override
|
| | | public void initAuditCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractAuditNumber);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordAuditCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordAuditCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | private void addRecordAuditCount(String preDay) throws Exception{
|
| | | for (int i = 1; i < 3; i++) {
|
| | | int count = extractAuditRecordMapper.countAuditTotal(i, preDay);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setState(i);
|
| | | record.setNum(count);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractAuditNumber.name())+ "-" + i);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractAuditNumber);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | | } |
| | |
|
| | | |
| | | @Override
|
| | | public List<CountUserInfo> getApplyMoney(Date startTime, Date endTime) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initApplyMoneyCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractApplyMoney, startTime, endTime);
|
| | | }
|
| | | |
| | | // 初始化统计
|
| | | @Override
|
| | | public void initApplyMoneyCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractApplyMoney);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordApplyMoneyCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordApplyMoneyCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | private void addRecordApplyMoneyCount(String preDay) throws Exception{
|
| | | BigDecimal money = extractAuditRecordMapper.countApplyExtractMoney(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setMoney(money);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractApplyMoney.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractApplyMoney);
|
| | | countUserInfoDao.save(record);
|
| | | } |
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> geApplyNumber(Date startTime, Date endTime) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initApplyNumberCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractApplyNumber, startTime, endTime);
|
| | | }
|
| | |
|
| | | |
| | | // 初始化统计
|
| | | @Override
|
| | | public void initApplyNumberCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractApplyNumber);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | private void addRecordCount(String preDay) throws Exception{
|
| | | int count = extractAuditRecordMapper.countApplyNumberByDay(preDay);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setNum(count);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractApplyNumber.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractApplyNumber);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.money.extract; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.fanli.dao.mybatis.ExtractAuditRecordMapper; |
| | | import com.yeshi.fanli.dao.user.count.CountUserInfoDao; |
| | | import com.yeshi.fanli.dto.money.ExtractOrderStatisticDTO; |
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord; |
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | @Service |
| | | public class ExtractAuditRecordServiceImpl implements ExtractAuditRecordService { |
| | | |
| | | @Resource |
| | | private ExtractAuditRecordMapper extractAuditRecordMapper; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Override |
| | | public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime) { |
| | | return extractAuditRecordMapper.getList((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public int getCount(String key, String startTime, String endTime) { |
| | | return extractAuditRecordMapper.getCount(key, startTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize, String key, Integer state, |
| | | Long adminId) { |
| | | return extractAuditRecordMapper.getMyAuditedAllList((pageIndex - 1) * pageSize, pageSize, key, state, adminId); |
| | | } |
| | | |
| | | @Override |
| | | public int getMyAuditedAllCount(String key, Integer state, Long adminId) { |
| | | return extractAuditRecordMapper.getMyAuditedAllCount(key, state, adminId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize, String key, Integer state, |
| | | Long adminId, Integer days) { |
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getMyAuditedTimeSlotList((pageIndex - 1) * pageSize, |
| | | pageSize, key, state, adminId, days); |
| | | Gson gson = new Gson(); |
| | | if (list != null) |
| | | for (ExtractAuditRecord record : list) { |
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) { |
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class)); |
| | | SystemEnum system = userInfoService.getUserSystem(record.getExtract().getUserInfo().getId()); |
| | | record.setSystem(system.getName()); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public int getMyAuditedTimeSlotCount(String key, Integer state, Long adminId, Integer days) { |
| | | return extractAuditRecordMapper.getMyAuditedTimeSlotCount(key, state, adminId, days); |
| | | } |
| | | |
| | | @Override |
| | | public int getMyAuditedCountWeek(Long adminId) { |
| | | return extractAuditRecordMapper.getMyAuditedCountWeek(adminId); |
| | | } |
| | | |
| | | @Override |
| | | public int getMyAuditedCountMonth(Long adminId) { |
| | | return extractAuditRecordMapper.getMyAuditedCountMonth(adminId); |
| | | } |
| | | |
| | | @Override |
| | | public int getMyAuditedCountToday(Long adminId) { |
| | | return extractAuditRecordMapper.getMyAuditedCountToday(adminId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExtractAuditRecord> getByUidList(int pageIndex, int pageSize, Long uid) { |
| | | List<ExtractAuditRecord> list = extractAuditRecordMapper.getByUidList((pageIndex - 1) * pageSize, pageSize, uid); |
| | | |
| | | Gson gson = new Gson(); |
| | | if (list != null) |
| | | for (ExtractAuditRecord record : list) { |
| | | if (!StringUtil.isNullOrEmpty(record.getExtraInfoStr())) { |
| | | record.setExtraInfo(gson.fromJson(record.getExtraInfoStr(), ExtractOrderStatisticDTO.class)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public int getByUidCount(Long key) { |
| | | return extractAuditRecordMapper.getByUidCount(key); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExtractAuditRecord> getListbyExtractId(Long extractId) { |
| | | return extractAuditRecordMapper.getListbyExtractId(extractId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExtractAuditRecord> getbyExtractId(Long extractId) { |
| | | return extractAuditRecordMapper.getbyExtractId(extractId); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Long countAuditNumberByDay(int state, String preDay) { |
| | | return extractAuditRecordMapper.countAuditTotal(state, preDay); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public BigDecimal countApplyMoneyByDay(String preDay) { |
| | | return extractAuditRecordMapper.countApplyExtractMoney(preDay); |
| | | } |
| | | |
| | | @Override |
| | | public Long countApplyNumberByDay(String preDay) { |
| | | return extractAuditRecordMapper.countApplyNumberByDay(preDay); |
| | | } |
| | | |
| | | |
| | | } |