Commit 1e68e16e authored by chenhao's avatar chenhao

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

parents d8ee8871 9e872afd
......@@ -23,6 +23,7 @@ public class DateUtils {
public static final String YEAR_PATTERN = "yyyy";
public static final String MINUTE_ONLY_PATTERN = "mm";
public static final String HOUR_ONLY_PATTERN = "HH";
public static final String DATE_PATTERN_NUM = "yyyyMMdd";
/**
* 获取 当前年、半年、季度、月、日、小时 开始结束时间
......@@ -707,4 +708,16 @@ public class DateUtils {
timeSdf.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
return timeSdf.format(newTimes-oldTimes);
}
/**
* 获取现在日期字符串时间戳格式
*
* @return返回字符串格式 yyyyMMdd
*/
public static String getDateNowShortNumber() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN_NUM);
String dateString = formatter.format(currentTime);
return dateString;
}
}
......@@ -107,6 +107,9 @@ public interface IOrgUsrService {
* @throws Exception
*/
Map<String, Object> selectForShowById(OrgUsr orgUsr, Long id) throws Exception;
Map<String, Object> selectForShowByIduser(OrgUsr orgUsr, Long id) throws Exception;
List<OrgUsr> selectCompanyDepartmentMsg();
......@@ -141,7 +144,7 @@ public interface IOrgUsrService {
OrgDepartmentFormDto selectDepartmentById(Long id) throws Exception;
List<Map<String, Object>> selectForShowByListId(List<Long> ids) throws Exception;
List<Map<String, Object>> selectForShowByListIdUser(List<Long> ids) throws Exception;
/**
* * @param null
*
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -21,4 +22,6 @@ public interface RescueStationMapper extends BaseMapper<RescueStation> {
* @return
*/
List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance);
List<RescueStationDto> selectExportData(@Param("ids") List<String> ids);
}
......@@ -23,4 +23,5 @@ public interface IRescueStationService extends IService<RescueStation> {
*/
List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance);
List<RescueStationDto> selectExportData(String exportId);
}
......@@ -44,4 +44,18 @@
</select>
<select id="selectExportData" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto">
select t.*
from tcb_rescue_station t where t.is_delete = 0
<if test="ids != null and ids.size() > 0">
and t.sequence_nbr in
<foreach item="item" collection="ids" separator="," open="(" close=")" index=""> #{item}
</foreach>
</if>
</select>
</mapper>
......@@ -613,6 +613,49 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return result;
}
@Override
public Map<String, Object> selectForShowByIduser(OrgUsr orgUsr, Long id) throws Exception {
QueryWrapper<DynamicFormColumn> queryWrapper = new QueryWrapper<DynamicFormColumn>();
queryWrapper.eq("group_code", OrgPersonEnum.人员.getCode());
List<DynamicFormColumn> alertForms = alertFormServiceImpl.list(queryWrapper);
// 动态表单数据
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id);
Map<String, Object> result = new HashMap<>();
result = Bean.BeantoMap(orgUsr);
// 放入所有动态表单数据
for (DynamicFormColumn alertForm : alertForms) {
result.put(alertForm.getFieldCode(), null);
}
result.put("parenName", orgUsr.getParentId() != null?getByIduser(orgUsr.getParentId()).getBizOrgName():"");
for (DynamicFormInstanceDto alertFormValue : list) {
result.put(alertFormValue.getFieldCode(),
ObjectUtils.isEmpty(alertFormValue.getFieldValueLabel()) ? alertFormValue.getFieldValue()
: alertFormValue.getFieldValueLabel());
}
return result;
}
@Override
public List<OrgUsr> selectCompanyDepartmentMsg() {
List<OrgUsr> list = this.baseMapper.selectCompanyDepartmentMsg();
......@@ -942,7 +985,16 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
return personResult;
}
@Override
public List<Map<String, Object>> selectForShowByListIdUser(List<Long> ids) throws Exception {
List<Map<String, Object>> personResult = new ArrayList<>();
for (int i = 0; i < ids.size(); i++) {
OrgUsr orgUsr = getByIduser(ids.get(i));
Map<String, Object> result = selectForShowByIduser(orgUsr, ids.get(i));
personResult.add(result);
}
return personResult;
}
@Override
public List<CompanyDto> listContractDto(Integer pageNum, Integer pageSize, RequestData requestData) {
if (null == pageNum || null == pageSize) {
......@@ -1625,6 +1677,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return orgUser;
}
public OrgUsr getByIduser(Serializable id) {
OrgUsr orgUser = this.baseMapper.selectById(id);
return orgUser;
}
public Object amosIdExist(String amosId) {
List<OrgUsr> orgUsrs = orgUsrMapper.amosIdExist(amosId);
if (orgUsrs.size() > 0) {
......
......@@ -222,11 +222,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmitted.setSchedulingTypeCode(alertSchedulingTypeEnum.get().getCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo)));
String token = RequestContext.getToken();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(),token)).toString(),
ReginParams.class);
alertSubmitted.setRecUserName(reginParams.getUserModel().getUserName());
alertSubmitted.setSender(reginParams.getUserModel().getUserName());
// String token = RequestContext.getToken();
// ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(),token)).toString(),
// ReginParams.class);
// alertSubmitted.setRecUserName(reginParams.getUserModel().getUserName());
// alertSubmitted.setSender(reginParams.getUserModel().getUserName());
alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date());
......@@ -238,7 +238,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsCode = alertBusinessTypeEnum.get().getSms_code();
}
// 组装人员信息
List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListId(ids);
List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListIdUser(ids);
for (Map<String, Object> orgUser : orgUsers) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
......
......@@ -5,11 +5,13 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ExportDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.TemplateExport;
import com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService;
import com.yeejoin.amos.boot.module.tzs.api.service.IUseUnitService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import org.apache.commons.lang3.StringUtils;
......@@ -18,7 +20,11 @@ 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.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TemplateExportServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -57,6 +63,9 @@ public class TemplateExportController extends BaseController {
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
@Autowired
IRescueStationService iRescueStationService;
/**
* 新增模板表
*
......@@ -140,9 +149,23 @@ public class TemplateExportController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "模板表列表全部数据查询", notes = "模板表列表全部数据查询")
@GetMapping(value = "/list/{type}")
public ResponseModel<List<TemplateExport>> selectForList(@PathVariable String type) {
public ResponseModel<Map<String, Object>> selectForList(@PathVariable String type) {
Map<String, Object> result = new HashMap<>();
List<TemplateExport> list = templateExportServiceImpl.list(new LambdaQueryWrapper<TemplateExport>().eq(TemplateExport::getIsDelete,0).eq(TemplateExport::getTemplateType,type).orderByDesc(TemplateExport::getIsStandard));
return ResponseHelper.buildResponse(list);
result.put("list",list);
String fileName = null;
if("ELEVATOR".equals(type)) { // 查询电梯数据
fileName = "电梯信息";
} else if("MAINTENANCE_COMPANY".equals(type)) { // 查询维保单位数据
fileName = "维保单位";
} else if("USE_UNIT".equals(type)) { // 查询使用单位数据
fileName = "使用单位";
} else if("RESCUE_STATION".equals(type)) { // 查询救援站数据
fileName = "救援站";
}
fileName += DateUtils.getDateNowShortNumber();
result.put("fileName",fileName);
return ResponseHelper.buildResponse(result);
}
......@@ -166,7 +189,6 @@ public class TemplateExportController extends BaseController {
} else {
exportDto.setExportId("");
}
System.out.println(exportDto.getExportArray());
JSONArray jsonArray = JSONArray.parseArray(exportDto.getExportArray());
List<List<String>> heads = Lists.newArrayList();
List<String> headstr = Lists.newArrayList();
......@@ -188,6 +210,9 @@ public class TemplateExportController extends BaseController {
} else if("USE_UNIT".equals(exportDto.getExportType())) { // 查询使用单位数据
sheetName = "使用单位";
list = iUseUnitService.selectExportData(exportDto.getExportId());
} else if("RESCUE_STATION".equals(exportDto.getExportType())) { // 查询救援站数据
sheetName = "救援站";
list = iRescueStationService.selectExportData(exportDto.getExportId());
}
ExcelUtil.createTemplateWithHeaders(response, fileName, sheetName, list, ElevatorDto.class, null, false, heads, headstr, exportDto.getFileType());
......
......@@ -4,10 +4,12 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import com.yeejoin.amos.boot.module.tzs.api.mapper.RescueStationMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Arrays;
import java.util.List;
/**
......@@ -26,4 +28,14 @@ public class RescueStationServiceImpl extends BaseService<RescueStationDto, Resc
public List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance) {
return rescueStationMapper.getListByLatLonDistance(lat,lon,distance);
}
@Override
public List<RescueStationDto> selectExportData(String exportId) {
List<String> ids = null;
if(StringUtils.isNotEmpty(exportId)) {
String[] idStr = exportId.split(",");
ids = Arrays.asList(idStr);
}
return baseMapper.selectExportData(ids);
}
}
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