1.资源重复申请判断逻辑修改

2.新增资金报表需求
3.西海岸已申请列表需求
This commit is contained in:
dinggang 2022-11-22 17:01:31 +08:00
parent 16c77f7686
commit 7eac8dd1c2
21 changed files with 530 additions and 18 deletions

View File

@ -0,0 +1,11 @@
-- 2022-11-22 资源增加价格字段,申请表增加申请价格
ALTER TABLE t_ability_application ADD COLUMN `apply_price` BIGINT NOT NULL DEFAULT 0 COMMENT '申请价格';
ALTER TABLE tb_data_resource ADD COLUMN `price` BIGINT NOT NULL DEFAULT 0 COMMENT '价格';
ALTER TABLE t_meetingroom ADD COLUMN `price` BIGINT NOT NULL DEFAULT 0 COMMENT '价格';
ALTER TABLE t_meetingroom_book ADD COLUMN `apply_price` BIGINT NOT NULL DEFAULT 0 COMMENT '申请价格';

View File

@ -7,6 +7,7 @@ import io.renren.common.constant.Constant;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.DateUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -148,7 +149,8 @@ public class AbilityCenterControllerV2 {
}
break;
default: {
executor.execute(() -> deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user));
//executor.execute(() -> deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user));
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
}
}
return new Result().ok(LocalDateTime.now().toString());
@ -156,10 +158,26 @@ public class AbilityCenterControllerV2 {
private void deal(TAbilityBatchApplicationDTO abilityBatchApplicationDTO, Optional<SysDeptDTO> deptDTO, String applyFlag, UserDetail user) {
List<TAbilityApplicationDTO> tAbilityApplicationDTOList = abilityBatchApplicationDTO.getSystem().stream().map(index -> {
if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
logger.error("重复发起申请");
return null;
//if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
// logger.error("重复发起申请");
// return null;
//}
//2022-11-22 资源重复申请判断更新
if (index.containsKey("channelId")) {
String today = DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN);
if (tAbilityApplicationService.countUserCameraApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId")), today) > 0) {
logger.error("重复发起申请");
return null;
}
} else {
if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
logger.error("重复发起申请");
return null;
}
}
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());

View File

@ -8,6 +8,7 @@ import io.renren.common.constant.Constant;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.DateUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -218,10 +219,27 @@ public class AbilityCenterControllerV3 {
}
logger.info("开始申请流程!");
List<TAbilityApplicationDTO> tAbilityApplicationDTOList = abilityBatchApplicationDTO.getSystem().stream().map(index -> {
if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
logger.error("重复发起申请");
return null;
//if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
// logger.error("重复发起申请");
// return null;
//}
//2022-11-22 资源重复申请判断更新
if (index.containsKey("channelId")) {
String today = DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN);
if (tAbilityApplicationService.countUserCameraApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId")), today) > 0) {
logger.error("重复发起申请");
return null;
}
} else {
if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
logger.error("重复发起申请");
return null;
}
}
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());
@ -332,7 +350,6 @@ public class AbilityCenterControllerV3 {
Boolean crossRegion = Boolean.FALSE; // 是否跨区
Boolean cityApplyCity = Boolean.FALSE; // 是否为市区申请市区
// TODO
if (sysUserDTO.getDeptId() != null) {
SysDeptDTO applyUserDeptDTO = sysDeptService.get(sysUserDTO.getDeptId()); // 发起人的部门
Integer applyUserDeptType = applyUserDeptDTO.getType(); // 发起人

View File

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -51,4 +52,7 @@ public class TMeetingroomBookDTO implements Serializable {
private Date auditTime;
private String roomName;
@ApiModelProperty(value = "申请价格")
private BigDecimal applyPrice;
}

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -39,5 +40,8 @@ public class TMeetingroomDTO implements Serializable {
private Long modifier;
@ApiModelProperty(value = "是否删除0-未删除1-删除")
private Integer delFlag;
@ApiModelProperty(value = "价格")
private BigDecimal price;
}

View File

@ -5,6 +5,7 @@ import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -47,4 +48,9 @@ public class TMeetingroom extends BaseEntity {
private Integer delFlag;
private Long modifier;
/**
* 价格
*/
private BigDecimal price;
}

View File

@ -5,6 +5,7 @@ import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -65,4 +66,10 @@ public class TMeetingroomBook extends BaseEntity {
* 审核时间
*/
private Date auditTime;
/**
* 申请价格
*/
private BigDecimal applyPrice;
}

View File

@ -1,5 +1,6 @@
package io.renren.modules.processForm.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.annotation.LogOperation;
@ -23,6 +24,8 @@ import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
import io.renren.modules.processForm.excel.TAbilityApplicationExcel;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.excel.census.config.CustomCellWriteHeightConfig;
import io.renren.modules.resource.excel.census.config.CustomCellWriteWeightConfig;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
@ -50,6 +53,8 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -454,21 +459,92 @@ public class TAbilityApplicationController {
}
@GetMapping("/getApplyCameraList")
@ApiOperation("/西海岸-根据用户获取已申请摄像头列表")
@LogOperation("/西海岸-根据用户获取已申请摄像头列表")
@ApiOperation("西海岸-根据用户获取已申请摄像头列表")
@LogOperation("西海岸-根据用户获取已申请摄像头列表")
public Result getApplyCameraList() {
return new Result().ok(tAbilityApplicationService.getApplyCameraList());
}
@PostMapping("/delApplyCamera")
@ApiOperation("/西海岸-用户删除已申请摄像头")
@LogOperation("/西海岸-用户删除已申请摄像头")
@ApiOperation("西海岸-用户删除已申请摄像头")
@LogOperation("西海岸-用户删除已申请摄像头")
public Result delApplyCamera(@RequestBody List<Long> ids) {
tAbilityApplicationService.delApplyCamera(ids);
return new Result().ok("删除成功。");
}
@GetMapping("/getFundStatement")
@ApiOperation("获取资金报表")
@LogOperation("获取资金报表")
@ApiImplicitParams({@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "provideDept", value = "提供部门", paramType = "query", dataType = "Long"),
@ApiImplicitParam(name = "applyDept", value = "申请部门", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "resourceType", value = "资源类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "resourceName", value = "资源名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query", dataType = "INTEGER"),
@ApiImplicitParam(name = "pageSize", value = "页数大小", paramType = "query", dataType = "INTEGER")
})
public Result getFundStatement (@ApiIgnore @RequestParam Map<String, Object> params) {
return new Result().ok(tAbilityApplicationService.getFundStatement(params));
}
@GetMapping("/exportFundStatementTable")
@ApiOperation("导出资金报表")
@LogOperation("导出资金报表")
@ApiImplicitParams({@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "provideDept", value = "提供部门", paramType = "query", dataType = "Long"),
@ApiImplicitParam(name = "applyDept", value = "申请部门", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "resourceType", value = "资源类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "resourceName", value = "资源名称", paramType = "query", dataType = "String")
})
public void exportFundStatementTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
List<Map> resultList = (List<Map>) tAbilityApplicationService.exportFundStatementTable(params);
List<List<Object>> date = resultList.stream().map(index -> {
List<Object> data = new ArrayList<>();
data.add(index.getOrDefault("resourceName", "") == null ? "" : index.getOrDefault("resourceName", "").toString());
data.add(index.getOrDefault("resourceType", "") == null ? "" : index.getOrDefault("resourceType", "").toString());
data.add(index.getOrDefault("provideDept", "") == null ? "" : index.getOrDefault("provideDept", "").toString());
data.add(index.getOrDefault("applyDept", "") == null ? "" : index.getOrDefault("applyDept", "").toString());
data.add(index.getOrDefault("applyDate", "") == null ? "" : index.getOrDefault("applyDate", "").toString());
data.add(index.getOrDefault("applyPrice", "") == null ? "" : index.getOrDefault("applyPrice", "").toString());
return data;
}).collect(Collectors.toList());
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
String fileName = URLEncoder.encode("资金报表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream()).head(exportSelectCensusApplyTableHead())
.registerWriteHandler(new CustomCellWriteWeightConfig())
.registerWriteHandler(new CustomCellWriteHeightConfig())
.sheet("资金报表").doWrite(date);
}
private List<List<String>> exportSelectCensusApplyTableHead() {
List<List<String>> list = new ArrayList<>();
List<String> head0 = new ArrayList<>();
head0.add("资源名称");
List<String> head1 = new ArrayList<>();
head1.add("类型");
List<String> head2 = new ArrayList<>();
head2.add("提供部门");
List<String> head3 = new ArrayList<>();
head3.add("申请部门");
List<String> head4 = new ArrayList<>();
head4.add("申请时间");
List<String> head5 = new ArrayList<>();
head5.add("参考价格");
list.add(head0);
list.add(head1);
list.add(head2);
list.add(head3);
list.add(head4);
list.add(head5);
return list;
}
}

View File

@ -54,4 +54,14 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
List<Map> getApplyCameraList(@Param("userId") Long userId, @Param("date") String date);
Integer delApplyCamera(@Param("ids") List<Long> ids);
Integer countUserCameraApply(@Param("userId") Long userId, @Param("resourceId") Long resourceId, @Param("today") String today);
List<Map> getFundStatement(@Param("params") Map<String, Object> params);
Long getFundStatementSum(@Param("params") Map<String, Object> params);
List<Map> exportFundStatementTable(@Param("params") Map<String, Object> params);
Long getFundStatementCount(@Param("params") Map<String, Object> params);
}

View File

@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -93,4 +94,7 @@ public class TAbilityApplicationDTO extends AuditingBaseDTO implements Serializa
@ApiModelProperty(value = "过期时间")
private Date expireDate;
@ApiModelProperty(value = "申请价格")
private BigDecimal applyPrice;
}

View File

@ -9,6 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -136,4 +137,10 @@ public class TAbilityApplicationEntity extends BaseEntity implements Serializabl
* 过期时间
*/
private Date expireDate;
/**
* 申请价格
*/
private BigDecimal applyPrice;
}

View File

@ -62,4 +62,10 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
Object getApplyCameraList();
void delApplyCamera(List<Long> ids);
Integer countUserCameraApply(Long userId, Long resourceId, String today);
Object getFundStatement(Map<String, Object> params);
Object exportFundStatementTable(Map<String, Object> params);
}

View File

@ -1,5 +1,6 @@
package io.renren.modules.processForm.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
@ -16,10 +17,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -158,5 +157,27 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
abilityApplicationDao.delApplyCamera(ids);
}
@Override
public Integer countUserCameraApply(Long userId, Long resourceId, String today) {
return abilityApplicationDao.countUserCameraApply(userId, resourceId, today);
}
@Override
public Object getFundStatement(Map<String, Object> params) {
Map<String, Object> resultMap = new HashMap<>();
int pageNum = Integer.parseInt(params.get("pageNum").toString());
int pageSize = Integer.parseInt(params.get("pageSize").toString());
params.replace("pageNum", (pageNum - 1) * pageSize);
resultMap.put("list", abilityApplicationDao.getFundStatement(params));
resultMap.put("totalPrice", abilityApplicationDao.getFundStatementSum(params));
resultMap.put("total", abilityApplicationDao.getFundStatementCount(params));
return resultMap;
}
@Override
public Object exportFundStatementTable(Map<String, Object> params) {
return abilityApplicationDao.exportFundStatementTable(params);
}
}

View File

@ -18,10 +18,8 @@ public class WillApplyCameraServiceImpl extends CrudServiceImpl<WillApplyCameraD
@Autowired
private WillApplyCameraDao willApplyCameraDao;
@Override
public QueryWrapper<WillApplyCameraEntity> getWrapper(Map<String, Object> params) {
return null;
}

View File

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Optional;
@ -132,6 +133,9 @@ public class ResourceDTO extends AuditingBaseDTO implements Serializable {
@ApiModelProperty(value = "下架流程实例ID")
private Long undercarriageInstanceId;
@ApiModelProperty(value = "价格")
private BigDecimal price;
public String getDelFlagTip() {
if (this.delFlag != null) {
Optional<ResourceEntityDelFlag> resourceEntityDelFlagOptional = Optional.ofNullable(ResourceEntityDelFlag.getByFlag(this.delFlag));

View File

@ -8,6 +8,7 @@ import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -174,5 +175,13 @@ public class ResourceEntity extends BaseEntity {
*/
private String applyNumber;
/**
* 下架流程实例ID
*/
private Long undercarriageInstanceId;
/**
* 价格
*/
private BigDecimal price;
}

View File

@ -0,0 +1,11 @@
-- 2022-11-22 资源增加价格字段,申请表增加申请价格
ALTER TABLE t_ability_application ADD COLUMN `apply_price` BIGINT NOT NULL DEFAULT 0 COMMENT '申请价格';
ALTER TABLE tb_data_resource ADD COLUMN `price` BIGINT NOT NULL DEFAULT 0 COMMENT '价格';
ALTER TABLE t_meetingroom ADD COLUMN `price` BIGINT NOT NULL DEFAULT 0 COMMENT '价格';
ALTER TABLE t_meetingroom_book ADD COLUMN `apply_price` BIGINT NOT NULL DEFAULT 0 COMMENT '申请价格';

View File

@ -18,6 +18,7 @@
<result column="audit_viem" property="auditViem"/>
<result column="auditor" property="auditor"/>
<result column="audit_time" property="auditTime"/>
<result column="apply_price" property="applyPrice"/>
</resultMap>
<resultMap id="dtoMap" type="io.renren.modules.meeting.dto.TMeetingroomBookDTO">
@ -37,6 +38,7 @@
<result column="audit_viem" property="auditViem"/>
<result column="auditor" property="auditor"/>
<result column="audit_time" property="auditTime"/>
<result column="apply_price" property="applyPrice"/>
</resultMap>
<!-- 表字段 -->
@ -57,6 +59,7 @@
, t.audit_viem
, t.auditor
, t.audit_time
, t.apply_price
</sql>
<select id="selectByRoomAndTime" resultMap="dtoMap">

View File

@ -14,6 +14,7 @@
<result column="modify_time" property="modifyTime"/>
<result column="del_flag" property="delFlag"/>
<result column="modifier" property="modifier"/>
<result column="price" property="price"/>
</resultMap>
<resultMap id="meetingroomDto" type="io.renren.modules.meeting.dto.TMeetingroomDTO">
@ -29,6 +30,7 @@
<result column="modify_time" property="modifyTime"/>
<result column="del_flag" property="delFlag"/>
<result column="modifier" property="modifier"/>
<result column="price" property="price"/>
</resultMap>
<!-- 表字段 -->
@ -45,6 +47,7 @@
, t.del_flag
, t.creator
, t.modifier
, t.price
</sql>
<select id="queryCount" resultType="java.lang.Integer">

View File

@ -29,7 +29,9 @@
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
<result property="createDate" column="create_date"/>
<result property="applyPrice" column="apply_price"/>
</resultMap>
<resultMap id="resourceDTO" type="io.renren.modules.processForm.dto.TAbilityApplicationDTO">
<result property="id" column="id"/>
<result property="user" column="user"/>
@ -55,6 +57,7 @@
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
<result property="createDate" column="create_date"/>
<result property="applyPrice" column="apply_price"/>
</resultMap>
<update id="updateInstanceId">
@ -337,4 +340,292 @@
AND expire_date > #{date}
ORDER BY create_date DESC
</select>
<select id="countUserCameraApply" resultType="java.lang.Integer">
SELECT
COUNT( 1 )
FROM
( SELECT id FROM t_ability_application WHERE user_id = #{userId} AND resource_id = #{resourceId} AND IFNULL( expire_date > #{today}, 1 ) > 0 ) temp
</select>
<select id="getFundStatement" resultType="java.util.Map">
SELECT
taa.id,
tdr.NAME AS "resourceName",
( CASE tdr.type WHEN '应用资源' THEN tdr.type WHEN '组件服务' THEN tda.attr_value ELSE tdr.type END ) AS "resourceType",
sd.name AS "provideDept",
taa.unit AS "applyDept",
taa.create_date AS "applyDate",
taa.apply_price AS "applyPrice"
FROM
t_ability_application taa
LEFT JOIN tb_data_resource tdr ON taa.resource_id = tdr.id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
WHERE
1 = 1
AND taa.approve_status IN ( '审核中', '通过' )
AND taa.del_flag = 0
AND tdr.del_flag = 0
AND tda.del_flag = 0
AND tda.attr_type = '组件类型'
<if test = "params.startDate != null and params.startDate != ''" >
AND taa.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= taa.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND sd.id = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND taa.unit LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tdr.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND ( CASE tdr.type WHEN '应用资源' THEN tdr.type WHEN '组件服务' THEN tda.attr_value ELSE tdr.type END ) = #{params.resourceType}
</if>
UNION ALL
SELECT
tmb.id,
tm.NAME AS "resourceName",
'会客厅' AS "resourceType",
'青岛市大数据发展管理局' AS "provideDept",
tmb.dept AS "applyDept",
tmb.create_date AS "applyDate",
tmb.apply_price AS "applyPrice"
FROM
t_meetingroom_book tmb
LEFT JOIN t_meetingroom tm ON tmb.room_id = tm.id
WHERE
tm.del_flag = 0
<if test = "params.startDate != null and params.startDate != ''" >
AND tmb.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= tmb.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND 1067246875800000066 = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND tmb.dept LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tm.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND '会客厅' = #{params.resourceType}
</if>
ORDER BY applyDate
LIMIT ${params.pageNum}, ${params.pageSize}
</select>
<select id="getFundStatementSum" resultType="java.lang.Long">
SELECT SUM(temp.applyPrice) FROM (
SELECT
taa.apply_price AS "applyPrice"
FROM
t_ability_application taa
LEFT JOIN tb_data_resource tdr ON taa.resource_id = tdr.id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
WHERE
1 = 1
AND taa.approve_status IN ( '审核中', '通过' )
AND taa.del_flag = 0
AND tdr.del_flag = 0
AND tda.del_flag = 0
AND tda.attr_type = '组件类型'
<if test = "params.startDate != null and params.startDate != ''" >
AND taa.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= taa.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND sd.id = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND taa.unit LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tdr.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND ( CASE tdr.type WHEN '应用资源' THEN tdr.type WHEN '组件服务' THEN tda.attr_value ELSE tdr.type END ) = #{params.resourceType}
</if>
UNION ALL
SELECT
tmb.apply_price AS "applyPrice"
FROM
t_meetingroom_book tmb
LEFT JOIN t_meetingroom tm ON tmb.room_id = tm.id
WHERE
tm.del_flag = 0
<if test = "params.startDate != null and params.startDate != ''" >
AND tmb.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= tmb.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND 1067246875800000066 = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND tmb.dept LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tm.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND '会客厅' = #{params.resourceType}
</if>
) temp
</select>
<select id="exportFundStatementTable" resultType="java.util.Map">
SELECT
taa.id,
tdr.NAME AS "resourceName",
( CASE tdr.type WHEN '应用资源' THEN tdr.type WHEN '组件服务' THEN tda.attr_value ELSE tdr.type END ) AS "resourceType",
sd.name AS "provideDept",
taa.unit AS "applyDept",
taa.create_date AS "applyDate",
taa.apply_price AS "applyPrice"
FROM
t_ability_application taa
LEFT JOIN tb_data_resource tdr ON taa.resource_id = tdr.id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
WHERE
1 = 1
AND taa.approve_status IN ( '审核中', '通过' )
AND taa.del_flag = 0
AND tdr.del_flag = 0
AND tda.del_flag = 0
AND tda.attr_type = '组件类型'
<if test = "params.startDate != null and params.startDate != ''" >
AND taa.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= taa.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND sd.id = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND taa.unit LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tdr.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND ( CASE tdr.type WHEN '应用资源' THEN tdr.type WHEN '组件服务' THEN tda.attr_value ELSE tdr.type END ) = #{params.resourceType}
</if>
UNION ALL
SELECT
tmb.id,
tm.NAME AS "resourceName",
'会客厅' AS "resourceType",
'青岛市大数据发展管理局' AS "provideDept",
tmb.dept AS "applyDept",
tmb.create_date AS "applyDate",
tmb.apply_price AS "applyPrice"
FROM
t_meetingroom_book tmb
LEFT JOIN t_meetingroom tm ON tmb.room_id = tm.id
WHERE
tm.del_flag = 0
<if test = "params.startDate != null and params.startDate != ''" >
AND tmb.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= tmb.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND 1067246875800000066 = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND tmb.dept LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tm.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND '会客厅' = #{params.resourceType}
</if>
ORDER BY applyDate
</select>
<select id="getFundStatementCount" resultType="java.lang.Long">
SELECT COUNT(1) FROM (
SELECT
taa.id
FROM
t_ability_application taa
LEFT JOIN tb_data_resource tdr ON taa.resource_id = tdr.id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
WHERE
1 = 1
AND taa.approve_status IN ( '审核中', '通过' )
AND taa.del_flag = 0
AND tdr.del_flag = 0
AND tda.del_flag = 0
AND tda.attr_type = '组件类型'
<if test = "params.startDate != null and params.startDate != ''" >
AND taa.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= taa.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND sd.id = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND taa.unit LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tdr.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND ( CASE tdr.type WHEN '应用资源' THEN tdr.type WHEN '组件服务' THEN tda.attr_value ELSE tdr.type END ) = #{params.resourceType}
</if>
UNION ALL
SELECT
tmb.id
FROM
t_meetingroom_book tmb
LEFT JOIN t_meetingroom tm ON tmb.room_id = tm.id
WHERE
tm.del_flag = 0
<if test = "params.startDate != null and params.startDate != ''" >
AND tmb.create_date >= #{params.startDate}
</if>
<if test = "params.endDate != null and params.endDate != ''" >
AND #{params.endDate} >= tmb.create_date
</if>
<if test = "params.provideDept != null and params.provideDept != ''" >
AND 1067246875800000066 = #{params.provideDept}
</if>
<if test = "params.applyDept != null and params.applyDept != ''" >
AND tmb.dept LIKE CONCAT('%', #{params.applyDept} ,'%')
</if>
<if test = "params.resourceName != null and params.resourceName != ''" >
AND tm.NAME LIKE CONCAT('%', #{params.resourceName} ,'%')
</if>
<if test = "params.resourceType != null and params.resourceType != ''" >
AND '会客厅' = #{params.resourceType}
</if>
) temp
</select>
</mapper>

View File

@ -42,6 +42,7 @@
<result property="undercarriageTitle" column="undercarriage_title"/>
<result property="undercarriageUserPhone" column="undercarriage_phone"/>
<result property="undercarriageEnclosureName" column="undercarriage_enclosure_name"/>
<result property="price" column="price"/>
</resultMap>
<resultMap id="resourceDTO" type="io.renren.modules.resource.dto.ResourceDTO">
@ -91,6 +92,7 @@
<result property="undercarriageTitle" column="undercarriage_title"/>
<result property="undercarriageUserPhone" column="undercarriage_phone"/>
<result property="undercarriageEnclosureName" column="undercarriage_enclosure_name"/>
<result property="price" column="price"/>
</resultMap>
<update id="deleteByIds">