Commit 2e410da2 authored by 李成龙's avatar 李成龙

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

parents dc62bfad 382adbc8
......@@ -35,6 +35,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -131,10 +132,15 @@ public class ControllerAop {
CompanyBo company = new CompanyBo();
DepartmentBo department = new DepartmentBo();
RoleBo role = new RoleBo();
//平台更新 人员部门可能为NULL 导致redis缓存不到人员信息
Map<Long, List<DepartmentModel>> mapDepartments = new HashMap<>();
DepartmentModel departmentM = new DepartmentModel();
CompanyModel companyM = user.getCompanys() != null ? user.getCompanys().get(0) : null;
Bean.copyExistPropertis(companyM, company);
Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments();
DepartmentModel departmentM = companyM != null ? mapDepartments.get(companyM.getSequenceNbr()).get(0) : null;
if (!ValidationUtil.isEmpty(user.getCompanyDepartments())){
mapDepartments = user.getCompanyDepartments();
departmentM = companyM != null ? mapDepartments.get(companyM.getSequenceNbr()).get(0) : null;
}
Bean.copyExistPropertis(departmentM, department);
Map<Long, List<RoleModel>> roles = user.getOrgRoles();
Long sequenceNbr;
......
......@@ -774,6 +774,34 @@ public class DateUtils {
}
/**
* 获得本天的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public static Date getCurrentDayStartTime(Date date) {
try {
date = shortSdf.parse(shortSdf.format(date) + " 00:00:00");
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
/**
* 获得本天的结束时间,即2012-01-01 23:59:59
*
* @return
*/
public static Date getCurrentDayEndTime(Date date) {
try {
date = longSdf.parse(shortSdf.format(date) + " 23:59:59");
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
/**
* 获取指定时间所在周的第一天日期
*
* @param date
......
package com.yeejoin.amos.boot.module.jcs.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
import java.util.Map;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("jc_situation_detail")
@ApiModel(value="AlertCalled对象", description="警情接警记录")
public class JcSituationDetail extends BaseEntity {
@ApiModelProperty(value = "报送内容")
private String info;
@ApiModelProperty(value = "类型")
private String infoType = "指令下发";
@ApiModelProperty(value = "警情ID")
private Long alertCalledId;
}
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.entity.JcSituationDetail;
public interface JcSituationDetailMapper extends BaseMapper<JcSituationDetail> {
}
......@@ -315,7 +315,7 @@ public class CarController extends AbstractBaseController {
if(car.getIotCode()!=null){
Car ar= carMapper.getCarsByIotCode(car.getIotCode());
Car ar= carMapper.getCarsByIotCodeExcludeCarId(car.getIotCode(),car.getId());
if(ar!=null){
throw new BadRequest("物联编码重复");
}
......
......@@ -37,6 +37,8 @@ public interface CarMapper extends BaseMapper<Car> {
List<String> getIotCodeList(@Param("id") String id);
Car getCarsByIotCode(@Param("iotCode") String iotCode);
Car getCarsByIotCodeExcludeCarId(@Param("iotCode") String iotCode, @Param("carId") Long carId);
List<CarIndexVo> getCarsInfoByOrgCode(@Param("orgCode") String orgCode);
......
......@@ -181,7 +181,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
*
* @param indexs
*/
void updateEquipmentSpecIndexRealtimeData(List<EquipmentSpecificIndex> indexs);
void updateEquipmentSpecIndexRealtimeData(EquipmentSpecificIndex index);
List<EquipmentSpecificVo> getEquipAndCarIotcodeByIotcode(String iotCode);
......
......@@ -6,15 +6,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mchange.lang.DoubleUtils;
import com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.DateUtils;
......@@ -39,6 +37,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import ucar.ma2.ArrayDouble;
import java.util.*;
import java.util.stream.Collectors;
......@@ -113,7 +112,8 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired
private ISignalClassifyService signalClassifyService;
@Autowired
private IFormInstanceService instanceService;
@Override
public Map<String, Object> getDetailsById(Long alarmId, Long equipId, String type, String area) {
......@@ -360,6 +360,25 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
// }
// }
//查询当前建筑是否是 最顶级建筑
public List<FormInstance> selectBuildingById(List<FormInstance> formInstances){
if (formInstances.get(0).getGroupType().equals("building")){
return formInstances;
}
String parentId = null;
for (FormInstance formInstance : formInstances) {
if (formInstance.getFieldName().equals("parentId")){
parentId =formInstance.getFieldValue();
}
}
LambdaQueryWrapper<FormInstance> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FormInstance::getInstanceId,parentId);
formInstances = instanceService.getBaseMapper().selectList(wrapper);
return selectBuildingById(formInstances);
}
public void sendIotSystemAlarm(EquipmentSpecificAlarmLog ent, String userId, String appKey, String product, String token){
// Token serverToken = remoteSecurityService.getServerToken();
IotSystemAlarmRo confirmAlamVo = new IotSystemAlarmRo();
......@@ -367,15 +386,49 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
ent = confirmAlarmMapper.getDetailsById(ent.getId(), null);
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(ent.getEquipmentSpecificId());
List<FormInstance> formInstances = new ArrayList<>();
//现在需要返回设备的所在建筑及经纬度 查询当前设备所在建筑
if(!ValidationUtil.isEmpty(equipmentSpecific.getWarehouseStructureId())){
LambdaQueryWrapper<FormInstance> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FormInstance::getInstanceId,equipmentSpecific.getWarehouseStructureId());
formInstances = instanceService.getBaseMapper().selectList(wrapper);
}
//判断所在建筑是否是顶级建筑 房间及楼层是没有经纬度的 向上查询
if (!ValidationUtil.isEmpty(formInstances)){
formInstances = selectBuildingById(formInstances);
}
String address = null ;
String latitude= null ;
String longitude= null ;
if (!ValidationUtil.isEmpty(formInstances)){
for (FormInstance formInstance : formInstances) {
if (formInstance.getFieldName().equals("address")){
address =formInstance.getFieldValue();
if (address.contains("@")){
String[] split = address.split("@");
address = split[0];
}
}
if (formInstance.getFieldName().equals("latitude")){
latitude =formInstance.getFieldValue();
}
if (formInstance.getFieldName().equals("longitude")){
longitude =formInstance.getFieldValue();
}
}
}
if (!ValidationUtil.isEmpty(equipmentSpecific.getAgencyId())){
// 机场单位
JSONObject unitMap = jcsFeign.getUnitById(appKey, product, token, equipmentSpecific.getAgencyId()).getResult();
JSONObject jsonObject = unitMap.getJSONObject("map");
confirmAlamVo.setUnitInvolvedId(equipmentSpecific.getAgencyId());
confirmAlamVo.setUnitInvolvedName(unitMap.getString("bizOrgName"));
confirmAlamVo.setAddress(jsonObject.getString("companyLocation"));
confirmAlamVo.setLongitude(jsonObject.getDouble("longitude"));
confirmAlamVo.setLatitude(jsonObject.getDouble("latitude"));
confirmAlamVo.setAddress(address == null ? jsonObject.getString("companyLocation"):address);
confirmAlamVo.setLongitude(latitude == null?jsonObject.getDouble("longitude"): Double.valueOf(latitude));
confirmAlamVo.setLatitude(longitude == null?jsonObject.getDouble("latitude"):Double.valueOf(longitude));
}
try {
// 机场人员
......
......@@ -1631,10 +1631,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public void updateEquipmentSpecIndexRealtimeData(List<EquipmentSpecificIndex> indexs) {
public void updateEquipmentSpecIndexRealtimeData(EquipmentSpecificIndex index) {
// TODO Auto-generated method stub
if (!ObjectUtils.isEmpty(indexs)) {
EquipmentSpecificIndex index = indexs.get(0);
if (!ObjectUtils.isEmpty(index)) {
EquipmentSpecific es = equipmentSpecificMapper.selectById(index.getEquipmentSpecificId());
es.setRealtimeIotEsIndexId(index.getId());
es.setRealtimeIotIndexKey(index.getNameKey());
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Arrays;
import java.util.Objects;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.entity.JcSituationDetail;
import com.yeejoin.amos.boot.module.jcs.api.mapper.JcSituationDetailMapper;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -22,6 +30,9 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferCompanySer
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
......@@ -38,6 +49,18 @@ public class PowerTransferCompanyController extends BaseController {
@Autowired
PowerTransferCompanyServiceImpl powerTransferCompanyService;
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
JcSituationDetailMapper jcSituationDetailMapper;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.power.deployment}")
private String topic;
/**
* 新增调派单位
*
......@@ -139,5 +162,29 @@ public class PowerTransferCompanyController extends BaseController {
page = powerTransferCompanyService.page(pageBean, powerTransferCompanyQueryWrapper);
return page;
}
/**
* 新增文字信息图片信息
*
* @return 返回结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jcSituationDetail/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增文字信息图片信息", notes = "新增文字信息图片信息")
public ResponseModel<Boolean> saveJcSituationDetail(@RequestBody JcSituationDetail jcSituationDetail) throws MqttException {
if (Objects.isNull(jcSituationDetail.getAlertCalledId())) {
throw new BadRequest("警情ID不能为空");
}
jcSituationDetailMapper.insert(jcSituationDetail);
// if (ObjectUtils.isNotEmpty(jcSituationDetail.getAttachments())) {
// sourceFileService.saveAttachments(jcSituationDetail.getSequenceNbr(), jcSituationDetail.getAttachments());
// }
// 自定义指令信息消息推送
// 定义指令信息消息推送 页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
return ResponseHelper.buildResponse(Boolean.TRUE);
}
}
......@@ -32,6 +32,9 @@ import java.util.stream.IntStream;
import com.yeejoin.amos.boot.module.command.api.dto.FrontlineLiaisonDto;
import com.yeejoin.amos.boot.module.command.biz.service.impl.FrontlineLiaisonServiceImpl;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.JcSituationDetailMapper;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
......@@ -113,10 +116,6 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
......@@ -214,6 +213,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
private FrontlineLiaisonServiceImpl frontlineLiaisonServiceImpl;
@Autowired
JcSituationDetailMapper jcSituationDetailMapper;
@Value("${mqtt.topic.command.alert.noticeJa}")
private String topicJa;
......@@ -1434,6 +1436,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
listInstructionsZHDto.add(instruct);
});
//增加自定义指令信息:实战指挥需求【1575】
LambdaQueryWrapper<JcSituationDetail> qw = new LambdaQueryWrapper();
qw.eq(JcSituationDetail::getAlertCalledId, id);
List<JcSituationDetail> jcSituationDetailList = jcSituationDetailMapper.selectList(qw);
jcSituationDetailList.stream().forEach(item -> {
InstructionsZHDto instructionsZHDto = new InstructionsZHDto();
instructionsZHDto.setSequenceNbr(item.getSequenceNbr());
instructionsZHDto.setType(item.getInfoType());
instructionsZHDto.setContent(item.getInfo());
instructionsZHDto.setSubmissionTime(item.getRecDate());
listInstructionsZHDto.add(instructionsZHDto);
});
// ;
//排序时间倒序
/* Bug 2613 修改排序 按照发送时间排序 2021-09-01 陈召 开始*/
Collections.sort(listInstructionsZHDto, new Comparator<InstructionsZHDto>() {
......
......@@ -378,22 +378,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
continue;
paramMap.clear();
paramMap.put("id", plan.getId());
// 2.1计划数据合法性校验
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) {
paramMap.put("next_gen_date", tomorrow);
planMapper.updPlanStatusOrGenDate(paramMap);// 更新为明天
continue;
}
// 2.2.计算生成数据的日期区间
CalDateVo vo = PlanTaskUtil.reGenPlanTaskData(plan, tomorrow, tomorrow);
// 计划未开始,则更新生成时间为明天
if (null == vo) {
paramMap.put("next_gen_date", tomorrow);
planMapper.updPlanStatusOrGenDate(paramMap);// 更新为明天
continue;
}
// 计划已过期,则更新status = 7,已完成
if (!vo.getIsGenData()) {
int num = 0;
......@@ -413,9 +400,28 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
paramMap.put("status", PlanStatusEnum.COMPLETED.getValue());
}
}
if (plan.getIsFixedDate().equals("2")){
paramMap.put("status", PlanStatusEnum.OUT_TIME.getValue());
planMapper.updPlanStatusOrGenDate(paramMap);
continue;
}
planMapper.updPlanStatusOrGenDate(paramMap);
continue;
}
// 2.1计划数据合法性校验
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) {
paramMap.put("next_gen_date", tomorrow);
planMapper.updPlanStatusOrGenDate(paramMap);// 更新为明天
continue;
}
// 计划未开始,则更新生成时间为明天
if (null == vo) {
paramMap.put("next_gen_date", tomorrow);
planMapper.updPlanStatusOrGenDate(paramMap);// 更新为明天
continue;
}
// 2.3.执行数据生成(具体时间 + 人员)
List<HashMap<String, Object>> list = genAllExeDate(plan, vo, XJConstant.SCHED_FLAG);
......@@ -757,7 +763,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
ReginParams reginParam = JSON.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
params.put("loginUserId", reginParam.getPersonIdentity().getPersonSeq());
// params.put("loginUserId", reginParam.getPersonIdentity().getPersonSeq());
long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) {
return new PageImpl<>(content, pageParam, total);
......
......@@ -2860,4 +2860,31 @@
create unique index uni on wl_equipment_standard (`type`, `equipment_id`, `org_code`);
</sql>
</changeSet>
<changeSet author="ls" id="20220601-1">
<comment>`getChildListdate`</comment>
<sql endDelimiter="#">
DROP FUNCTION IF EXISTS `getChildListdate`#
CREATE DEFINER=`root`@`%` FUNCTION `getChildListdate`(`p_id` VARCHAR(1000)) RETURNS varchar(5000) CHARSET latin1
BEGIN
DECLARE sTemp TEXT;
DECLARE sTempChd VARCHAR(5000);
SET sTemp='';
SET sTempChd = CAST(p_id AS CHAR);
WHILE sTempChd IS NOT NULL DO
SET sTemp = CONCAT(sTemp,',',sTempChd);
SELECT GROUP_CONCAT(distinct a.instance_id) INTO sTempChd FROM
(select wl_form_instance.instance_id ,wl_form_instance.field_value from wl_form_instance where wl_form_instance.group_type in('building','room','floor') and field_name='parentId') a
WHERE FIND_IN_SET(a.field_value,sTempChd) > 0;
END WHILE;
RETURN SUBSTRING(sTemp,LENGTH(CONCAT(',',p_id))+1);
END
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -247,6 +247,18 @@
AND
wc.iot_code = #{iotCode}
</select>
<select id="getCarsByIotCodeExcludeCarId" resultType="com.yeejoin.equipmanage.common.entity.Car">
SELECT
wc.car_num
FROM
wl_car wc
WHERE
wc.iot_code IS NOT NULL
AND
wc.iot_code = #{iotCode}
AND wc.id != #{carId}
</select>
<select id="getCarsInfoByOrgCode" resultMap="carIotInfoMap">
......
......@@ -2899,5 +2899,38 @@
</sql>
</changeSet>
<changeSet author="zs" id="2022-05-31-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="jc_situation_detail"/>
</not>
</preConditions>
<comment>增加自定义指令表</comment>
<sql>
CREATE TABLE `jc_situation_detail` (
`sequence_nbr` bigint(20) NOT NULL AUTO_INCREMENT,
`info` longtext COMMENT '内容图片信息',
`alert_called_id` bigint(20) DEFAULT NULL COMMENT '警情ID',
`rec_date` datetime DEFAULT NULL COMMENT '时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '发送人',
`rec_user_name` varchar(15) DEFAULT NULL COMMENT '发送人名称',
`is_delete` bit(1) NOT NULL COMMENT '是否删除',
`info_type` varchar(255) DEFAULT NULL COMMENT '消息类型',
PRIMARY KEY (`sequence_nbr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</sql>
</changeSet>
<changeSet author="ls" id="2022-06-01-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="jc_power_transfer_company_resources" columnName="arrival_time"/>
</not>
</preConditions>
<comment>jc_power_transfer_company_resources add column arrival_time 车辆到场时间</comment>
<sql>
ALTER TABLE jc_power_transfer_company_resources ADD arrival_time varchar(255) NULL COMMENT '车辆到场时间';
</sql>
</changeSet>
</databaseChangeLog>
......@@ -1041,8 +1041,8 @@
<if test="key == 'endDeadline' and value != null and value != ''">
and a.reform_limit_date <![CDATA[ <= ]]> #{value}
</if>
<if test="key == 'pointName' and value != null and value != ''">
and a.biz_info like concat('%"pointName":"', #{value}, '"%')
<if test="key == 'pointId' and value != null and value != ''">
and a.biz_info like concat('%"pointId":"', #{value}, '"%')
</if>
</foreach>
</where>
......
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 任务表
*
* @author system_generator
* @date 2022-05-31
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="TaskDto", description="任务表")
public class TaskDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "任务名称")
private String name;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "状态【0:待填报,1:待签收,2:已完成】")
private Integer status = 0;
@ApiModelProperty(value = "用户ID")
private String userId;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "对接公司编码")
private String appId;
@ApiModelProperty(value = "单位ID")
private String deptId;
@ApiModelProperty(value = "单位名称")
private String deptName;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 任务表
*
* @author system_generator
* @date 2022-05-31
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_task")
public class Task extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 任务名称
*/
@TableField("name")
private String name;
/**
* 内容
*/
@TableField("content")
private String content;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 状态【0:待填报,1:待签收,2:已完成】
*/
@TableField("status")
private Integer status;
/**
* 用户ID
*/
@TableField("user_id")
private String userId;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
/**
* 对接公司编码
*/
@TableField("app_id")
private String appId;
/**
* 单位ID
*/
@TableField("dept_id")
private String deptId;
/**
* 单位名称
*/
@TableField("dept_name")
private String deptName;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.enums;
import lombok.Getter;
/**
* 任务状态枚举
*/
@Getter
public enum TaskStatusEnum {
待填报(0, "待填报"),
待签收(1, "待签收"),
已完成(2, "已完成");
private Integer key;
private String desc;
TaskStatusEnum(Integer key, String desc) {
this.key = key;
this.desc = desc;
}
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Task;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 任务表 Mapper 接口
*
* @author system_generator
* @date 2022-05-31
*/
public interface TaskMapper extends BaseMapper<Task> {
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
/**
* 任务表接口类
*
* @author system_generator
* @date 2022-05-31
*/
public interface ITaskService {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.TaskMapper">
</mapper>
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.TaskStatusEnum;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.TaskServiceImpl;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.TaskDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 任务表
*
* @author system_generator
* @date 2022-05-31
*/
@RestController
@Api(tags = "任务表Api")
@RequestMapping(value = "/task")
public class TaskController extends BaseController {
@Autowired
TaskServiceImpl taskServiceImpl;
/**
* 新增任务表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增任务表", notes = "新增任务表")
public ResponseModel<TaskDto> save(@RequestBody TaskDto model) {
model.setCreateDate(new Date());
model.setUserId(RequestContext.getExeUserId());
model = taskServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新任务表", notes = "根据sequenceNbr更新任务表")
public ResponseModel<TaskDto> updateBySequenceNbrTask(@RequestBody TaskDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(taskServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除任务表", notes = "根据sequenceNbr删除任务表")
public ResponseModel deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
taskServiceImpl.deleteById(sequenceNbr);
return ResponseHelper.buildResponse(null);
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个任务表", notes = "根据sequenceNbr查询单个任务表")
public ResponseModel<TaskDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(taskServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @param status TODO(uncomplete: 待办,complete:已办)
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "任务表分页查询", notes = "任务表分页查询")
public ResponseModel<Page<TaskDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "status", required = false) String status) {
Page<TaskDto> page = new Page<TaskDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(taskServiceImpl.queryForTaskPageByStatus(page, RequestContext.getExeUserId(), status));
}
/**
* 统计任务数量
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "任务数量查询", notes = "任务数量查询")
@GetMapping(value = "/queryCount")
public ResponseModel<JSONObject> queryCountForMap() {
return ResponseHelper.buildResponse(taskServiceImpl.queryCountForMap(RequestContext.getExeUserId()));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "任务表列表全部数据查询", notes = "任务表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<TaskDto>> selectForList() {
return ResponseHelper.buildResponse(taskServiceImpl.queryForTaskList());
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.TaskDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Task;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.TaskStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.TaskMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ITaskService;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 任务表服务实现类
*
* @author system_generator
* @date 2022-05-31
*/
@Component
public class TaskServiceImpl extends BaseService<TaskDto, Task, TaskMapper> implements ITaskService {
public void deleteById(Long sequenceNbr) {
TaskDto taskDto = this.queryBySeq(sequenceNbr);
taskDto.setIsDelete(true);
this.updateWithModel(taskDto);
}
public Page<TaskDto> queryForTaskPageByStatus(Page<TaskDto> page, String userId, String status) {
List<Integer> statusList = getStatus(status);
return this.queryForTaskPage(page, userId, statusList);
}
public JSONObject queryCountForMap(String userId){
Date[] recDate = new Date[2];
Date now = DateUtils.getDateNow();
recDate[0] = DateUtils.getCurrentDayStartTime(now);
recDate[1] = DateUtils.getCurrentDayEndTime(now);
// 我的任务
Integer myTaskCount = this.queryForCount(userId, null, null);
// 今日待办
List<Integer> statusList = getStatus("uncomplete");
Integer todyUnCompletedTaskCount = this.queryForCount(userId, recDate, statusList);
// 未完结业务
Integer unCompletedTaskCount = this.queryForCount(userId, null, statusList);
JSONObject jsonObject = new JSONObject();
jsonObject.put("myTask", myTaskCount);
jsonObject.put("todyUnCompletedTask", todyUnCompletedTaskCount);
jsonObject.put("unCompletedTask", unCompletedTaskCount);
return jsonObject;
}
/**
* 分页查询
*/
public Page<TaskDto> queryForTaskPage(Page<TaskDto> page, String userId, @Condition(Operator.in) List<Integer> status) {
return this.queryForPage(page, null, false, userId, status);
}
/**
* 列表查询 示例
*/
public List<TaskDto> queryForTaskList() {
return this.queryForList("", false);
}
/**
* 列表查询 示例
*/
public Integer queryForCount(String userId, @Condition(Operator.between) Date[] recDate, @Condition(Operator.in) List<Integer> status) {
return this.queryCount(userId, recDate, status);
}
private List<Integer> getStatus (String status) {
List<Integer> statusList = new ArrayList<>();
if ("uncomplete".equals(status)) {
statusList.add(TaskStatusEnum.待填报.getKey());
statusList.add(TaskStatusEnum.待签收.getKey());
} else if ("complete".equals(status)) {
statusList.add(TaskStatusEnum.已完成.getKey());
}
return statusList;
}
}
\ 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