Merge remote-tracking branch 'origin/dev2.0' into dev_price
# Conflicts: # src/main/java/com/glxp/api/dao/system/SysMsgTodoMapper.java # src/main/java/com/glxp/api/entity/system/SysMsgTodoEntity.java # src/main/java/com/glxp/api/service/system/SysMsgTodoService.java # src/main/resources/mybatis/mapper/system/SysMsgTodoMapper.xmltest
commit
bbcdd1dbd2
@ -0,0 +1,34 @@
|
|||||||
|
package com.glxp.api.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import com.glxp.api.config.serializer.*;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class JacksonConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Primary
|
||||||
|
// @ConditionalOnMissingBean(ObjectMapper.class)
|
||||||
|
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||||
|
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
|
||||||
|
SimpleModule simpleModule = new SimpleModule();
|
||||||
|
|
||||||
|
simpleModule.addSerializer(Long.class, new LongJsonSerializer());
|
||||||
|
simpleModule.addDeserializer(Long.class, new LongJsonDeserializer());
|
||||||
|
simpleModule.addSerializer(LocalDate.class, new LocalDateJsonSerializer());
|
||||||
|
simpleModule.addDeserializer(LocalDate.class, new LocalDateJsonDeserializer());
|
||||||
|
simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeJsonSerializer());
|
||||||
|
simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeJsonDeserializer());
|
||||||
|
|
||||||
|
objectMapper.registerModule(simpleModule);
|
||||||
|
return objectMapper;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.glxp.api.config.serializer;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONNull;
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
import org.springframework.boot.jackson.JsonComponent;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@JsonComponent
|
||||||
|
public class JsonNullSerializer extends JsonSerializer<JSONNull> {
|
||||||
|
@Override
|
||||||
|
public void serialize(JSONNull jsonNull, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||||
|
jsonGenerator.writeNull();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.glxp.api.config.serializer;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串转Long类型
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class LocalDateJsonDeserializer extends JsonDeserializer<LocalDate> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
|
String value = p.getText();
|
||||||
|
try {
|
||||||
|
return StrUtil.isEmpty(value) ? null : LocalDateTimeUtil.parseDate(value, DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("日期格式解析错误", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.glxp.api.config.serializer;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串转Long类型
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class LocalDateTimeJsonDeserializer extends JsonDeserializer<LocalDateTime> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
|
String value = p.getText();
|
||||||
|
try {
|
||||||
|
return StrUtil.isEmpty(value) ? null : LocalDateTimeUtil.parse(value, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("日期格式解析错误", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.glxp.api.config.serializer;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串转Long类型
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class LongJsonDeserializer extends JsonDeserializer<Long> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
|
String value = p.getText();
|
||||||
|
return StrUtil.isEmpty(value) ? null : Long.parseLong(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.glxp.api.controller.system;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.entity.system.SysMsgTodoEntity;
|
||||||
|
import com.glxp.api.req.system.SysMsgTodoQuery;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.service.system.SysMsgTodoService;
|
||||||
|
import com.glxp.api.vo.system.SysMsgTodoVo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SysMsgTodoController {
|
||||||
|
|
||||||
|
private final SysMsgTodoService sysMsgTodoService;
|
||||||
|
|
||||||
|
@PostMapping("/spms/sysMsgTodo/page")
|
||||||
|
public BaseResponse page(@RequestBody SysMsgTodoQuery query) {
|
||||||
|
List<SysMsgTodoVo> msgTodoVos = sysMsgTodoService.pageOfVo(query);
|
||||||
|
PageInfo<SysMsgTodoVo> page = new PageInfo<>(msgTodoVos);
|
||||||
|
PageSimpleResponse<SysMsgTodoVo> simpleResponse = new PageSimpleResponse<>();
|
||||||
|
simpleResponse.setTotal(page.getTotal());
|
||||||
|
simpleResponse.setList(BeanUtil.copyToList(msgTodoVos, SysMsgTodoVo.class));
|
||||||
|
return ResultVOUtils.success(simpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,20 @@
|
|||||||
package com.glxp.api.dao.system;
|
package com.glxp.api.dao.system;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.glxp.api.entity.system.SysMsgTodoEntity;
|
import com.glxp.api.entity.system.SysMsgTodoEntity;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.req.system.SysMsgTodoQuery;
|
||||||
|
import com.glxp.api.vo.system.SysMsgTodoVo;
|
||||||
|
|
||||||
@Mapper
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对表【sys_msg_todo】的数据库操作Mapper
|
||||||
|
*/
|
||||||
public interface SysMsgTodoMapper extends BaseMapper<SysMsgTodoEntity> {
|
public interface SysMsgTodoMapper extends BaseMapper<SysMsgTodoEntity> {
|
||||||
|
|
||||||
|
List<SysMsgTodoVo> pageOfVo(SysMsgTodoQuery query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.glxp.api.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DealStatusEnum {
|
||||||
|
|
||||||
|
NOT_CONFIRMED("not_confirmed", 1, "未处理"),
|
||||||
|
|
||||||
|
CONFIRMED("confirmed", 2, "已处理"),
|
||||||
|
;
|
||||||
|
|
||||||
|
final String key;
|
||||||
|
@EnumValue
|
||||||
|
final Integer value;
|
||||||
|
final String desc;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.glxp.api.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PushStatusEnum {
|
||||||
|
|
||||||
|
NOT_PUSHED("not_pushed", 1, "未推送"),
|
||||||
|
|
||||||
|
PUSH_SUCCESS("push_success", 2, "推送成功"),
|
||||||
|
PUSH_FAIL("push_fail", 3, "推送失败"),
|
||||||
|
;
|
||||||
|
|
||||||
|
final String key;
|
||||||
|
@EnumValue
|
||||||
|
final Integer value;
|
||||||
|
final String desc;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.glxp.api.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum TodoMsgTypeEnum {
|
||||||
|
|
||||||
|
PUT_IN_APPLY("put_in_apply", 1, "入院物资申请"),
|
||||||
|
|
||||||
|
ORDER_AUDIT("order_audit", 2, "单据审核"),
|
||||||
|
INVOICE_CONFIRM("invoice_confirm", 3, "单据发票确认"),
|
||||||
|
CERT_AUDIT("cert_audit", 5, "资质审核"),
|
||||||
|
USE_AUDIT("use_audit", 6, "领用单审核"),
|
||||||
|
BUY_APPLY_AUDIT("buy_audit", 7, "申购单审核"),
|
||||||
|
PROCUREMENT_AUDIT("procurement_audit", 8, "采购单审核"),
|
||||||
|
;
|
||||||
|
|
||||||
|
final String key;
|
||||||
|
@EnumValue
|
||||||
|
final Integer value;
|
||||||
|
final String desc;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.glxp.api.req.system;
|
||||||
|
|
||||||
|
import com.glxp.api.enums.DealStatusEnum;
|
||||||
|
import com.glxp.api.enums.PushStatusEnum;
|
||||||
|
import com.glxp.api.enums.TodoMsgTypeEnum;
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysMsgTodoQuery extends ListPageRequest {
|
||||||
|
|
||||||
|
TodoMsgTypeEnum msgType;
|
||||||
|
PushStatusEnum pushStatus;
|
||||||
|
DealStatusEnum dealStatus;
|
||||||
|
|
||||||
|
String invCode;
|
||||||
|
|
||||||
|
String deptCode;
|
||||||
|
}
|
@ -1,12 +1,16 @@
|
|||||||
package com.glxp.api.service.system;
|
package com.glxp.api.service.system;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.glxp.api.dao.system.SysMsgTodoMapper;
|
|
||||||
import com.glxp.api.entity.system.SysMsgTodoEntity;
|
import com.glxp.api.entity.system.SysMsgTodoEntity;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.glxp.api.req.system.SysMsgTodoQuery;
|
||||||
|
import com.glxp.api.vo.system.SysMsgTodoVo;
|
||||||
|
|
||||||
@Service
|
import java.util.List;
|
||||||
public class SysMsgTodoService extends ServiceImpl<SysMsgTodoMapper, SysMsgTodoEntity> {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对表【sys_msg_todo】的数据库操作Service
|
||||||
|
*/
|
||||||
|
public interface SysMsgTodoService extends IService<SysMsgTodoEntity> {
|
||||||
|
|
||||||
|
List<SysMsgTodoVo> pageOfVo(SysMsgTodoQuery query);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.glxp.api.service.system.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.entity.system.SysMsgTodoEntity;
|
||||||
|
import com.glxp.api.req.system.SysMsgTodoQuery;
|
||||||
|
import com.glxp.api.service.system.SysMsgTodoService;
|
||||||
|
import com.glxp.api.dao.system.SysMsgTodoMapper;
|
||||||
|
import com.glxp.api.vo.system.SysMsgTodoVo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对表【sys_msg_todo】的数据库操作Service实现
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysMsgTodoServiceImpl extends ServiceImpl<SysMsgTodoMapper, SysMsgTodoEntity>
|
||||||
|
implements SysMsgTodoService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysMsgTodoVo> pageOfVo(SysMsgTodoQuery query) {
|
||||||
|
|
||||||
|
PageHelper.startPage(query.getPage(), query.getLimit(), true);
|
||||||
|
return super.baseMapper.pageOfVo(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.glxp.api.vo.system;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.system.SysMsgTodoEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysMsgTodoVo extends SysMsgTodoEntity {
|
||||||
|
|
||||||
|
String msgTypeName;
|
||||||
|
String pushStatusName;
|
||||||
|
String dealStatusName;
|
||||||
|
|
||||||
|
String invName;
|
||||||
|
|
||||||
|
String deptName;
|
||||||
|
|
||||||
|
public String getMsgTypeName() {
|
||||||
|
if (super.getMsgType() != null) {
|
||||||
|
return super.getMsgType().getDesc();
|
||||||
|
}
|
||||||
|
return msgTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPushStatusName() {
|
||||||
|
if (super.getPushStatus() != null) {
|
||||||
|
return super.getPushStatus().getDesc();
|
||||||
|
}
|
||||||
|
return pushStatusName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDealStatusName() {
|
||||||
|
if (super.getDealStatus() != null) {
|
||||||
|
return super.getDealStatus().getDesc();
|
||||||
|
}
|
||||||
|
return dealStatusName;
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.glxp.api.dao.system.SysMsgTodoMapper">
|
<mapper namespace="com.glxp.api.dao.system.SysMsgTodoMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.system.SysMsgTodoEntity">
|
<select id="pageOfVo" resultType="com.glxp.api.vo.system.SysMsgTodoVo">
|
||||||
<!--@mbg.generated-->
|
select *,aw.name invName,ad.name deptName
|
||||||
<!--@Table sys_msg_todo-->
|
from sys_msg_todo smt
|
||||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
left join auth_warehouse aw on aw.code = smt.invCode
|
||||||
<result column="code" jdbcType="VARCHAR" property="code"/>
|
left join auth_dept ad on ad.code = smt.deptCode
|
||||||
<result column="msgType" jdbcType="TINYINT" property="msgType"/>
|
<where>
|
||||||
<result column="msgContent" jdbcType="VARCHAR" property="msgContent"/>
|
<if test="msgType!=null">
|
||||||
<result column="dealStatus" jdbcType="TINYINT" property="dealStatus"/>
|
and smt.msgType = #{msgType}
|
||||||
<result column="pushStatus" jdbcType="TINYINT" property="pushStatus"/>
|
</if>
|
||||||
<result column="toUrl" jdbcType="VARCHAR" property="toUrl"/>
|
<if test="pushStatus!=null">
|
||||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
|
and smt.pushStatus = #{pushStatus}
|
||||||
<result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
|
</if>
|
||||||
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
|
<if test="dealStatus!=null">
|
||||||
<result column="deptCode" jdbcType="VARCHAR" property="deptCode"/>
|
and smt.dealStatus = #{dealStatus}
|
||||||
<result column="invCode" jdbcType="VARCHAR" property="invCode"/>
|
</if>
|
||||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
<if test="invCode!=null and invCode!=''">
|
||||||
</resultMap>
|
and smt.invCode = #{invCode}
|
||||||
<sql id="Base_Column_List">
|
</if>
|
||||||
<!--@mbg.generated-->
|
<if test="deptCode!=null and deptCode!=''">
|
||||||
id, code, msgType, msgContent, dealStatus, pushStatus, toUrl, createTime, updateUser,
|
and smt.deptCode = #{deptCode}
|
||||||
updateTime, deptCode, invCode, remark
|
</if>
|
||||||
</sql>
|
</where>
|
||||||
|
order by smt.createTime desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue