提交修改

This commit is contained in:
quyixiao 2020-09-22 17:08:09 +08:00
commit b89bd9b444
37 changed files with 412 additions and 228 deletions

View File

@ -65,6 +65,7 @@ public class ShiroConfig {
filterMap.put("/aaa.txt", "anon");
filterMap.put("/dtlg/login", "anon");
filterMap.put("/oneCode/**", "anon");
filterMap.put("/modules/**", "anon");//临时添加后期去掉
filterMap.put("/dtlg/luck", "anon");
filterMap.put("/dtlg/look", "anon");
filterMap.put("/dtlg/jump", "anon");

View File

@ -1,12 +1,13 @@
package com.lz.modules.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import com.lz.common.utils.BigDecimalUtil;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dto.*;
import com.lz.modules.app.dto.CharBarDto;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.GraphicsDto;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.enums.ResultRecordStatusEnum;
import com.lz.modules.app.enums.ResultRecordTypeEnum;
import com.lz.modules.app.resp.OwnResultResp;
@ -15,16 +16,20 @@ import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.sys.controller.AbstractController;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ChartService;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
* @Author: djc
@ -49,36 +54,30 @@ public class ReportResultController extends AbstractController{
@RequestMapping("chart")
public R reportChart(String monthTime){
public R reportChart(String monthTime,String departmentId){
if(StringUtil.isBlank(monthTime)){
String time = LocalDate.now().toString();
monthTime = time.substring(0,time.length()-3);
monthTime = YearMonth.now().toString();
}
ReportChartResp data = new ReportChartResp();
//月初目标
List<GraphicsStatisticalDto> start = chartService.resultProgressDistribution(ResultRecordTypeEnum.TARGET.getType(),monthTime);
List<GraphicsStatisticalDto> start = chartService.resultProgressDistribution(ResultRecordTypeEnum.TARGET.getType(),monthTime,departmentId);
//月末结果
List<GraphicsStatisticalDto> end = chartService.resultProgressDistribution(ResultRecordTypeEnum.RESULT.getType(),monthTime);
List<GraphicsStatisticalDto> end = chartService.resultProgressDistribution(ResultRecordTypeEnum.RESULT.getType(),monthTime,departmentId);
//人员等级分布
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(monthTime);
List<GraphicsStatisticalDto> sortStaffLevels = new ArrayList<>();
// 0人是否需要展示
Map<String,Integer> map = Maps.newHashMap();
List<String> names = new ArrayList<>();
List<Double> datas = new ArrayList<>();
int konwn = 0;
for (GraphicsStatisticalDto staffLevel : staffLevels) {
map.put(staffLevel.getCategory(),staffLevel.getNumber());
}
// 默认等级赋予默认值并排序
for (String level : levels) {
GraphicsStatisticalDto dto = new GraphicsStatisticalDto();
dto.setCategory(level);
if(!map.containsKey(level)){
dto.setNumber(0);
}else {
dto.setNumber(map.get(level));
}
sortStaffLevels.add(dto);
names.add(staffLevel.getCategory());
datas.add(BigDecimalUtil.div(Double.valueOf(staffLevel.getNumber()),Double.valueOf(total),2));
konwn = konwn + staffLevel.getNumber();
logger.info("等级:" + staffLevel.getCategory() + " 人数:" + staffLevel.getNumber());
}
names.add("未知");
datas.add(BigDecimalUtil.div(Double.valueOf((total - konwn)),Double.valueOf(total),2));
//部门等级占比
GraphicsDto dto = new GraphicsDto();
dto.setRows(start);
@ -86,9 +85,12 @@ public class ReportResultController extends AbstractController{
dto = new GraphicsDto();
dto.setRows(end);
data.setResultDistribution(dto);
dto = new GraphicsDto();
dto.setRows(sortStaffLevels);
data.setStaffDistribution(dto);
CharBarDto barDto= new CharBarDto();
barDto.setNames(names);
barDto.setDatas(datas);
barDto.setTotal(total);
data.setStaffDistribution(barDto);
data.setMonthTime(YearMonth.now().toString());
return R.ok().put("data",data);
}
@ -157,3 +159,25 @@ public class ReportResultController extends AbstractController{
}
}
// 0人是否需要展示
/* List<GraphicsStatisticalDto> sortStaffLevels = new ArrayList<>();
Map<String,Integer> map = Maps.newHashMap();
for (GraphicsStatisticalDto staffLevel : staffLevels) {
map.put(staffLevel.getCategory(),staffLevel.getNumber());
}
// 默认等级赋予默认值并排序
for (String level : levels) {
GraphicsStatisticalDto dto = new GraphicsStatisticalDto();
dto.setCategory(level);
if(!map.containsKey(level)){
dto.setNumber(0);
}else {
dto.setNumber(map.get(level));
}
sortStaffLevels.add(dto);
}*/

View File

@ -399,11 +399,10 @@ public class ResultRecordController extends AbstractController {
if (!StringUtil.in(resultRecord.getStatus(),6)) {
return R.error("您的提交记录中有状态不正确,请重新选择");
}
resultRecordService.reject(resultRecord);
}
if(batchOpt == 3 ){
for (ResultRecord resultRecord : resultRecords) {
r = resultRecordService.reject(resultRecord);
r = resultRecordService.reject(resultRecord,1); //更新驳回状态
if (!r.isSuccess()) {
return r;
}

View File

@ -80,8 +80,7 @@ public class StaffRoleController {
List<RecordRole> roles = recordRoleService.selectAll();
return R.ok().put("lzStaffRole", lzStaffRole)
.put("staffs", newList)
.put("targetRoles", roles)
;
.put("targetRoles", roles);
}
/**

View File

@ -0,0 +1,20 @@
package com.lz.modules.app.dto;
import lombok.Data;
import java.util.List;
/**
* @Author: djc
* @Desc:
* @Date: 2020/9/21 10:21
*/
@Data
public class CharBarDto {
private List<String> names;
private List<Double> datas;
private int total;
}

View File

@ -1,16 +0,0 @@
package com.lz.modules.app.dto;
import lombok.Data;
/**
* @Author: djc
* @Desc:
* @Date: 2020/9/16 16:39
*/
@Data
public class ChartDto {
//属性名
private String name;
//属性值
private String value;
}

View File

@ -1,12 +1,9 @@
package com.lz.modules.app.resp;
import com.lz.modules.app.dto.ChartDto;
import com.lz.modules.app.dto.CharBarDto;
import com.lz.modules.app.dto.GraphicsDto;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import lombok.Data;
import java.util.List;
/**
* @Author: djc
* @Desc:
@ -19,8 +16,8 @@ public class ReportChartResp {
//月末结果
private GraphicsDto resultDistribution;
//个人等级占比
private GraphicsDto staffDistribution;
//部门等级占比
private GraphicsDto departmentDistribution;
private CharBarDto staffDistribution;
//当前月份
private String monthTime;
}

View File

@ -78,8 +78,10 @@ public interface StaffService extends IService<StaffEntity> {
List<StaffEntity> selectBySearchName(IPage page, FindByNameModel nameModel);
SysUserEntity getUser(String userName);
//查询部门下的所有人员 包括子部门下人员
List<Long> selectAllStaffByDepartmentId(String departmentId);
//查询部门下的所有子部门
List<String> selectAllDeparmentIdsByDepartmentParentId(String departmentId);
//统计部门下的人数
int countStaffByAllDeparmentIds(List<String> deparmentIds);
List<StaffEntity> selectAll();
}

View File

@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.lz.common.utils.DateUtils;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.Query;
import com.lz.common.utils.R;
import com.lz.common.utils.*;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dto.*;
import com.lz.modules.app.dao.StaffDao;
@ -18,6 +15,7 @@ import com.lz.modules.app.service.*;
import com.lz.modules.equipment.entity.model.FindByNameModel;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import com.lz.modules.sys.entity.SysUserEntity;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -27,6 +25,8 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service("staffService")
@ -50,6 +50,8 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
DepartmentsStaffRelateService departmentsStaffRelateService;
@Autowired
private DepartmentsDao departmentsDao;
@Autowired
private StaffService staffService;
@ -383,11 +385,42 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
@Override
public List<Long> selectAllStaffByDepartmentId(String departmentId) {
//154344269,154322459,154274609,154254673
List<String> parentsIds = Lists.newArrayList("154344269","154322459","154274609","154254673");
public List<String> selectAllDeparmentIdsByDepartmentParentId(String departmentId) {
//默认所有
if(StringUtil.isBlank(departmentId)){
departmentId = "1";
}
List<String> parentsIds = Lists.newArrayList(departmentId);
List<String> departmentsList = new ArrayList<>();
return null;
List<String> childs = departmentsDao.selectDepartmentIdsByparentIds(parentsIds);
if(CollectionUtils.isEmpty(childs)){
departmentsList.addAll(parentsIds);
return departmentsList;
}
departmentsList.addAll(childs);
List<String> allChilds = getAllChilds(departmentsList, childs);
return allChilds;
}
@Override
public int countStaffByAllDeparmentIds(List<String> deparmentIds) {
if(CollectionUtils.isEmpty(deparmentIds)){
return 0;
}
//获取所有子部门
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
.select("staff_id")
.eq("is_delete", 0)
.in("department_id", deparmentIds));
if(CollectionUtils.isEmpty(list)){
return 0;
}
//获取人员个数去重
List<String> staffs = list.stream().map(e -> e.getStaffId() + "").collect(Collectors.toList());
List<String> staffdistincts = staffs.stream().distinct().collect(Collectors.toList());
return staffdistincts.size();
}
@Override
@ -403,12 +436,11 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
*/
private List<String> getAllChilds(List<String> departmentsList,List<String> parentIds){
List<String> childs = departmentsDao.selectDepartmentIdsByparentIds(parentIds);
/* while (childs!=null){
}*/
return null;
if(CollectionUtils.isEmpty(childs)){
return departmentsList;
}
departmentsList.addAll(childs);
return getAllChilds(departmentsList,childs);
}

View File

@ -139,11 +139,18 @@ public class EquipmentBrandController {
EquipmentType type = map.get(brand.getTypeId());
if(type !=null){
resp.setTypeName(type.getType());
}else{
resp.setTypeName("【分类被删】");
}
resps.add(resp);
}
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");
equipmentTypes.add(0, type);
return R.ok().put("total", page.getTotalCount())
.put("rows", resps)
.put("types", equipmentTypes)
;
}

View File

@ -41,6 +41,7 @@ public class EquipmentInfoController {
private TCountService tCountService;
/**
* 添加设备表页面
*
@ -104,13 +105,13 @@ public class EquipmentInfoController {
public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception {
EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId());
BeanUtils.copyProperty(equipmentInfo, req, true);
Long typeId = NumberUtil.objToLongDefault(equipmentInfo.getType(), 0);
/*Long typeId = NumberUtil.objToLongDefault(equipmentInfo.getType(), 0);//20200921注释掉后台不支持修改类型品牌等只能修改备注时间金额
EquipmentType type = equipmentTypeService.selectEquipmentTypeById(typeId);
equipmentInfo.setType(type.getType());
Long brandId = NumberUtil.objToLongDefault(equipmentInfo.getBrandName(), 0);
EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(brandId);
equipmentInfo.setBrandName(equipmentBrand.getBrand());
equipmentInfo.setBrandName(equipmentBrand.getBrand());*/
equipmentInfoService.updateEquipmentInfoById(equipmentInfo);
return R.ok("编辑成功");
}
@ -149,8 +150,17 @@ public class EquipmentInfoController {
*/
@RequestMapping(value = "/modules/usereq/equipmentInfoList")
public R equipmentInfoList(@RequestBody EquipmentInfoReq req) throws Exception {
List<EquipmentType> types = equipmentTypeService.selectAll();
List<TCount> tcounts = tCountService.selectListLimit(10);
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");
types.add(0, type);
PageUtils page = equipmentInfoService.selectByCondition(req);
return R.ok().put("total", page.getTotalCount())
.put("rows", page.getList());
.put("rows", page.getList())
.put("types", types)
.put("tCounts", tcounts)
.put("curCount", req.getCount());
}
}

View File

@ -129,6 +129,11 @@ public class EquipmentSpecsController {
@RequestMapping(value = "/modules/specs/brandList")
public R brandList(@RequestBody EquipmentSpecsReq req) throws Exception {
List<EquipmentBrand> brands = equipmentBrandService.selectByTypeId(req.getTypeId());
EquipmentBrand band = new EquipmentBrand();
band.setId(null);
band.setTypeId(null);
band.setBrand("全部");
brands.add(0, band);
return R.ok().put("brands",brands);
}
@ -157,8 +162,22 @@ public class EquipmentSpecsController {
for (EquipmentSpecs specs : specsList) {
EquipmentSpecsResp resp = new EquipmentSpecsResp();
resp.setId(specs.getId());
resp.setType(typeMap.get(specs.getTypeId()).getType());
resp.setBrand(brandMap.get(specs.getBrandId()).getBrand());
EquipmentType type = typeMap.get(specs.getTypeId());
if(type == null){
resp.setType("【分类被删】");
}else{
resp.setType(type.getType());
resp.setTypeId(type.getId());
}
EquipmentBrand brand = brandMap.get(specs.getBrandId());
if(brand == null){
resp.setBrand("【品牌被删】");
}else{
resp.setBrand(brand.getBrand());
resp.setBrandId(brand.getId());
}
resp.setSpecs(specs.getSpecs());
resp.setRank(specs.getRank());
resp.setSkus(specs.getSkus());
@ -166,7 +185,12 @@ public class EquipmentSpecsController {
resp.setRemark(specs.getRemark());
resps.add(resp);
}
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");
types.add(0, type);
return R.ok().put("total", page.getTotalCount())
.put("rows", resps);
.put("rows", resps)
.put("types", types);
}
}

View File

@ -1,9 +1,11 @@
package com.lz.modules.equipment.controller;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.equipment.entity.OneCode;
import com.lz.modules.equipment.entity.OneCodeReq;
import com.lz.modules.equipment.service.OneCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@ -24,6 +26,17 @@ public class OneCodeController {
/**
* 获取code编码
* */
@RequestMapping("/get/getPrints")
public R getPrints(@RequestBody OneCodeReq req) {
PageUtils pageUtils = oneCodeService.selectByReq(req);
return R.ok().put("codes", pageUtils);
}
/**
* 批量生成指定数量编码
* */

View File

@ -38,7 +38,7 @@ public interface EquipmentBrandMapper extends BaseMapper<EquipmentBrand> {
EquipmentBrand selectEquipmentBrandByTypeBrand(@Param("typeId") Long typeId, @Param("brand") String brand);
List<EquipmentBrand> selectByCondition(IPage page, EquipmentBrandReq req);
List<EquipmentBrand> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentBrandReq req);
List<EquipmentBrand> selectEquipmentBrandByTypeAndLikeBrand(@Param("typeId") Long typeId, @Param("brand") String brand);
List<EquipmentBrand> selectAll();

View File

@ -39,7 +39,7 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
EquipmentInfo selectEquipmentInfoByCode(@Param("code") String code);
List<EquipmentInfo> selectByCondition(IPage page, EquipmentInfoReq req);
List<EquipmentInfo> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentInfoReq req);
List<EquipmentInfo> selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel);
}

View File

@ -37,7 +37,7 @@ public interface EquipmentSpecsMapper extends BaseMapper<EquipmentSpecs> {
EquipmentSpecs selectEquipmentSpecsByTypeBrandSpecss(@Param("typeId") Long typeId, @Param("brandId") Long brandId, @Param("specs") String specs);
List<EquipmentSpecs> selectByCondition(IPage page, EquipmentSpecsReq req);
List<EquipmentSpecs> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentSpecsReq req);
List<EquipmentSpecs> selectEquipmentSpecsByTypeBrandLikeSpecss(@Param("typeId") Long typeId, @Param("brandId") Long brandId, @Param("specs") String specs);
EquipmentSpecs selectSpecs(@Param("specs") String specs);

View File

@ -41,7 +41,7 @@ public interface EquipmentTypeMapper extends BaseMapper<EquipmentType> {
List<EquipmentType> selectByType(@Param("type") String type);
List<EquipmentType> selectByCondition(IPage page, EquipmentTypeReq req);
List<EquipmentType> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentTypeReq req);
List<EquipmentType> selectAll();

View File

@ -8,7 +8,9 @@ package com.lz.modules.equipment.dao;
* @since 2020-07-29
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.equipment.entity.OneCode;
import com.lz.modules.equipment.entity.OneCodeReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -40,4 +42,6 @@ public interface OneCodeMapper extends BaseMapper<OneCode> {
OneCode selectByCode(@Param("code") String code);
Long updatePrintOneCodes(List<String> codes);
List selectByCondition(@Param("page") IPage page, @Param("req") OneCodeReq req);
}

View File

@ -0,0 +1,33 @@
package com.lz.modules.equipment.entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* <p>
* 菜单权限表
* </p>*员工表
* @author quyixiao
* @since 2020-07-30
*/
@Data
public class OneCodeReq implements java.io.Serializable {
private int page = 1;
private int rows = 10;
private Long id;
//是否删除0未删除1删除
private Integer isDelete;
//创建时间
private Date gmtCreate;
//修改时间
private Date gmtModified;
//编码
private String code;
//是否打印 0未打印 1打印
private Integer isPrint;
}

View File

@ -2,7 +2,9 @@ package com.lz.modules.equipment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.entity.OneCode;
import com.lz.modules.equipment.entity.OneCodeReq;
import java.util.List;
@ -40,4 +42,6 @@ public interface OneCodeService extends IService<OneCode> {
OneCode selectByCode(String code);
Long updatePrintOneCodes(List<String> codes);
PageUtils selectByReq(OneCodeReq req);
}

View File

@ -16,6 +16,7 @@ import com.lz.modules.equipment.entity.model.FindByNameModel;
import com.lz.modules.equipment.entity.model.FindEquipmentsByNameModel;
import com.lz.modules.equipment.service.IEquipmentInfoService;
import com.lz.modules.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -33,6 +34,7 @@ import java.util.List;
*/
@Service
@Slf4j
public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, EquipmentInfo> implements IEquipmentInfoService {
@ -98,6 +100,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
@Override
public void changeEquipmentInfo(EquipmentDto dto, SysUserEntity infoDto) {
log.info("编辑传入内容{}", dto);
EquipmentType equipmentType = equipmentTypeMapper.selectEquipmentTypeById(dto.getTypeId());
EquipmentBrand equipmentBrand = equipmentBrandMapper.selectEquipmentBrandById(dto.getBrandId());
EquipmentSpecs equipmentSpecs = equipmentSpecsMapper.selectEquipmentSpecsById(dto.getSpecId());

View File

@ -1,8 +1,10 @@
package com.lz.modules.equipment.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.dao.OneCodeMapper;
import com.lz.modules.equipment.entity.OneCode;
import com.lz.modules.equipment.entity.OneCodeReq;
import com.lz.modules.equipment.service.OneCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -80,4 +82,12 @@ public class OneCodeServiceImpl extends ServiceImpl<OneCodeMapper, OneCode> impl
return oneCodeMapper.updatePrintOneCodes(codes);
}
@Override
public PageUtils selectByReq(OneCodeReq req){
PageUtils pageUtils = PageUtils.startPage(req.getPage(), req.getRows()).doSelect(
page -> oneCodeMapper.selectByCondition(page, req)
);
return pageUtils;
}
}

View File

@ -5,12 +5,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Maps;
import com.lz.common.utils.NumberUtil;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dao.StaffDao;
import com.lz.modules.app.dto.StaffRoleResp;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.flow.dao.RecordRoleMapper;
import com.lz.modules.flow.dao.StaffRoleDepartmentMapper;
import com.lz.modules.flow.dao.StaffRoleMapper;
@ -18,13 +19,11 @@ import com.lz.modules.flow.entity.RecordRole;
import com.lz.modules.flow.entity.StaffRole;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import com.lz.modules.flow.service.RecordRoleService;
import com.lz.modules.flow.service.StaffRoleDepartmentService;
import com.lz.modules.flow.service.StaffRoleService;
import com.lz.modules.sys.entity.SysMenuEntity;
import com.lz.modules.sys.entity.SysRoleEntity;
import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -70,6 +69,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Autowired
private RecordRoleService recordRoleService;
@Autowired
private DepartmentsStaffRelateService departmentsStaffRelateService;
@Override
public StaffRole selectStaffRoleById(Long id) {
return staffRoleMapper.selectStaffRoleById(id);
@ -196,22 +198,48 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
//根据两个属性进行过滤
.filter(s -> s.getDepartmentParentId().equals("1"))
.collect(Collectors.toList());
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll();
Map<String,DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap = new HashMap<>();
for(DepartmentsStaffRelateEntity d : departmentsStaffRelateEntities){
if(new Integer(1).equals(d.getIsLeader())){
departmentsStaffRelateEntityMap.put(d.getDepartmentId(),d);
}
}
List<StaffEntity> staffEntities = staffDao.selectAll();
Map<Long ,StaffEntity> staffMap = new HashMap<>();
for(StaffEntity staffEntity : staffEntities){
staffMap.put(staffEntity.getId(),staffEntity);
}
List<SysMenuEntity> list = new ArrayList<>();
for(DepartmentsEntity d:parentDepartments){
SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(d.getDepartmentId(),0l),d.getDepartmentName(),0l,"");
getMenuList(tDepartments,entity,list);
for (DepartmentsEntity d : parentDepartments) {
String departmentName = d.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId());
SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(d.getDepartmentId(), 0l),departmentName , 0l, "");
getMenuList(tDepartments, entity, list,departmentsStaffRelateEntityMap,staffMap);
list.add(entity);
}
return list;
}
public void getMenuList(List<DepartmentsEntity> tDepartments,SysMenuEntity sysMenuEntity,List<SysMenuEntity> list) {
public String getSuffix(Map<String,DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap, Map<Long ,StaffEntity> staffMap,String departmentId){
String suffix = "";
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateEntityMap.get(departmentId);
if(departmentsStaffRelateEntity !=null){
StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId());
if(staffEntity !=null ){
suffix = " , "+staffEntity.getName();
}
}
return suffix;
}
public void getMenuList(List<DepartmentsEntity> tDepartments,SysMenuEntity sysMenuEntity,List<SysMenuEntity> list,
Map<String,DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap, Map<Long ,StaffEntity> staffMap) {
for(DepartmentsEntity child : tDepartments) {
if(NumberUtil.objToLongDefault(child.getDepartmentParentId(),0l).equals(sysMenuEntity.getMenuId())){
String departmentName = child.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,child.getDepartmentId());
SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(child.getDepartmentId(),0l),
child.getDepartmentName(),sysMenuEntity.getMenuId(),sysMenuEntity.getName());
getMenuList(tDepartments,entity,list);
departmentName,sysMenuEntity.getMenuId(),sysMenuEntity.getName());
getMenuList(tDepartments,entity,list,departmentsStaffRelateEntityMap,staffMap);
list.add(entity);
}
}

View File

@ -10,7 +10,6 @@ package com.lz.modules.sys.dao.app;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.app.dto.ChartDto;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.OwnResultResp;
@ -57,8 +56,5 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime);
List<ChartDto> departmentDistribution(@Param("monthTime") String monthTime);
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
}

View File

@ -1,6 +1,5 @@
package com.lz.modules.sys.service.app;
import com.lz.modules.app.dto.ChartDto;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import java.util.List;
@ -18,7 +17,7 @@ public interface ChartService {
* @param monthTime
* @return
*/
List<GraphicsStatisticalDto> resultProgressDistribution(int type, String monthTime);
List<GraphicsStatisticalDto> resultProgressDistribution(int type, String monthTime,String departmentId);

View File

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.emun.WorkMsgTypeEnum;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.dto.ChartDto;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.StaffEntity;
@ -12,6 +11,7 @@ import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.OwnResultResp;
import com.lz.modules.app.utils.t.TwoTuple;
import com.lz.modules.flow.entity.Flow;
import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.app.ResultRecord;
@ -81,16 +81,11 @@ public interface ResultRecordService extends IService<ResultRecord> {
*/
List<GraphicsStatisticalDto> staffDistribution(String monthTime);
/**
* 部门等级占比
* @param monthTime
* @return
*/
List<ChartDto> departmentDistribution(String monthTime);
Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments);
ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status);
R reject( ResultRecord resultRecord);
R reject( ResultRecord resultRecord,Integer status);
StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel, List<StaffRoleDto> staffRoleDtos, Long roleId);
}

View File

@ -1,8 +1,6 @@
package com.lz.modules.sys.service.app.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dto.ChartDto;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.enums.ResultRecordStatusEnum;
@ -10,7 +8,6 @@ import com.lz.modules.app.service.StaffService;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ChartService;
import com.lz.modules.sys.service.app.ResultRecordService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -29,15 +26,18 @@ public class ChartServiceImpl implements ChartService {
@Autowired
private StaffService staffService;
@Override
public List<GraphicsStatisticalDto> resultProgressDistribution(int type, String monthTime) {
public List<GraphicsStatisticalDto> resultProgressDistribution(int type, String monthTime,String departmentId) {
List<GraphicsStatisticalDto> dtos = new ArrayList<>();
int total = staffService.count(new QueryWrapper<StaffEntity>().eq("is_delete", 0));
//获取所有人员总数
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
//已提交
int commit = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)
.eq("type", type)
.like("month_time",monthTime)
.ne("status", ResultRecordStatusEnum.CREATE.getStatus()));
//已完成
int finished = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)
.eq("type", type)
@ -45,17 +45,23 @@ public class ChartServiceImpl implements ChartService {
.in("status", ResultRecordStatusEnum.REFUSE.getStatus(),ResultRecordStatusEnum.AGREE.getStatus()));
GraphicsStatisticalDto dto = new GraphicsStatisticalDto();
dto.setCategory("未提交");
dto.setNumber(total-commit);
dtos.add(dto);
dto = new GraphicsStatisticalDto();
dto.setCategory("已完成");
dto.setNumber(finished);
dtos.add(dto);
dto = new GraphicsStatisticalDto();
dto.setCategory("审核中");
dto.setNumber(commit-finished);
dtos.add(dto);
if(total-commit>0){
dto.setCategory("未提交");
dto.setNumber(total-commit);
dtos.add(dto);
}
if(finished>0){
dto = new GraphicsStatisticalDto();
dto.setCategory("已完成");
dto.setNumber(finished);
dtos.add(dto);
}
if(commit-finished>0){
dto = new GraphicsStatisticalDto();
dto.setCategory("审核中");
dto.setNumber(commit-finished);
dtos.add(dto);
}
return dtos;
}

