forked from luyan/epmet-cloud-lingshan
11 changed files with 49 additions and 407 deletions
@ -1,73 +0,0 @@ |
|||||
package com.epmet.controller; |
|
||||
|
|
||||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|
||||
import com.epmet.commons.tools.page.PageData; |
|
||||
import com.epmet.commons.tools.utils.Result; |
|
||||
import com.epmet.commons.tools.validator.AssertUtils; |
|
||||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
||||
import com.epmet.commons.tools.validator.group.AddGroup; |
|
||||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|
||||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|
||||
import com.epmet.dto.IcResiVaccineDTO; |
|
||||
import com.epmet.service.IcResiVaccineService; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.web.bind.annotation.*; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 居民疫苗情况 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2022-03-28 |
|
||||
*/ |
|
||||
@RestController |
|
||||
@RequestMapping("icResiVaccine") |
|
||||
public class IcResiVaccineController { |
|
||||
|
|
||||
@Autowired |
|
||||
private IcResiVaccineService icResiVaccineService; |
|
||||
|
|
||||
@RequestMapping("page") |
|
||||
public Result<PageData<IcResiVaccineDTO>> page(@RequestParam Map<String, Object> params){ |
|
||||
PageData<IcResiVaccineDTO> page = icResiVaccineService.page(params); |
|
||||
return new Result<PageData<IcResiVaccineDTO>>().ok(page); |
|
||||
} |
|
||||
|
|
||||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|
||||
public Result<IcResiVaccineDTO> get(@PathVariable("id") String id){ |
|
||||
IcResiVaccineDTO data = icResiVaccineService.get(id); |
|
||||
return new Result<IcResiVaccineDTO>().ok(data); |
|
||||
} |
|
||||
|
|
||||
@NoRepeatSubmit |
|
||||
@PostMapping("save") |
|
||||
public Result save(@RequestBody IcResiVaccineDTO dto){ |
|
||||
//效验数据
|
|
||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|
||||
icResiVaccineService.save(dto); |
|
||||
return new Result(); |
|
||||
} |
|
||||
|
|
||||
@NoRepeatSubmit |
|
||||
@PostMapping("update") |
|
||||
public Result update(@RequestBody IcResiVaccineDTO dto){ |
|
||||
//效验数据
|
|
||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|
||||
icResiVaccineService.update(dto); |
|
||||
return new Result(); |
|
||||
} |
|
||||
|
|
||||
@PostMapping("delete") |
|
||||
public Result delete(@RequestBody String[] ids){ |
|
||||
//效验数据
|
|
||||
AssertUtils.isArrayEmpty(ids, "id"); |
|
||||
icResiVaccineService.delete(ids); |
|
||||
return new Result(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,16 +0,0 @@ |
|||||
package com.epmet.dao; |
|
||||
|
|
||||
import com.epmet.commons.mybatis.dao.BaseDao; |
|
||||
import com.epmet.entity.IcResiVaccineEntity; |
|
||||
import org.apache.ibatis.annotations.Mapper; |
|
||||
|
|
||||
/** |
|
||||
* 居民疫苗情况 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2022-03-28 |
|
||||
*/ |
|
||||
@Mapper |
|
||||
public interface IcResiVaccineDao extends BaseDao<IcResiVaccineEntity> { |
|
||||
|
|
||||
} |
|
@ -1,79 +0,0 @@ |
|||||
package com.epmet.entity; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||
|
|
||||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|
||||
import lombok.Data; |
|
||||
import lombok.EqualsAndHashCode; |
|
||||
|
|
||||
import java.util.Date; |
|
||||
|
|
||||
/** |
|
||||
* 居民疫苗情况 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2022-03-28 |
|
||||
*/ |
|
||||
@Data |
|
||||
@EqualsAndHashCode(callSuper=false) |
|
||||
@TableName("ic_resi_vaccine") |
|
||||
public class IcResiVaccineEntity extends BaseEpmetEntity { |
|
||||
|
|
||||
private static final long serialVersionUID = 1L; |
|
||||
|
|
||||
/** |
|
||||
* 客户Id customer.id |
|
||||
*/ |
|
||||
private String customerId; |
|
||||
|
|
||||
/** |
|
||||
* 姓名 |
|
||||
*/ |
|
||||
private String name; |
|
||||
|
|
||||
/** |
|
||||
* 手机号 |
|
||||
*/ |
|
||||
private String mobile; |
|
||||
|
|
||||
/** |
|
||||
* 身份证号 |
|
||||
*/ |
|
||||
private String idCard; |
|
||||
|
|
||||
/** |
|
||||
* 接种时间 |
|
||||
*/ |
|
||||
private Date inoculateTime; |
|
||||
|
|
||||
/** |
|
||||
* 接种地点 |
|
||||
*/ |
|
||||
private String inoculateAddress; |
|
||||
|
|
||||
/** |
|
||||
* 疫苗厂家 |
|
||||
*/ |
|
||||
private String manufacturer; |
|
||||
|
|
||||
/** |
|
||||
* 预留字段1 |
|
||||
*/ |
|
||||
private String field1; |
|
||||
|
|
||||
/** |
|
||||
* 预留字段2 |
|
||||
*/ |
|
||||
private String field2; |
|
||||
|
|
||||
/** |
|
||||
* 预留字段3 |
|
||||
*/ |
|
||||
private String field3; |
|
||||
|
|
||||
/** |
|
||||
* 备注 |
|
||||
*/ |
|
||||
private String remaek; |
|
||||
|
|
||||
} |
|
@ -1,89 +0,0 @@ |
|||||
package com.epmet.service; |
|
||||
|
|
||||
import com.epmet.commons.mybatis.service.BaseService; |
|
||||
import com.epmet.commons.tools.page.PageData; |
|
||||
import com.epmet.dto.IcResiVaccineDTO; |
|
||||
import com.epmet.dto.result.VaccineListDTO; |
|
||||
import com.epmet.entity.IcResiVaccineEntity; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
/** |
|
||||
* 居民疫苗情况 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2022-03-28 |
|
||||
*/ |
|
||||
public interface IcResiVaccineService extends BaseService<IcResiVaccineEntity> { |
|
||||
|
|
||||
/** |
|
||||
* 默认分页 |
|
||||
* |
|
||||
* @param params |
|
||||
* @return PageData<IcResiVaccineDTO> |
|
||||
* @author generator |
|
||||
* @date 2022-03-28 |
|
||||
*/ |
|
||||
PageData<IcResiVaccineDTO> page(Map<String, Object> params); |
|
||||
|
|
||||
/** |
|
||||
* 默认查询 |
|
||||
* |
|
||||
* @param params |
|
||||
* @return java.util.List<IcResiVaccineDTO> |
|
||||
* @author generator |
|
||||
* @date 2022-03-28 |
|
||||
*/ |
|
||||
List<IcResiVaccineDTO> list(Map<String, Object> params); |
|
||||
|
|
||||
/** |
|
||||
* 单条查询 |
|
||||
* |
|
||||
* @param id |
|
||||
* @return IcResiVaccineDTO |
|
||||
* @author generator |
|
||||
* @date 2022-03-28 |
|
||||
*/ |
|
||||
IcResiVaccineDTO get(String id); |
|
||||
|
|
||||
/** |
|
||||
* 默认保存 |
|
||||
* |
|
||||
* @param dto |
|
||||
* @return void |
|
||||
* @author generator |
|
||||
* @date 2022-03-28 |
|
||||
*/ |
|
||||
void save(IcResiVaccineDTO dto); |
|
||||
|
|
||||
/** |
|
||||
* 默认更新 |
|
||||
* |
|
||||
* @param dto |
|
||||
* @return void |
|
||||
* @author generator |
|
||||
* @date 2022-03-28 |
|
||||
*/ |
|
||||
void update(IcResiVaccineDTO dto); |
|
||||
|
|
||||
/** |
|
||||
* 批量删除 |
|
||||
* |
|
||||
* @param ids |
|
||||
* @return void |
|
||||
* @author generator |
|
||||
* @date 2022-03-28 |
|
||||
*/ |
|
||||
void delete(String[] ids); |
|
||||
|
|
||||
/** |
|
||||
* 获取居民疫苗接种信息 |
|
||||
* |
|
||||
* @Param idCard |
|
||||
* @Return {@link List< VaccineListDTO>} |
|
||||
* @Author zhaoqifeng |
|
||||
* @Date 2022/3/30 10:24 |
|
||||
*/ |
|
||||
List<VaccineListDTO> getVaccineList(String customerId, String idCard); |
|
||||
} |
|
@ -1,116 +0,0 @@ |
|||||
package com.epmet.service.impl; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
||||
import com.epmet.commons.tools.constant.FieldConstant; |
|
||||
import com.epmet.commons.tools.page.PageData; |
|
||||
import com.epmet.commons.tools.utils.ConvertUtils; |
|
||||
import com.epmet.commons.tools.utils.DateUtils; |
|
||||
import com.epmet.dao.IcResiVaccineDao; |
|
||||
import com.epmet.dto.IcResiVaccineDTO; |
|
||||
import com.epmet.dto.result.VaccineListDTO; |
|
||||
import com.epmet.entity.IcResiVaccineEntity; |
|
||||
import com.epmet.service.IcResiVaccineService; |
|
||||
import org.apache.commons.collections4.CollectionUtils; |
|
||||
import org.apache.commons.lang3.StringUtils; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
import org.springframework.transaction.annotation.Transactional; |
|
||||
|
|
||||
import java.util.Arrays; |
|
||||
import java.util.Collections; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
import java.util.stream.Collectors; |
|
||||
|
|
||||
/** |
|
||||
* 居民疫苗情况 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2022-03-28 |
|
||||
*/ |
|
||||
@Service |
|
||||
public class IcResiVaccineServiceImpl extends BaseServiceImpl<IcResiVaccineDao, IcResiVaccineEntity> implements IcResiVaccineService { |
|
||||
|
|
||||
@Override |
|
||||
public PageData<IcResiVaccineDTO> page(Map<String, Object> params) { |
|
||||
IPage<IcResiVaccineEntity> page = baseDao.selectPage( |
|
||||
getPage(params, FieldConstant.CREATED_TIME, false), |
|
||||
getWrapper(params) |
|
||||
); |
|
||||
return getPageData(page, IcResiVaccineDTO.class); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public List<IcResiVaccineDTO> list(Map<String, Object> params) { |
|
||||
List<IcResiVaccineEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
||||
|
|
||||
return ConvertUtils.sourceToTarget(entityList, IcResiVaccineDTO.class); |
|
||||
} |
|
||||
|
|
||||
private QueryWrapper<IcResiVaccineEntity> getWrapper(Map<String, Object> params){ |
|
||||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
||||
|
|
||||
QueryWrapper<IcResiVaccineEntity> wrapper = new QueryWrapper<>(); |
|
||||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
||||
|
|
||||
return wrapper; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public IcResiVaccineDTO get(String id) { |
|
||||
IcResiVaccineEntity entity = baseDao.selectById(id); |
|
||||
return ConvertUtils.sourceToTarget(entity, IcResiVaccineDTO.class); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
@Transactional(rollbackFor = Exception.class) |
|
||||
public void save(IcResiVaccineDTO dto) { |
|
||||
IcResiVaccineEntity entity = ConvertUtils.sourceToTarget(dto, IcResiVaccineEntity.class); |
|
||||
insert(entity); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
@Transactional(rollbackFor = Exception.class) |
|
||||
public void update(IcResiVaccineDTO dto) { |
|
||||
IcResiVaccineEntity entity = ConvertUtils.sourceToTarget(dto, IcResiVaccineEntity.class); |
|
||||
updateById(entity); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
@Transactional(rollbackFor = Exception.class) |
|
||||
public void delete(String[] ids) { |
|
||||
// 逻辑删除(@TableLogic 注解)
|
|
||||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 获取居民疫苗接种信息 |
|
||||
* |
|
||||
* @param idCard |
|
||||
* @Param idCard |
|
||||
* @Return {@link List< VaccineListDTO >} |
|
||||
* @Author zhaoqifeng |
|
||||
* @Date 2022/3/30 10:24 |
|
||||
*/ |
|
||||
@Override |
|
||||
public List<VaccineListDTO> getVaccineList(String customerId, String idCard) { |
|
||||
LambdaQueryWrapper<IcResiVaccineEntity> wrapper = new LambdaQueryWrapper<>(); |
|
||||
wrapper.eq(IcResiVaccineEntity::getCustomerId, customerId); |
|
||||
wrapper.eq(IcResiVaccineEntity::getIdCard, idCard); |
|
||||
wrapper.orderByDesc(IcResiVaccineEntity::getInoculateTime); |
|
||||
List<IcResiVaccineEntity> list = baseDao.selectList(wrapper); |
|
||||
if (CollectionUtils.isEmpty(list)) { |
|
||||
return Collections.emptyList(); |
|
||||
} |
|
||||
return list.stream().map(item -> { |
|
||||
VaccineListDTO dto = new VaccineListDTO(); |
|
||||
dto.setAddress(item.getInoculateAddress()); |
|
||||
dto.setManufactor(item.getManufacturer()); |
|
||||
dto.setVaccinateTime(DateUtils.format(item.getInoculateTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)); |
|
||||
return dto; |
|
||||
}).collect(Collectors.toList()); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,28 +0,0 @@ |
|||||
<?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.epmet.dao.IcResiVaccineDao"> |
|
||||
|
|
||||
<resultMap type="com.epmet.entity.IcResiVaccineEntity" id="icResiVaccineMap"> |
|
||||
<result property="id" column="ID"/> |
|
||||
<result property="customerId" column="CUSTOMER_ID"/> |
|
||||
<result property="name" column="NAME"/> |
|
||||
<result property="mobile" column="MOBILE"/> |
|
||||
<result property="idCard" column="ID_CARD"/> |
|
||||
<result property="inoculateTime" column="INOCULATE_TIME"/> |
|
||||
<result property="inoculateAddress" column="INOCULATE_ADDRESS"/> |
|
||||
<result property="manufacturer" column="MANUFACTURER"/> |
|
||||
<result property="field1" column="FIELD1"/> |
|
||||
<result property="field2" column="FIELD2"/> |
|
||||
<result property="field3" column="FIELD3"/> |
|
||||
<result property="remaek" column="REMAEK"/> |
|
||||
<result property="delFlag" column="DEL_FLAG"/> |
|
||||
<result property="revision" column="REVISION"/> |
|
||||
<result property="createdBy" column="CREATED_BY"/> |
|
||||
<result property="createdTime" column="CREATED_TIME"/> |
|
||||
<result property="updatedBy" column="UPDATED_BY"/> |
|
||||
<result property="updatedTime" column="UPDATED_TIME"/> |
|
||||
</resultMap> |
|
||||
|
|
||||
|
|
||||
</mapper> |
|
Loading…
Reference in new issue