Commit e5fad2cb by sdif

添加用户陪诊员假数据

parent ebffa3af
package com.pz.web.task;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pz.common.utils.DateUtils;
......@@ -69,6 +70,8 @@ public class InsertTestOrderTask {
private final EmployeesDivideMapper employeesDivideMapper;
private final FalseDataMapper falseDataMapper;
public static List<Integer> businessIds = Arrays.asList(1, 2, 3, 4, 5, 6);
public static Map<Integer, Integer> orderNumMap = new HashMap<>();
......@@ -90,6 +93,41 @@ public class InsertTestOrderTask {
orderNumMap.put(16, 27);
}
@Scheduled(cron = "0 0 1 * * ?") // 凌晨12点执行
@Transactional
public void insertUser() {
Random random = new Random();
int randomNumber1 = random.nextInt(5 - 1 + 1) + 1;
int randomNumber = random.nextInt(50 - 30 + 1) + 30;
List<FalseData> falseData1 = falseDataMapper.selectList();
FalseData falseData = new FalseData();
falseData.setId(1L);
falseData.setAdminToday((long) randomNumber);
falseData.setAdminSeven(falseData1.get(0).getCompanySeven() + randomNumber);
falseData.setAdminThirty(falseData1.get(0).getAdminThirty() + randomNumber);
falseData.setAdminSum(falseData1.get(0).getAdminSum() + randomNumber);
falseData.setCompanyToday((long) randomNumber);
falseData.setCompanySeven(falseData1.get(0).getCompanySeven() + randomNumber);
falseData.setCompanyThirty(falseData1.get(0).getCompanyThirty() + randomNumber);
falseData.setCompanySum(falseData1.get(0).getCompanySum() + randomNumber);
falseDataMapper.updateById(falseData);
List<Company> companies = companyMapper.selectList();
for (Company company : companies) {
FalseData falseData2 = falseDataMapper.selectOne(new LambdaQueryWrapper<FalseData>().eq(FalseData::getCompanyId, company.getId()));
if(null == falseData2){
continue;
}
falseData2.setId(1L);
falseData2.setAdminToday((long) randomNumber);
falseData2.setAdminSeven(falseData2.getCompanySeven() + randomNumber1);
falseData2.setAdminThirty(falseData2.getAdminThirty() + randomNumber1);
falseData2.setAdminSum(falseData2.getAdminSum() + randomNumber1);
falseDataMapper.updateById(falseData2);
}
}
@Scheduled(cron = "0 0 0 * * ?") // 凌晨12点执行
@Transactional
......
......@@ -510,27 +510,33 @@ public class EmployeesServiceImpl implements IEmployeesService {
@Override
public DataViewVo dataEmployees(DataViewBo dataViewBo) {
List<FalseData> falseData = falseDataMapper.selectList();
Company company = companyMapper.selectOne(new LambdaQueryWrapper<Company>().eq(Company::getUid, dataViewBo.getUserId()));
if(null == company){
DataViewVo dataViewVo = new DataViewVo();
dataViewVo.setDataSum(0);
return dataViewVo;
}
FalseData falseData = falseDataMapper.selectOne(new LambdaQueryWrapper<FalseData>().eq(FalseData::getCompanyId,company.getId()));
DataViewVo dataViewVo = new DataViewVo();
if(null != dataViewBo.getUserId()){
if(dataViewBo.getCondition() == 2){
dataViewVo.setDataSum(falseData.get(1).getCompanySeven().intValue());
dataViewVo.setDataSum(falseData.getCompanySeven().intValue());
}else if(dataViewBo.getCondition() == 3){
dataViewVo.setDataSum(falseData.get(1).getCompanyThirty().intValue());
dataViewVo.setDataSum(falseData.getCompanyThirty().intValue());
}else if(dataViewBo.getCondition() == 1){
dataViewVo.setDataSum(falseData.get(1).getCompanyToday().intValue());
dataViewVo.setDataSum(falseData.getCompanyToday().intValue());
}else {
dataViewVo.setDataSum(falseData.get(1).getCompanySum().intValue());
dataViewVo.setDataSum(falseData.getCompanySum().intValue());
}
}else {
if(dataViewBo.getCondition() == 2){
dataViewVo.setDataSum(falseData.get(0).getCompanySeven().intValue());
dataViewVo.setDataSum(falseData.getCompanySeven().intValue());
}else if(dataViewBo.getCondition() == 3){
dataViewVo.setDataSum(falseData.get(0).getCompanyThirty().intValue());
dataViewVo.setDataSum(falseData.getCompanyThirty().intValue());
}else if(dataViewBo.getCondition() == 1){
dataViewVo.setDataSum(falseData.get(0).getCompanyToday().intValue());
dataViewVo.setDataSum(falseData.getCompanyToday().intValue());
}else {
dataViewVo.setDataSum(falseData.get(0).getCompanySum().intValue());
dataViewVo.setDataSum(falseData.getCompanySum().intValue());
}
}
......
......@@ -57,4 +57,6 @@ public class FalseData extends BaseEntity {
*/
private Long companySum;
private Long companyId;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment