Commit f55867d3 authored by 廖旭伟's avatar 廖旭伟

基础事项转事项接口,事项推荐或者取消接口,事项申请材料推荐或取消接口

parent fa6b84b2
...@@ -1174,6 +1174,78 @@ msg|String|消息|- ...@@ -1174,6 +1174,78 @@ msg|String|消息|-
"msg":"成功" "msg":"成功"
} }
```
### 基础事项转为事项
**请求URL:** matter/createMatter
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 基础事项转为事项
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
ids|String|是|数组
**请求样例:**
```
http://localhost:8080/matter/createMatter?ids=1&id=2'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
### 推荐或取消推荐事项
**请求URL:** matter/recommend
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 推荐或取消推荐事项
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
id|String|是|数组
**请求样例:**
```
http://localhost:8080/matter/recommend?id=1&id=2'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
``` ```
## 事项申请材料 ## 事项申请材料
...@@ -1431,6 +1503,43 @@ msg|String|消息|- ...@@ -1431,6 +1503,43 @@ msg|String|消息|-
} }
``` ```
### 推荐或取消推荐事项申请材料
**请求URL:** matter/datum/recommend
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 推荐或取消推荐事项申请材料
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
id|String|是|数组
**请求样例:**
```
http://localhost:8080/matter/datum/recommend?id=1&id=2'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
## 首页接口 ## 首页接口
### 查询用户站点列表 ### 查询用户站点列表
......
...@@ -68,4 +68,12 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar ...@@ -68,4 +68,12 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar
*/ */
void setPrintDisplayQuantity(int value); void setPrintDisplayQuantity(int value);
/**
* 通过Key设置参数值 value
* @param key
* @param value
* @return
*/
void setValueByKey(String key,String value);
} }
\ No newline at end of file
...@@ -126,6 +126,31 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par ...@@ -126,6 +126,31 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
} }
} }
@Override
public void setValueByKey(String key, String value) {
List<ParamEntity> list = this.getCacheList();
ParamEntity entity = null;
for(ParamEntity paramEntity:list){
if(key.equals(paramEntity.getParamKey())){
entity = paramEntity;
break;
}
}
if(entity!=null){
entity.setParamValue(String.valueOf(value));
this.update(entity);
}else {
entity = new ParamEntity();
entity.setParamValue(String.valueOf(value));
entity.setParamKey(key);
entity.setName("key");
entity.setCreateTime(new Date());
entity.setCreateUserId(1l);
entity.setCreateUserName("系统管理员");
this.save(entity);
}
}
@Override @Override
public boolean needRefresh() { public boolean needRefresh() {
......
...@@ -11,5 +11,8 @@ public class ParamKey { ...@@ -11,5 +11,8 @@ public class ParamKey {
public static final String FILE_URL = "iot:base:param:fileUrl"; public static final String FILE_URL = "iot:base:param:fileUrl";
/** 物料编码长度,默认6 */ /** 物料编码长度,默认6 */
public static final String MATERIA_CODE_LENGTH = "iot:base:param:materia:length"; public static final String MATERIA_CODE_LENGTH = "iot:base:param:materia:length";
/** 事项推荐个数 */
public static final String MATTER_RECOMMEND_COUNT = "matter:recommend";
/** 事项材料推荐个数 */
public static final String MATTER_DATUM_RECOMMEND_COUNT = "matter:datum:recommend";
} }
...@@ -19,5 +19,9 @@ public interface MatterDatumService extends ICRUDService<MatterDatumEntity,Long> ...@@ -19,5 +19,9 @@ public interface MatterDatumService extends ICRUDService<MatterDatumEntity,Long>
*/ */
String mergeFormToDoc(MatterDatumEntity docFormVo, Context context); String mergeFormToDoc(MatterDatumEntity docFormVo, Context context);
/**
* 推荐or取消推荐
* @param id
*/
void recommend(Long id);
} }
\ No newline at end of file
...@@ -11,4 +11,15 @@ import com.mortals.xhx.module.matter.model.MatterEntity; ...@@ -11,4 +11,15 @@ import com.mortals.xhx.module.matter.model.MatterEntity;
*/ */
public interface MatterService extends ICRUDService<MatterEntity,Long>{ public interface MatterService extends ICRUDService<MatterEntity,Long>{
/**
* 站点事项转系统事项
* @param sheetMatterIds
*/
void createMatterbBySheetMatter(Long[] sheetMatterIds);
/**
* 推荐or取消推荐
* @param id
*/
void recommend(Long id);
} }
\ No newline at end of file
...@@ -19,12 +19,15 @@ import com.deepoove.poi.util.RegexUtils; ...@@ -19,12 +19,15 @@ import com.deepoove.poi.util.RegexUtils;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService; import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.ComponentEnum; import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.formdesign.*; import com.mortals.xhx.common.formdesign.*;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.pdu.gen.component.ComponentCons; import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
import com.mortals.xhx.common.utils.ExportDocUtil; import com.mortals.xhx.common.utils.ExportDocUtil;
import com.mortals.xhx.common.utils.WordUtil; import com.mortals.xhx.common.utils.WordUtil;
import com.mortals.xhx.module.matter.model.MatterEntity;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -60,6 +63,8 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD ...@@ -60,6 +63,8 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
private String uploadUrl; private String uploadUrl;
@Autowired @Autowired
private UploadService uploadService; private UploadService uploadService;
@Autowired
private ParamService paramService;
@Override @Override
protected void saveBefore(MatterDatumEntity entity, Context context) throws AppException { protected void saveBefore(MatterDatumEntity entity, Context context) throws AppException {
...@@ -326,146 +331,170 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD ...@@ -326,146 +331,170 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
return ""; return "";
} }
@Override
public static void main(String[] args){ public void recommend(Long id) {
String filePath ="D:\\mortals\\app\\data\\file\\uploadfile\\1663917302157.docx"; MatterDatumEntity matterDatumEntity = this.dao.get(id);
String formContent = "{\n" + if(matterDatumEntity==null){
" \"i_1_班级\": \"432432\",\n" + throw new AppException("数据已更改,请重试");
" \"i_2_姓名\": \"324\",\n" +
" \"i_3_监护人\": \"234\",\n" +
" \"i_4_电话\": \"324\",\n" +
" \"dt_1_汇报\": [\n" +
" {\n" +
" \"汇报_date_1_日期\": \"2022-09-06\",\n" +
" \"汇报_i_4_有无出现呕吐\": \"543\",\n" +
" \"汇报_i_5_有无其他\": \"435\",\n" +
" \"汇报_i_6_有无接触\": \"345\",\n" +
" \"index\": 0\n" +
" },\n" +
" {\n" +
" \"汇报_date_1_日期\": \"\",\n" +
" \"汇报_i_4_有无出现呕吐\": \"\",\n" +
" \"汇报_i_5_有无其他\": \"\",\n" +
" \"汇报_i_6_有无接触\": \"\",\n" +
" \"index\": 1\n" +
" },\n" +
" {\n" +
" \"汇报_date_1_日期\": null,\n" +
" \"汇报_i_4_有无出现呕吐\": \"\",\n" +
" \"汇报_i_5_有无其他\": \"\",\n" +
" \"汇报_i_6_有无接触\": \"\",\n" +
" \"index\": 2\n" +
" }\n" +
" ],\n" +
" \"i_5_誉抄\": \"435\",\n" +
" \"date_1_填表年月日\": \"2022年09月07日\"\n" +
"}";
//转换表单参数为map集合
ObjectMapper mapper = new ObjectMapper();
ConfigureBuilder builder = Configure.builder();
builder.buildGrammerRegex(RegexUtils.createGeneral("{{", "}}"));
try {
Map<String, Object> data = mapper.readValue(formContent, Map.class);
//遍历查看是否有图片数据,多选框
data.entrySet().stream().forEach(entry -> {
// if (entry.getKey().indexOf("@image") != -1) {
// //获取值 读取本地图片
// String imagepath = uploadService.getFilePath(entry.getValue().toString());
// log.info("Image path: " + imagepath);
// try {
// PictureRenderData pictureRenderData = Pictures.ofStream(new FileInputStream(imagepath), PictureType.JPEG)
// .size(100, 120).create();
// data.put(StrUtil.removePrefixIgnoreCase(entry.getKey(),"@"),pictureRenderData);
// //entry.setValue(pictureRenderData);
// } catch (FileNotFoundException e) {
// log.error("error", e);
// }
// }
//构建填充复选框值
if (entry.getKey().indexOf("ck_") != -1 && entry.getKey().indexOf("<") != -1) {
//获取复选框选项,并渲染值
String ckStr = StringUtils.substringBetween(entry.getKey(), "<", ">");
//获取所有选项
List<String> checkboxs = StrUtil.splitTrim(ckStr, "-", -1);
//选中的项
List<String> ckList = Convert.toList(String.class, entry.getValue());
//合并
String ckStrs = checkboxs.stream().map(item -> {
for (String checked : ckList) {
if (checked.equals(item)) {
Map<Boolean, String> map = new HashMap<>();
map.put(true, item);
return map;
} }
int recommendCount = paramService.getParamIntValue(ParamKey.MATTER_DATUM_RECOMMEND_COUNT);
Map<String,Object> data = new HashMap<>();
Map<String,Object> condition = new HashMap<>();
condition.put("id",id);
if(matterDatumEntity.getIsRecommend()==0){
if(recommendCount==6){
throw new AppException("超过推荐个数");
} }
Map<Boolean, String> map = new HashMap<>(); recommendCount++;
map.put(false, item); data.put("isRecommend",1);
return map; }else {
}).map(m -> m.entrySet().stream().map(m1 -> ExportDocUtil.createCheckBoxStrOther(m1.getKey(), m1.getValue())).findFirst().orElseGet(() -> "") recommendCount--;
).collect(Collectors.joining("")); data.put("isRecommend",0);
entry.setValue(ckStrs);
} }
//TODO 单选 this.dao.update(data,condition);
//绑定动态表单 paramService.setValueByKey(ParamKey.MATTER_DATUM_RECOMMEND_COUNT,String.valueOf(recommendCount));
if (entry.getKey().indexOf("dt_") != -1) {
builder.bind(entry.getKey(), new MultipleRowTableRenderPolicy());
} }
});
//查询是否有多选框,
String path = filePath ;
String templateName = FileUtil.getName(path);
Configure config = builder.build();
XWPFTemplate template = null;
ByteArrayOutputStream byteArrayOutputStream = null;
try {
template = XWPFTemplate.compile(path, config).render(data);
byteArrayOutputStream = new ByteArrayOutputStream();
template.write(byteArrayOutputStream);
MultipartFile multipartFile = new MockMultipartFile(templateName, templateName,
ContentType.APPLICATION_OCTET_STREAM.toString(), byteArrayOutputStream.toByteArray());
//String mergedocPath = uploadService.saveFileUpload(multipartFile, "/mergedoc", context.getUser()); // public static void main(String[] args){
File pathDir = new File(filePath); // String filePath ="D:\\mortals\\app\\data\\file\\uploadfile\\1663917302157.docx";
if (!pathDir.exists()) { // String formContent = "{\n" +
pathDir.mkdirs(); // " \"i_1_班级\": \"432432\",\n" +
} // " \"i_2_姓名\": \"324\",\n" +
String fileName = multipartFile.getOriginalFilename(); // " \"i_3_监护人\": \"234\",\n" +
String extension = FilenameUtils.getExtension(fileName); // " \"i_4_电话\": \"324\",\n" +
String newName = new Date().getTime() + "." + extension; // " \"dt_1_汇报\": [\n" +
//String newName = IdUtil.fastSimpleUUID() + "." + extension; // " {\n" +
String filePathAll = "D:\\mortals\\app\\data\\file\\uploadfile\\" + newName; // " \"汇报_date_1_日期\": \"2022-09-06\",\n" +
// " \"汇报_i_4_有无出现呕吐\": \"543\",\n" +
File uploadFile = new File(filePathAll); // " \"汇报_i_5_有无其他\": \"435\",\n" +
try { // " \"汇报_i_6_有无接触\": \"345\",\n" +
multipartFile.transferTo(uploadFile); // " \"index\": 0\n" +
} catch (Exception e) { // " },\n" +
throw new AppException(e.getMessage()); // " {\n" +
} // " \"汇报_date_1_日期\": \"\",\n" +
// " \"汇报_i_4_有无出现呕吐\": \"\",\n" +
// " \"汇报_i_5_有无其他\": \"\",\n" +
//转换预览图片 // " \"汇报_i_6_有无接触\": \"\",\n" +
String fileName1 = RandomUtil.randomNumbers(12) + ".jpg"; // " \"index\": 1\n" +
String preView = "D:\\mortals\\app\\data\\preview\\" + fileName1; // " },\n" +
WordUtil.convertWordToJPEG(filePathAll, preView); // " {\n" +
// " \"汇报_date_1_日期\": null,\n" +
// " \"汇报_i_4_有无出现呕吐\": \"\",\n" +
System.out.println("returnStr:"); // " \"汇报_i_5_有无其他\": \"\",\n" +
} catch (Exception e) { // " \"汇报_i_6_有无接触\": \"\",\n" +
// " \"index\": 2\n" +
System.out.println("渲染模板失败:" + e.getMessage()); // " }\n" +
e.printStackTrace(); // " ],\n" +
} finally { // " \"i_5_誉抄\": \"435\",\n" +
try { // " \"date_1_填表年月日\": \"2022年09月07日\"\n" +
template.close(); // "}";
byteArrayOutputStream.close(); // //转换表单参数为map集合
} catch (IOException e) { // ObjectMapper mapper = new ObjectMapper();
// ConfigureBuilder builder = Configure.builder();
} // builder.buildGrammerRegex(RegexUtils.createGeneral("{{", "}}"));
} // try {
} catch (JsonProcessingException e) { // Map<String, Object> data = mapper.readValue(formContent, Map.class);
System.out.println("表单参数转换异常:" + e.getMessage()); // //遍历查看是否有图片数据,多选框
} // data.entrySet().stream().forEach(entry -> {
} //// if (entry.getKey().indexOf("@image") != -1) {
//// //获取值 读取本地图片
//// String imagepath = uploadService.getFilePath(entry.getValue().toString());
//// log.info("Image path: " + imagepath);
//// try {
//// PictureRenderData pictureRenderData = Pictures.ofStream(new FileInputStream(imagepath), PictureType.JPEG)
//// .size(100, 120).create();
//// data.put(StrUtil.removePrefixIgnoreCase(entry.getKey(),"@"),pictureRenderData);
//// //entry.setValue(pictureRenderData);
//// } catch (FileNotFoundException e) {
//// log.error("error", e);
//// }
//// }
// //构建填充复选框值
// if (entry.getKey().indexOf("ck_") != -1 && entry.getKey().indexOf("<") != -1) {
// //获取复选框选项,并渲染值
// String ckStr = StringUtils.substringBetween(entry.getKey(), "<", ">");
// //获取所有选项
// List<String> checkboxs = StrUtil.splitTrim(ckStr, "-", -1);
// //选中的项
// List<String> ckList = Convert.toList(String.class, entry.getValue());
// //合并
// String ckStrs = checkboxs.stream().map(item -> {
// for (String checked : ckList) {
// if (checked.equals(item)) {
// Map<Boolean, String> map = new HashMap<>();
// map.put(true, item);
// return map;
// }
// }
// Map<Boolean, String> map = new HashMap<>();
// map.put(false, item);
// return map;
// }).map(m -> m.entrySet().stream().map(m1 -> ExportDocUtil.createCheckBoxStrOther(m1.getKey(), m1.getValue())).findFirst().orElseGet(() -> "")
// ).collect(Collectors.joining(""));
// entry.setValue(ckStrs);
// }
// //TODO 单选
// //绑定动态表单
// if (entry.getKey().indexOf("dt_") != -1) {
// builder.bind(entry.getKey(), new MultipleRowTableRenderPolicy());
// }
// });
// //查询是否有多选框,
//
// String path = filePath ;
// String templateName = FileUtil.getName(path);
// Configure config = builder.build();
// XWPFTemplate template = null;
// ByteArrayOutputStream byteArrayOutputStream = null;
// try {
// template = XWPFTemplate.compile(path, config).render(data);
// byteArrayOutputStream = new ByteArrayOutputStream();
// template.write(byteArrayOutputStream);
//
// MultipartFile multipartFile = new MockMultipartFile(templateName, templateName,
// ContentType.APPLICATION_OCTET_STREAM.toString(), byteArrayOutputStream.toByteArray());
//
// //String mergedocPath = uploadService.saveFileUpload(multipartFile, "/mergedoc", context.getUser());
// File pathDir = new File(filePath);
// if (!pathDir.exists()) {
// pathDir.mkdirs();
// }
// String fileName = multipartFile.getOriginalFilename();
// String extension = FilenameUtils.getExtension(fileName);
// String newName = new Date().getTime() + "." + extension;
// //String newName = IdUtil.fastSimpleUUID() + "." + extension;
// String filePathAll = "D:\\mortals\\app\\data\\file\\uploadfile\\" + newName;
//
// File uploadFile = new File(filePathAll);
// try {
// multipartFile.transferTo(uploadFile);
// } catch (Exception e) {
// throw new AppException(e.getMessage());
// }
//
//
// //转换预览图片
// String fileName1 = RandomUtil.randomNumbers(12) + ".jpg";
// String preView = "D:\\mortals\\app\\data\\preview\\" + fileName1;
// WordUtil.convertWordToJPEG(filePathAll, preView);
//
//
// System.out.println("returnStr:");
// } catch (Exception e) {
//
// System.out.println("渲染模板失败:" + e.getMessage());
// e.printStackTrace();
// } finally {
// try {
// template.close();
// byteArrayOutputStream.close();
// } catch (IOException e) {
//
// }
// }
// } catch (JsonProcessingException e) {
// System.out.println("表单参数转换异常:" + e.getMessage());
// }
// }
} }
\ No newline at end of file
package com.mortals.xhx.module.matter.service.impl; package com.mortals.xhx.module.matter.service.impl;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.sheet.dao.SheetMatterDao;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -6,6 +12,9 @@ import com.mortals.framework.model.Context; ...@@ -6,6 +12,9 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.matter.dao.MatterDao; import com.mortals.xhx.module.matter.dao.MatterDao;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
import java.util.*;
/** /**
* MatterService * MatterService
* 事项申请材料 service实现 * 事项申请材料 service实现
...@@ -16,4 +25,61 @@ import com.mortals.xhx.module.matter.service.MatterService; ...@@ -16,4 +25,61 @@ import com.mortals.xhx.module.matter.service.MatterService;
@Service("matterService") @Service("matterService")
public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, MatterEntity, Long> implements MatterService { public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, MatterEntity, Long> implements MatterService {
@Autowired
private ParamService paramService;
@Autowired
private SheetMatterDao sheetMatterDao;
@Override
public void createMatterbBySheetMatter(Long[] sheetMatterIds) {
List<SheetMatterEntity> sheetMatterEntityList = sheetMatterDao.get(sheetMatterIds);
if(CollectionUtils.isNotEmpty(sheetMatterEntityList)){
Date now = new Date();
List<MatterEntity> list = new ArrayList<>();
for(SheetMatterEntity sheetMatterEntity:sheetMatterEntityList){
MatterEntity matterEntity = new MatterEntity();
matterEntity.setSiteId(sheetMatterEntity.getSiteId());
matterEntity.setTid(sheetMatterEntity.getTid());
matterEntity.setTcode(sheetMatterEntity.getTcode());
matterEntity.setTname(sheetMatterEntity.getTname());
matterEntity.setMatterName(sheetMatterEntity.getMatterName());
matterEntity.setEnglishName(sheetMatterEntity.getEnglishName());
matterEntity.setMatterNo(sheetMatterEntity.getMatterNo());
matterEntity.setMatterFullName(sheetMatterEntity.getMatterName());
matterEntity.setTotal(0);
matterEntity.setSort(0);
matterEntity.setIsRecommend(0);
matterEntity.setCreateUserId(1l);
matterEntity.setCreateTime(now);
list.add(matterEntity);
}
this.dao.insertBatch(list);
}
}
@Override
public void recommend(Long id) {
MatterEntity matterEntity = this.dao.get(id);
if(matterEntity==null){
throw new AppException("数据已更改,请重试");
}
int recommendCount = paramService.getParamIntValue(ParamKey.MATTER_RECOMMEND_COUNT);
Map<String,Object> data = new HashMap<>();
Map<String,Object> condition = new HashMap<>();
condition.put("id",id);
boolean IsAdd = false;
if(matterEntity.getIsRecommend()==0){
if(recommendCount==6){
throw new AppException("超过推荐个数");
}
recommendCount++;
data.put("isRecommend",1);
}else {
recommendCount--;
data.put("isRecommend",0);
}
this.dao.update(data,condition);
paramService.setValueByKey(ParamKey.MATTER_RECOMMEND_COUNT,String.valueOf(recommendCount));
}
} }
\ No newline at end of file
package com.mortals.xhx.module.matter.web; package com.mortals.xhx.module.matter.web;
import com.mortals.framework.common.code.YesNo;
import com.mortals.framework.service.IUser;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -46,5 +49,48 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -46,5 +49,48 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
super.init(model, context); super.init(model, context);
} }
@RequestMapping(value = {"createMatter"},method = {RequestMethod.POST, RequestMethod.GET})
public String createMatter(Long[] ids) {
Context context = this.getContext();
Map<String, Object> model = new HashMap();
int code = 1;
String busiDesc = "站点事项转事项";
try {
this.service.createMatterbBySheetMatter(ids);
model.put("message_info", "站点事项转事项成功!");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + ids + "]");
} catch (Exception var7) {
code = -1;
this.doException(this.request, busiDesc, model, var7);
}
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
@RequestMapping(value = {"recommend"},method = {RequestMethod.POST, RequestMethod.GET})
public String recommend(Long id) {
Context context = this.getContext();
Map<String, Object> model = new HashMap();
int code = 1;
String busiDesc = "推荐or取消推荐" + this.getModuleDesc();
try {
this.service.recommend(id);
model.put("message_info", this.getModuleDesc() + "推荐or取消推荐成功!");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + id + "]");
} catch (Exception var7) {
code = -1;
this.doException(this.request, busiDesc, model, var7);
}
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
} }
\ No newline at end of file
...@@ -47,4 +47,25 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat ...@@ -47,4 +47,25 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
super.init(model, context); super.init(model, context);
} }
@RequestMapping(value = {"recommend"},method = {RequestMethod.POST, RequestMethod.GET})
public String recommend(Long id) {
Context context = this.getContext();
Map<String, Object> model = new HashMap();
int code = 1;
String busiDesc = "推荐or取消推荐" + this.getModuleDesc();
try {
this.service.recommend(id);
model.put("message_info", this.getModuleDesc() + "推荐or取消推荐成功!");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + id + "]");
} catch (Exception var7) {
code = -1;
this.doException(this.request, busiDesc, model, var7);
}
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment