00d3760a 张雷

厂区人员、周报、设备、数字孪生数据接口修改

1 个父辈 06d9148b
package com.skua.modules.digitaltwins;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.core.api.vo.Result;
import com.skua.core.api.vo.TransTreeModel;
import com.skua.core.api.vo.TreeData;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.core.util.TreeUtils;
import com.skua.modules.equipment.entity.EquipmentInfo;
import com.skua.modules.equipment.service.IEquipmentInfoService;
import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo;
import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
/**
* <pre>
* 设备中心
* </pre>
* @author Li Yuanyuan
* @version V0.1, 2024年8月5日 下午5:02:16
*/
@Slf4j
@Api(tags="/数字孪生/设备中心")
@RestController
@RequestMapping("/v1/digital/equipmentAnalysis")
public class DigitalEquipmentController {
@Autowired
private IEquipmentInfoService equipmentInfoService;
@Autowired
private ISysMonitorMetricInfoService sysMonitorMetricInfoService;
/**
* 智能报警按构筑物统计
* @return
* @throws ParseException
* @author Li Yuanyuan, 2024年8月6日 下午2:54:53
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@ApiOperation(value="构筑物设备树", notes="构造构筑物和设备分组树")
@GetMapping(value = "/getEquipmentTree")
public Result<List<TreeData>> getEquipmentTree() throws ParseException{
Result<List<TreeData>> result = new Result<List<TreeData>>();
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
//使用sql统计
String sql = "SELECT id,struct_name AS title,'root' AS pid,'struct' as tree_type FROM sys_struct_dict \r\n" +
"UNION ALL\r\n" +
"SELECT id,equipment_name,structures AS pid,'equipment' as tree_type FROM equipment_info where digital_twins_struct_code!='' and digital_twins_struct_code is not null";
List<Map<String,Object>> dataList = masterDB.queryForList(sql);
List<TransTreeModel> transTreeModels = dataList.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList());
List<TreeData> treeList=TreeUtils.buildTreeForParentId(transTreeModels, "root");
result.setResult(treeList);
result.setSuccess(true);
return result;
}
/**
* 将SysDcodeConfig对象数据填充到TransTreeModel中
* @param dataMap
* @return
*/
private TransTreeModel convertToTreeModel(Map<String,Object> dataMap) {
TransTreeModel transTreeModel = new TransTreeModel();
transTreeModel.setId(ConvertUtils.getString(dataMap.get("id")));
transTreeModel.setPid(ConvertUtils.getString(dataMap.get("pid")));
transTreeModel.setTitle(ConvertUtils.getString(dataMap.get("title")));
Map<String,String> map=new HashMap<String,String>();
map.put("treeType", ConvertUtils.getString(dataMap.get("tree_type")));
transTreeModel.setMap(map);
return transTreeModel;
}
/**
* 根据传入的构筑物id或设备id获取相关设备运行状态
* @param treeType
* @param ids
* @return
*/
@ApiOperation(value = "设备-设备运行状态", notes = "设备-设备运行状态,根据构筑物id/设备id获取设备状态【0停止/1运行/2故障】")
@GetMapping(value = "/queryEquipmentStatusById")
public Result<Map<String,Object>> queryEquipmentStatusById(@RequestParam(value = "treeType") String treeType,@RequestParam(value = "ids") String ids) {
Result<Map<String,Object>> result = new Result<>();
//结果接收对象
Map<String,Object> resultMap = new HashMap<String,Object>();
List<EquipmentInfo> equipmentInfoList = new ArrayList<EquipmentInfo>();
//判断参数类型,如果是构筑物类型,则先获取设备id集合,如果是设备类型,则直接使用
if("struct".equals(treeType)) {
QueryWrapper<EquipmentInfo> equipmentQueryWrapper = new QueryWrapper<>();
equipmentQueryWrapper.isNotNull("digital_twins_struct_code");
equipmentQueryWrapper.ne("digital_twins_struct_code", "");
equipmentInfoList = equipmentInfoService.list(equipmentQueryWrapper);
}else {
List<String> idList = Arrays.asList(ids.split(","));
QueryWrapper<EquipmentInfo> equipmentQueryWrapper = new QueryWrapper<>();
equipmentQueryWrapper.in("id", idList);
equipmentInfoList = equipmentInfoService.list(equipmentQueryWrapper);
}
//获取已关联设备的运行状态点
List<String> equipmentIdList = new ArrayList<>();
for(EquipmentInfo equipmentInfo : equipmentInfoList) {
equipmentIdList.add(equipmentInfo.getId());
}
//根据设备id集合获取设备运行点位
QueryWrapper<SysMonitorMetricInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("metric_type", "1");
queryWrapper.ne("metric_express1", "");
queryWrapper.isNotNull("metric_express1");
queryWrapper.in("equipment_code", equipmentIdList);
List<SysMonitorMetricInfo> sysMonitorMetricInfoList = sysMonitorMetricInfoService.list(queryWrapper);
List<String> equipmentRunPointList = new ArrayList<>();
Map<String,String> equipmentToPointMap = new HashMap<String,String>();
for(SysMonitorMetricInfo sysMonitorMetricInfo : sysMonitorMetricInfoList) {
equipmentRunPointList.add(sysMonitorMetricInfo.getId());
equipmentToPointMap.put(sysMonitorMetricInfo.getEquipmentCode(), sysMonitorMetricInfo.getId());
}
Map<String, Map<String, Object>> tempEquipmentStateMap = sysMonitorMetricInfoService.getEquipRunState(equipmentRunPointList);
for(EquipmentInfo equipmentInfo : equipmentInfoList) {
String equipmentId = equipmentInfo.getId();
String point = equipmentToPointMap.get(equipmentId);
Map<String, Object> tempMap = tempEquipmentStateMap.get(point);
if(tempMap!=null&&tempMap.size()>0) {
resultMap.put(equipmentInfo.getId(), ConvertUtils.getString(tempMap.get("value")));
}else{
resultMap.put(equipmentInfo.getId(), "-1");
}
}
result.setResult(resultMap);
return result;
}
}
......@@ -336,7 +336,7 @@
SELECT
RIGHT(LEFT( v.time, 7 ),2) AS time,
v2.sjwscll,
v2.rwscll,
f.pro_scale AS rwscll,
v2.scsj,
ROUND(v2.scsj*f.pro_scale,2) AS wsclnl,
ROUND( SUM( v.DLHJ ) / 10000, 2 ) AS dl,
......
......@@ -11,7 +11,6 @@ import com.skua.modules.custom.mapper.FCustomReportDatasetMapper;
import com.skua.modules.custom.service.IFCustomReportDatasetService;
import com.skua.modules.custom.vo.DepartWeekReportVO;
import com.skua.modules.custom.vo.FCustomReportDatasetVO;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
......@@ -22,14 +21,12 @@ import com.skua.modules.report.vo.*;
import com.skua.modules.report.vo.largeScreen.*;
import com.skua.tool.util.DateUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModelProperty;
import io.micrometer.core.instrument.util.TimeUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
/**
......@@ -42,6 +39,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
private FCustomReportDatasetMapper mapper;
@Resource
private CommonSqlMapper commonSqlMapper;
private static DecimalFormat df = new DecimalFormat("#.##");
/* (non-Javadoc)
* @see com.skua.modules.custom.service.IFCustomReportDatasetService#getFillReportList()
*/
......@@ -603,21 +602,54 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
public Map<String, Object> reportWeekShow(String dataTime, String week) {
Map<String, Object> map = new HashMap<>();
List<DepartWeekReportVO> list = new ArrayList<>();
List<DepartWeekReportVO> hbList = new ArrayList<>();
Map<String,String> weekMap = getWeekDate(dataTime,week);
String startDate = weekMap.get("start");
String endDate = weekMap.get("end");
String startDateHb = getBeforeDate(startDate,7);
String endDateHb = getBeforeDate(endDate,7);
String field3a24 = ReportConstant.fieldDl + "," + ReportConstant.fieldYj + "," + ReportConstant.fieldWnl;
String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, "", startDate, endDate);
String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, "", startDate, endDate);
list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119);
String dataViewName3a24Hb = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, "", startDateHb, endDateHb);
String dataViewName2119Hb = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, "", startDateHb, endDateHb);
hbList = mapper.getWeekReportData(startDateHb, endDateHb, dataViewName3a24Hb, dataViewName2119Hb);
Map<String, Object> totalMap = getTotalData(list);
Map<String, Object> totalMapHb = getTotalData(hbList);
map.put("start", startDate);//开始时间
map.put("end", endDate);//结束时间
map.put("zclsl", "776");//处理水量合计
map.put("rjclsl", "110.7");//日均处理水量
map.put("rjclsl_hb", "2");//较上周增减量
map.put("dsdh", "0.329");//吨水电耗
map.put("dsdh_hb", "0.002");//吨水电耗较上周增减量
map.put("cnl", "3978.8");//产泥量
String zclsl = totalMap.getOrDefault("zclsl","0").toString();
map.put("zclsl", zclsl);//处理水量合计
String rjclsl = totalMap.getOrDefault("rjclsl","0").toString();
map.put("rjclsl", rjclsl);//日均处理水量
String rjclslHb = totalMapHb.getOrDefault("rjclsl","0").toString();
String rjclslStr = "";//文字描述
String dsdhStr = "";//文字描述
//较上周增减量 rjclsl - rjclslHb
if(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb) > 0){
rjclslStr = "+"+df.format(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb))+"万吨/日";
}else if(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb) < 0){
rjclslStr = df.format(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb))+"万吨/日";
}else{
rjclslStr = "持平";
}
map.put("rjclsl_hb", rjclslStr);
String dsdh = totalMap.getOrDefault("dsdh","0").toString();
map.put("dsdh", dsdh);//吨水电耗
String dsdhHb = totalMapHb.getOrDefault("dsdh","0").toString();
//吨水电耗较上周增减量 dsdh - dsdhHb
if(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb) > 0){
dsdhStr = "+"+df.format(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb))+"Kwh/吨";
}else if(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb) < 0){
dsdhStr = df.format(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb))+"Kwh/吨";
}else{
dsdhStr = "持平";
}
map.put("dsdh_hb", dsdhStr);
String cnl = totalMap.getOrDefault("cnl","0").toString();
map.put("cnl", cnl);//产泥量
map.put("list", list);
map.put("scqk", "(1)本周暂无生产情况说明");//生产情况
map.put("wxqk", "(1)本周暂无设备大修、更新情况");//
......@@ -625,4 +657,46 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
map.put("qt", "(1)本周暂无其他情况说明");//其他
return map;
}
private Map<String, Object> getTotalData(List<DepartWeekReportVO> list) {
Map<String, Object> map = new HashMap<>();
int num = 0;//计数
double zclsl = 0.00;//处理水量
double dsdh = 0.00;//吨水电耗
double cnl = 0.00;//产泥量
for (DepartWeekReportVO departWeekReportVO : list) {
num = num+1;
if(ConvertUtils.isNotEmpty(departWeekReportVO.getClsl())){
zclsl = zclsl + Double.parseDouble(departWeekReportVO.getClsl());
}
if(ConvertUtils.isNotEmpty(departWeekReportVO.getDsdh())){
dsdh = dsdh + Double.parseDouble(departWeekReportVO.getDsdh());
}
if(ConvertUtils.isNotEmpty(departWeekReportVO.getWnl())){
cnl = cnl + Double.parseDouble(departWeekReportVO.getWnl());
}
}
map.put("zclsl", df.format(zclsl));//处理水量合计
map.put("rjclsl", df.format(zclsl/num));//日均处理水量
map.put("dsdh", df.format(dsdh/num));//吨水电耗
map.put("cnl", df.format(cnl));//产泥量
return map;
}
/**
* 获取n天前的日期
* @param day
* @param num
* @return
*/
public static String getBeforeDate(String day,int num) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
try {
LocalDate date = LocalDate.parse(day, formatter);
LocalDate daysAgo = date.minusDays(num);
return daysAgo.format(formatter);
} catch (Exception e) {
return day;
}
}
}
......
......@@ -7,6 +7,7 @@ import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.json.JSONObject;
import com.skua.core.context.BaseContextHandler;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
......@@ -153,6 +154,12 @@ public class EquipmentController {
public Result<List<EquipmentStatisticVO>> statisticsCtrl(EquipmentStatisticDTO equipmentStatisticDTO) throws Exception {
Result<List<EquipmentStatisticVO>> result = new Result<>();
List<EquipmentStatisticVO> voList = new ArrayList<>();
String departs = "";//机构
if(ConvertUtils.isNotEmpty(equipmentStatisticDTO.getDepartId())){
departs = equipmentStatisticDTO.getDepartId();
}else{
departs = BaseContextHandler.getDeparts();
}
// 统计 departId => 所属机构
if (equipmentStatisticDTO.getShowDepartId()) {
List<Map<String, Object>> departIdMapList = WrapperFactory.joinWrapper()
......@@ -162,6 +169,7 @@ public class EquipmentController {
.innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
.where()
.eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
.in(true,"depart_id", Arrays.asList(departs.split(",")))
.groupBy(true, "depart_id")
.queryWrapperForList();
EquipmentStatisticVO departIdVO = new EquipmentStatisticVO();
......@@ -190,6 +198,7 @@ public class EquipmentController {
.innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
.where()
.eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
.in(true,"depart_id", Arrays.asList(departs.split(",")))
.groupBy(true, "asset_type")
.queryWrapperForList();
EquipmentStatisticVO assetTypeVO = new EquipmentStatisticVO();
......@@ -215,6 +224,7 @@ public class EquipmentController {
.innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
.where()
.eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
.in(true,"depart_id", Arrays.asList(departs.split(",")))
.eq(true, "asset_type", "assets-material-type")
.groupBy(true, "supplies_type")
.queryWrapperForList();
......@@ -241,6 +251,7 @@ public class EquipmentController {
.leftJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
.where()
.eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
.in(true,"depart_id", Arrays.asList(departs.split(",")))
.groupBy(true, "equipment_top_type")
.queryWrapperForList();
EquipmentStatisticVO equipmentTypeVO = new EquipmentStatisticVO();
......@@ -479,9 +490,8 @@ public class EquipmentController {
.like(StringUtils.isNotEmpty(equipmentCode), "equipment_code", equipmentCode)
.eq(StringUtils.isNotEmpty(equipmentStatus), "equipment_status", equipmentStatus)
.like(StringUtils.isNotEmpty(installPosition), EquipmentInfo::getInstallPosition, installPosition)
.eq(StringUtils.isNotEmpty(equipmentDTO.getEquipmentInfo().getId()), "equipment_info.id", equipmentDTO.getEquipmentInfo().getId());
.eq(StringUtils.isNotEmpty(equipmentDTO.getEquipmentInfo().getId()), "equipment_info.id", equipmentDTO.getEquipmentInfo().getId())
.orderBy(true,false,"equipment_info.create_time");
Page<Map<String, Object>> mapPage = (Page<Map<String, Object>>) base.queryForPage(new Page<>(equipmentDTO.getPageNo(), equipmentDTO.getPageSize()));
// 转义
......@@ -795,4 +805,19 @@ public class EquipmentController {
return result;
}
@ApiOperation(value = "设备台账-孪生体批量配置", notes = "设备台账-孪生体批量配置")
@PostMapping(value = "/batchConfigDigitaltwins")
public Result<String> batchConfigDigitaltwins(@RequestBody JSONObject jsonObject) {
Result<String> result = new Result<>();
try {
equipmentInfoService.batchConfigDigitaltwins(jsonObject);
result.setSuccess(true);
result.setResult("批量配置成功");
} catch (Exception e) {
e.printStackTrace();
result.error500("批量配置失败");
}
return result;
}
}
......
......@@ -34,4 +34,9 @@ public class EquipmentStatisticDTO {
*/
private String isSpecial;
/**
* 所属厂区
*/
private String departId;
}
......
......@@ -290,4 +290,7 @@ public class EquipmentInfo {
@ApiModelProperty(value = "企业负责人")
private String enterpriseManager;
@ApiModelProperty(value = "数字孪生模型区域编码")
private java.lang.String digitalTwinsStructCode;
}
......
......@@ -23,4 +23,5 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
*/
List<EquipmentInfoForMonitorVO> queryCustomPageList(Page<EquipmentInfoForMonitorVO> pageList, EquipmentInfoForMonitorVO equipmentInfoForMonitorVO);
void clearDigitaltwins();
}
......
......@@ -23,6 +23,9 @@
</if>
<if test="equipmentInfoForMonitorVO.equipmentName!=null and equipmentInfoForMonitorVO.equipmentName!=''">
and a.equipment_name LIKE CONCAT(CONCAT('%', #{equipmentInfoForMonitorVO.equipmentName}),'%')
</if>
</if>
</select>
</mapper>
\ No newline at end of file
<update id="clearDigitaltwins">
update equipment_info set digital_twins_struct_code = ''
</update>
</mapper>
......
......@@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.core.api.vo.Result;
......@@ -84,4 +85,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
void importExcel(MultipartFile file, String departId) throws Exception;
String reCreateQrCode(String id);
void batchConfigDigitaltwins(JSONObject jsonObject);
}
......
......@@ -9,6 +9,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.excel.CustomExcelUtil;
......@@ -340,4 +341,23 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
return qrCodePath;
}
@Override
public void batchConfigDigitaltwins(JSONObject json) {
List<String> idList = (List<String>)json.get("equip_id_list");
//清空孪生体配置数据
equipmentInfoMapper.clearDigitaltwins();
//组装需要更新的设备集合
List<EquipmentInfo> equipmentInfoList = new ArrayList<EquipmentInfo>();
EquipmentInfo equipmentInfo = null;
for(String id : idList) {
equipmentInfo = new EquipmentInfo();
equipmentInfo.setId(id);
equipmentInfo.setDigitalTwinsStructCode(id);
equipmentInfoList.add(equipmentInfo);
}
if(equipmentInfoList!=null&&equipmentInfoList.size()>0) {
this.updateBatchById(equipmentInfoList);
}
}
}
......
......@@ -113,6 +113,8 @@ public class ShiroConfig {
// filterChainDefinitionMap.put("/v1/report/reportDisplay/**", "anon");
filterChainDefinitionMap.put("/v1/sys/factoryMonitorData/**", "anon");
filterChainDefinitionMap.put("/sys/dict/getDictItems/**", "anon");
//数字孪生设备、孪生体批量关联
filterChainDefinitionMap.put("/equipment/batchConfigDigitaltwins", "anon");
//性能监控
filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
......@@ -124,6 +126,7 @@ public class ShiroConfig {
//flowable工作流权限过滤
filterChainDefinitionMap.put("/process/diagram-view", "anon");
filterChainDefinitionMap.put("/process/resource-view","anon");//工作流流程图
// filterChainDefinitionMap.put("/report/headerConfig/**","anon");
filterChainDefinitionMap.put("/v1/monitor/**","anon");//点表初始化导入
filterChainDefinitionMap.put("/example/**","anon");
......
......@@ -88,14 +88,6 @@ public class SysFactoryUserInfoController {
HttpServletRequest req) {
Result<IPage<SysFactoryUserInfo>> result = new Result<IPage<SysFactoryUserInfo>>();
Page<SysFactoryUserInfo> page = new Page<SysFactoryUserInfo>(pageNo, pageSize);
// QueryWrapper<SysFactoryUserInfo> queryWrapper = QueryGenerator.initQueryWrapper(sysFactoryUserInfo, req.getParameterMap());
// String departIds = BaseContextHandler.getDeparts();
// String[] departIdArray = departIds.split(",");
// if(StringUtils.isEmpty(sysFactoryUserInfo.getDepartId())&&StringUtils.isNotBlank(departIds)) {
// queryWrapper.in("depart_id", departIdArray);
// }
// queryWrapper.eq(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId()),"depart_id",sysFactoryUserInfo.getDepartId());
// IPage<SysFactoryUserInfo> pageList = sysFactoryUserInfoService.page(page, queryWrapper);
IPage<SysFactoryUserInfo> pageList = sysFactoryUserInfoService.getPage(page, sysFactoryUserInfo);
result.setSuccess(true);
result.setResult(pageList);
......@@ -109,13 +101,6 @@ public class SysFactoryUserInfoController {
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = new HashMap<>();
int female = 0;int male = 0;
// QueryWrapper<SysFactoryUserInfo> queryWrapper = new QueryWrapper<>();
// String departIds = BaseContextHandler.getDeparts();
// String[] departIdArray = departIds.split(",");
// if(StringUtils.isEmpty(sysFactoryUserInfo.getDepartId())&&StringUtils.isNotBlank(departIds)) {
// queryWrapper.in("depart_id", departIdArray);
// }
// queryWrapper.eq(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId()),"depart_id",sysFactoryUserInfo.getDepartId());
List<SysFactoryUserInfo> list = sysFactoryUserInfoService.getList(sysFactoryUserInfo);
if(list.size()>0){
map.put("total", list.size());
......
......@@ -3,6 +3,7 @@ package com.skua.modules.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.system.entity.SysFactoryUserInfo;
import com.skua.modules.system.entity.SysUser;
import com.skua.modules.system.mapper.SysFactoryUserInfoMapper;
......@@ -24,6 +25,8 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf
@Autowired
private SysFactoryUserInfoMapper sysFactoryUserInfoMapper;
@Autowired
private ICommonSqlService commonSqlService;
@Override
public IPage<SysFactoryUserInfo> getPage(Page<SysFactoryUserInfo> page, SysFactoryUserInfo sysFactoryUserInfo) {
......@@ -38,7 +41,8 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf
List<SysFactoryUserInfo> list = new ArrayList<>();
String departIds = BaseContextHandler.getDeparts();
if(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId())){
departIds = sysFactoryUserInfo.getDepartId();
String departId = sysFactoryUserInfo.getDepartId();
departIds = commonSqlService.getChildDepartId(departId);
}
list = sysFactoryUserInfoMapper.getList(departIds,sysFactoryUserInfo.getUserName());
return list;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!