View File

@ -214,49 +214,10 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
public List<Step> getStepList(ResultRecord resultRecord) {
Long staffId = resultRecord.getStaffId();
int type = resultRecord.getType();
String departmentId = resultRecord.getDepartmentId();
List<Step> stepList = new ArrayList<>();
StaffEntity mySelf = staffService.selectStaffById(staffId);
TwoTuple<Long, List<FlowDepartment>> flowInfo = resultRecordService.getFlowInfo(staffId, type);
Long flowId = flowInfo.getFirst();
List<FlowDepartment> list = flowInfo.getSecond();
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
//approvalList = [ME,ONE_D,TWO_D,HR,BOSS]
List<String> approvalList = new ArrayList<>();
Map<String,String> roleNameMap = new HashMap<>();
approvalList.add("ME");
roleNameMap.put("ME",mySelf.getName());
for (FlowRelation flowRelation : flowRelations) {
FlowDepartment flowDepartment = staffEntityMap.get(flowRelation.getChild());
if (flowDepartment != null || flowRelation.getCanReplace() == 0) {
approvalList.add(flowRelation.getChild());
String departmentLevel = flowRelation.getChild();
if(flowDepartment != null ){
StaffEntity flowStaff = staffService.selectStaffById(flowDepartment.getStaffId());
roleNameMap.put(departmentLevel,flowStaff.getName());
}else{
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
Long approvalStaffId = 0l;
for (StaffRole staffRole : staffRoles) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(departmentId);
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
if (StringUtil.isNotBlank(value)) {
approvalStaffId =staffRole.getStaffId();
break;
}
}
}
StaffEntity flowStaff = staffService.selectStaffById(approvalStaffId);
roleNameMap.put(departmentLevel,flowStaff.getName());
}
}
}
log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) + " roleNameMap : " + JSON.toJSONString(roleNameMap));
List<Flow> flows = flowService.selectByFlowId(flowId);
List<FlowRecord> flowRecordList = flowRecordService.selectFlowRecordByResultRecordIdFlowId(resultRecord.getId());
SimpleDateFormat myFmt2 = new SimpleDateFormat("MM-dd HH:mm");
FlowRecord lastFlowRecord = null;
@ -270,8 +231,43 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
stepList.add(new Step(name, time, 1, ""));
}
}
//approvalList = [ME,ONE_D,TWO_D,HR,BOSS]
List<String> approvalList = new ArrayList<>();
Map<String,String> roleNameMap = new HashMap<>();
approvalList.add("ME");
roleNameMap.put("ME",mySelf.getName());
TwoTuple<Long, List<FlowDepartment>> flowInfo = resultRecordService.getFlowInfo(staffId, type);
List<FlowDepartment> list = flowInfo.getSecond();
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
Long flowId = flowInfo.getFirst();
List<Flow> flows = flowService.selectByFlowId(flowId);
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
log.info("flowIndex = " + flowIndex);
for (FlowRelation flowRelation : flowRelations) {
FlowDepartment flowDepartment = staffEntityMap.get(flowRelation.getChild());
if (flowDepartment != null || flowRelation.getCanReplace() == 0) {
approvalList.add(flowRelation.getChild());
String departmentLevel = flowRelation.getChild();
if(flowDepartment != null ){
StaffEntity flowStaff = staffService.selectStaffById(flowDepartment.getStaffId());
roleNameMap.put(departmentLevel,flowStaff.getName());
}else{
Long roleId = flows.get(flowIndex - 1).getRoleId();
List<StaffRoleDto> staffRoleDtos = new ArrayList<>();
StaffEntity approvalStaff = resultRecordService.getApprovalStaff(resultRecord, departmentLevel, staffRoleDtos, roleId);
roleNameMap.put(departmentLevel,approvalStaff.getName());
}
}
}
log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) + " roleNameMap : " + JSON.toJSONString(roleNameMap));
for (int i = flowIndex; i < flowIndex + 10; i++) {
int index = resultRecordService.getDepartmentLevelIndex(flows, i);
if (index < 0 || index >= approvalList.size()) {

View File

@ -7,7 +7,6 @@ import com.lz.common.emun.WorkMsgTypeEnum;
import com.lz.common.utils.*;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
import com.lz.modules.app.dto.ChartDto;
import com.lz.modules.app.dto.EmployeesDto;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.entity.DepartmentsEntity;
@ -466,7 +465,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
} else {
FlowDepartment flowD = staffEntityMap.get(departmentLevel);
if (flowD == null) {
approvalStaff = getApprovalStaff(resultRecord, departmentLevel, approvalStaff, staffRoleDtos, roleId);
approvalStaff = getApprovalStaff(resultRecord, departmentLevel, staffRoleDtos, roleId);
} else {
approvalStaff = staffService.selectStaffById(flowD.getStaffId());
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(), roleId);
@ -516,7 +515,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
}
private StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel, StaffEntity approvalStaff, List<StaffRoleDto> staffRoleDtos, Long roleId) {
@Override
public StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel,List<StaffRoleDto> staffRoleDtos, Long roleId) {
StaffEntity approvalStaff = null;
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
for (StaffRole staffRole : staffRoles) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
@ -585,11 +586,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
resultRecordService.updateResultRecordById(resultRecord);
} else if (req.getStatus() == 5) { // 驳回
status = 5;
r = reject(resultRecord);
r = reject(resultRecord,status);
} else if (req.getStatus() == 7) {
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdType(req.getRecordResultId(), resultRecord.getType());
if (flowRecords != null && flowRecords.size() == 2) { // 表示可以撤回
r = reject(resultRecord);
r = reject(resultRecord,5);
} else if (flowRecords != null && flowRecords.size() > 2) {
return R.error("你的领导己经审批,不能撤回了");
}
@ -621,14 +622,14 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
}
@Override
public R reject( ResultRecord resultRecord){
public R reject( ResultRecord resultRecord,Integer status){
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(resultRecord.getId());
StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId());
StaffEntity approvalStaff = mySelf;
if (flowRecords.size() >= 2) {
FlowRecord secondFlowRecord = flowRecords.get(flowRecords.size() - 2);
resultRecord.setFlowStaffIdRole(secondFlowRecord.getFlowStaffIdRole());
resultRecord.setStatus(5); //更新驳回状态为5
resultRecord.setStatus(status); //更新驳回状态为5
List<StaffRoleDto> list = JSONObject.parseArray(resultRecord.getFlowStaffIdRole(), StaffRoleDto.class);
if (CollectionUtils.isNotEmpty(list)) {
StaffRoleDto staffRoleDto = list.get(0);
@ -693,9 +694,4 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
public List<GraphicsStatisticalDto> staffDistribution(String monthTime) {
return resultRecordMapper.staffDistribution(monthTime);
}
@Override
public List<ChartDto> departmentDistribution(String monthTime) {
return resultRecordMapper.departmentDistribution(monthTime);
}
}

View File

@ -265,12 +265,7 @@
</select>
<select id="staffDistribution" resultType="com.lz.modules.app.dto.GraphicsStatisticalDto">
SELECT count(score_level) number ,CASE score_level when 0 THEN '未知' ELSE score_level END category from lz_result_record where is_delete = 0 and status =4 and type =2 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime} GROUP BY score_level
</select>
<select id="departmentDistribution" resultType="com.lz.modules.app.dto.ChartDto">
SELECT count(score_level) value,score_level name from lz_result_record where is_delete = 0 and status =4 and type =2 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime} GROUP BY score_level
SELECT count(score_level) number ,score_level category from lz_result_record where is_delete = 0 and status =4 and type =2 and score_level !=0 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime} GROUP BY score_level
</select>

