app
This commit is contained in:
parent
5ec9e8ab60
commit
7707baaca5
|
|
@ -44,4 +44,10 @@ public class ParamDto {
|
|||
|
||||
@ApiModelProperty(value = "未绑定班组人员")
|
||||
private String unBandingUsers;
|
||||
|
||||
@ApiModelProperty(value = "角色编码")
|
||||
private String roleCode;
|
||||
|
||||
@ApiModelProperty(value = "建管单位")
|
||||
private String orgId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.securitycontrol.background.controller;
|
||||
|
||||
import com.securitycontrol.background.service.IAppService;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:30
|
||||
* @version:1.0
|
||||
* @description:APP-web层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/index/")
|
||||
public class AppController {
|
||||
|
||||
@Resource(name = "IAppService")
|
||||
private IAppService service;
|
||||
|
||||
@ApiOperation(value = "项目简介")
|
||||
@GetMapping("getProBrief")
|
||||
public AjaxResult getProBrief(ParamDto dto){
|
||||
return service.getProBrief(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "当前登录人绑定工程")
|
||||
@GetMapping("getProsByUser")
|
||||
public AjaxResult getProsByUser(ParamDto dto){
|
||||
return service.getProsByUser(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.securitycontrol.background.mapper;
|
||||
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:37
|
||||
* @version:1.0
|
||||
* @description:app数据库访问层
|
||||
*/
|
||||
@Repository(value = "IAppMapper")
|
||||
public interface IAppMapper {
|
||||
|
||||
/**
|
||||
* 项目简介
|
||||
*
|
||||
* @param dto
|
||||
* @return ProVo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 17:58
|
||||
*/
|
||||
ProVo getProBrief(ParamDto dto);
|
||||
|
||||
/**
|
||||
* 获取工程图片/平面图
|
||||
*
|
||||
* @param proId
|
||||
* @return List<ResourceFileVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 18:09
|
||||
*/
|
||||
List<ResourceFileVo> getFiles(String proId);
|
||||
|
||||
/**
|
||||
* 当前登录人绑定的工程
|
||||
* @param dto
|
||||
* @return List<Map < String>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 19:11
|
||||
*/
|
||||
@MapKey("bidCode")
|
||||
List<Map<String, String>> getProsByUser(ParamDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.securitycontrol.background.service;
|
||||
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:35
|
||||
* @version:1.0
|
||||
* @description:app-业务层
|
||||
*/
|
||||
public interface IAppService {
|
||||
/**
|
||||
* 项目简介
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 17:50
|
||||
*/
|
||||
AjaxResult getProBrief(ParamDto dto);
|
||||
|
||||
/**
|
||||
* 当前登录人绑定的工程
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 19:08
|
||||
*/
|
||||
AjaxResult getProsByUser(ParamDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.securitycontrol.background.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.securitycontrol.background.mapper.IAppMapper;
|
||||
import com.securitycontrol.background.service.IAppService;
|
||||
import com.securitycontrol.common.core.constant.HttpStatus;
|
||||
import com.securitycontrol.common.core.constant.SecurityConstants;
|
||||
import com.securitycontrol.common.core.domain.Result;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import com.securitycontrol.system.api.RemoteFileService;
|
||||
import com.securitycontrol.system.api.domain.SysFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:36
|
||||
* @version:1.0
|
||||
* @description:App业务逻辑层
|
||||
*/
|
||||
@Service(value = "IAppService")
|
||||
@Slf4j
|
||||
public class AppServiceImpl implements IAppService {
|
||||
|
||||
@Resource(name = "IAppMapper")
|
||||
private IAppMapper mapper;
|
||||
|
||||
@Resource
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Override
|
||||
public AjaxResult getProBrief(ParamDto dto) {
|
||||
ProVo proVo = new ProVo();
|
||||
try {
|
||||
proVo = mapper.getProBrief(dto);
|
||||
List<ProVo.FileData> list = new ArrayList<>();
|
||||
List<ResourceFileVo> resourceFileVos = mapper.getFiles(proVo.getProId());
|
||||
if (CollectionUtils.isNotEmpty(resourceFileVos)) {
|
||||
for (ResourceFileVo fileVo : resourceFileVos) {
|
||||
String base64 = null;
|
||||
Result<SysFile> result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONObject item = JSON.parseObject(jsonString);
|
||||
base64 = item.getString("url");
|
||||
}
|
||||
ProVo.FileData fileData = new ProVo.FileData();
|
||||
fileData.setFileId(fileVo.getFileId());
|
||||
fileData.setBase64Url(base64);
|
||||
fileData.setFileSourceType(fileVo.getSourceType());
|
||||
list.add(fileData);
|
||||
}
|
||||
}
|
||||
proVo.setFileData(list);
|
||||
} catch (Exception e) {
|
||||
log.error("工程简介", e);
|
||||
}
|
||||
return AjaxResult.success(proVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProsByUser(ParamDto dto) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getProsByUser(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("当前登录人绑定的工程");
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?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.securitycontrol.background.mapper.IAppMapper">
|
||||
|
||||
<!--项目简介-->
|
||||
<select id="getProBrief" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
|
||||
SELECT tp.pro_id AS proId,
|
||||
tp.sign_code AS signCode,
|
||||
tp.bid_code AS bidCode,
|
||||
tp.pro_code AS proCode,
|
||||
tp.pro_name AS proName,
|
||||
sb.city_name AS org,
|
||||
tp.plan_start_time AS planStartTime,
|
||||
tp.plan_end_time AS planEndTime,
|
||||
tp.jl_unit AS jlUnit,
|
||||
tp.sg_unit AS sgUnit,
|
||||
tp.pro_brief AS proBrief,
|
||||
tp.pro_type AS proType
|
||||
FROM tb_project tp
|
||||
LEFT JOIN sys_build sb ON tp.org = sb.org_id
|
||||
WHERE tp.bid_code = #{bidCode} AND del_flag = 0
|
||||
</select>
|
||||
<!-- 获取工程图片/平面图 -->
|
||||
<select id="getFiles" resultType="com.securitycontrol.entity.system.vo.ResourceFileVo">
|
||||
SELECT id AS resourceId,
|
||||
file_id AS fileId
|
||||
FROM tb_resource_file
|
||||
WHERE source_id = #{proId} AND source_type = '工程图片'
|
||||
</select>
|
||||
<!--当前登录人绑定的工程-->
|
||||
<select id="getProsByUser" resultType="java.util.Map">
|
||||
SELECT tp.pro_name AS proName,
|
||||
tp.bid_code AS bidCode
|
||||
FROM tb_project tp
|
||||
<if test="id!=null and id!='' and roleCode == 'roleCode'">
|
||||
INNER JOIN tb_user_pro tup ON tp.bid_code = tup.bid_cod AND tup.del_flag = '0' AND tup.user_id = #{id}
|
||||
</if>
|
||||
WHERE tp.del_flag = 0
|
||||
<if test="orgId != '' and orgId!=null and roleCode == 'city'">
|
||||
AND tp.org = #{orgId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -41,21 +41,22 @@
|
|||
SELECT tp.bid_code AS bidCode,
|
||||
tp.pro_name AS proName
|
||||
FROM tb_project tp
|
||||
WHERE del_flag = 0
|
||||
ORDER BY plan_start_time
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
SELECT tup.bid_cod AS bidCode,
|
||||
tp.pro_name AS proName
|
||||
FROM tb_user_pro tup
|
||||
LEFT JOIN tb_project tp on tup.bid_cod = tp.bid_code
|
||||
WHERE tup.user_id = #{param}
|
||||
LEFT JOIN tb_project tp on tup.bid_cod = tp.bid_code AND tp.del_flag = 0
|
||||
WHERE tup.user_id = #{param} AND tup.del_flag = '0'
|
||||
ORDER BY tup.times
|
||||
</if>
|
||||
<if test="type == 3">
|
||||
SELECT tp.bid_code AS bidCode,
|
||||
tp.pro_name AS proName
|
||||
FROM tb_project tp
|
||||
WHERE tp.org = #{param}
|
||||
WHERE tp.org = #{param} AND tp.del_flag = 0
|
||||
ORDER BY plan_start_time
|
||||
</if>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -217,7 +217,6 @@
|
|||
<!--工程详情-->
|
||||
<select id="getProById" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
|
||||
SELECT tp.pro_id AS proId,
|
||||
tp.user_id AS userId,
|
||||
tp.sign_code AS signCode,
|
||||
tp.bid_code AS bidCode,
|
||||
tp.pro_code AS proCode,
|
||||
|
|
|
|||
Loading…
Reference in New Issue