Commit 894aa8b6 by 邓实川 Committed by chenzg

细节判断优化

parent e16bf212
......@@ -32,6 +32,7 @@ import com.github.pagehelper.PageHelper;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
......@@ -111,7 +112,7 @@ public class QyzxBusinessController {
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEntInfoM>().eq(QyzxEntInfoM::getId, userBean.getOrgCode()));
Date endTime = qyzxEntInfoM.getEndTime();
Long day = DateUtil.between(new Date(), endTime, DateUnit.DAY,false);
Long day = DateUtil.between(new Date(), endTime, DateUnit.DAY, false);
Integer level = qyzxEntInfoM.getLevel();
Map<String, Object> map1 = new HashMap<String, Object>();
......@@ -151,13 +152,22 @@ public class QyzxBusinessController {
@GetMapping(value = "/getPayList/System")
@ApiOperation(value = "获取系统续费商品列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxPayContent>> getPayListWithSystem(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 3).select(
QyzxPayContent::getId, QyzxPayContent::getContent, QyzxPayContent::getNowPrice,
QyzxPayContent::getOriginalPrice, QyzxPayContent::getSpecification,
public Result<Map<String, Object>> getPayListWithSystem(@CurrentUser UserBean userBean) {
List<QyzxPayContent> list1 = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 3)
.eq(QyzxPayContent::getSpecification, 1).select(QyzxPayContent::getId,
QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice,
QyzxPayContent::getExpiration));
return ResultUtil.data(list, "获取成功");
List<QyzxPayContent> list2 = QyzxPayContent.builder().build()
.selectList(new LambdaQueryWrapper<QyzxPayContent>().eq(QyzxPayContent::getPmid, 3)
.eq(QyzxPayContent::getSpecification, 2).select(QyzxPayContent::getId,
QyzxPayContent::getNowPrice, QyzxPayContent::getOriginalPrice,
QyzxPayContent::getExpiration));
Map<String, Object> map = new HashMap<String, Object>();
map.put("simple", list1);
map.put("professional", list2);
return ResultUtil.data(map, "获取成功");
}
@PostMapping(value = "/generateOrder")
......@@ -211,10 +221,33 @@ public class QyzxBusinessController {
return ResultUtil.pageData(list, page.getTotal(), "查询成功");
}
public static void main(String[] args) {
QyzxInvoiceData qyzxInvoiceData = new QyzxInvoiceData();
qyzxInvoiceData.setBankAccount("123");
qyzxInvoiceData.setBankName("234");
if (!ObjectUtil.isAllNotEmpty(qyzxInvoiceData, qyzxInvoiceData.getBankAccount(),
qyzxInvoiceData.getBankName())) {
System.out.println("请完善发票信息!");
} else {
System.err.println("可以,不错");
}
}
@PostMapping(value = "/invoicing")
@ApiOperation(value = "开发票", httpMethod = "POST", notes = "接口发布说明")
public Result<QyzxInvoiceData> generateOrder(@CurrentUser UserBean userBean,
@RequestBody QyzxInvoiceData qyzxInvoiceData) {
if (!ObjectUtil.isAllNotEmpty(qyzxInvoiceData, qyzxInvoiceData.getInvoiceTitle(),
qyzxInvoiceData.getDutyParagraph(), qyzxInvoiceData.getCompanyAddress(),
qyzxInvoiceData.getCompanyPhone(), qyzxInvoiceData.getBankName(), qyzxInvoiceData.getBankAccount(),
qyzxInvoiceData.getInvoiceType(), qyzxInvoiceData.getInvoiceProject(),
qyzxInvoiceData.getInvoiceValue(), qyzxInvoiceData.getConsignee(), qyzxInvoiceData.getConsigneePhone(),
qyzxInvoiceData.getEmail(), qyzxInvoiceData.getShippingArea(), qyzxInvoiceData.getShippingAddress(),
qyzxInvoiceData.getZipCode())) {
return ResultUtil.error("请完善发票信息!");
}
String orderNo = qyzxInvoiceData.getOrderNo();
QyzxBuyRecord qyzxBuyRecord = QyzxBuyRecord.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxBuyRecord>().eq(QyzxBuyRecord::getOrderNo, orderNo));
......
......@@ -8,7 +8,6 @@ package cn.timer.api.controller.yggl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
......@@ -21,9 +20,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.transaction.Transactional;
import javax.websocket.server.PathParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -42,6 +39,7 @@ import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWra
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.util.StringUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
......@@ -76,13 +74,13 @@ import cn.timer.api.dao.yggl.YgMzDtoMapper;
import cn.timer.api.dao.yggl.YgProDtoMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.yggl.YgglMainLzbMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.dto.yggl.LoginerChargeDto;
import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.YgAreaDto;
import cn.timer.api.dto.yggl.YgCartogramDto;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.dto.yggl.YgDrjqbDto;
import cn.timer.api.dto.yggl.YgDrsDto;
......@@ -93,7 +91,6 @@ import cn.timer.api.dto.yggl.YgbintuDto;
import cn.timer.api.dto.yggl.YgglCartogramDto;
import cn.timer.api.dto.yggl.YgjgDto;
import cn.timer.api.dto.yggl.YgmzDto;
import cn.timer.api.dto.yggl.YgCartogramDto;
import cn.timer.api.dto.yggl.YgzzDto;
import cn.timer.api.utils.Md5;
import cn.timer.api.utils.Result;
......@@ -148,14 +145,16 @@ public class YgglController {
public Result<YgglMainEmp> loginmessage(@CurrentUser UserBean userBean) {
Integer empNum = userBean.getEmpNum();
Integer orgCode = userBean.getOrgCode();
YgglMainEmp ygglMainEmp=new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId,YgglMainEmp::getName,YgglMainEmp::getRzTime,YgglMainEmp::getEmpNum).
eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId, YgglMainEmp::getName, YgglMainEmp::getRzTime, YgglMainEmp::getEmpNum)
.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
Integer gw = ygglMainEmp.getBmgwId();
ZzglBmgwM bmid = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId).eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one();
ZzglBmgwM bmid = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId)
.eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one();
ygglMainEmp.setUnionid(bmid.toString());
return ResultUtil.data(ygglMainEmp, "部门id返回字段为unionid");
}
/**
* 获取登录人和上级主管的empNum和名称
*
......@@ -170,54 +169,56 @@ public class YgglController {
ArrayList<Integer> list = new ArrayList<Integer>();
Integer empNum = userBean.getEmpNum();
Integer gw = empNumConfirm(orgCode, empNum).getBmgwId();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).eq(ZzglBmgwM::getOrgCode, orgCode).list();
//获取该员工的上级部门id 的数组list
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
// 获取该员工的上级部门id 的数组list
ZzglBmgwM.getUpDepts(list, gw, zzglBmgwMs);
List<Integer> leaderList = new ArrayList<Integer>();
for (Integer zzglId : list) {
for (ZzglBmgwM zzglBmgwM : zzglBmgwMs) {
if (zzglId.equals(zzglBmgwM.getId()) && zzglBmgwM.getLeader()!=null) {
if (zzglId.equals(zzglBmgwM.getId()) && zzglBmgwM.getLeader() != null) {
leaderList.add(zzglBmgwM.getLeader());
}
}
}
List<YgglMainEmp> ygglMainEmps = empNumsConfirm(orgCode, leaderList);
List<LoginerChargeDto> loginerChargeDtos =new ArrayList<LoginerChargeDto>();
List<LoginerChargeDto> loginerChargeDtos = new ArrayList<LoginerChargeDto>();
for (YgglMainEmp m : ygglMainEmps) {
if (m.getHeadUrl() == null) {
m.setHeadUrl("");
}
loginerChargeDtos.add(new LoginerChargeDto(m.getEmpNum(),m.getName(),m.getHeadUrl()));
loginerChargeDtos.add(new LoginerChargeDto(m.getEmpNum(), m.getName(), m.getHeadUrl()));
}
Collections.reverse(loginerChargeDtos);
return ResultUtil.data(loginerChargeDtos, "获取上级部门的部门id");
}
//根据传来的empNum获取该人员信息,没有则传全部
public List<YgglMainEmp> empNumsConfirm(Integer orgCode,List<Integer> empNumList) {
List<YgglMainEmp> all = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper).eq(YgglMainEmp::getOrgCode, orgCode).list();
// 根据传来的empNum获取该人员信息,没有则传全部
public List<YgglMainEmp> empNumsConfirm(Integer orgCode, List<Integer> empNumList) {
List<YgglMainEmp> all = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, orgCode).list();
List<YgglMainEmp> ygglMainEmps = new ArrayList<YgglMainEmp>();
if (empNumList.size()!=0) {
if (empNumList.size() != 0) {
for (Integer empNum : empNumList) {
all.stream().filter(item -> empNum.equals(item.getEmpNum())).forEach(action ->{
all.stream().filter(item -> empNum.equals(item.getEmpNum())).forEach(action -> {
ygglMainEmps.add(action);
});
}
}else {
} else {
ygglMainEmps.addAll(all);
}
return ygglMainEmps;
}
//根据传来的empNum获取该人员信息
public YgglMainEmp empNumConfirm(Integer orgCode,Integer empNum) {
YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper).eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
// 根据传来的empNum获取该人员信息
public YgglMainEmp empNumConfirm(Integer orgCode, Integer empNum) {
YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
return one;
}
/**
* 获取用户头像
*
......@@ -228,11 +229,13 @@ public class YgglController {
@ApiOperation(value = "获取用户头像", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 70)
public Result<List<YgglMainEmp>> headphotos(@CurrentUser UserBean userBean, @RequestBody List<Integer> empNumList) {
if (empNumList.size()==0) {
if (empNumList.size() == 0) {
return ResultUtil.error("请输入empNum数组");
}
List<YgglMainEmp> yglList = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getEmpNum, empNumList).select(YgglMainEmp::getEmpNum,YgglMainEmp::getName,YgglMainEmp::getHeadUrl));
List<YgglMainEmp> yglList = YgglMainEmp.builder().build()
.selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.in(YgglMainEmp::getEmpNum, empNumList)
.select(YgglMainEmp::getEmpNum, YgglMainEmp::getName, YgglMainEmp::getHeadUrl));
for (YgglMainEmp yg : yglList) {
if (StringUtil.isEmpty(yg.getHeadUrl())) {
yg.setHeadUrl("");
......@@ -240,6 +243,7 @@ public class YgglController {
}
return ResultUtil.data(yglList, "获取用户头像组成功");
}
/**
* 获取员工档案
*
......@@ -428,8 +432,9 @@ public class YgglController {
ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.select("name", "emp_num", "bmgw_id", "rz_time", "job_type", "phone", "job_status")
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType()).eq("org_code", orgCode).eq(t != null && t > -1, "job_type", t)
.eq(j != null && j > -1, "job_status", j).in(!bList.isEmpty(), "bmgw_id", bList)
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType()).eq("org_code", orgCode)
.eq(t != null && t > -1, "job_type", t).eq(j != null && j > -1, "job_status", j)
.in(!bList.isEmpty(), "bmgw_id", bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like("name", q).or().like("phone", q));
// List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
......@@ -1499,8 +1504,8 @@ public class YgglController {
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(3).build().update(updateWrapper);
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime()).lzyy(lzygQueryDto.getLzyy())
.lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
// 删除员工表
// ygglMainEmp.deleteById();
// 删除员工登陆表
......@@ -1525,9 +1530,10 @@ public class YgglController {
updateWrapper.eq("emp_num", lzygQueryDto.getEmpNum());
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).build().update(updateWrapper);
YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date()).build()
.update(updateWrapper1);
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.build().update(updateWrapper);
YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.sjlzTime(new Date()).build().update(updateWrapper1);
// 查询该员工的关联表
QueryWrapper<QyzxEmpEntAsso> queryWrapper1 = new QueryWrapper<QyzxEmpEntAsso>();
queryWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
......@@ -1621,24 +1627,23 @@ public class YgglController {
@ApiOperationSupport(order = 60)
public Result<List<YgjgDto>> selectjgs(@CurrentUser UserBean userBean) {
List<YgjgDto> oldfather = new ArrayList<YgjgDto>();//老父亲
List<YgjgDto> oldfather = new ArrayList<YgjgDto>();// 老父亲
List<YgProDto> pro = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).list();//super继承人
List<YgProDto> pro = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).list();// super继承人
List<YgCityDto> city = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).list();
List<YgAreaDto> area = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).list();
for (YgProDto p : pro) {
Map<String, Object> map = BeanUtil.beanToMap(p);
//设置别名对应bean
// 设置别名对应bean
HashMap<String, String> mapping = CollUtil.newHashMap();
mapping.put("id", "jgid");
mapping.put("name", "jgname");
YgjgDto ygproDto = BeanUtil.mapToBean(map, YgjgDto.class,CopyOptions.create().setFieldMapping(mapping));
//添加cityList
//给一个upid
List<YgCityDto> outcity= uptocityList(city, ygproDto.getJgid());
//新建一个篮子
YgjgDto ygproDto = BeanUtil.mapToBean(map, YgjgDto.class, CopyOptions.create().setFieldMapping(mapping));
// 添加cityList
// 给一个upid
List<YgCityDto> outcity = uptocityList(city, ygproDto.getJgid());
// 新建一个篮子
List<YgjgDto> cityDtos = new ArrayList<YgjgDto>();
for (YgCityDto c : outcity) {
Map<String, Object> map2 = BeanUtil.beanToMap(c);
......@@ -1646,8 +1651,9 @@ public class YgglController {
mapping2.put("id", "jgid");
mapping2.put("name", "jgname");
mapping2.put("province", "upid");
YgjgDto ygcityDto = BeanUtil.mapToBean(map2, YgjgDto.class,CopyOptions.create().setFieldMapping(mapping2));
//把果实收起来
YgjgDto ygcityDto = BeanUtil.mapToBean(map2, YgjgDto.class,
CopyOptions.create().setFieldMapping(mapping2));
// 把果实收起来
cityDtos.add(ygcityDto);
List<YgAreaDto> outarea = uptoareaList(area, ygcityDto.getJgid());
......@@ -1658,7 +1664,8 @@ public class YgglController {
mapping3.put("id", "jgid");
mapping3.put("name", "jgname");
mapping3.put("city", "upid");
YgjgDto ygjgDto3 = BeanUtil.mapToBean(map3, YgjgDto.class,CopyOptions.create().setFieldMapping(mapping3));
YgjgDto ygjgDto3 = BeanUtil.mapToBean(map3, YgjgDto.class,
CopyOptions.create().setFieldMapping(mapping3));
areaDtos.add(ygjgDto3);
}
......@@ -1672,7 +1679,8 @@ public class YgglController {
return ResultUtil.data(oldfather, "老父亲出来了");
}
//根据上级id抽取出list
// 根据上级id抽取出list
public List<YgCityDto> uptocityList(List<YgCityDto> city, Integer jgid) {
List<YgCityDto> outcity = new ArrayList<YgCityDto>();
for (YgCityDto c : city) {
......@@ -1683,6 +1691,7 @@ public class YgglController {
city.removeAll(outcity);
return outcity;
}
public List<YgAreaDto> uptoareaList(List<YgAreaDto> area, Integer jgid) {
List<YgAreaDto> outarea = new ArrayList<YgAreaDto>();
for (YgAreaDto a : area) {
......@@ -1694,7 +1703,6 @@ public class YgglController {
return outarea;
}
/**
* 展示籍贯/展示所有籍贯(威力增强版)
*
......@@ -1731,7 +1739,6 @@ public class YgglController {
return ResultUtil.data(maps, "展示籍贯成功");
}
/**
* 查询员工列表
*
......@@ -1777,7 +1784,9 @@ public class YgglController {
List<YgglCartogramDto> ygglCartogramDto11 = ygglMainEmpMapper.queryWorkingAge(userBean);
map.put("positive", ygglCartogramDto1.getPositive());
if (ygglCartogramDto2 != null) {
map.put("avgAge", ygglCartogramDto2.getAvgAge());
}
map.put("induction", ygglCartogramDto3.getInduction());
map.put("probation", ygglCartogramDto4.getProbation());
map.put("regular", ygglCartogramDto4.getRegular());
......@@ -1854,7 +1863,8 @@ public class YgglController {
ageList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
}
// 在职
Integer zaizhi = jobStatus.get(YgEnumInterface.jobStatus.ZHENSHI.getType()).intValue() + jobStatus.get(YgEnumInterface.jobStatus.SHIYONG.getType()).intValue();
Integer zaizhi = jobStatus.get(YgEnumInterface.jobStatus.ZHENSHI.getType()).intValue()
+ jobStatus.get(YgEnumInterface.jobStatus.SHIYONG.getType()).intValue();
// 本月新入职
Integer xinruzhi = workage.get("本月新入职").intValue();
// 本月离职
......
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