Commit f1f3e0d1 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents aa10143a 4bb03dbc
package com.yeejoin.amos.boot.module.common.api.feign;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
// 消防监督调用
@FeignClient(name = "${supervision.feign.name}", path = "supervision", configuration = {MultipartSupportConfig.class})
public interface SupervisionFeign {
@RequestMapping(value = "/api/point/teamInput", method = RequestMethod.POST, consumes = "application/json")
ResponseModel asyncOwner(@RequestBody OrgUsrFormDto orgUsrFormDto);
@RequestMapping(value = "/api/point/delete", method = RequestMethod.POST, consumes = "application/json")
ResponseModel deleteOwner(@RequestBody Long id);
}
......@@ -3,129 +3,122 @@
<mapper
namespace="com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper">
<select id="getPageList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT
c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM
cb_key_site c
left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
where c.is_delete=FALSE
<if test="name != null and name != ''">
AND c.`name` like concat(#{name}, '%')
</if>
<if test="buildingId != null and buildingId != -1">
AND c.`building_id`= #{buildingId}
</if>
<if test="fireEnduranceRate != null and fireEnduranceRate != ''">
AND c.`fire_endurance_rate`= #{fireEnduranceRate}
</if>
<if test="useNature != null and useNature != ''">
AND c.`use_nature`= #{useNature}
</if>
<if test="fireFacilitiesInfo != null and fireFacilitiesInfo != ''">
AND c.`fire_facilities_info`= #{fireFacilitiesInfo}
</if>
<if test="belongId != null and belongId!='-1' and belongId != -1">
AND c.`belong_id`= #{belongId}
</if>
SELECT
c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM
cb_key_site c
left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
where c.is_delete=FALSE
<if test="name != null and name != ''">
AND c.`name` like concat(#{name}, '%')
</if>
<if test="buildingId != null and buildingId != -1">
AND c.`building_id`= #{buildingId}
</if>
<if test="fireEnduranceRate != null and fireEnduranceRate != ''">
AND c.`fire_endurance_rate`= #{fireEnduranceRate}
</if>
<if test="useNature != null and useNature != ''">
AND c.`use_nature`= #{useNature}
</if>
<if test="fireFacilitiesInfo != null and fireFacilitiesInfo != ''">
AND c.`fire_facilities_info`= #{fireFacilitiesInfo}
</if>
<if test="belongId != null and belongId!='-1' and belongId != -1">
AND c.`belong_id`= #{belongId}
</if>
order by c.rec_date desc
</select>
<select id="getSequenceNbr" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT
c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM
cb_key_site c
left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
where c.sequence_nbr=#{sequenceNbr} and c.is_delete=FALSE;
</select>
SELECT c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM cb_key_site c
left join cb_org_usr cou on c.belong_id = cou.sequence_nbr
where c.sequence_nbr = #{sequenceNbr}
and c.is_delete = FALSE;
</select>
<select id="getKeySiteList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT
c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM
cb_key_site c
left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
where c.is_delete=FALSE;
</select>
<select id="getKeySiteList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM cb_key_site c
left join cb_org_usr cou on c.belong_id = cou.sequence_nbr
where c.is_delete = FALSE;
</select>
</mapper>
package com.yeejoin.amos.maintenance.dao.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.hibernate.annotations.Where;
@Entity
@Table(name="p_app_version")
@NamedQuery(name="AppVersion.findAll", query="SELECT c FROM AppVersion c")
@Where(clause="is_latest_version=1")//表示未删除的数据
public class AppVersion extends BasicEntity {
/**
*
*/
private static final long serialVersionUID = -3207180951171522450L;
/**
* app版本
*/
@Column(name="version")
private String version;
/**
* 版本说明
*/
@Column(name="remark")
private String remark;
/**
* app发布人id
*/
@Column(name="publisher")
private int publisher;
/**
* app发布人名称
*/
@Column(name="publisher_name")
private String publisherName;
/**
* 是否需要强制更新
*/
@Column(name="update_type")
private int updateType;
/**
* 是否为最新版本
*/
@Column(name="is_latest_version")
private Boolean isLatestVersion;
/**
* app保存路径
*/
@Column(name="url")
private String url;
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public int getPublisher() {
return publisher;
}
public void setPublisher(int publisher) {
this.publisher = publisher;
}
public String getPublisherName() {
return publisherName;
}
public void setPublisherName(String publisherName) {
this.publisherName = publisherName;
}
public int getUpdateType() {
return updateType;
}
public void setUpdateType(int updateType) {
this.updateType = updateType;
}
public Boolean getIsLatestVersion() {
return isLatestVersion;
}
public void setIsLatestVersion(Boolean isLatestVersion) {
this.isLatestVersion = isLatestVersion;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
package com.yeejoin.amos.maintenance.dao.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@Entity
@Table(name="p_config")
@NamedQuery(name="Config.findAll", query="SELECT c FROM Config c")
public class Config extends BasicEntity {
private static final long serialVersionUID = 1L;
/**
* 描述
*/
@Column(name="des")
private String des;
/**
* 名称
*/
@Column(name="name")
private String name;
/**
* 属性
*/
@Column(name="attribute")
private String attribute;
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAttribute() {
return attribute;
}
public void setAttribute(String attribute) {
this.attribute = attribute;
}
}
......@@ -17,7 +17,11 @@ public enum DictTypeEnum {
EQUIPTYPE("设备类型","EQUIP_TYPE"),
DANGERLEVEL("隐患等级", "DANGER_LEVEL"),
OUTERPOINTTYPE("导入外部安全检查表分类", "OUTER_POINT_TYPE"),
MAINTENANCE_CLASSIFY("维保项分类","MAINTENANCE_CLASSIFY");
MAINTENANCE_CLASSIFY("维保项分类","MAINTENANCE_CLASSIFY"),
CHECK_ITEM_CLASSIFY("消防监督检查项分类","CHECK_ITEM_CLASSIFY"),
CHECK_ITEM_TYPE("消防监督检查类别","CHECK_ITEM_TYPE"),
CHECK_ITEM_LEVEL("消防监督检查项等级","CHECK_ITEM_LEVEL"),
CHECK_ITEM_CONTENT("消防监督检查类型","CHECK_ITEM_CONTENT");
/**
* 名称,描述
......
......@@ -182,6 +182,90 @@ public class InputItem extends BasicEntity {
@Column(name = "test_requirement")
private String testRequirement;
/**
* 检查类型
*/
@Column(name="check_type")
private String checkType;
/**
* 父类检查项id
*/
@Column(name="item_parent")
private String itemParent;
/**
* 检查项分类
*/
@Column(name="item_classify")
private String itemClassify;
/**
* 适用检查类别
*/
@Column(name="item_type_classify")
private String itemTypeClassify;
/**
* 检查项等级
*/
@Column(name="item_level")
private String itemLevel;
/**
* 检查项启用
*/
@Column(name="item_start")
private String itemStart;
public String getItemStart() {
return itemStart;
}
public void setItemStart(String itemStart) {
this.itemStart = itemStart;
}
public String getItemParent() {
return itemParent;
}
public void setItemParent(String itemParent) {
this.itemParent = itemParent;
}
public String getItemClassify() {
return itemClassify;
}
public void setItemClassify(String itemClassify) {
this.itemClassify = itemClassify;
}
public String getItemTypeClassify() {
return itemTypeClassify;
}
public void setItemTypeClassify(String itemTypeClassify) {
this.itemTypeClassify = itemTypeClassify;
}
public String getItemLevel() {
return itemLevel;
}
public void setItemLevel(String itemLevel) {
this.itemLevel = itemLevel;
}
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public void setMaintenanceContent(String maintenanceContent) {
this.maintenanceContent = maintenanceContent;
}
......
......@@ -268,6 +268,34 @@ public class Point extends BasicEntity {
private String riskSourceId;
/**
* 所在建筑名称
*/
@Column(name="building_name")
private String buildingName;
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
/**
* 所在建筑Id
*/
@Column(name="building_id")
private String buildingId;
/**
* ue4位置
*/
......
......@@ -192,8 +192,6 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "使用单位")
private String useUnit;
@TableField(exist=false)
@ApiModelProperty(value = "地址")
private String address;
......
......@@ -26,16 +26,16 @@
<select id="queryNearlyCount" resultType="java.util.Map">
SELECT
DATE_ADD(#{beginDate},INTERVAL -1 DAY) dateTime,
DATE_ADD(#{beginDate},INTERVAL -7 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -1 DAY)
and call_time >= DATE_ADD(#{beginDate},INTERVAL -7 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -1 DAY)
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -7 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
......@@ -43,16 +43,16 @@
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -2 DAY) dateTime,
DATE_ADD(#{beginDate},INTERVAL -6 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -2 DAY)
and call_time >= DATE_ADD(#{beginDate},INTERVAL -6 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -2 DAY)
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -6 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
......@@ -60,16 +60,16 @@
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -3 DAY) dateTime,
DATE_ADD(#{beginDate},INTERVAL -5 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -3 DAY)
and call_time >= DATE_ADD(#{beginDate},INTERVAL -5 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -3 DAY)
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -5 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
......@@ -94,16 +94,16 @@
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -5 DAY) dateTime,
DATE_ADD(#{beginDate},INTERVAL -3 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -5 DAY)
and call_time >= DATE_ADD(#{beginDate},INTERVAL -3 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -5 DAY)
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -3 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
......@@ -111,16 +111,16 @@
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -6 DAY) dateTime,
DATE_ADD(#{beginDate},INTERVAL -2 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -6 DAY)
and call_time >= DATE_ADD(#{beginDate},INTERVAL -2 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -6 DAY)
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -2 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
......@@ -128,16 +128,16 @@
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -7 DAY) dateTime,
DATE_ADD(#{beginDate},INTERVAL -1 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -7 DAY)
and call_time >= DATE_ADD(#{beginDate},INTERVAL -1 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -7 DAY)
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -1 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
......
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.feign.SupervisionFeign;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -34,6 +35,8 @@ import java.util.Map;
public class OrgPersonController {
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
SupervisionFeign supervisionFeign;
/**
......@@ -63,6 +66,7 @@ public class OrgPersonController {
// 删除时,只作逻辑删除
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete",
CommonConstant.IS_DELETE_01));
supervisionFeign.deleteOwner(id);
return ResponseHelper.buildResponse(null);
}
......
......@@ -67,6 +67,7 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
String useNature, String fireFacilitiesInfo, Long belongId){
return keySiteMapper.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId);
}
@Override
public List<Object> getBuildTree() {
ResponseModel<Object> response = equipFeignClient.getBuildingTree();
......
......@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.feign.SupervisionFeign;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -50,7 +51,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
DynamicFormColumnServiceImpl alertFormServiceImpl;
@Resource
OrgUsrMapper orgUsrMapper;
@Autowired
SupervisionFeign supervisionFeign;
@Autowired
ESOrgUsrService eSOrgUsrService;
@Override
......@@ -399,7 +401,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public void saveOrgUsrDynamicFormInstance(OrgUsr orgUsr, List<DynamicFormInstance> alertFromValuelist) {
public void saveOrgUsrDynamicFormInstance(OrgUsr orgUsr, List<DynamicFormInstance> alertFromValuelist) throws Exception {
orgUsr.setRecDate(new Date());
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
orgUsr.setRecUserName(user.getRealName());
......@@ -417,6 +419,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
});
// 保存动态表单数据
alertFormValueServiceImpl.saveBatch(alertFromValuelist);
OrgUsrFormDto formDto = this.selectCompanyById(orgUsr.getSequenceNbr());
if (OrgPersonEnum.公司.getKey().equals(orgUsr.getBizOrgType())) {
supervisionFeign.asyncOwner(formDto);
}
}
@Override
......
package com.yeejoin.amos.maintenance.business.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.maintenance.business.service.intfc.IAppService;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.common.enums.CheckStatisticsTypeEnum;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskExecution;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.TaskStatisticsTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping(value = "/api/common")
@Api(tags="公共接口api")
public class CommonController extends AbstractBaseController{
/*@Autowired
IUserService userService;*/
@Autowired
private IAppService iAppService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "任务统计口径类型", notes = "任务统计口径类型")
@RequestMapping(value = "/taskgetStatisticsType", method = RequestMethod.GET)
public CommonResponse getTaskStatisticsType() {
return CommonResponseUtil.success(TaskStatisticsTypeEnum.getEnumList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡检统计口径类型", notes = "巡检统计口径类型")
@RequestMapping(value = "/checkStatisticsType", method = RequestMethod.GET)
public CommonResponse getCheckStatisticsType() {
return CommonResponseUtil.success(CheckStatisticsTypeEnum.getEnumList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "计划任务完成种类", notes = "计划任务完成种类")
@RequestMapping(value = "/planTaskFinishStatus", method = RequestMethod.GET)
public CommonResponse getPlanTaskFinishStatus() {
return CommonResponseUtil.success(PlanTaskFinishStatusEnum.getEnumList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "计划任务执行情况种类", notes = "计划任务执行情况种类")
@RequestMapping(value = "/planTaskExecution", method = RequestMethod.GET)
public CommonResponse getPlanTaskExecution() {
return CommonResponseUtil.success(PlanTaskExecution.getEnumList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取app最新版本信息", notes = "获取app最新版本信息")
@RequestMapping(value = "/queryAppVersion", method = RequestMethod.GET)
//@Authorization(ingore=true)
public CommonResponse getAppLastVersion() {
return CommonResponseUtil.success(iAppService.queryAppLastVersion());
}
}
package com.yeejoin.amos.maintenance.business.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.maintenance.business.dao.repository.IConfigDao;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.dao.entity.Config;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 获取主题信息
*
* @author
*
*/
@RestController
@RequestMapping(value = "/api/config")
@Api(tags="配置接口api")
public class ConfigController extends AbstractBaseController{
private final Logger log = LoggerFactory.getLogger(ConfigController.class);
@Autowired
private IConfigDao configDao ;
/**
* <pre>
* 获取配置接口信息
* </pre>
*
*
* @return
*/
//@Authorization(ingore = true)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取配置接口信息", notes = " 获取配置接口信息")
@RequestMapping(value = "/getConfigsInfo", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse getConfigsInfo() {
List<Config> configs = configDao.findAll();
return CommonResponseUtil.success(configs);
}
}
package com.yeejoin.amos.maintenance.business.controller;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.repository.IMsgSubscribeDao;
import com.yeejoin.amos.maintenance.business.param.MsgInfoPageParam;
import com.yeejoin.amos.maintenance.business.param.NoticePublishParam;
import com.yeejoin.amos.maintenance.business.param.UserMsgInitParam;
import com.yeejoin.amos.maintenance.business.service.intfc.IAppService;
import com.yeejoin.amos.maintenance.business.service.intfc.IMessageService;
import com.yeejoin.amos.maintenance.business.service.intfc.IMsgSubscribeService;
import com.yeejoin.amos.maintenance.business.service.intfc.IRouteService;
import com.yeejoin.amos.maintenance.business.util.ClazzFieldUtil;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.business.util.DaoCriteria;
import com.yeejoin.amos.maintenance.business.util.MsgParamUtils;
import com.yeejoin.amos.maintenance.business.vo.MsgVo;
import com.yeejoin.amos.maintenance.common.enums.CheckEmailEnum;
import com.yeejoin.amos.maintenance.common.enums.CheckTypeEnum;
import com.yeejoin.amos.maintenance.common.enums.MsgTypeEnum;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import com.yeejoin.amos.maintenance.core.common.request.CommonRequest;
import com.yeejoin.amos.maintenance.dao.entity.Msg;
import com.yeejoin.amos.maintenance.dao.entity.MsgSubscribe;
import com.yeejoin.amos.maintenance.quartz.IJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* 消息订阅接口 --- 手机
* @author gaodongdong
*
*/
@RestController
@RequestMapping("/api/msgSubscribe")
@Api(value = "手机--消息订阅",tags = "消息模块api")
public class MsgController extends AbstractBaseController {
private final Logger log = LoggerFactory.getLogger(MsgController.class);
@Autowired
private IRouteService routeService;
@Autowired
private IMsgSubscribeService msgSubscribeService;
@Autowired
private IMessageService iMsgService;
@Autowired
private IJobService jobService;
@Autowired
private IAppService iAppService;
@Autowired
private IMsgSubscribeDao msgSubscribeDao;
/*@Autowired
private IUserService iUserService;
*/
/**
* 获取用户当前所选择公司的消息订阅信息
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value="获取用户当前所选择公司的消息订阅信息", notes="获取用户当前所选择公司的消息订阅信息")
@GetMapping(value="/querySubscribe", produces = "application/json;charset=UTF-8")
public CommonResponse queryMsgSetting() {
try {
AgencyUserModel userModel = getUserInfo();
String userId = userModel.getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String deptId=null;
if( reginParams.getDepartment()!=null){
deptId = reginParams.getDepartment().getDepartmentDesc();
}
/*if(XJConstant.ROLE_NAME_SUPERADMIN.equals(roleTypeName) || XJConstant.ROLE_NAME_ADMIN.equals(roleTypeName)){
orgCode = param.getUserOrgCode();
}else if(XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)){
deptId = param.getDepartmentId();
userId = param.getUserId();
}else if(XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)){
userId = param.getUserId();
}*/
List<HashMap<String, Object>> routeList = routeService.queryRouteListByOrgCode(loginOrgCode,userId,deptId);
List<Map<String, Object>> checkType = CheckTypeEnum.getEnumList();
List<Map<String, Object>> emailType = CheckEmailEnum.getEnumList();
UserMsgInitParam userInitParam = new UserMsgInitParam();
userInitParam.setOrgCode(loginOrgCode);
userInitParam.setUserId( userModel.getUserId());
List<MsgSubscribe> msgSubs = iAppService.saveUserMsgInit(userInitParam); // 获取搜友消息推送类型
if(ObjectUtils.isEmpty(msgSubs)){
}
emailType = setupSelectItem(emailType, msgSubs); //标记已经选择的邮件消息推送类型
checkType = setupSelectItem(checkType, msgSubs); // 标记已经选择的检查类型消息
/**
* 获取所有已经选择的路线id数组
*/
String sRoutes = "";
for (MsgSubscribe msg : msgSubs) {
if ("route".equals(msg.getMsgType())) {
sRoutes = msg.getAttribute1();
}
}
List<Map<String, Object>> respRoute = new ArrayList<>();
if (!ObjectUtils.isEmpty(sRoutes)) {
String[] aRoutes = sRoutes.split(",");
for (HashMap<String, Object> route : routeList) {
for (String s : aRoutes) {
if (!ObjectUtils.isEmpty(s) && s.equals(route.get("id"))) {
route.put("selected", true);
respRoute.add(route);
break;
} else {
respRoute.add(route);
}
}
} //将已经选择的路线标记位已选择
}
Map<String, Object> response = new HashMap<>();
response.put("route", respRoute);
response.put("email", emailType);
response.put("check", checkType);
List< Map<String, Object>> listf =new ArrayList<>();
if(msgSubs!=null&&msgSubs.size()>0){
for (MsgSubscribe msg : msgSubs) {
listf.add(objectToMap1(msg));
}
}
response.put("checkPlan", listf);
return CommonResponseUtil.success(response);
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return CommonResponseUtil.failure();
}
}
/**
* 保存用户消息订阅信息
* @param subscribe
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value="保存用户消息订阅信息", notes="保存用户消息订阅信息")
@PostMapping(value="/saveSubscribe",produces = "application/json;charset=UTF-8")
public CommonResponse saveSubscribe(@ApiParam(value = "消息订阅信息", required = false) @RequestBody(required = true) List<MsgSubscribe> subscribe) {
try {
AgencyUserModel userModel = getUserInfo();
String userId = userModel.getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
for (MsgSubscribe s: subscribe) {
s.setOrgCode(orgCode);
s.setUserId(userModel.getUserId());
}
//查询当前用户是否已保存
List<MsgSubscribe> lits=msgSubscribeService.queryMsgSubscribes(userId);
// if(lits!=null&&lits.size()>0){
// //删除
// List<Long> userIds=new ArrayList<>();
// userIds.add(Long.valueOf(userId));
// msgSubscribeDao.delMsgSubscribeByUserId(userIds);
// }
//
msgSubscribeService.saveSubscribe(subscribe);
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
return CommonResponseUtil.success();
}
private List<Map<String, Object>> setupSelectItem(List<Map<String, Object>> type, List<MsgSubscribe> msgSubs) {
for (Map map : type) {
for (MsgSubscribe msg : msgSubs) {
if (!msg.getMsgType().equals(map.get("ower"))) continue;
if (map.get("code").equals(msg.getAttribute1())) {
map.put("selected", true);
break;
}
}
}
return type;
}
private Map<String, Object> objectToMap(Object obj) throws Exception {
if(obj == null)
return null;
Map<String, Object> map = new HashMap<String, Object>();
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor property : propertyDescriptors) {
String key = property.getName();
if (key.compareToIgnoreCase("class") == 0) {
continue;
}
Method getter = property.getReadMethod();
Object value = getter!=null ? getter.invoke(obj) : null;
map.put(key, value);
}
return map;
}
/**
* 根据登陆用户APP获取未读消息个数
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value="APP根据登陆用户获取未读消息个数", notes="APP根据登陆用户获取未读消息个数")
@GetMapping(value="/unreadCount",produces = "application/json;charset=UTF-8")
public CommonResponse getUnreadCount() {
try {
AgencyUserModel user = getUserInfo();
int count = msgSubscribeService.getUnreadCount(user);
return CommonResponseUtil.success(count);
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
}
/**
* 获取消息类型
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value="APP获取消息类型", notes="APP获取消息类型")
@GetMapping(value="/MsgType",produces = "application/json;charset=UTF-8")
public CommonResponse getMsgType() {
try {
return CommonResponseUtil.success(MsgTypeEnum.getEnumList());
} catch (Exception e) {
return CommonResponseUtil.failure("获取消息类型失败");
}
}
/**
* 根据条件获取消息列表
* @param queryRequests
* @param commonPageable
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "APP 根据条件获取消息列表", notes = "APP 根据条件获取消息列表")
@PostMapping(value = "/msgList", produces = "application/json;charset=UTF-8")
public CommonResponse queryMsgList(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true, defaultValue = "pageNumber=0&pageSize=10") CommonPageable commonPageable) {
try {
AgencyUserModel user = getUserInfo();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
CommonRequest request = new CommonRequest();
CommonRequest request1 = new CommonRequest();
request.setName("userId");
request.setValue(user.getUserId());
request1.setName("status");
request1.setValue(XJConstant.IS_SENT);
queryRequests.add(request1);
queryRequests.add(request);
List< Map<String, Object>> listf =new ArrayList<>();
List<DaoCriteria> criterias = buildDaoCriterias(queryRequests, false, loginOrgCode, roleTypeName);
Page<Msg> msgList = msgSubscribeService.queryMsgList(criterias, commonPageable);
List<Msg> li= msgList.getContent();
if(li!=null&&li.size()>0){
for (Msg msg : li) {
listf.add(objectToMap1(msg));
}
}
Page< Map<String, Object>> pd=new PageImpl<>(listf, msgList.getPageable(), msgList.getTotalElements());
return CommonResponseUtil.success(pd);
} catch (Exception e) {
log.error(e.getMessage(),e);
return CommonResponseUtil.failure("件获取消息列表失败");
}
}
public static Map<String, Object> objectToMap1(Object obj) throws IllegalAccessException {
Map<String, Object> map = new HashMap<String,Object>();
if(obj!=null){
for (Field field : ClazzFieldUtil.getAllFields(obj)) {
field.setAccessible(true);
String fieldName = field.getName();
Object value = nvl(field.get(obj));
if("userId".equals(fieldName)){
map.put(fieldName, Long.valueOf(value.toString()));
}else{
map.put(fieldName, value);
}
}
return map;
}
return map;
}
public static Object nvl(Object param) {
return param != null ? param : null;
}
/**
* 根据条件查询消息列表
* @param queryRequests
* @param commonPageable
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据条件获取消息列表", notes = "APP 根据条件获取消息列表")
@PostMapping(value = "/list", produces = "application/json;charset=UTF-8")
public CommonResponse querylist(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true, defaultValue = "pageNumber=0&pageSize=10") CommonPageable commonPageable) {
try {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, roleTypeName);
if(XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)||XJConstant.ROLE_NAME_PERSON.equals(roleTypeName))
paramMap.put("userId",getUserId());
MsgInfoPageParam param = MsgParamUtils.fillMsgInfoParam(queryRequests, commonPageable, paramMap);
Page<MsgVo> dataList = iMsgService.queryMsgInfoList(param);
return CommonResponseUtil.success(dataList);
} catch (Exception e) {
log.error(e.getMessage(),e);
return CommonResponseUtil.failure("件获取消息列表失败");
}
}
/**
* 修改消失为已读
* @param msgId
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "修改消失为已读", notes = "修改消失为已读")
@PostMapping(value = "/isRead", produces = "application/json;charset=UTF-8")
public CommonResponse isRead(
@ApiParam(value = "消息id", required = true) @RequestBody Long msgId) {
try {
Msg msg = msgSubscribeService.isRead(msgId);
return CommonResponseUtil.success(msg);
} catch (Exception e) {
log.error(e.getMessage(),e);
return CommonResponseUtil.failure("修改消失为已读失败");
}
}
/**
* 通知发布
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "通知发布", notes = "通知发布")
@PostMapping(value = "/noticePublish", produces = "application/json;charset=UTF-8")
public CommonResponse noticePublish(@ApiParam(value = "通知信息", required = true) @RequestBody NoticePublishParam msg) {
try {
AgencyUserModel user = getUserInfo();
msg.setCreateBy(user.getUserId());
ReginParams reginParams = getSelectedOrgInfo();
msg.setUserName(user.getRealName());
String loginOrgCode = getOrgCode(reginParams);
msg.setOrgCode(loginOrgCode);
List<Msg> msgList = iMsgService.publishNotice(getToken(),getProduct(),getAppKey(),msg);
msgList.forEach(m->{
jobService.msgAddJob(m);
});
return CommonResponseUtil.success();
} catch (Exception e) {
return CommonResponseUtil.failure("通知发布失败!");
}
}
}
package com.yeejoin.amos.maintenance.business.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.maintenance.business.param.AppLoginUserParam;
import com.yeejoin.amos.maintenance.business.service.intfc.IAppService;
import com.yeejoin.amos.maintenance.business.util.*;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.core.framework.PersonIdentify;
import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
import com.yeejoin.amos.maintenance.jpush.AppMessagePushService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.http.*;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
/**
* 获取用户信息
*
......@@ -46,775 +20,9 @@ import java.util.stream.Collectors;
@RequestMapping(value = "/api/user")
@Api(tags = "用户信息api")
public class UserController extends AbstractBaseController {
private final Logger logger = LoggerFactory.getLogger(UserController.class);
@Autowired
private IAppService iAppService;
@Autowired
private Environment env;
private static final String appType = "APP";
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private AppMessagePushService appMessagePushService;
@Value("${Security.fegin.name}")
private String SecurityName;
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKey}")
private String appKey;
@Autowired
private RestTemplate restTemplate;
/**
* 根据部门id查询用户信息
*
* @param deptId
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "部门人员查询", notes = "部门人员查询")
@RequestMapping(value = "/queryDeptUser", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryDeptUser(@RequestParam(value = "deptId", required = false) String deptId) {
List<AgencyUserModel> userModels = remoteSecurityService.listUserByDepartmentId(getToken(), getProduct(), getAppKey(), deptId);
List<LinkedHashMap<String, Object>> userList = new ArrayList<>();
if ("-1".equals(deptId)) {
ReginParams reginParams = getSelectedOrgInfo();
String dep = reginParams.getCompany().getSequenceNbr().toString();
//查询没有部门的人员信息
CompanyModel companyModel = remoteSecurityService.listUserByCompanyId1(getToken(), getProduct(), getAppKey(), dep);
List children = (List) companyModel.getChildren();
for (int i = 0; i < children.size(); i++) {
Map<String, Object> map = (LinkedHashMap) children.get(i);
if ("其他".equals((map.get("departmentName").toString()))) {
List<LinkedHashMap<String, Object>> user1 = (List<LinkedHashMap<String, Object>>) map.get("userModelList");
for (int j = 0; j < user1.size(); j++) {
LinkedHashMap<String, Object> user = new LinkedHashMap<>();
user.put("id", user1.get(j).get("userId").toString());
user.put("key", user1.get(j).get("userId").toString());
user.put("value", user1.get(j).get("userId").toString());
user.put("checked", false);
user.put("state", "open");
user.put("name", user1.get(j).get("realName").toString());
user.put("desc", null);
user.put("writeable", 0);
user.put("userName", user1.get(j).get("realName").toString());
if (StringUtil.isNotEmpty(user1.get(j).get("mobile"))) {
user.put("mobile", user1.get(j).get("mobile").toString());
} else {
user.put("mobile", "");
}
if (StringUtil.isNotEmpty(user1.get(j).get("landlinePhone"))) {
user.put("telephone", user1.get(j).get("landlinePhone").toString());
} else {
user.put("telephone", "");
}
user.put("departmentName", "其他");
userList.add(user);
}
}
}
} else {
userList = paraseData(userModels, null).stream().distinct().collect(Collectors.toList());
}
return CommonResponseUtil.success(userList);
}
private List<LinkedHashMap<String, Object>> paraseData(List<AgencyUserModel> list, String userNmae) {
List<LinkedHashMap<String, Object>> userList = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) {
for (AgencyUserModel userModel : list) {
LinkedHashMap<String, Object> user = new LinkedHashMap<>();
user.put("id", userModel.getUserId().toString());
user.put("key", userModel.getUserId().toString());
user.put("value", userModel.getUserId().toString());
user.put("checked", false);
user.put("state", "open");
user.put("name", userModel.getRealName());
user.put("desc", null);
user.put("writeable", 0);
user.put("userName", userModel.getUserId().toString());
user.put("mobile", userModel.getMobile());
user.put("telephone", userModel.getLandlinePhone());
user.put("departmentName", "其他");
userList.add(user);
}
}
return userList;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "部门人员树查询", notes = "部门人员树查询")
@RequestMapping(value = "/queryDeptUserTree1", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryDeptUserTree1() {
ReginParams reginParams = getSelectedOrgInfo();
CompanyModel companyModel = remoteSecurityService.listUserByCompanyId1(getToken(), getProduct(), getAppKey(), reginParams.getCompany().getSequenceNbr().toString());
List children = (List) companyModel.getChildren();
List<DepartmentUserTreeWebVo> list = Lists.newArrayList();
String loginOrgCode = getOrgCode(reginParams);
for (int i = 0; i < children.size(); i++) {
Map<String, Object> map = (LinkedHashMap) children.get(i);
JSONObject json = JSON.parseObject(JSON.toJSONString(map));
DepartmentUserTreeWebVo deptTreeWeb = new DepartmentUserTreeWebVo();
JSONArray childrens = json.getJSONArray("children");
deptTreeWeb.setType("department");
deptTreeWeb.setKey(map.get("sequenceNbr").toString());
deptTreeWeb.setLabel(map.get("sequenceNbr").toString());
deptTreeWeb.setTitle(map.get("departmentName").toString());
deptTreeWeb.setValue(map.get("sequenceNbr").toString());
if (!ObjectUtils.isEmpty(map.get("userModelList"))) {
List userModalList = (List) ((List) map.get("userModelList")).stream().distinct().collect(Collectors.toList());
deptTreeWeb.setUserModelList(userModalList);
}
list.add(deptTreeWeb);
if (childrens != null && childrens.size() > 0) {
buildUserDeptTreeForWebBefore(list, childrens);
}
list = buildUserDeptTreeForWeb(list);
}
return CommonResponseUtil.success(list);
}
/**
* 重构数据,用户存放在部门的children
*
* @param list
* @return
*/
private List<DepartmentUserTreeWebVo> buildUserDeptTreeForWeb(List<DepartmentUserTreeWebVo> list) {
list.forEach(
x -> {
List<DepartmentUserTreeWebVo> users = Lists.newArrayList();
if (!ObjectUtils.isEmpty(x.getUserModelList())) {
List<DepartmentUserTreeWebVo> collects = x.getUserModelList().stream().collect(Collectors.toList());
List<Map<String, Object>> userModelList = (List) collects;
userModelList.forEach(
userModel -> {
DepartmentUserTreeWebVo userTreeWeb = new DepartmentUserTreeWebVo();
userTreeWeb.setType("user");
userTreeWeb.setKey(userModel.get("userId").toString() + "*" + x.getValue() + "*" + UUID.randomUUID().toString());
userTreeWeb.setLabel(userModel.get("realName").toString());
userTreeWeb.setTitle(userModel.get("realName").toString());
userTreeWeb.setValue(userModel.get("userId").toString() + "*" + x.getValue() + "*" + UUID.randomUUID().toString());
users.add(userTreeWeb);
}
);
x.setChildren(users);
collects.clear();
x.setUserModelList(collects);
}
}
);
return list;
}
/**
* 部门数据预处理(获取所有子节点)
*
* @param list
* @param children
*/
private void buildUserDeptTreeForWebBefore(List<DepartmentUserTreeWebVo> list, JSONArray children) {
for (int i = 0; i < children.size(); i++) {
JSONObject json = children.getJSONObject(i);
DepartmentUserTreeWebVo deptTreeWeb = new DepartmentUserTreeWebVo();
Map deptMap = JSONObject.parseObject(json.toJSONString(), Map.class);
deptTreeWeb.setType("department");
deptTreeWeb.setKey(deptMap.get("sequenceNbr").toString());
deptTreeWeb.setLabel(deptMap.get("sequenceNbr").toString());
deptTreeWeb.setTitle(deptMap.get("departmentName").toString());
deptTreeWeb.setValue(deptMap.get("sequenceNbr").toString());
if (!ObjectUtils.isEmpty(deptMap.get("userModelList"))) {
deptTreeWeb.setUserModelList((List) deptMap.get("userModelList"));
}
if (json != null && json.size() > 0) {
list.add(deptTreeWeb);
} else {
JSONArray childrens = json.getJSONArray("children");
if (childrens != null && childrens.size() > 0) {
buildUserDeptTreeForWebBefore(deptTreeWeb.getChildren(), childrens);
}
if ("0".equals(deptMap.get("parentId"))) {
list.add(deptTreeWeb);
}
}
}
}
/**
* 查询用户权限人员
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "人员查询", notes = "人员查询")
@RequestMapping(value = "/queryAuthUsers", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
// @Authorization(ingore = true)
public CommonResponse queryAllUser() {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
List<AgencyUserModel> userModels = remoteSecurityService.listUserByOrgCode(getToken(), getProduct(), getAppKey(), loginOrgCode);
List<LinkedHashMap<String, Object>> userList = paraseData(userModels, null);
return CommonResponseUtil.success(userList);
}
/**
* 查询用户部门人员树
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "部门人员树查询", notes = "部门人员树查询")
@RequestMapping(value = "/queryDeptUserTree", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryDeptUserTree() {
ReginParams reginParams = getSelectedOrgInfo();
String departmentId = getDepartmentId(reginParams);
List<AgencyUserModel> userModels = remoteSecurityService.listUserByDepartmentId(getToken(), getProduct(), getAppKey(), departmentId);
List<LinkedHashMap<String, Object>> userList = paraseData(userModels, null);
return CommonResponseUtil.success(userList);
}
/**
* 查询用户部门人员树
*
* @return
* @RequestParam userName 用户名
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "通讯录(<font color='blue'>手机app</font>)", notes = "通讯录(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/queryUserAddressList", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryUserAddressListTree(
@ApiParam(value = "用户名", required = false) @RequestParam(value = "userName", required = false) String userName) {
try {
ReginParams reginParams = getSelectedOrgInfo();
CompanyBo companyBo = reginParams.getCompany();
JSONArray arr = remoteSecurityService.listDepartmentUserTree(getToken(), getProduct(), getAppKey(), companyBo.getSequenceNbr().toString());
DepartmentUserTreeAppVo departmentUserTreeDto = new DepartmentUserTreeAppVo();
if (arr != null && arr.size() > 0) {
buildUserDeptTree(departmentUserTreeDto, arr);
}
List<LinkedHashMap<String, Object>> content = new ArrayList<>();
//数据重新封装
List<DepartmentUserTreeAppVo> list = departmentUserTreeDto.getChildren();
LinkedHashMap<String, Object> otherDept1 = new LinkedHashMap<>();
for (DepartmentUserTreeAppVo departmentUserTreeAppVo : list) {
LinkedHashMap<String, Object> otherDept = new LinkedHashMap<>();
if ("其他".equals(departmentUserTreeAppVo.getName())) {
otherDept1.put("children", paraseData1(getToken(), getProduct(), getAppKey(), departmentUserTreeAppVo.getChildren(), "其他", "-1", userName));
otherDept1.put("id", -1);
otherDept1.put("key", -1);
otherDept1.put("value", -1);
otherDept1.put("state", "open");
otherDept1.put("type", "department");
otherDept1.put("label", "其他");
otherDept1.put("title", "其他");
otherDept1.put("name", "其他");
otherDept1.put("desc", "其他");
otherDept1.put("writeable", 0);
otherDept1.put("attributes", "");
} else {
otherDept.put("children", paraseData1(getToken(), getProduct(), getAppKey(), departmentUserTreeAppVo.getChildren(), departmentUserTreeAppVo.getName(), departmentUserTreeAppVo.getId(), userName));
otherDept.put("id", departmentUserTreeAppVo.getId());
otherDept.put("key", departmentUserTreeAppVo.getId());
otherDept.put("value", departmentUserTreeAppVo.getId());
otherDept.put("state", "open");
otherDept.put("type", "department");
otherDept.put("label", departmentUserTreeAppVo.getName());
otherDept.put("title", departmentUserTreeAppVo.getName());
otherDept.put("name", departmentUserTreeAppVo.getName());
otherDept.put("desc", null);
otherDept.put("writeable", 0);
otherDept.put("attributes", "");
content.add(otherDept);
}
}
if (otherDept1 != null) {
content.add(otherDept1);
}
return CommonResponseUtil.success(content);
} catch (Exception e) {
e.printStackTrace();
logger.error("通讯录异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
private List<LinkedHashMap<String, Object>> paraseData1(String toke, String product, String appKey, List<DepartmentUserTreeAppVo> map, String name, String depid, String username) {
List<LinkedHashMap<String, Object>> content = new ArrayList<>();
if (map != null && map.size() > 0) {
for (DepartmentUserTreeAppVo departmentUserTreeAppVo : map) {
if ("dept".equals(departmentUserTreeAppVo.getType())) {
LinkedHashMap<String, Object> otherDept = new LinkedHashMap<>();
otherDept.put("children", paraseData1(getToken(), getProduct(), getAppKey(), departmentUserTreeAppVo.getChildren(), departmentUserTreeAppVo.getName(), departmentUserTreeAppVo.getId(), username));
otherDept.put("id", departmentUserTreeAppVo.getId());
otherDept.put("key", departmentUserTreeAppVo.getId());
otherDept.put("value", departmentUserTreeAppVo.getId());
otherDept.put("state", "open");
otherDept.put("type", "department");
otherDept.put("label", departmentUserTreeAppVo.getName());
otherDept.put("title", departmentUserTreeAppVo.getName());
otherDept.put("name", departmentUserTreeAppVo.getName());
otherDept.put("desc", null);
otherDept.put("writeable", 0);
otherDept.put("attributes", "");
content.add(otherDept);
} else {
LinkedHashMap<String, Object> user = new LinkedHashMap<>();
user.put("id", departmentUserTreeAppVo.getId());
user.put("key", departmentUserTreeAppVo.getId());
user.put("value", departmentUserTreeAppVo.getId());
user.put("checked", false);
user.put("state", "open");
user.put("type", "user");
user.put("label", departmentUserTreeAppVo.getName());
user.put("title", departmentUserTreeAppVo.getName());
user.put("name", departmentUserTreeAppVo.getName());
user.put("desc", null);
user.put("writeable", 0);
user.put("userName", departmentUserTreeAppVo.getName());
user.put("depid", depid);
//获取电话邮箱
Map<String, String> userObj = departmentUserTreeAppVo.getObject();
if (userObj != null && userObj.get("telephone") != null) {
user.put("mobile", userObj.get("telephone"));
} else {
user.put("mobile", "");
}
if (userObj != null && userObj.get("email") != null) {
user.put("email", userObj.get("email"));
} else {
user.put("email", "");
}
if (userObj != null && userObj.get("mobile") != null) {
user.put("mobile", userObj.get("mobile"));
} else {
user.put("mobile", "");
}
// AgencyUserModel userdate=remoteSecurityService.getUserById( toke, product, appKey, departmentUserTreeAppVo.getId());
// if(userdate!=null){
// user.put("telephone", userdate.getLandlinePhone());
// user.put("mobile", userdate.getMobile());
// user.put("email", userdate.getEmail());
// }else{
// user.put("mobile", "");
// }
user.put("departmentName", name);
if (username != null && !"".equals(username)) {
if (!ObjectUtils.isEmpty(departmentUserTreeAppVo.getName()) && departmentUserTreeAppVo.getName().indexOf(username) != -1) {
content.add(user);
}
} else {
content.add(user);
}
}
}
return content;
}
return null;
}
private List<LinkedHashMap<String, Object>> filterUser(List<LinkedHashMap<String, Object>> tempChildren,
String userNmae) {
List<LinkedHashMap<String, Object>> userList = new ArrayList<LinkedHashMap<String, Object>>();
if (ObjectUtils.isEmpty(tempChildren)) {
return userList;
}
userList.forEach((item) -> {
if (!ObjectUtils.isEmpty(userNmae) && item.get("label").toString().indexOf(userNmae) != -1) {
userList.add(item);
}
});
return userList;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "用户登录成功之后数据初始化(<font color='blue'>手机app</font>)", notes = "用户登录成功之后数据初始化")
@RequestMapping(value = "/initData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse initUserApp() {
try {
CommonResponse secResponse = remoteSecurityService.searchPermissionTree(getToken(), getProduct(), getAppKey(), appType);
if (!secResponse.isSuccess()) {
return CommonResponseUtil.failure("权限获取失败");
}
List<LinkedHashMap<String, Object>> response = new ArrayList<>();
HashMap<String, Object> resp = new HashMap<>();
resp.put("permissionitems", secResponse.getDataList());
resp.put("companys", response);
return CommonResponseUtil.success(resp);
} catch (Exception e) {
return CommonResponseUtil.failure("数据初始化失败");
}
}
/**
* 递归调用获取list中的末端节点
*
* @param src
* @return
*/
private List<LinkedHashMap<String, Object>> getLeaves(List<LinkedHashMap<String, Object>> src) {
List<LinkedHashMap<String, Object>> dest = new ArrayList<>();
for (LinkedHashMap<String, Object> leaves : src) {
if (ObjectUtils.isEmpty(leaves.get("children"))) {
dest.add(leaves);
} else {
List<LinkedHashMap<String, Object>> list = getLeaves((List<LinkedHashMap<String, Object>>) leaves.get("children"));
dest.addAll(list);
}
}
return dest;
}
///////////////////////////////2019-11-18安全服务升级///////////////////////////////
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "通讯录", notes = "通讯录")
@RequestMapping(value = "/mobile/addressList", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse addressList() {
try {
ReginParams reginParams = getSelectedOrgInfo();
CompanyBo companyBo = reginParams.getCompany();
JSONArray arr = remoteSecurityService.listDepartmentUserTree(getToken(), getProduct(), getAppKey(), companyBo.getSequenceNbr().toString());
DepartmentUserTreeAppVo departmentUserTreeDto = new DepartmentUserTreeAppVo();
if (arr != null && arr.size() > 0) {
buildUserDeptTree(departmentUserTreeDto, arr);
}
return CommonResponseUtil.success(departmentUserTreeDto.getChildren());
} catch (Exception e) {
logger.error("通讯录异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
private void buildUserDeptTree(DepartmentUserTreeAppVo deptUser, JSONArray childs) {
for (int i = 0; i < childs.size(); i++) {
JSONObject json = childs.getJSONObject(i);
DepartmentUserTreeAppVo treeDto = new DepartmentUserTreeAppVo();
treeDto.setName(json.getString("departmentName"));
treeDto.setId(json.getString("sequenceNbr"));
treeDto.setType(json.getString("level"));
JSONArray childrens = json.getJSONArray("children");
if (childrens != null && childrens.size() > 0) {
buildUserDeptTree(treeDto, childrens);
}
JSONArray userModelList = json.getJSONArray("userModelList");
if (userModelList != null && userModelList.size() > 0) {
List<HashMap> modelList = JSONObject.parseArray(userModelList.toJSONString(), HashMap.class);
modelList = modelList.stream().distinct().collect(Collectors.toList());
userModelList = JSONArray.parseArray(JSON.toJSONString(modelList));
UserDeptTree(treeDto, userModelList);
}
deptUser.getChildren().add(treeDto);
}
}
//部门下用户
private void UserDeptTree(DepartmentUserTreeAppVo deptUser, JSONArray childs) {
for (int i = 0; i < childs.size(); i++) {
JSONObject json = childs.getJSONObject(i);
DepartmentUserTreeAppVo treeDto = new DepartmentUserTreeAppVo();
treeDto.setName(json.getString("realName"));
treeDto.setId(json.getString("userId"));
//treeDto.setType(json.getString("level"));
treeDto.setType("user");
// JSONObject object = json.getJSONObject("object");
Map<String, String> user = Maps.newHashMap();
user.put("mobile", json.getString("mobile"));
user.put("telephone", json.getString("landlinePhone"));
user.put("email", json.getString("email"));
treeDto.setObject(user);
deptUser.getChildren().add(treeDto);
}
}
/**
* APP登录
*/
@ApiOperation(value = "APP登录", notes = "APP登录")
@PostMapping(value = "/mobile/login")
public CommonResponse mobileLogin(@ApiParam(value = "账号", required = true) @RequestBody AppLoginUserParam param) {
try {
JSONObject jsonObject = null;
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(param.getUserName());
dPasswordAuthModel.setPassword(DesUtil.decode(param.getPassword(), "yeejoin"));
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("product", productApp);
HttpEntity httpEntity = new HttpEntity<>(dPasswordAuthModel, headers);
FeignClientResult feignClientResult = restTemplate.postForObject("http://" + SecurityName + "/privilege/v1/auth/idpassword", httpEntity, FeignClientResult.class);
if (feignClientResult.getStatus() == 200) {
Map map = (Map) feignClientResult.getResult();
map.put("appKey", appKey);
map.put("product", productApp);
String jsonStr = JSON.toJSONString(map);
jsonObject = JSONObject.parseObject(jsonStr);
} else {
return CommonResponseUtil.failure(feignClientResult.getMessage());
}
if (jsonObject != null) {
JSONObject result = new JSONObject();
result.put("token", jsonObject.getString("token"));
result.put("userId", jsonObject.getString("userId"));
result.put("appKey", jsonObject.getString("appKey"));
result.put("product", jsonObject.getString("product"));
result.put("jpushUserKey", param.getUserName());
// //删除别名关联设备
// CommonResponse commonResponse=PushFeign.PushDevice(appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
return CommonResponseUtil.success(result);
}
return CommonResponseUtil.failure("登录失败");
} catch (Exception e) {
e.printStackTrace();
logger.error("APP登录异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
/**
* APP登出
*/
@ApiOperation(value = "APP登出", notes = "APP登出")
@PostMapping(value = "/mobile/loginOut")
public CommonResponse mobileLoginOut() {
try {
// if (remoteSecurityService.loginOutFromApp(getToken(), getProduct(), getAppKey())) {
// return CommonResponseUtil.success();
// } else {
// return CommonResponseUtil.failure("APP登出失败");
// }
return CommonResponseUtil.success();
} catch (Exception e) {
logger.error("APP登出异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
/**
* 获取公司选择信息
*/
@ApiOperation(value = "获取公司选择信息", notes = "获取公司选择信息")
@GetMapping(value = "/selectInfo")
public CommonResponse selectInfo() {
try {
JSONObject result = new JSONObject();
AgencyUserModel user = getUserInfo();
if (user != null) {
List<CompanyModel> list = user.getCompanys().stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CompanyModel::getSequenceNbr))), ArrayList::new));
Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments();
Map<String, List<Map<String, Object>>> mapdate = new HashMap<String, List<Map<String, Object>>>();
List<Map> listCompanyModel = new ArrayList();
if (list != null && list.size() > 0) {
for (CompanyModel article : list) {
Map<String, Object> map = objectToMap(article);
map.put("companySeq", map.get("companySeq") + "");
map.put("parentId", map.get("parentId") + "");
listCompanyModel.add(map);
long key = Long.valueOf(map.get("sequenceNbr").toString());
List<DepartmentModel> listdep = mapDepartments.get(key);
List<Map<String, Object>> dep = new ArrayList();
for (DepartmentModel departmentModel : listdep) {
if (departmentModel != null) {
Map<String, Object> mapo = objectToMap(departmentModel);
mapo.put("sequenceNbr", mapo.get("sequenceNbr").toString());
dep.add(mapo);
}
}
mapdate.put(map.get("sequenceNbr").toString(), dep);
}
}
result.put("companys", listCompanyModel);
result.put("orgRoles", user.getOrgRoles());
result.put("companyDepartments", mapdate);
return CommonResponseUtil.success(result);
}
return CommonResponseUtil.failure("请重新登录");
} catch (Exception e) {
logger.error("获取公司选择信息异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
//对象转map
public static Map<String, Object> objectToMap(Object obj) throws IllegalAccessException {
Map<String, Object> map = new HashMap<String, Object>();
if (obj != null) {
Class<?> clazz = obj.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String fieldName = field.getName();
Object value = nvl(field.get(obj));
map.put(fieldName, value);
}
return map;
}
return map;
}
public static Object nvl(Object param) {
return param != null ? param : "";
}
/**
* 保存登陆用户选择公司信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "保存登陆用户选择公司信息", notes = "保存登陆用户选择公司信息")
@PostMapping(value = "/save/curCompany")
public CommonResponse saveCurCompany(@ApiParam(value = "当前登陆用户所选单位机构编号", required = true) @RequestBody ReginParams reginParams) {
try {
AgencyUserModel user = getUserInfo();
// saveSelectedOrgInfo(reginParams);
return CommonResponseUtil.success(buildCurCompany(getToken(), getProduct(), getAppKey(), reginParams, user));
} catch (Exception e) {
logger.error("保存登陆用户选择公司信息异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
private JSONObject buildCurCompany(String toke, String product, String appKey, ReginParams reginParams, AgencyUserModel user) {
JSONObject result = new JSONObject();
result.put("userId", user.getUserId());
result.put("realName", user.getRealName());
result.put("userMobile", user.getMobile());
result.put("userName", user.getUserName());
result.put("email", user.getEmail());
CommonResponse secResponse = remoteSecurityService.searchPermissionTree(Long.valueOf(reginParams.getRole().getSequenceNbr()), toke, product, appKey, appType);
if (secResponse.isSuccess() && secResponse.getDataList() != null) {
JSONArray arr = JSON.parseArray(JSONArray.toJSONString(secResponse.getDataList()));
Map<String, JSONObject> map = Maps.newHashMap();
if (arr != null && arr.size() > 0) {
JSONObject obj = arr.getJSONObject(0);
if (obj != null) {
JSONArray childrens = obj.getJSONArray("children");
if (childrens != null && childrens.size() > 0) {
for (int i = 0; i < childrens.size(); i++) {
JSONObject child = childrens.getJSONObject(i);
map.put(child.getString("path"), child);
}
}
}
List<String> userHaveToDo = iAppService.getHaveToDoList(user.getUserId());
result.put("userHaveToDo", userHaveToDo);
result.put("userPower", map.get("appPower"));
result.put("userShow", map.get("appMenu"));
}
}
result.put("companyModel", reginParams.getCompany());
result.put("departmentModel", reginParams.getDepartment());
result.put("roleModel", reginParams.getRole());
return result;
}
/**
* 装备登录返回巡检统计信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "装备登录返回巡检统计信息", notes = "装备登录返回巡检统计信息")
@GetMapping(value = "/patrolCount")
public CommonResponse getPatrolCount() {
try {
AgencyUserModel user = getUserInfo();
List<String> userHaveToDo = iAppService.getHaveToDoList(user.getUserId());
return CommonResponseUtil.success(userHaveToDo);
} catch (Exception e) {
logger.error("保存登陆用户选择公司信息异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
/**
* 修改密码
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = " 修改密码", notes = " 修改密码")
@GetMapping(value = "/editPassword")
public CommonResponse editPassword(@ApiParam(value = "旧密码", required = true) @RequestParam String password,
@ApiParam(value = "新密码", required = true) @RequestParam String newPassword) {
AgencyUserModel userModel = getUserInfo();
boolean flag = false;
if (password.equals(newPassword)) {
return CommonResponseUtil.failure("新密码不能跟旧密码相同!");
}
try {
//flag=remoteSecurityService.editPassword(getToken(), getProduct(), getAppKey(), userModel.getUserId(), password, newPassword);
AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setPassword(newPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(password);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("product", getProduct());
headers.set("token", getToken());
headers.set("appKey", getAppKey());
HttpEntity httpEntity = new HttpEntity<>(agencyUserModel, headers);
ResponseEntity<FeignClientResult> feignClientResult = restTemplate.exchange("http://" + SecurityName + "/privilege/v1/agencyuser/" + userModel.getUserId() + "/password", HttpMethod.PUT, httpEntity, FeignClientResult.class);
if (feignClientResult.getBody().getStatus() == 200) {
CommonResponse dates = CommonResponseUtil.success();
dates.setMessage("修改成功!");
return dates;
} else {
return CommonResponseUtil.failure(feignClientResult.getBody().getMessage());
}
} catch (Exception e) {
logger.error("修改密码异常", e);
return CommonResponseUtil.failure(e.getMessage());
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PersonIdentify(isNeedIdentity = true)
@PersonIdentify
@ApiOperation(value = "获取人员身份信息", notes = " 获取人员身份信息")
@GetMapping(value = "/identify")
public CommonResponse personIdentity() {
......
package com.yeejoin.amos.maintenance.business.dao.repository;
import org.springframework.data.jpa.repository.Query;
import com.yeejoin.amos.maintenance.dao.entity.AppVersion;
public interface AppVersionDao extends BaseDao<AppVersion, Long>{
@Query(value="SELECT * FROM p_app_version v ORDER BY v.id DESC LIMIT 0,1", nativeQuery = true)
AppVersion findLastVersion();
}
package com.yeejoin.amos.maintenance.business.dao.repository;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.yeejoin.amos.maintenance.dao.entity.Config;
@Repository("configDao")
public interface IConfigDao extends BaseDao<Config, Long>{
List<Config> findAll();
}
package com.yeejoin.amos.maintenance.business.entity.mybatis;
import lombok.Data;
import java.util.Date;
/**
* @author DELL
*/
@Data
public class PlanTaskPointInputItemBo {
/**
......@@ -65,153 +71,32 @@ public class PlanTaskPointInputItemBo {
private String inputName;
private Long classifyId;
//新增执行部门
/**
* 执行部门
*/
private String depId;
//执行人名称
/**
* 执行人名称
*/
private String userName;
//执行部门名称
private String depName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDepName() {
return depName;
}
public void setDepName(String depName) {
this.depName = depName;
}
public Long getInputItemId() {
return inputItemId;
}
public void setInputItemId(Long inputItemId) {
this.inputItemId = inputItemId;
}
public int getOrderNo() {
return orderNo;
}
public void setOrderNo(int orderNo) {
this.orderNo = orderNo;
}
public long getPointId() {
return pointId;
}
public void setPointId(long pointId) {
this.pointId = pointId;
}
public long getPlanTaskId() {
return planTaskId;
}
public void setPlanTaskId(long planTaskId) {
this.planTaskId = planTaskId;
}
public long getRouteId() {
return routeId;
}
public void setRouteId(long routeId) {
this.routeId = routeId;
}
public long getPlanId() {
return planId;
}
public void setPlanId(long planId) {
this.planId = planId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public long getRoutePointItemId() {
return routePointItemId;
}
public void setRoutePointItemId(long routePointItemId) {
this.routePointItemId = routePointItemId;
}
public long getPlanTaskDetailId() {
return planTaskDetailId;
}
public void setPlanTaskDetailId(long planTaskDetailId) {
this.planTaskDetailId = planTaskDetailId;
}
public String getClassifyName() {
return classifyName;
}
public void setClassifyName(String classifyName) {
this.classifyName = classifyName;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public String getInputName() {
return inputName;
}
public void setInputName(String inputName) {
this.inputName = inputName;
}
public String getDepId() {
return depId;
}
/**
* 执行部门名称
*/
private String depName;
public void setDepId(String depId) {
this.depId = depId;
}
/**
* 冗余字段:点名称
*/
private String pointName;
/**
* 冗余字段:路线名称
*/
private String routeName;
/**
* 冗余字段:计划名称
*/
private String planName;
}
package com.yeejoin.amos.maintenance.business.service.impl;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.maintenance.business.dao.repository.AppVersionDao;
import com.yeejoin.amos.maintenance.business.dao.repository.IMsgSubscribeDao;
import com.yeejoin.amos.maintenance.business.param.UserMsgInitParam;
import com.yeejoin.amos.maintenance.business.service.intfc.IAppService;
import com.yeejoin.amos.maintenance.business.service.intfc.IMsgSubscribeService;
import com.yeejoin.amos.maintenance.common.enums.MsgSubscribeTypeEnum;
import com.yeejoin.amos.maintenance.dao.entity.AppVersion;
import com.yeejoin.amos.maintenance.dao.entity.MsgSubscribe;
import org.assertj.core.util.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service("iAppService")
public class AppServiceImpl implements IAppService {
@Autowired
private IMsgSubscribeDao msgSubscribeDao;
@Autowired
private AppVersionDao appVersionDao;
@Autowired
private IMsgSubscribeService msgSubscribeService;
@Autowired
private PlanTaskMapper planTaskMapper;
@Override
public AppVersion queryAppLastVersion() {
// TODO Auto-generated method stub
return appVersionDao.findLastVersion();
}
/**
* 新增用户时初始化消息订阅(p_msg_subscribe)表
*
* @param userDTO
*/
@Override
public List<MsgSubscribe> saveUserMsgInit(UserMsgInitParam userInitParam) {
Long count = msgSubscribeDao.countByUserId(userInitParam.getUserId());
if (count > 0) { // 已存在用户订阅,直接返回
return msgSubscribeService.queryMsgSubscribes(userInitParam.getUserId());
}
List<MsgSubscribe> msgConfigs = new ArrayList<MsgSubscribe>();
for (MsgSubscribeTypeEnum type : MsgSubscribeTypeEnum.values()) {
MsgSubscribe msgSub = new MsgSubscribe();
msgSub.setOrgCode(userInitParam.getOrgCode());
msgSub.setUserId(userInitParam.getUserId());
if (type.equals(MsgSubscribeTypeEnum.PLANBEGIN)
|| type.equals(MsgSubscribeTypeEnum.PLANWARN)
|| type.equals(MsgSubscribeTypeEnum.PLANEND)) {
msgSub.setAttribute1("False");
msgSub.setAttribute2(10 + "");
} else if (type.equals(MsgSubscribeTypeEnum.CHECKTYPE)
|| type.equals(MsgSubscribeTypeEnum.CHECKEMAIL)) {
msgSub.setAttribute1("error");
}
msgSub.setMsgType(type.getName());
msgSubscribeDao.saveAndFlush(msgSub);
msgConfigs.add(msgSub);
}
return msgConfigs;
}
@Override
public List<String> getHaveToDoList(String userId) {
int taskCount = planTaskMapper.getCurrentPlanTaskCount(userId);
List<String> havetoDoList = Lists.newArrayList();
if (taskCount > 0) {
havetoDoList.add("planPatrol");
}
return havetoDoList;
}
}
\ No newline at end of file
......@@ -117,17 +117,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//3.计算生成数据的日期区间(前10位:yyyy-MM-dd)
CalDateVo vo = PlanTaskUtil.reGenPlanTaskData(plan, strBeginDate, strEndDate);
if (null == vo) {//计划未开始,则结束
//计划未开始,则结束
if (null == vo) {
return;
}
if (!vo.getIsGenData()) {//日期不符合条件直接结束
//日期不符合条件直接结束
if (!vo.getIsGenData()) {
return;
}
//3.删除planTask表,按照计划id+日期
//4.删除planTask表,按照计划id+日期
deletePlanTaskAndDet(param);
//5.执行数据生成(具体时间 + 人员)
......@@ -135,68 +134,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//6.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, flag, new Date());
//7.重新统计计划
if (ObjectUtils.isEmpty(plan.getUserId())) {
return;
}
reformStatisticsPlanTask(strBeginDate, strEndDate, plan.getUserId(), plan.getOrgCode());
}
}
@Override
public void reformStatisticsPlanTask(String strBginDate, String strEndDate, String userId, String orgCode) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date startTime = sdf.parse(strBginDate);
Date endTime = sdf.parse(strEndDate);
Calendar cal = Calendar.getInstance();
cal.setTime(startTime);
Date currentDate = new Date();
String strCurrentDate = sdf.format(currentDate);
long abortTime = endTime.getTime();
if (endTime.getTime() >= sdf.parse(strCurrentDate).getTime()) {
abortTime = sdf.parse(strCurrentDate).getTime();
}
String[] ids = userId.split(",");
// StringBuffer orgCodeBuffer = new StringBuffer();
// Map<String,String> deptMap =new HashMap<>();
// Set<Object> userIds =new HashSet<>();
// for (int i = 0; i <ids.length ; i++) {
// userIds.add(ids[i].toString());
// }
// Map<String,AgencyUserModel> agencyUserModelMap = remoteSecurityService.getUsersMap(toke.getToke(),toke.getProduct(),toke.getAppKey(),userIds);
// List<Map<String, String>> idOrgCodeList = new ArrayList<>();
// for(Map.Entry<String, AgencyUserModel> entry : agencyUserModelMap.entrySet()){
// String id = entry.getKey();
// AgencyUserModel agencyUserModels = entry.getValue();
// StringBuffer agencyUserOrgcode = new StringBuffer();
// if(agencyUserModelMap.size() > 0){
// agencyUserModels.getCompanys().forEach(companyModel -> {
// agencyUserOrgcode.append(companyModel.getOrgCode()).append(",");
// });
// }
// Map<String,String> map = new HashMap<>();
// map.put(id,agencyUserOrgcode.toString().substring(0,agencyUserOrgcode.length()-1));
// }
//
// Map<String, String> userIdOrgCodeMap = new HashMap<>(ids.length);
// if (!CollectionUtils.isEmpty(idOrgCodeList)) {
// userIdOrgCodeMap = idOrgCodeList.stream().collect(Collectors.toMap(x-> String.valueOf(x.get(
// "id")), x->x.get("org_code")));
// }
while (cal.getTime().getTime() <= abortTime) {
String refDate = sdf.format(cal.getTime());
for (String id : ids) {
if (!ObjectUtils.isEmpty(id)) {
planTaskMapper.reformStatistics(id, refDate, orgCode);
// planTaskMapper.reformStatistics(id, refDate, userIdOrgCodeMap.get(id));
}
}
cal.add(Calendar.DATE, 1);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -514,8 +454,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
jobService.planTaskAddJob(planTask);
}
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表
Date genDate = DateUtil.str2Date(list.get(list.size() - 1).get("NEXT_GEN_DATE").toString(), "yyyy-MM-dd");//下次生成日期
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表 ,下次生成日期
Date genDate = DateUtil.str2Date(list.get(list.size() - 1).get("NEXT_GEN_DATE").toString(), "yyyy-MM-dd");
//明天
Date tomorrow = DateUtil.getIntervalDate(now, 1);
String strGenDate = list.get(list.size() - 1).get("NEXT_GEN_DATE").toString().substring(0, 10);
......@@ -523,17 +463,21 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
paramMap.put("id", plan.getId());
paramMap.put("next_gen_date", strGenDate);
if (XJConstant.SCHED_FLAG.equals(flag)) {
paramMap.put("plan_task_id", 0);//修改为初始值
//修改为初始值
paramMap.put("plan_task_id", 0);
paramMap.put("first_flag", XJConstant.PLAN_FIRST_STATUS_NO);
} else if (!XJConstant.SCHED_FLAG.equals(flag) && (genDate.getTime() - tomorrow.getTime() >= 0) && XJConstant.FIX_DATE_NO.equals(plan.getIsFixedDate())) {//更新日期及plantaskId到plan表
} else if (genDate.getTime() - tomorrow.getTime() >= 0 && XJConstant.FIX_DATE_NO.equals(plan.getIsFixedDate())) {
//更新日期及plantaskId到plan表
long planTaskId = iplanTaskDao.findMaxIdByBatchNo(batchNo);
paramMap.put("plan_task_id", planTaskId);// 更新新的任务id到plan
// 更新新的任务id到plan
paramMap.put("plan_task_id", planTaskId);
paramMap.put("first_flag", XJConstant.PLAN_FIRST_STATUS_NO);
}
if (DateUtil.str2Date(strGenDate, "yyyy-MM-dd").getTime() - now.getTime() < 0 || org.apache.commons.lang.StringUtils.isBlank(strGenDate)) {
paramMap.put("next_gen_date", DateUtil.formatDatrToStr(now, "yyyy-MM-dd"));
}
planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期
// 更新下次任务生成日期
planMapper.updPlanStatusOrGenDate(paramMap);
} catch (Exception e) {
log.error(e.getMessage(), e);
......@@ -542,8 +486,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
public List<PlanTask> getPlanTaskByRouteId(Long routeId) {
List<PlanTask> planTaskList = planTaskMapper.getPlanTaskByRouteId(routeId);
return planTaskList;
return planTaskMapper.getPlanTaskByRouteId(routeId);
}
@Override
......@@ -578,11 +521,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public int getCurrentPlanTaskCount(String userId) {
return planTaskMapper.getCurrentPlanTaskCount(userId);
}
@Override
public List<PlanTaskVo> getPlanTaskListByIds(String toke, String product, String appKey, Long[] ids) {
List<PlanTaskVo> content = planTaskMapper.getPlanTaskListByIds(ids);
......@@ -717,153 +655,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return result;
}
@Override
public Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params) {
return planTaskMapper.getPlanTaskStatisticsForApp(params);
}
@Override
public AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey, check.getId());
} else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
if (planPointInfo != null) {
List<String> userIds = Arrays.asList(planPointInfo.getUsername().split(","));
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, planPointInfo.getUsername());
Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
if (userModelMap != null) {
List<String> userNameList = new ArrayList<>();
for (String userId : userIds) {
userNameList.add(userModelMap.get(userId));
}
userNameList.remove("");
userNameList.remove(null);
pointCheckRespone.setUsername(Joiner.on(",").join(userNameList));
}
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, planPointInfo.getUsername());
if (departmentBo != null) {
pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName());
}
pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setPointStatus("0");
pointCheckRespone.setPlanName(planPointInfo.getPlanName());
List<PointCheckDetailBo> pointInputs = planTaskMapper.getPointInputByRouteIdAndPointId(planPointInfo.getRouteId(), planPointInfo.getPointId());
JSONObject appResponeMap = new JSONObject();
pointInputs.forEach(action -> {
AppCheckInputRespone input = new AppCheckInputRespone();
input.setInputName(action.getInputName());
input.setCheckInputId(action.getCheckInputId());
input.setDataJson(action.getDataJson());
input.setIsMultiline(action.getIsMultiline());
input.setIsMust(action.getIsMust());
input.setItemType(action.getItemType());
input.setOrderNo(action.getOrderNo());
input.setPictureJson(action.getPictureJson());
input.setClassifyId(action.getClassifyId());
input.setClassifyName(action.getClassifyName());
String key = ObjectUtils.isEmpty(action.getClassifyName()) ? "其他" : action.getClassifyName();
if (appResponeMap.containsKey(key)) {
appResponeMap.getJSONArray(key).add(input);
} else {
List<AppCheckInputRespone> appCheckInputResponeList = new ArrayList<AppCheckInputRespone>();
appCheckInputResponeList.add(input);
appResponeMap.put(key, appCheckInputResponeList);
}
});
pointCheckRespone.setAppCheckInput(appResponeMap);
} else {
return null;
}
}
return pointCheckRespone;
}
@Override
public AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey, check.getId());
} else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
if (planPointInfo != null) {
pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setPointStatus("0");
pointCheckRespone.setPlanName(planPointInfo.getPlanName());
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, planPointInfo.getUserId());
for (AgencyUserModel userModel : userModelList) {
pointCheckRespone.setUsername(userModel.getRealName());
}
// DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId());
DepartmentModel departmentModel = new DepartmentModel();
pointCheckRespone.setDepartmentName(departmentModel.getDepartmentName());
List<PointCheckDetailBo> pointInputs = planTaskMapper.getPointInputByRouteIdAndPointId(planPointInfo.getRouteId(), planPointInfo.getPointId());
JSONObject appResponeMap = new JSONObject();
pointInputs.forEach(action -> {
AppCheckInputRespone input = new AppCheckInputRespone();
input.setInputName(action.getInputName());
input.setCheckInputId(action.getCheckInputId());
input.setDataJson(action.getDataJson());
input.setIsMultiline(action.getIsMultiline());
input.setIsMust(action.getIsMust());
input.setItemType(action.getItemType());
input.setOrderNo(action.getOrderNo());
input.setPictureJson(action.getPictureJson());
input.setClassifyId(action.getClassifyId());
input.setClassifyName(action.getClassifyName());
String classifyName = action.getClassifyName();
if (!StringUtil.isNotEmpty(classifyName)) {
classifyName = "其他";
}
String riskDesc = action.getRiskDesc();
if (!StringUtil.isNotEmpty(riskDesc)) {
riskDesc = XJConstant.DEFAULT_RISKDESC;
}
JSONObject classifyJson;
if (appResponeMap.containsKey(classifyName)) {
classifyJson = appResponeMap.getJSONObject(classifyName);
} else {
classifyJson = new JSONObject();
}
JSONArray riskDescArr;
if (classifyJson.containsKey(riskDesc)) {
riskDescArr = classifyJson.getJSONArray(riskDesc);
} else {
riskDescArr = new JSONArray();
}
riskDescArr.add(action);
classifyJson.put(riskDesc, riskDescArr);
appResponeMap.put(classifyName, classifyJson);
});
pointCheckRespone.setAppCheckInput(appResponeMap);
} else {
return null;
}
}
return pointCheckRespone;
}
@Override
public String getCumulativePlanCountByOrgCode(String loginOrgCode) {
return planTaskMapper.getCumulativePlanCountByOrgCode(loginOrgCode);
}
@Override
public List<LeavePlanTaskVo> queryLeavePlanTask(HashMap<String, Object> params) {
return planTaskMapper.queryLeavePlanTask(params);
}
@Override
public PlanTask selectPlanTaskStatus(Long id) {
......@@ -880,121 +681,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planMapper.initUpdatePlanNextGenDate();
}
@Override
public List<Map<String, Object>> queryPlanTaskTimeAxis(Long userId, Integer createDate) {
HashMap<String, Object> params = new HashMap<>();
params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = "";
if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
} else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
} else {
beginTime = DateUtil.getShortCurrentDate();
}
params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime", endTime + " 23:59:59");
List<Map<String, Object>> content = planTaskMapper.queryPlanTaskTimeAxis(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
content.forEach(e -> {
String id = e.get("userId").toString();
if (StringUtil.isNotEmpty(id)) {
userIds.add(id);
}
});
Toke toke = remoteSecurityService.getServerToken();
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), Joiner.on(",").join(userIds));
Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
content.forEach(e -> {
StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(",");
}
e.put("userName", userNames.substring(0, userNames.length() - 1));
e.put("beginTime", DateUtil.formatDatrToStr((Date) e.get("beginTime"), DateUtil.LONG_PATTERN));
e.put("endTime", DateUtil.formatDatrToStr((Date) e.get("endTime"), DateUtil.LONG_PATTERN));
});
}
return content;
}
@Override
public List<Map<String, Object>> queryTimeAxis(Long userId, Integer createDate) {
HashMap<String, Object> params = new HashMap<>();
params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = "";
if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
} else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
} else {
beginTime = DateUtil.getShortCurrentDate();
}
params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime", endTime + " 23:59:59");
String structListString = equipFeign.getStructureNameAll();
JSONObject jsonObject = JSONObject.parseObject(structListString);
JSONArray structList = jsonObject.getJSONArray("result");
List<Map<String, Object>> result = new ArrayList<>();
List<Map<String, Object>> content = planTaskMapper.queryTimeAxis(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
content.forEach(e -> {
String id = e.get("userId").toString();
if (StringUtil.isNotEmpty(id)) {
userIds.add(id);
}
});
Toke toke = remoteSecurityService.getServerToken();
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), Joiner.on(",").join(userIds));
Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
content.forEach(e -> {
StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(",");
}
HashMap<String, Object> map = new HashMap();
map.put("userName", userNames.substring(0, userNames.length() - 1));
map.put("beginTime", DateUtil.formatDatrToStr((Date) e.get("beginTime"), DateUtil.LONG_PATTERN));
map.put("endTime", DateUtil.formatDatrToStr((Date) e.get("endTime"), DateUtil.LONG_PATTERN));
map.put("leftName", "巡检点");
map.put("titleName", userNames.substring(0, userNames.length() - 1) + "-" + e.get("name").toString() + "-" + e.get("STATUS").toString());
String structName = "";
if (!StringUtils.isEmpty(e.get("risk_source_id"))) {
for (int i = 0; i < structList.size(); i++) {
if (structList.getJSONObject(i).get("id").equals(e.get("risk_source_id"))) {
structName = structList.getJSONObject(i).get("name").toString();
}
}
} else {
structName = "无";
}
if (!StringUtils.isEmpty(e.get("executorDate"))) {
map.put("firstPropsValue", structName + "-" + e.get("executorDate"));
} else {
map.put("firstPropsValue", structName + "-无");
}
result.add(map);
});
}
return result;
}
@Override
public Map<String, Object> planTaskPointDetail(String planTaskDetailId, String routePointId) {
......
package com.yeejoin.amos.maintenance.business.service.intfc;
import java.util.List;
import com.yeejoin.amos.maintenance.business.param.UserMsgInitParam;
import com.yeejoin.amos.maintenance.dao.entity.AppVersion;
import com.yeejoin.amos.maintenance.dao.entity.MsgSubscribe;
public interface IAppService {
AppVersion queryAppLastVersion();
List<MsgSubscribe> saveUserMsgInit(UserMsgInitParam userInitParam);
List<String> getHaveToDoList(String userId);
}
package com.yeejoin.amos.maintenance.business.service.intfc;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.maintenance.business.vo.CodeOrderVo;
import com.yeejoin.amos.maintenance.business.vo.LeavePlanTaskVo;
import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam;
import com.yeejoin.amos.maintenance.business.param.PlanTaskPageParam;
import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import com.yeejoin.amos.maintenance.dao.entity.PlanTask;
import org.springframework.data.domain.Page;
import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam;
import com.yeejoin.amos.maintenance.business.param.PlanTaskPageParam;
import com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.maintenance.dao.entity.PlanTask;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface IPlanTaskService {
/**
* 计划执行查询
*/
Page<HashMap<String, Object>> getPlanTaskInfo(PlanTaskPageParam params);
/**
* 计划执行重做
*/
void reGenPlanTask(HashMap<String, Object> param) throws ParseException;
/**
* 计划执行删除
*/
void planTaskDet(String[] strArry);
/**
* 执行计划导出
*/
List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam params);
/**
* 自动任务执行
* @param runDate
*/
void taskExecution(String runDate);
/**
* 根据路线id获取关联的所有计划任务
*
* @param routeId
* @return
*/
List<PlanTask> getPlanTaskByRouteId(Long routeId);
/**
* 停用计划任务
*
* @param routeIds
*/
void disablePlanTask(Long[] routeIds);
/**
* 计划任务列表
* @param params
* @param page
* @return
*/
Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable page);
/**
* 根据计划ID获取所有的 任务计划巡检点
* @param param
* @return
*/
List getPlanTaskPoints(Map<String, Object> param);
/**
* 获取用户当前所有有的计划任务
* @param userId
* @return
*/
int getCurrentPlanTaskCount(String userId);
/**
* 今日执行情况
* @param params
* 计划执行查询
*/
Page<HashMap<String, Object>> getPlanTaskInfo(PlanTaskPageParam params);
/**
* 计划执行重做
*/
void reGenPlanTask(HashMap<String, Object> param) throws ParseException;
/**
* 计划执行删除
*/
void planTaskDet(String[] strArry);
/**
* 执行计划导出
*/
List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam params);
/**
* 自动任务执行
*
* @param runDate
*/
void taskExecution(String runDate);
/**
* 根据路线id获取关联的所有计划任务
*
* @param routeId
* @return
*/
Page<CheckChkExListBo> getChkExList(String toke, String product, String appKey, CheckPtListPageParam params);
List<PlanTask> getPlanTaskByRouteId(Long routeId);
/**
* 根据id获取执行计划
* @param ids
* @return
*/
List<PlanTaskVo> getPlanTaskListByIds(String toke,String product,String appKey,Long[] ids);
/**
* 停用计划任务
*
* @param routeIds
*/
void disablePlanTask(Long[] routeIds);
/**
* 根据任务id点id 获取点详情
* @param planTaskId
* @param pointId
* @return
*/
AppPointCheckRespone queryPointPlanTaskDetail(String toke,String product,String appKey,Long planTaskId,Long pointId);
AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke,String product,String appKey,Long planTaskId,Long pointId);
/**
* 计划任务列表
*
* @param params
* @param page
* @return
*/
Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable page);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
/**
* 获取公司计划累计情况
* @param loginOrgCode
* @return
*/
String getCumulativePlanCountByOrgCode(String loginOrgCode);
/**
* 根据计划ID获取所有的 任务计划巡检点
*
* @param param
* @return
*/
List getPlanTaskPoints(Map<String, Object> param);
List<LeavePlanTaskVo> queryLeavePlanTask(HashMap<String, Object> params);
/**
* 今日执行情况
*
* @param params
* @return
*/
Page<CheckChkExListBo> getChkExList(String toke, String product, String appKey, CheckPtListPageParam params);
/**
* 根据id获取执行计划
*
* @param ids
* @return
*/
List<PlanTaskVo> getPlanTaskListByIds(String toke, String product, String appKey, Long[] ids);
PlanTask selectPlanTaskStatus(Long id);
/**
* 获取公司计划累计情况
*
* @param loginOrgCode
* @return
*/
String getCumulativePlanCountByOrgCode(String loginOrgCode);
void reformStatisticsPlanTask(String strBginDate, String strEndDate, String userId, String orgCode) throws ParseException;
void initPlanStatusOrGenDate();
PlanTask selectPlanTaskStatus(Long id);
List<Map<String,Object>> queryPlanTaskTimeAxis(Long userId,Integer createDate);
List<Map<String,Object>> queryTimeAxis(Long userId,Integer createDate);
void initPlanStatusOrGenDate();
/**
* 任务点详情
*
* @param planTaskDetailId 子表id
* @param routePointId 关系表id
* @return Map<String, Object>
*/
Map<String, Object> planTaskPointDetail(String planTaskDetailId, String routePointId);
/**
* 任务点详情
*
* @param planTaskDetailId 子表id
* @param routePointId 关系表id
* @return Map<String, Object>
*/
Map<String, Object> planTaskPointDetail(String planTaskDetailId, String routePointId);
}
......@@ -38,8 +38,6 @@ public class JobService implements IJobService {
@Autowired
private IPlanTaskDao iPlanTaskDao;
@Autowired
private IPlanDao iPlanDao;
@Autowired
private IPlanTaskDetailDao iPlanTaskDetailDao;
......@@ -51,9 +49,6 @@ public class JobService implements IJobService {
private PlanTaskMapper planTaskMapper;
@Autowired
private MsgMapper msgMapper;
@Autowired
private ICheckDao iCheckDao;
@Autowired
......@@ -69,14 +64,10 @@ public class JobService implements IJobService {
private ITaskFeedbackDao taskFeedbackDao;
@Autowired
private CheckMapper checkMapper;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Value("${amosRefresh.patrol.topic}")
private String patrolTopic;
@Autowired
private MqttGateway webMqttComponent;
@Override
@Transactional
......@@ -204,12 +195,15 @@ public class JobService implements IJobService {
check.setUserId(planTask.getUserId());
check.setUserName(planTask.getUserName());
check.setDepName("");
check.setPointName(arg.getPointName());
check.setPointId(arg.getPointId());
check.setUploadTime(new Date());
check.setPlanId(arg.getPlanId());
check.setPlanName(arg.getPlanName());
check.setPlanTaskId(arg.getPlanTaskId());
check.setPlanTaskDetailId(arg.getPlanTaskDetailId());
check.setRouteId(arg.getRouteId());
check.setRouteName(arg.getRouteName());
check.setCheckTime(arg.getEndTime());
check.setIsOk(CheckStatusEnum.OMISSION.getCode());
check = iCheckDao.saveAndFlush(check);
......@@ -301,7 +295,6 @@ public class JobService implements IJobService {
@Override
public void planTaskAddJob(PlanTask planTask) {
// TODO Auto-generated method stub
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date endTime = sdf.parse(planTask.getEndTime());
......@@ -316,30 +309,6 @@ public class JobService implements IJobService {
|| PlanTaskFinishStatusEnum.UNDERWAY.getValue() == status) {
addJob("planTask", XJConstant.STATUS_MONITOR_END, planTask.getId(), endTime);// 添加监控任务开始结束定时任务
}
// 查询需要推送消息提醒
List<MsgConfigParam> configParam = msgMapper.getPlanTaskMsgConfigByUserIdAndStatus(planTask.getUserId().split(","),
"True");
if (!configParam.isEmpty()) {
configParam.forEach(config -> {
String jobType = "";
Date time = new Date();
int minute = Integer.valueOf(config.getValue());
long tempTime = minute * 60 * 1000;
if (MsgSubscribeTypeEnum.PLANWARN.getName().equals(config.getMsgType())) {
time = new Date(beginTime.getTime() - tempTime);
jobType = XJConstant.PLAN_TASK_WARN_MSG_PUSH + "-" + config.getUserId();
} else if (MsgSubscribeTypeEnum.PLANBEGIN.getName().equals(config.getMsgType())) {
time = new Date(beginTime.getTime() + tempTime);
jobType = XJConstant.PLAN_TASK_BEGIN_MSG_PUSH + "-" + config.getUserId();
} else if (MsgSubscribeTypeEnum.PLANEND.getName().equals(config.getMsgType())) {
time = new Date(endTime.getTime() + tempTime);
jobType = XJConstant.PLAN_TASK_END_MSG_PUSH + "-" + config.getUserId();
}
addJob("planTask", jobType, planTask.getId(), time);
});
}
} else {
updatePlanTaskStatus(planTask, PlanTaskFinishStatusEnum.OVERTIME.getValue());
}
......
......@@ -402,4 +402,18 @@ public class InputItemController extends AbstractBaseController {
List<InputItemTemplateVo> itemTemplateVoList = ExcelUtils.importExcel(file, 1, 1, InputItemTemplateVo.class);
return CommonResponseUtil.success(inputItemService.uploadListByTemplate(itemTemplateVoList, orgCode, userId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取字典值", notes = "获取字典值")
@GetMapping(value = "/diction")
public CommonResponse getCheckItemClassify() {
return CommonResponseUtil.success(inputItemService.generateDictionaryValue());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取上一级", notes = "获取上一级")
@GetMapping(value = "/parent/item")
public CommonResponse getItemParent(@ApiParam(value = "检查项id") @RequestParam(required = false) String id) {
return CommonResponseUtil.success(inputItemService.getItemParent(id));
}
}
......@@ -11,6 +11,7 @@ import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import com.yeejoin.amos.supervision.business.vo.MaintenanceResourceData;
import com.yeejoin.amos.supervision.business.vo.PointClassifyVo;
import com.yeejoin.amos.supervision.business.vo.PointInputItemVo;
......@@ -216,7 +217,7 @@ public class PointController extends AbstractBaseController {
/**
* 查询巡检点信息
*
* @param point
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -270,7 +271,7 @@ public class PointController extends AbstractBaseController {
/**
* 查询巡检点信息
*
* @param point
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -499,7 +500,7 @@ public class PointController extends AbstractBaseController {
/**
* 查询巡检点的巡检项
*
* @param id
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -518,7 +519,7 @@ public class PointController extends AbstractBaseController {
/**
* 查询巡检点的巡检项
*
* @param id
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -537,7 +538,7 @@ public class PointController extends AbstractBaseController {
/**
* 查询巡检点的分类
*
* @param id
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -556,7 +557,7 @@ public class PointController extends AbstractBaseController {
/**
* 根据分类id查询对应项
*
* @param id
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -576,7 +577,7 @@ public class PointController extends AbstractBaseController {
/**
* 根据点id查询点的分类及对应项
*
* @param id
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -672,7 +673,7 @@ public class PointController extends AbstractBaseController {
/**
* 查询巡检点信息
*
* @param point
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -808,15 +809,34 @@ public class PointController extends AbstractBaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "装备维保项", notes = "装备维保项")
@RequestMapping(value = "/equipmentInput", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ApiOperation(value = "机场单位同步", notes = "机场单位同步")
@RequestMapping(value = "/teamInput", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse syncSavePoint(
@ApiParam(value = "同步请求参数") @RequestBody() List<MaintenanceResourceData> list) {
@ApiParam(value = "同步请求参数") @RequestBody OrgUsrFormDto orgUsrFormDto) {
ReginParams reginParams = getSelectedOrgInfo();
AgencyUserModel model = getUserInfo();
String orgCode = getOrgCode(reginParams);
iPointService.syncSavePoint(list, orgCode, model.getUserId());
iPointService.syncSavePoint(orgUsrFormDto, orgCode, model.getUserId());
return CommonResponseUtil.success();
}
/**
* 删除巡检点
*
* @param id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "同步删除机场单位", notes = "同步删除机场单位")
@PostMapping(value = "/delete", produces = "application/json;charset=UTF-8")
public CommonResponse deleteOwner(@ApiParam(value = "巡检点ID", required = true) @RequestBody Long id) {
try {
iPointService.delPointByPointNo(id);
return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("删除检查点失败");
}
}
}
......@@ -32,4 +32,6 @@ public interface InputItemMapper {
List<PointInputItemVo> queryCustomInputItemByPointId(@Param("pointId") Long pointId, @Param("equipmentId") String equipmentName);
Integer insertList(List<InputItem> list);
List<InputItemVo> getInputItemParent(@Param("id") String id);
}
......@@ -36,4 +36,12 @@ public interface IPointDao extends BaseDao<Point, Long> {
void delPointBIds(Long id);
List<Point> findAllByOriginalId(String relationId);
@Modifying
@Transactional
@Query(value = "UPDATE p_point SET is_delete = 1 WHERE point_no IN (?1)", nativeQuery = true)
void delPointByPointNo(Long id);
@Query(value = "SELECT id FROM p_point p WHERE is_delete = 0 AND p.point_no = (?1)", nativeQuery = true)
List<Long> findPointByPointNo(String pointNo);
}
package com.yeejoin.amos.supervision.business.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
*
* @return
* <PRE>
* author tw
* date 2021/6/21
* </PRE>
* 动态表单值
*/
@Data
@ApiModel(value="FormValue", description="动态表单值")
public class FormValue implements Serializable{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "key")
private String key;
@ApiModelProperty(value = "label")
private String label;
@ApiModelProperty(value = "type")
private String type;
@ApiModelProperty(value = "value")
private String value;
@ApiModelProperty(value = "是否一行显示")
private boolean block;
public FormValue() {
}
public FormValue(String key, String label, String type, String value, boolean block) {
super();
this.key = key;
this.label = label;
this.type = type;
this.value = value;
this.block = block;
}
}
package com.yeejoin.amos.supervision.business.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 机构/部门/人员表
*
* @author tb
* @date 2021-06-18
*/
@Data
@Accessors(chain = true)
@TableName("cb_org_usr")
@ApiModel(value="OrgUsrVo", description="人员信息")
public class OrgPersonFormDto extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "机构/部门id")
private Long id;
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ApiModelProperty(value = "机构类型`")
private String bizOrgType;
@ApiModelProperty(value = "所属建筑名称")
private String buildName;
@ApiModelProperty(value = "所属建筑ID")
private String buildId;
@ApiModelProperty(value = "归属机构/部门/人员")
private String parentId;
@ApiModelProperty(value = "归属机构/部门/人员")
private String parentName;
@ApiModelProperty(value = "动态表单值")
private List<FormValue> dynamicFormAlert;
public OrgPersonFormDto() {
}
public OrgPersonFormDto(List<FormValue> dynamicFormAlert) {
this.dynamicFormAlert = dynamicFormAlert;
}
}
package com.yeejoin.amos.supervision.business.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 机构/部门/人员表
*
* @author tb
* @date 2021-06-18
*/
@Data
@Accessors(chain = true)
@TableName("cb_org_usr")
@ApiModel(value="OrgUsrVo", description="机构/部门/人员表")
public class OrgUsrFormDto implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "单位id")
private Long id;
@ApiModelProperty(value = "单位id")
protected Long sequenceNbr;
@ApiModelProperty(value = "单位名称")
private String currentUnit;
@ApiModelProperty(value = "归属机构/部门")
private String parentId;
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ApiModelProperty(value = "机构类型`")
private String bizOrgType;
@ApiModelProperty(value = "所属建筑名称")
private String buildName;
@ApiModelProperty(value = "所属建筑ID")
private String buildId;
private Integer personNum;
@ApiModelProperty(value = "动态表单值")
private List<FormValue> dynamicFormAlert;
@ApiModelProperty(value = "单位人员信息值")
private List<OrgPersonFormDto> children;
public List<FormValue> getDynamicFormAlert() {
return dynamicFormAlert;
}
@ApiModelProperty(value = "转换动态表单")
private Map<String,Object> map=new HashMap<>();;
public void setDynamicFormAlert(List<FormValue> dynamicFormAlert) {
if(dynamicFormAlert!=null) {
dynamicFormAlert.forEach(formValue->{
this.map.put(formValue.getKey(), formValue.getValue());
});
}
this.dynamicFormAlert=dynamicFormAlert;
}
public OrgUsrFormDto() {
}
}
......@@ -10,9 +10,11 @@ import com.yeejoin.amos.supervision.business.param.InputItemPageParam;
import com.yeejoin.amos.supervision.business.service.intfc.ICatalogTreeService;
import com.yeejoin.amos.supervision.business.service.intfc.IInputItemService;
import com.yeejoin.amos.supervision.business.util.DaoCriteria;
import com.yeejoin.amos.supervision.business.util.StringUtil;
import com.yeejoin.amos.supervision.business.vo.InputItemTemplateVo;
import com.yeejoin.amos.supervision.business.vo.InputItemVo;
import com.yeejoin.amos.supervision.business.vo.PointInputItemVo;
import com.yeejoin.amos.supervision.common.enums.DictTypeEnum;
import com.yeejoin.amos.supervision.core.util.query.BaseQuerySpecification;
import com.yeejoin.amos.supervision.dao.entity.InputItem;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
......@@ -25,6 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
......@@ -93,6 +96,46 @@ public class InputItemServiceImpl implements IInputItemService {
}
@Override
public List<Map<String, Object>> generateDictionaryValue() {
List<Map<String, Object>> list = new ArrayList<>();
for (Map<String, String> map : DictTypeEnum.getEnumList()) {
JSONArray jsonArray = remoteSecurityService.listDictionaryByDictCode(RequestContext.getToken(),
RequestContext.getProduct(), RequestContext.getAppKey(), map.get("code"));
Map<String, Object> map1 = new HashMap<>();
List lists = new LinkedList();
for (int i = 0, size = jsonArray.size(); i < size; i++) {
Map<String, String> m = new HashMap<>();
JSONObject jsonObject = jsonArray.getJSONObject(i);
m.put("id", jsonObject.get("dictDataKey").toString());
m.put("name", jsonObject.get("dictDataValue").toString());
lists.add(m);
}
if ("itemClassify".equals(map.get("code"))) {
map1.put("CHECK_ITEM_CLASSIFY", lists);
list.add(map1);
}
if ("itemType".equals(map.get("code"))) {
map1.put("CHECK_ITEM_TYPE", lists);
list.add(map1);
}
if ("itemLevel".equals(map.get("code"))) {
map1.put("CHECK_ITEM_LEVEL", lists);
list.add(map1);
}
if ("checkType".equals(map.get("code"))) {
map1.put("CHECK_ITEM_CONTENT", lists);
list.add(map1);
}
}
return list;
}
@Override
public List getItemParent(String id) {
return inputItemMapper.getInputItemParent(id);
}
@Override
public List<InputItem> queryInputItemByCondition(List<DaoCriteria> criterias) {
BaseQuerySpecification<InputItem> specification = new BaseQuerySpecification<>(criterias);
return inputItemDao.findAll(specification);
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
......@@ -20,6 +21,8 @@ import com.yeejoin.amos.supervision.business.dao.repository.IPointInputItemDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPointPhotoDao;
import com.yeejoin.amos.supervision.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.supervision.business.dao.repository.IRoutePointItemDao;
import com.yeejoin.amos.supervision.business.dto.FormValue;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import com.yeejoin.amos.supervision.business.dto.PointDto;
import com.yeejoin.amos.supervision.business.entity.mybatis.CheckPtListBo;
import com.yeejoin.amos.supervision.business.feign.EquipFeign;
......@@ -1118,45 +1121,53 @@ public class PointServiceImpl implements IPointService {
}
@Override
public void syncSavePoint(List<MaintenanceResourceData> list, String orgCode, String userId) {
public void syncSavePoint(OrgUsrFormDto orgUsrFormDto, String orgCode, String userId) {
List<Point> points = new ArrayList<>();
List<PointInputItem> inputItems = new ArrayList<>();
List<Long> ids = new ArrayList<Long>();
for (MaintenanceResourceData x : list) {
Point point = new Point();
String pointNo = StringUtil.isNotEmpty(x.getFireFacilityCode()) ? x.getFireFacilityCode() : String.valueOf(sequence.nextId());
String originalId = String.valueOf(x.getFireFacilityId());
point.setOriginalId(originalId);
point.setName(x.getFireFacilityName());
point.setPointNo(pointNo);
point.setEquipmentId(x.getClassifyId() == null ? "" : x.getClassifyId().toString());
point.setEquipmentName(x.getClassifyName());
point.setBelongSystemId(x.getFireFightSysId() == null ? "" : x.getFireFightSysId().toString());
point.setBelongSystemName(x.getFireFightSysName());
point.setOwnerId(String.valueOf(x.getOwnerUnitId()));
point.setOwnerName(x.getOwnerUnitName());
point.setAddress(x.getLocation());
point.setLevel("");
point.setCreatorId(userId);
point.setOrgCode(orgCode);
points.add(point);
Long id = iPointDao.findPointByEquipmentIdAndFireFacilityId(pointNo, originalId);
if (null != id) {
ids.add(id);
iPointDao.delPointBIds(id);
}
iPointDao.save(point);
List<InputItem> inputItemVos = inputItemMapper.getInputItemByEquipmentName(x.getClassifyName(), orgCode);
if (0 < inputItemVos.size()) {
inputItemVos.forEach(y -> {
PointInputItem inputItem = new PointInputItem();
inputItem.setPointId(point.getId());
inputItem.setOrderNo(y.getOrderNo());
inputItem.setInputItemId(y.getId());
inputItems.add(inputItem);
});
Point point = new Point();
String pointNo = StringUtil.isNotEmpty(orgUsrFormDto.getSequenceNbr()) ? String.valueOf(orgUsrFormDto.getSequenceNbr()) : String.valueOf(sequence.nextId());
point.setName(orgUsrFormDto.getBizOrgName());
point.setPointNo(pointNo);
point.setOrgCode(orgUsrFormDto.getBizOrgCode());
point.setBuildingId(orgUsrFormDto.getBuildId());
point.setBuildingName(orgUsrFormDto.getBuildName());
point.setOriginalId(orgUsrFormDto.getParentId());
String data = JSON.toJSONString(orgUsrFormDto.getMap());
point.setExtendJson(data);
point.setOwnerId(pointNo);
point.setOwnerName(orgUsrFormDto.getBizOrgName());
if (0 < orgUsrFormDto.getDynamicFormAlert().size()) {
for (FormValue formValue : orgUsrFormDto.getDynamicFormAlert()) {
if ("longitude".equals(formValue.getKey())) {
point.setLongitude(formValue.getValue());
}
if ("latitude".equals(formValue.getKey())) {
point.setLatitude(formValue.getValue());
}
if ("companyLocation".equals(formValue.getKey())) {
point.setAddress(formValue.getValue());
}
}
}
point.setOrgCode(orgUsrFormDto.getAmosOrgCode());
points.add(point);
Long id = iPointDao.findPointByEquipmentIdAndFireFacilityId(pointNo, point.getOriginalId());
if (null != id) {
ids.add(id);
iPointDao.delPointBIds(id);
}
iPointDao.save(point);
List<InputItem> inputItemVos = inputItemMapper.getInputItemByEquipmentName(point.getName(), orgCode);
if (0 < inputItemVos.size()) {
inputItemVos.forEach(y -> {
PointInputItem inputItem = new PointInputItem();
inputItem.setPointId(point.getId());
inputItem.setOrderNo(y.getOrderNo());
inputItem.setInputItemId(y.getId());
inputItems.add(inputItem);
});
}
if (0 < ids.size()) {
iPointInputItemDao.deleteByPointId(ids);
}
......@@ -1183,4 +1194,12 @@ public class PointServiceImpl implements IPointService {
Pageable pageable = new CommonPageable(pointPage.getNumber(), pointPage.getSize(), pointPage.getSort());
return new PageImpl<>(pointDtos, pageable, pointPage.getTotalElements());
}
@Override
public void delPointByPointNo(Long id) {
List<Long> idLists = new ArrayList<>();
idLists = iPointDao.findPointByPointNo(String.valueOf(id));
iPointInputItemDao.deleteByPointId(idLists);
iPointDao.delPointByPointNo(id);
}
}
......@@ -112,4 +112,8 @@ public interface IInputItemService {
Boolean uploadListByTemplate(List<InputItemTemplateVo> itemTemplateVoList, String orgCode, String userId) throws Exception;
Integer insertList(List<InputItem> list);
List generateDictionaryValue();
List getItemParent(String id);
}
package com.yeejoin.amos.supervision.business.service.intfc;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import com.yeejoin.amos.supervision.business.dto.PointDto;
import com.yeejoin.amos.supervision.business.param.*;
import com.yeejoin.amos.supervision.business.param.CheckPtListPageParam;
......@@ -309,7 +310,7 @@ public interface IPointService {
LinkedHashMap<String,Object> getRegionTress ();
void syncSavePoint(List<MaintenanceResourceData> list, String orgCode, String userId);
void syncSavePoint(OrgUsrFormDto orgUsrFormDto, String orgCode, String userId);
/**
* 查询巡检点及点及点的项
* @param queryRequests 请求参数
......@@ -319,4 +320,11 @@ public interface IPointService {
*/
Page<PointDto> queryPointInfoWithItem(List<DaoCriteria> queryRequests, CommonPageable commonPageable, Long ownerId);
/**
* 删除巡检点
*
* @param ids
*/
void delPointByPointNo(Long id);
}
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -20,9 +19,6 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
......@@ -32,7 +28,6 @@ import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -54,7 +49,6 @@ import java.lang.reflect.Field;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -264,7 +258,7 @@ public class AlertCalledController extends BaseController {
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
IPage<AlertCalledDto> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageDto(page);
calledVoIPage.getRecords().stream().forEach(e->{
getResponseLevel(e.getSequenceNbr(), e,null);
//e.setAlertAddress(e.getAddress());
});
return ResponseHelper.buildResponse(calledVoIPage);
}
......@@ -324,28 +318,7 @@ public class AlertCalledController extends BaseController {
return queryWrapper;
}
void getResponseLevel(Long alertId, AlertCalledDto alertCalledDto, ESAlertCalledDto esAlertCalledDto) {
LambdaQueryWrapper<DispatchPaper> dispatchPaperQueryWrapper = new LambdaQueryWrapper<>();
dispatchPaperQueryWrapper.eq(DispatchPaper::getAlertId,alertId);
DispatchPaper dispatchPaper = dispatchPaperServiceImpl.getOne(dispatchPaperQueryWrapper);
if(null != dispatchPaper) {
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, dispatchPaper.getSequenceNbr()).eq(AlertFormValue::getAlertTypeCode, DispatchPaperEnums.getEnumById(dispatchPaper.getAlertCode()).getDynamicCode());
// 派遣单动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
// map 存取数据
Map<String,String> dynamicParms = new HashMap<String,String>();
list.stream().forEach(paperFormValue -> {
dynamicParms.put(paperFormValue.getFieldCode(),paperFormValue.getFieldValue());
});
String responseLevel = dynamicParms.get("response_level");
if(null != alertCalledDto) {
alertCalledDto.setResponseLevel(responseLevel);
} else {
esAlertCalledDto.setResponseLevel(responseLevel);
}
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -31,8 +31,8 @@ spring.liquibase.enabled=true
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
equip.fegin.name=AMOS-EQUIPMANAGE
equip.fegin.prefix=/equip
equip.feign.name=AMOS-EQUIPMANAGE-SHG
equip.feign.prefix=/equip
input.custom.prefix = QYZD
input.statute.prefix = FG
......@@ -54,7 +54,7 @@ management.endpoints.web.exposure.exclude=*
## redis失效时间
redis.cache.failure.time=10800
## eureka properties:
eureka.client.registry-fetch-interval-seconds=5
eureka.client.registry-fetch-interval-seconds=50
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
......
......@@ -378,13 +378,14 @@
</select>
<select id="getPlanTaskPointInputItemByPlanTaskId" resultType="com.yeejoin.amos.maintenance.business.entity.mybatis.PlanTaskPointInputItemBo">
SELECT
ppi.input_item_id inputItemId,
temp1.order_no orderNo,
temp1.routePointItemId,
temp1.classifyId,
temp1.classifyName,
temp1.routeName,
temp1.pointName,
pii.`name` inputName,
temp2.*
FROM
......@@ -399,11 +400,15 @@
prp.route_id,
prpi.id routePointItemId,
ppc.id classifyId,
ppc.`name` classifyName
ppc.`name` classifyName,
r.name as routeName,
p.name as pointName
FROM
p_route_point_item prpi
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id
LEFT JOIN p_point_classify ppc ON prpi.point_classify_id = ppc.id
LEFT JOIN p_route r ON r.id = prp.route_id
LEFT JOIN p_point p ON p.id = prp.point_id
) temp1 ON(ppi.id = temp1.point_input_item_id)
RIGHT JOIN
......@@ -417,16 +422,15 @@
ptd.org_code AS orgCode,
ptd.end_time AS endTime,
pptd.id as planTaskDetailId,
(select p_plan.dept_id from p_plan where p_plan.id=ptd.plan_id) depId
(select p_plan.dept_id from p_plan where p_plan.id=ptd.plan_id) depId,
(select p_plan.name from p_plan where p_plan.id=ptd.plan_id) planName
FROM
p_plan_task_detail pptd,
p_plan_task ptd
WHERE
pptd.task_no = ptd.id
AND ptd.id = #{planTaskId} and pptd.`status` = #{planTaskDetailStatus}
) temp2 on(temp1.point_id = temp2.pointId
AND temp1.route_id = temp2.routeId)
) temp2 on temp1.point_id = temp2.pointId AND temp1.route_id = temp2.routeId
</select>
<!-- 巡检执行情况统计分页用 -->
<select id="countChkExListData" resultType="long">
......
......@@ -16,4 +16,76 @@
ALTER TABLE p_point ADD COLUMN `last_check_id` varchar(32) DEFAULT NULL COMMENT '最近检查记录(漏检不算)' AFTER `original_id`;
</sql>
</changeSet>
<changeSet author="keyong" id="1629261435-1" runOnChange="true">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_input_item" columnName="check_type"/>
</not>
</preConditions>
<comment>p_input_item ADD COLUMN check_type</comment>
<sql>
ALTER TABLE p_input_item ADD COLUMN `check_type` varchar(32) DEFAULT NULL COMMENT '检查类别' AFTER `test_requirement`;
</sql>
</changeSet>
<changeSet author="keyong" id="1629261435-2" runOnChange="true">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_input_item" columnName="item_parent"/>
</not>
</preConditions>
<comment>p_input_item ADD COLUMN item_parent</comment>
<sql>
ALTER TABLE p_input_item ADD COLUMN `item_parent` varchar(50) DEFAULT NULL COMMENT '父类检查项id' AFTER `check_type`;
</sql>
</changeSet>
<changeSet author="keyong" id="1629261435-3" runOnChange="true">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_input_item" columnName="item_classify"/>
</not>
</preConditions>
<comment>p_input_item ADD COLUMN item_classify</comment>
<sql>
ALTER TABLE p_input_item ADD COLUMN `item_classify` varchar(50) DEFAULT NULL COMMENT '检查项分类' AFTER `item_parent`;
</sql>
</changeSet>
<changeSet author="keyong" id="1629261435-4" runOnChange="true">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_input_item" columnName="item_type_classify"/>
</not>
</preConditions>
<comment>p_input_item ADD COLUMN item_type_classify</comment>
<sql>
ALTER TABLE p_input_item ADD COLUMN `item_type_classify` varchar(50) DEFAULT NULL COMMENT '适用检查类别' AFTER `item_classify`;
</sql>
</changeSet>
<changeSet author="keyong" id="1629261435-5" runOnChange="true">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_input_item" columnName="item_level"/>
</not>
</preConditions>
<comment>p_input_item ADD COLUMN item_level</comment>
<sql>
ALTER TABLE p_input_item ADD COLUMN `item_level` varchar(50) DEFAULT NULL COMMENT '检查项等级' AFTER `item_type_classify`;
</sql>
</changeSet>
<changeSet author="keyong" id="1629261435-6" runOnChange="true">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_input_item" columnName="item_start"/>
</not>
</preConditions>
<comment>p_input_item ADD COLUMN item_start</comment>
<sql>
ALTER TABLE p_input_item ADD COLUMN `item_start` bit(1) DEFAULT b'0' COMMENT '检查项状态' AFTER `item_level`;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -94,7 +94,8 @@
a.test_requirement,
a.check_method,
a.create_date,
a.input_classify
a.input_classify,
a.check_type
from
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0'
......@@ -226,9 +227,9 @@
from
p_input_item pii
where is_delete = '0' and input_type = 1 and equipment_name=#{equipmentName}
<if test="orgCode!=null and orgCode !=''">
and org_Code = #{orgCode}
</if>
<!-- <if test="orgCode!=null and orgCode !=''">-->
<!-- and org_Code = #{orgCode}-->
<!-- </if>-->
</select>
<insert id="insertList" parameterType="java.util.List">
INSERT INTO p_input_item (
......@@ -260,4 +261,18 @@
)
</foreach>
</insert>
<select id="getInputItemParent" resultType="com.yeejoin.amos.supervision.business.vo.InputItemVo">
SELECT
pii.id AS id,
pii.name AS name
FROM
p_input_item pii
WHERE
1=1
<if test="id !=null and id !=''">
AND pii.id != #{id}
</if>
ORDER BY create_date DESC;
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment