| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.io.file.FileReader; |
| | |
| | | date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | } else date = LocalDateTime.parse(date+"T00:00:00").plusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | for (DataReporting dataReporting : list) { |
| | | // List<FansSubmit> fansSubmits = fansSubmitMapper.selectList(Wrappers.<FansSubmit>lambdaQuery().eq(FansSubmit::getProduct, dataReporting.getProduct()).eq(FansSubmit::getVx, param).select(FansSubmit::getFansAdd).like(FansSubmit::getCreateTime, date)); |
| | | FinanceSubmit financeSubmit = financeSubmitMapper.selectOne(Wrappers.<FinanceSubmit>lambdaQuery().eq(FinanceSubmit::getCompany, dataReporting.getAgent()).eq(FinanceSubmit::getName, dataReporting.getName()).select(FinanceSubmit::getEmployeeRebate).like(FinanceSubmit::getCreateTime, date).orderByDesc(FinanceSubmit::getId).last("limit 1")); |
| | | // Integer sum = 0; |
| | | // for (FansSubmit fansSubmit : fansSubmits) { |
| | | // sum += fansSubmit.getFansAdd(); |
| | | // } |
| | | // dataReporting.setFansAdd(sum); |
| | | if(ObjectUtil.isNotEmpty(financeSubmit)){ |
| | | dataReporting.setAgentRebate(financeSubmit.getEmployeeRebate()); |
| | | } |
| | |
| | | dataReporting.setRemark(dataReporting.getConsumption().subtract(dataReporting.getRebateConsumption())); |
| | | } catch (Exception e) { |
| | | } |
| | | // dataReporting.setVxCard(param); |
| | | // if (ObjectUtil.isEmpty(one)) { |
| | | dataReporting.setRegistrant(map.get("name")); |
| | | dataReporting.setDepartment(map.get("department")); |
| | | dataReporting.setCreateTime(LocalDateTime.parse(date2 + " " + new SimpleDateFormat("HH:mm:ss").format(new Date()), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | dataReportingMapper.insert(dataReporting); |
| | | // } else { |
| | | // dataReporting.setId(one.getId()); |
| | | // dataReporting.setName(null); |
| | | // dataReportingMapper.updateById(dataReporting); |
| | | // } |
| | | DataReporting dataReporting1 = dataReportingMapper.selectOne(Wrappers.<DataReporting>lambdaQuery() |
| | | .eq(DataReporting::getName, dataReporting.getName()) |
| | | .eq(DataReporting::getAccountConsumption, dataReporting.getAccountConsumption()) |
| | | .eq(DataReporting::getShowNum, dataReporting.getShowNum()) |
| | | .eq(DataReporting::getClick, dataReporting.getClick())); |
| | | if(BeanUtil.isNotEmpty(dataReporting1)){ |
| | | dataReporting.setId(dataReporting1.getId()); |
| | | dataReportingMapper.updateById(dataReporting); |
| | | }else{ |
| | | dataReportingMapper.insert(dataReporting); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer delDataReporting(Integer id) { |
| | | /*List<FansSubmit> fansSubmits = fansSubmitMapper.selectList(Wrappers.<FansSubmit>lambdaQuery().eq(FansSubmit::getDataId, id).select(FansSubmit::getId)); |
| | | if(fansSubmits.size()>0)fansSubmitMapper.deleteBatchIds(fansSubmits); |
| | | List<FinanceSubmit> financeSubmits = financeSubmitMapper.selectList(Wrappers.<FinanceSubmit>lambdaQuery().eq(FinanceSubmit::getDataId, id).select(FinanceSubmit::getId)); |
| | | if(financeSubmits.size()>0)financeSubmitMapper.deleteBatchIds(financeSubmits);*/ |
| | | return dataReportingMapper.deleteById(id); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<String> selectDataReportingForProduct(String time) { |
| | | return dataReportingMapper.selectDataReportingForProduct(time.split(" ")[0]); |
| | | } |
| | | |
| | | @Override |
| | | public int updateVxCards(List<DataReporting> list) { |
| | | for (DataReporting reporting : list) { |
| | | updateDataReporting(reporting); |