|
|
@@ -0,0 +1,58 @@
|
|
|
+package jp.yamoto.farm.crm.biz.demo.service.impl;
|
|
|
+
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import jp.yamoto.farm.common.exception.ServiceException;
|
|
|
+import jp.yamoto.farm.common.utils.MessageUtils;
|
|
|
+import jp.yamoto.farm.crm.biz.demo.domain.ReceptionFormItem;
|
|
|
+import jp.yamoto.farm.crm.biz.demo.domain.ReceptionFormItemScheme;
|
|
|
+import jp.yamoto.farm.crm.biz.demo.service.IReceptionFormSchemeService;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class ReceptionFormSchemeServiceImpl implements IReceptionFormSchemeService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ReceptionFormItem> getFormItemList() {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ ClassPathResource resource = new ClassPathResource("demo/items.json");
|
|
|
+ List<ReceptionFormItem> result = null;
|
|
|
+ try {
|
|
|
+ result = mapper.readValue(
|
|
|
+ resource.getInputStream(),
|
|
|
+ new TypeReference<List<ReceptionFormItem>>() {
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } catch (Exception e){
|
|
|
+ throw new ServiceException(MessageUtils.message("I0004"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ReceptionFormItemScheme> getFormSchemeList(String projectId) {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ ClassPathResource resource = new ClassPathResource("demo/scheme-items.json");
|
|
|
+ List<ReceptionFormItemScheme> result = null;
|
|
|
+ try {
|
|
|
+ result = mapper.readValue(
|
|
|
+ resource.getInputStream(),
|
|
|
+ new TypeReference<List<ReceptionFormItemScheme>>() {
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } catch (Exception e){
|
|
|
+ throw new ServiceException(MessageUtils.message("I0004"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int save(String projectId, List<ReceptionFormItemScheme> datas) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|