fms接口和bug修复
This commit is contained in:
parent
2221b93f3f
commit
d52f8bbec5
@ -1,12 +1,20 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.controller;
|
||||
|
||||
import cn.hutool.crypto.digest.HMac;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.util.Base64;
|
||||
import com.zhgd.xmgl.util.DateUtil;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -14,9 +22,12 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -215,4 +226,12 @@ public class SystemUserController {
|
||||
return systemUserService.deleteZjwjUser(systemUser);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "调外部接口,获取FMS监控⼤屏接⼊url", notes = "调外部接口,获取FMS监控⼤屏接⼊url", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "account", value = "账号", paramType = "query", required = true, dataType = "String")
|
||||
@GetMapping(value = "/getFmsMonitoringLargeScreenAccessUrl")
|
||||
public Result<Map<String, Object>> getFmsMonitoringLargeScreenAccessUrl(@RequestParam Map<String, Object> map) {
|
||||
HashMap<String, Object> rsMap = systemUserService.getFmsMonitoringLargeScreenAccessUrl(map);
|
||||
return Result.success(rsMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -107,14 +107,6 @@ public class SystemUser implements Serializable {
|
||||
@ApiModelProperty(value = "clientId")
|
||||
private java.lang.String clientId;
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@ApiModelProperty(value = "角色ID")
|
||||
private java.lang.Long roleId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private java.lang.String jobName;
|
||||
|
||||
/**
|
||||
* 三江统一登录的用户id
|
||||
@ -126,6 +118,17 @@ public class SystemUser implements Serializable {
|
||||
*/
|
||||
private String sjUnifiedAuthenticationOrgIds;
|
||||
|
||||
@ApiModelProperty(value = "fms监控大屏key")
|
||||
private String fmsMonitoringScreenKey;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "角色ID")
|
||||
private java.lang.Long roleId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private java.lang.String jobName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String projectSn;
|
||||
|
||||
@ -137,4 +140,5 @@ public class SystemUser implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private java.lang.String roleName;
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.entity.sj.JwtPayloadUserInfo;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -63,4 +63,7 @@ public interface ISystemUserService extends IService<SystemUser> {
|
||||
Result deleteZjwjUser(SystemUser systemUser);
|
||||
|
||||
Result<List<SystemUser>> getZjwjUserList(SystemUser systemUser);
|
||||
|
||||
HashMap<String, Object> getFmsMonitoringLargeScreenAccessUrl(Map<String, Object> map);
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,11 @@ package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.crypto.digest.HMac;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -88,6 +93,16 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
private ProjectExternalSystemServiceMapper projectExternalSystemServiceMapper;
|
||||
@Value("${mqtt-scope}")
|
||||
private String scope;
|
||||
/**
|
||||
* 接⼝地址host
|
||||
*/
|
||||
@Value("${fmsMonitoringScreenRequestHost:}")
|
||||
private String fmsMonitoringScreenRequestHost;
|
||||
/**
|
||||
* 施⼯监控⼤屏⻚⾯地址
|
||||
*/
|
||||
@Value("${fmsMonitoringScreenPageUrl:}")
|
||||
private String fmsMonitoringScreenPageUrl;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getToken(Map<String, Object> map) {
|
||||
@ -933,4 +948,62 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
List<SystemUser> list = systemUserMapper.getZjwjUserList(systemUser);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getFmsMonitoringLargeScreenAccessUrl(Map<String, Object> map) {
|
||||
//生成签名
|
||||
/*
|
||||
1.拼接签名字符串,由date与请求行拼接而成,以换行间隔,示例date: Thu, 22 Jun 2017 17:15:21 GMT\nGET /requests HTTP/1.1
|
||||
2.对拼接的签名字符串,进行HMAC-SHA256签名,签名需要用到的key由FMS提供
|
||||
3.对HMAC-SHA256的结果进行base64编码,得到signature值
|
||||
签名注意事项:
|
||||
请求参数需要分别进行url编码(UTF-8)
|
||||
*/
|
||||
String account = MapUtils.getString(map, "account");
|
||||
if (StringUtils.isBlank(account)) {
|
||||
throw new OpenAlertException("account不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(fmsMonitoringScreenRequestHost)) {
|
||||
throw new OpenAlertException("fmsMonitoringScreenHost未配置");
|
||||
}
|
||||
SystemUser systemUser = systemUserMapper.selectOne(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getAccount, account));
|
||||
if (systemUser == null) {
|
||||
throw new OpenAlertException("查询不到此用户");
|
||||
}
|
||||
|
||||
String key = systemUser.getFmsMonitoringScreenKey();
|
||||
|
||||
Date now = new Date();
|
||||
String gmtTime = com.zhgd.xmgl.util.DateUtil.getGMTTime(now);
|
||||
String algorithm = "hmac-sha256";
|
||||
String request_url = "/api-gateway/v2/system/getAccessToken";
|
||||
String request_line = "GET " + request_url + " HTTP/1.1";
|
||||
String content = "date: " + gmtTime + "\n" + request_line;
|
||||
HMac mac = new HMac(HmacAlgorithm.HmacSHA256, key.getBytes());
|
||||
String signature = com.zhgd.xmgl.util.Base64.encodeBase64(mac.digest(content));
|
||||
|
||||
//获取access_token
|
||||
//hmac username="{用户名}", algorithm="hmac-sha256", headers="date request-line", signature="{签名}"
|
||||
String authorization = "hmac username=\"" + account + "\", algorithm=\"" + algorithm + "\", headers=\"date request-line\", signature=\"" + signature + "\"";
|
||||
String accessUrl = fmsMonitoringScreenRequestHost + "/api-gateway/v2/system/getAccessToken";
|
||||
log.info("accessUrl:{},authorization:{},date:{}", accessUrl, authorization, gmtTime);
|
||||
String rs = HttpRequest.get(accessUrl)
|
||||
.header("authorization", authorization)
|
||||
.header("date", gmtTime)
|
||||
.execute().body();
|
||||
log.info("rs(获取access_token):{}", rs);
|
||||
JSONObject tokenJsonObject = com.alibaba.fastjson.JSON.parseObject(rs);
|
||||
if (!tokenJsonObject.getBoolean("success")) {
|
||||
throw new OpenAlertException(MessageUtil.get("thirdErr"));
|
||||
}
|
||||
JSONObject dataJSONObject = tokenJsonObject.getJSONObject("data");
|
||||
String token = dataJSONObject.getString("token");
|
||||
|
||||
//返回url
|
||||
String url = fmsMonitoringScreenPageUrl + token;
|
||||
HashMap<String, Object> rsMap = new HashMap<>();
|
||||
rsMap.put("url", url);
|
||||
return rsMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -57,11 +57,11 @@ public class GtMaterialContractPaymentRecord implements Serializable {
|
||||
@ApiModelProperty(value = "付款人")
|
||||
private java.lang.String payer;
|
||||
/**
|
||||
* 付款状态
|
||||
* 付款状态(1已付款2未付款)
|
||||
*/
|
||||
@Excel(name = "付款状态", width = 15)
|
||||
@ApiModelProperty(value = "付款状态")
|
||||
private java.lang.String paymentStatus;
|
||||
@Excel(name = "付款状态(1已付款2未付款)", width = 15)
|
||||
@ApiModelProperty(value = "付款状态(1已付款2未付款)")
|
||||
private Integer paymentStatus;
|
||||
/**
|
||||
* 实际付款金额
|
||||
*/
|
||||
@ -128,4 +128,6 @@ public class GtMaterialContractPaymentRecord implements Serializable {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateTime;
|
||||
@ApiModelProperty(value = "不能修改")
|
||||
private Boolean unmodifiable;
|
||||
}
|
||||
|
||||
@ -139,9 +139,12 @@ public class GtMaterialInOutWarehouse implements Serializable {
|
||||
@ApiModelProperty(value = "出库审批单")
|
||||
private java.lang.String outboundApprovalForm;
|
||||
|
||||
@ApiModelProperty(value = "部门班组id")
|
||||
@ApiModelProperty(value = "部门或班组id")
|
||||
private Long gtMaterialDepartmentTeamId;
|
||||
|
||||
@ApiModelProperty(value = "部门班组类型(1部门2班组)")
|
||||
private Integer gtMaterialDepartmentTeamType;
|
||||
|
||||
@ApiModelProperty(value = "作业单位id")
|
||||
private Long gtMaterialOperatingUnitId;
|
||||
|
||||
@ -179,8 +182,8 @@ public class GtMaterialInOutWarehouse implements Serializable {
|
||||
@ApiModelProperty(value = "作业单位名称")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String unitName;
|
||||
@ApiModelProperty(value = "班组名称")
|
||||
@ApiModelProperty(value = "部门或班组名称")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String team;
|
||||
private java.lang.String departmentTeamName;
|
||||
}
|
||||
|
||||
|
||||
@ -94,4 +94,7 @@ public class GtMaterialPurchaseDemandPlanning implements Serializable {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "物料单位(1斤、2克、3千克、4吨)")
|
||||
private Integer materialUnit;
|
||||
}
|
||||
|
||||
@ -43,11 +43,11 @@ public class GtMaterialTender implements Serializable {
|
||||
@ApiModelProperty(value = "招标单位")
|
||||
private java.lang.String tenderUnit;
|
||||
/**
|
||||
* 采购方式
|
||||
* 采购方式(1询价、2竞争性谈判、3直接委托、4单一来源、5其他合法采购方式)
|
||||
*/
|
||||
@Excel(name = "采购方式", width = 15)
|
||||
@ApiModelProperty(value = "采购方式")
|
||||
private java.lang.String purchasingMethod;
|
||||
@Excel(name = "采购方式(1询价、2竞争性谈判、3直接委托、4单一来源、5其他合法采购方式)", width = 15)
|
||||
@ApiModelProperty(value = "采购方式(1询价、2竞争性谈判、3直接委托、4单一来源、5其他合法采购方式)")
|
||||
private Integer purchasingMethod;
|
||||
/**
|
||||
* 招标类型
|
||||
*/
|
||||
|
||||
@ -2,16 +2,19 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.gt.mapper.GtMaterialInOutWarehouseMapper">
|
||||
<select id="queryPageList" resultType="com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse">
|
||||
SELECT
|
||||
DISTINCT io.*,
|
||||
SELECT DISTINCT io.*,
|
||||
mv.vendor_name,
|
||||
dt.team,
|
||||
ou.unit_name
|
||||
FROM
|
||||
`gt_material_in_out_warehouse` io
|
||||
CASE WHEN io.gt_material_department_team_type = 1 THEN di.department_name WHEN
|
||||
io.gt_material_department_team_type = 2 THEN ti.team_name END
|
||||
as department_team_name,
|
||||
ei.enterprise_name as unit_name
|
||||
FROM `gt_material_in_out_warehouse` io
|
||||
LEFT JOIN gt_material_vendor mv ON io.gt_material_vendor_id = mv.id
|
||||
LEFT JOIN gt_material_department_team dt ON io.gt_material_department_team_id = dt.id
|
||||
LEFT JOIN gt_material_operating_unit ou ON io.gt_material_operating_unit_id = ou.id
|
||||
LEFT JOIN enterprise_info ei ON io.gt_material_operating_unit_id = ei.id
|
||||
LEFT JOIN department_info di
|
||||
ON io.gt_material_department_team_id = di.id and io.gt_material_department_team_type = 1
|
||||
LEFT JOIN team_info ti
|
||||
ON io.gt_material_department_team_id = ti.id and io.gt_material_department_team_type = 2
|
||||
LEFT JOIN gt_material_point_check_into_warehouse_detail d ON d.gt_material_in_out_warehouse_id = io.id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
@ -2,6 +2,10 @@ package com.zhgd.xmgl.modules.project.controller;
|
||||
|
||||
import cn.hutool.core.img.ImgUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.HMac;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@ -16,10 +20,8 @@ import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectConfig;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectConfigService;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.util.ExcelUtils;
|
||||
import com.zhgd.xmgl.util.ImageUtils;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import com.zhgd.xmgl.util.RundeSafeyHatUtils;
|
||||
import com.zhgd.xmgl.util.Base64;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@ -29,19 +31,14 @@ import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @program: wisdomSite
|
||||
|
||||
@ -23,6 +23,7 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -189,13 +190,21 @@ public class ProjectController {
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<Project> edit(@RequestBody Project project) {
|
||||
Result<Project> result = new Result<Project>();
|
||||
LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<Project>().eq(Project::getProjectSn, project.getProjectSn());
|
||||
String projectSn = project.getProjectSn();
|
||||
LambdaQueryWrapper<Project> queryWrapper = null;
|
||||
if (StringUtils.isNotBlank(projectSn)) {
|
||||
queryWrapper = new LambdaQueryWrapper<Project>().eq(Project::getProjectSn, projectSn);
|
||||
} else if (project.getProjectId() != null) {
|
||||
queryWrapper = new LambdaQueryWrapper<Project>().eq(Project::getProjectId, project.getProjectId());
|
||||
} else {
|
||||
throw new RuntimeException("请求参数异常");
|
||||
}
|
||||
Project projectEntity = projectService.getOne(queryWrapper);
|
||||
if (projectEntity == null) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
} else {
|
||||
boolean ok = projectService.update(project, queryWrapper);
|
||||
redisRepository.del("projectInfoBySn:" + project.getProjectSn());
|
||||
redisRepository.del("projectInfoBySn:" + projectSn);
|
||||
if (ok) {
|
||||
result.successMsg(MessageUtil.get("editSucess"));
|
||||
}
|
||||
|
||||
@ -652,15 +652,15 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
||||
Date finishDate = progressTask.getFinishDate();
|
||||
Date actualStartDate = progressTask.getActualStartDate();
|
||||
Date actualFinishDate = progressTask.getActualFinishDate();
|
||||
long datePeriod = finishDate.getTime() - startDate.getTime();
|
||||
long datePeriod = DateUtil.betweenDay(startDate, finishDate, true);
|
||||
int status;
|
||||
//状态 1:提前 2正常 3延迟
|
||||
if (actualStartDate != null && actualFinishDate != null && actualFinishDate.getTime() - actualStartDate.getTime() < datePeriod) {
|
||||
if (actualStartDate != null && actualFinishDate != null && DateUtil.betweenDay(actualStartDate, actualFinishDate, true) < datePeriod) {
|
||||
//1:提前
|
||||
status = 1;
|
||||
} else if ((actualStartDate == null && actualFinishDate == null) ||
|
||||
(actualStartDate != null && actualFinishDate != null && actualFinishDate.getTime() - actualStartDate.getTime() == datePeriod) ||
|
||||
(actualStartDate != null && actualFinishDate == null && System.currentTimeMillis() - actualStartDate.getTime() <= datePeriod)) {
|
||||
(actualStartDate != null && actualFinishDate != null && DateUtil.betweenDay(actualStartDate, actualFinishDate, true) == datePeriod) ||
|
||||
(actualStartDate != null && actualFinishDate == null && DateUtil.betweenDay(new Date(), actualStartDate, true) <= datePeriod)) {
|
||||
//2正常
|
||||
status = 2;
|
||||
} else {
|
||||
|
||||
@ -7,6 +7,7 @@ import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -37,7 +38,7 @@ import java.util.Map;
|
||||
public class DepartmentInfoController {
|
||||
@Autowired
|
||||
private IDepartmentInfoService departmentInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param departmentInfo
|
||||
@ -60,8 +61,8 @@ public class DepartmentInfoController {
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param departmentInfo
|
||||
* @return
|
||||
@ -73,8 +74,8 @@ public class DepartmentInfoController {
|
||||
departmentInfoService.saveDepartmentInfo(departmentInfo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param departmentInfo
|
||||
* @return
|
||||
@ -86,8 +87,8 @@ public class DepartmentInfoController {
|
||||
departmentInfoService.editDepartmentInfo(departmentInfo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param
|
||||
* @return
|
||||
@ -114,14 +115,25 @@ public class DepartmentInfoController {
|
||||
return Result.success(departmentInfoService.getDepartmentInfoList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = " 列表查询项目下所有劳务人员部门信息", notes = "列表查询项目下所有劳务人员部门信息", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/selectDepartmentDetailsList")
|
||||
public Result<List<EntityMap>> selectDepartmentDetailsList(@RequestBody Map<String,Object> map) {
|
||||
return Result.success(departmentInfoService.selectDepartmentDetailsList(map));
|
||||
}
|
||||
@ApiOperation(value = " 列表查询项目下所有劳务人员部门信息", notes = "列表查询项目下所有劳务人员部门信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/selectDepartmentDetailsList")
|
||||
public Result<List<EntityMap>> selectDepartmentDetailsList(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(departmentInfoService.selectDepartmentDetailsList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "列表查询项目下所有部门和班组信息", notes = "列表查询项目下所有部门和班组信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "所属企业", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "departmentTeamName", value = "部门或班组名称", paramType = "query", required = false, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/queryDepartmentAndTeamList")
|
||||
public Result<List<GtMaterialInOutWarehouse>> queryDepartmentAndTeamList(@RequestParam Map<String, Object> map) {
|
||||
return Result.success(departmentInfoService.queryDepartmentAndTeamList(map));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -27,12 +28,14 @@ public interface DepartmentInfoMapper extends BaseMapper<DepartmentInfo> {
|
||||
|
||||
List<DepartmentInfo> selectDepartmentInfoList(Map<String, Object> map);
|
||||
|
||||
List<EntityMap> selectDepartmentInfoBySnList(@Param("projectSn")String projectSn);
|
||||
List<EntityMap> selectDepartmentInfoBySnList(@Param("projectSn") String projectSn);
|
||||
|
||||
@MapKey("enterpriseDepartmentName")
|
||||
Map<String, Object> getDepartmentInfoMapBySn(@Param("projectSn")String projectSn);
|
||||
Map<String, Object> getDepartmentInfoMapBySn(@Param("projectSn") String projectSn);
|
||||
|
||||
List<EntityMap> selectDepartmentDetailsList(Map<String, Object> map);
|
||||
|
||||
EntityMap getDepartmentInfo(@Param("departmentId")Long departmentId);
|
||||
EntityMap getDepartmentInfo(@Param("departmentId") Long departmentId);
|
||||
|
||||
List<GtMaterialInOutWarehouse> queryDepartmentAndTeamList(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -61,4 +61,20 @@
|
||||
from department_info a
|
||||
where a.id=#{departmentId}
|
||||
</select>
|
||||
|
||||
<select id="queryDepartmentAndTeamList" resultType="com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse">
|
||||
select t.* from (
|
||||
select di.id as gtMaterialDepartmentTeamId,di.department_name as department_team_name,1 as
|
||||
gt_material_department_team_type from department_info di
|
||||
<where>
|
||||
di.project_sn=#{projectSn} and di.enterprise_id=#{enterpriseId}
|
||||
</where>
|
||||
union all
|
||||
select ti.id as gtMaterialDepartmentTeamId,ti.team_name as department_team_name,2 as
|
||||
gt_material_department_team_type from team_info ti
|
||||
<where>
|
||||
ti.project_sn=#{projectSn} and ti.enterprise_id=#{enterpriseId}
|
||||
</where>
|
||||
)t
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.worker.service;
|
||||
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -19,7 +20,7 @@ public interface IDepartmentInfoService extends IService<DepartmentInfo> {
|
||||
|
||||
void batchDeleteDepartmentInfo(String projectSn);
|
||||
|
||||
Map<String,Object> getDepartmentInfoList(Map<String, Object> map);
|
||||
Map<String, Object> getDepartmentInfoList(Map<String, Object> map);
|
||||
|
||||
DepartmentInfo saveDepartmentInfo(DepartmentInfo departmentInfo);
|
||||
|
||||
@ -28,4 +29,6 @@ public interface IDepartmentInfoService extends IService<DepartmentInfo> {
|
||||
List<Map<String, Object>> selectEnterpriseDepartmentList(Map<String, Object> map);
|
||||
|
||||
List<EntityMap> selectDepartmentDetailsList(Map<String, Object> map);
|
||||
|
||||
List<GtMaterialInOutWarehouse> queryDepartmentAndTeamList(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.worker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.async.AsyncWorker;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.DepartmentInfoMapper;
|
||||
@ -12,8 +14,6 @@ import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -23,7 +23,7 @@ import java.util.Map;
|
||||
/**
|
||||
* @Description: 劳务人员部门
|
||||
* @author: pds
|
||||
* @date: 2020-08-13
|
||||
* @date: 2020-08-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -39,14 +39,14 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
@Override
|
||||
public void removeDepartmentInfo(String id) {
|
||||
DepartmentInfo departmentInfo = departmentInfoMapper.selectById(id);
|
||||
if(departmentInfo==null){
|
||||
if (departmentInfo == null) {
|
||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||
}
|
||||
QueryWrapper<WorkerInfo> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(WorkerInfo::getProjectSn,departmentInfo.getProjectSn())
|
||||
.eq(WorkerInfo::getDepartmentId,departmentInfo.getId());
|
||||
int count=workerInfoMapper.selectCount(queryWrapper);
|
||||
if(count>0){
|
||||
QueryWrapper<WorkerInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(WorkerInfo::getProjectSn, departmentInfo.getProjectSn())
|
||||
.eq(WorkerInfo::getDepartmentId, departmentInfo.getId());
|
||||
int count = workerInfoMapper.selectCount(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new OpenAlertException(MessageUtil.get("notDeleteDepartmentErr"));
|
||||
}
|
||||
departmentInfoMapper.deleteById(id);
|
||||
@ -54,53 +54,53 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
|
||||
@Override
|
||||
public void batchDeleteDepartmentInfo(String projectSn) {
|
||||
QueryWrapper<DepartmentInfo> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(DepartmentInfo::getProjectSn,projectSn);
|
||||
QueryWrapper<DepartmentInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(DepartmentInfo::getProjectSn, projectSn);
|
||||
departmentInfoMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getDepartmentInfoList(Map<String, Object> map) {
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
List<DepartmentInfo> list=departmentInfoMapper.getDepartmentInfoList(map);
|
||||
data.put("list",list);
|
||||
int totalWorkerNum=0;
|
||||
for (DepartmentInfo departmentInfo:list){
|
||||
totalWorkerNum=totalWorkerNum+departmentInfo.getWorkerNum();
|
||||
public Map<String, Object> getDepartmentInfoList(Map<String, Object> map) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
List<DepartmentInfo> list = departmentInfoMapper.getDepartmentInfoList(map);
|
||||
data.put("list", list);
|
||||
int totalWorkerNum = 0;
|
||||
for (DepartmentInfo departmentInfo : list) {
|
||||
totalWorkerNum = totalWorkerNum + departmentInfo.getWorkerNum();
|
||||
}
|
||||
data.put("totalWorkerNum",totalWorkerNum);
|
||||
data.put("totalDepartmentNum",list.size());
|
||||
data.put("totalWorkerNum", totalWorkerNum);
|
||||
data.put("totalDepartmentNum", list.size());
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepartmentInfo saveDepartmentInfo(DepartmentInfo departmentInfo) {
|
||||
QueryWrapper<DepartmentInfo> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(DepartmentInfo::getProjectSn,departmentInfo.getProjectSn())
|
||||
.eq(DepartmentInfo::getDepartmentName,departmentInfo.getDepartmentName());
|
||||
int count=departmentInfoMapper.selectCount(queryWrapper);
|
||||
if(count>0){
|
||||
QueryWrapper<DepartmentInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(DepartmentInfo::getProjectSn, departmentInfo.getProjectSn())
|
||||
.eq(DepartmentInfo::getDepartmentName, departmentInfo.getDepartmentName());
|
||||
int count = departmentInfoMapper.selectCount(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new OpenAlertException(MessageUtil.get("existsDepartmentErr"));
|
||||
}
|
||||
departmentInfoMapper.insert(departmentInfo);
|
||||
//上传外部平台
|
||||
asyncWorker.sendAddOrUpdateTeam(null,departmentInfo,2);
|
||||
asyncWorker.sendAddOrUpdateTeam(null, departmentInfo, 2);
|
||||
return departmentInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepartmentInfo editDepartmentInfo(DepartmentInfo departmentInfo) {
|
||||
QueryWrapper<DepartmentInfo> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(DepartmentInfo::getProjectSn,departmentInfo.getProjectSn())
|
||||
.eq(DepartmentInfo::getDepartmentName,departmentInfo.getDepartmentName())
|
||||
.ne(DepartmentInfo::getId,departmentInfo.getId());
|
||||
int count=departmentInfoMapper.selectCount(queryWrapper);
|
||||
if(count>0){
|
||||
QueryWrapper<DepartmentInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(DepartmentInfo::getProjectSn, departmentInfo.getProjectSn())
|
||||
.eq(DepartmentInfo::getDepartmentName, departmentInfo.getDepartmentName())
|
||||
.ne(DepartmentInfo::getId, departmentInfo.getId());
|
||||
int count = departmentInfoMapper.selectCount(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new OpenAlertException(MessageUtil.get("existsDepartmentErr"));
|
||||
}
|
||||
departmentInfoMapper.updateById(departmentInfo);
|
||||
//上传外部平台
|
||||
asyncWorker.sendAddOrUpdateTeam(null,departmentInfo,2);
|
||||
asyncWorker.sendAddOrUpdateTeam(null, departmentInfo, 2);
|
||||
return departmentInfo;
|
||||
}
|
||||
|
||||
@ -108,8 +108,15 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
public List<Map<String, Object>> selectEnterpriseDepartmentList(Map<String, Object> map) {
|
||||
return departmentInfoMapper.selectEnterpriseDepartmentList(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityMap> selectDepartmentDetailsList(Map<String, Object> map) {
|
||||
return departmentInfoMapper.selectDepartmentDetailsList(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GtMaterialInOutWarehouse> queryDepartmentAndTeamList(Map<String, Object> map) {
|
||||
List<GtMaterialInOutWarehouse> departmentAndTeamList = departmentInfoMapper.queryDepartmentAndTeamList(map);
|
||||
return departmentAndTeamList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.util;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.DayOfWeek;
|
||||
@ -488,4 +489,15 @@ public class DateUtil extends cn.hutool.core.date.DateUtil {
|
||||
//log.info(dealDateFormat("2021-08-25T04:22:20+0000"));
|
||||
System.out.println(getOtherDayAllDayList(10));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转成GMT时间
|
||||
*
|
||||
* @param date
|
||||
*/
|
||||
public static String getGMTTime(Date date) {
|
||||
DateFormat dateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH);
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user