|
|
|
@ -18,18 +18,12 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
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.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.dao.IcFormDao; |
|
|
|
import com.epmet.dto.IcFormDTO; |
|
|
|
import com.epmet.dto.form.CustomerFormQueryDTO; |
|
|
|
import com.epmet.dto.result.CustomerFormResultDTO; |
|
|
|
import com.epmet.dto.result.FormGroupDTO; |
|
|
|
@ -37,14 +31,10 @@ import com.epmet.dto.result.FormItemResult; |
|
|
|
import com.epmet.entity.IcFormEntity; |
|
|
|
import com.epmet.redis.CustomerFootBarRedis; |
|
|
|
import com.epmet.service.IcFormService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 配置表单 |
|
|
|
@ -60,58 +50,6 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity> |
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcFormDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IcFormEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, IcFormDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcFormDTO> list(Map<String, Object> params) { |
|
|
|
List<IcFormEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, IcFormDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<IcFormEntity> getWrapper(Map<String, Object> params){ |
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<IcFormEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public IcFormDTO get(String id) { |
|
|
|
IcFormEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, IcFormDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(IcFormDTO dto) { |
|
|
|
IcFormEntity entity = ConvertUtils.sourceToTarget(dto, IcFormEntity.class); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcFormDTO dto) { |
|
|
|
IcFormEntity entity = ConvertUtils.sourceToTarget(dto, IcFormEntity.class); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取居民信息表单 |
|
|
|
* |
|
|
|
@ -165,4 +103,16 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity> |
|
|
|
|
|
|
|
return formItemResults; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String initCustomerFormByCode(String customerId, String formCode) { |
|
|
|
CustomerFormResultDTO formResultDTO = baseDao.selectByCode(customerId, formCode); |
|
|
|
if (formResultDTO == null){ |
|
|
|
return "该客户已经存在了表单的数据"; |
|
|
|
} |
|
|
|
CustomerFormResultDTO defaultIcForm = baseDao.selectByCode("default", formCode); |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|