View File

@ -89,9 +89,9 @@
<select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentBrand">
select * from equipment_brand where is_delete = 0
<if test="typeId != null">and type_id = #{typeId}</if>
<if test="brand != null and brand != '' ">
AND brand LIKE CONCAT('%',#{brand},'%')
<if test="req.typeId != null">and type_id = #{req.typeId}</if>
<if test="req.brand != null and req.brand != '' ">
AND brand LIKE CONCAT('%',#{req.brand},'%')
</if>
order by rank desc , id desc
</select>

View File

@ -171,60 +171,60 @@
<select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentInfo">
select * from equipment_info where is_delete = 0
<if test="type != null">and type = #{type}</if>
<if test="brandName != null">and brand_name = #{brandName}</if>
<if test="specType != null and specType != '' ">
AND spec_type LIKE CONCAT('%',#{specType},'%')
<if test="req.type != null">and type = #{req.type}</if>
<if test="req.brandName != null">and brand_name = #{req.brandName}</if>
<if test="req.specType != null and req.specType != '' ">
AND spec_type LIKE CONCAT('%',#{req.specType},'%')
</if>
<if test="equipmentState != null">and equipment_state = #{equipmentState}</if>
<if test="user != null and user != '' ">
AND user LIKE CONCAT('%',#{user},'%')
<if test="req.equipmentState != null">and equipment_state = #{req.equipmentState}</if>
<if test="req.user != null and req.user != '' ">
AND user LIKE CONCAT('%',#{req.user},'%')
</if>
<if test="owner != null and owner != '' ">
AND owner LIKE CONCAT('%',#{owner},'%')
<if test="req.owner != null and req.owner != '' ">
AND owner LIKE CONCAT('%',#{req.owner},'%')
</if>
<if test="gmtInStartTime != null and gmtInStartTime != '' ">
AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{gmtInStartTime}, '%Y-%m-%d %H:%i:%S')
<if test="req.gmtInStartTime != null and req.gmtInStartTime != '' ">
AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.gmtInStartTime}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="gmtInEndTime != null and gmtInEndTime != '' ">
AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{gmtInEndTime}, '%Y-%m-%d %H:%i:%S')
<if test="req.gmtInEndTime != null and req.gmtInEndTime != '' ">
AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{req.gmtInEndTime}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="gmtOutStartTime != null and gmtOutStartTime != '' ">
AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{gmtOutStartTime}, '%Y-%m-%d %H:%i:%S')
<if test="req.gmtOutStartTime != null and req.gmtOutStartTime != '' ">
AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.gmtOutStartTime}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="gmtOutEndTime != null and gmtOutEndTime != '' ">
AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{gmtOutEndTime}, '%Y-%m-%d %H:%i:%S')
<if test="req.gmtOutEndTime != null and req.gmtOutEndTime != '' ">
AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{req.gmtOutEndTime}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="mark != null and mark != '' ">
AND mark LIKE CONCAT('%',#{mark},'%')
<if test="req.mark != null and req.mark != '' ">
AND mark LIKE CONCAT('%',#{req.mark},'%')
</if>
<if test="originalCode != null and originalCode != '' ">
AND original_code LIKE CONCAT('%',#{originalCode},'%')
<if test="req.originalCode != null and req.originalCode != '' ">
AND original_code LIKE CONCAT('%',#{req.originalCode},'%')
</if>
<if test="code != null and code != '' ">
AND code LIKE CONCAT('%',#{code},'%')
<if test="req.code != null and req.code != '' ">
AND code LIKE CONCAT('%',#{req.code},'%')
</if>
<if test="qr != null and qr != '' ">
AND qr LIKE CONCAT('%',#{qr},'%')
<if test="req.qr != null and req.qr != '' ">
AND qr LIKE CONCAT('%',#{req.qr},'%')
</if>
<choose>
<when test="other != null and other == 2">
AND count = #{count}-1
<when test="req.other != null and req.other == 2">
AND count = #{req.count}-1
</when>
<otherwise>
AND count = #{count}
AND count = #{req.count}
</otherwise>
</choose>
<if test="other != null and other != '' ">
<if test="other==1">
<if test="req.other != null and req.other != '' ">
<if test="req.other==1">
AND mark !='' and mark is not null
</if>
<if test="other==2">
and code not in (select code from equipment_info where is_delete = 0 AND count = #{count})
<if test="req.other==2">
and code not in (select code from equipment_info where is_delete = 0 AND count = #{req.count})
</if>
<if test="other==3">
<if test="req.other==3">
and equipment_state = 2
</if>

View File

@ -103,12 +103,12 @@
</select>
<select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentSpecs">
<select id="selectByCondition" resultType="EquipmentSpecs">
select * from equipment_specs where is_delete = 0
<if test="typeId != null">and type_id = #{typeId}</if>
<if test="brandId != null">and brand_id = #{brandId}</if>
<if test="specs != null and specs != '' ">
AND specs LIKE CONCAT('%',#{specs},'%')
<if test="req.typeId != null">and type_id = #{req.typeId}</if>
<if test="req.brandId != null">and brand_id = #{req.brandId}</if>
<if test="req.specs != null and req.specs != '' ">
AND specs LIKE CONCAT('%',#{req.specs},'%')
</if>
order by rank desc, id desc
</select>

View File

@ -95,8 +95,8 @@
<select id="selectByCondition" resultType="EquipmentType">
select * from equipment_type where is_delete = 0
<if test="type != null and type != '' ">
AND type LIKE CONCAT('%',#{type},'%')
<if test="req.type != null and req.type != '' ">
AND type LIKE CONCAT('%',#{req.type},'%')
</if>
order by rank desc , id desc

View File

@ -114,5 +114,12 @@
</foreach>)
</insert>
<select id="selectByCondition" resultType="OneCode" >
select * from one_code where is_delete = 0
<if test="req.isPrint != null">and isPrint = #{req.isPrint}</if>
<if test="req.code != null and req.code != ''">and code like CONCAT('%', #{req.code}, '%') </if>
order by id desc
</select>
</mapper>

View File

@ -66,7 +66,7 @@
<update id="deleteTCountById" parameterType="java.lang.Long">
update equipment_t_count set is_delete = 1 where id=#{id} limit 1
update equipment_t_count set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectMaxCount" resultType="com.lz.modules.equipment.entity.TCount">

View File

@ -58,7 +58,7 @@
group by staff_id
</select>
<select id="selectAll" resultType="com.lz.modules.app.entity.DepartmentsStaffRelateEntity">
select * from lz_departments_staff_relate
select * from lz_departments_staff_relate where is_delete = 0
</select>
<select id="selectLastDepartmentByStaffId"