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
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实现
...@@ -15,5 +24,62 @@ import com.mortals.xhx.module.matter.service.MatterService; ...@@ -15,5 +24,62 @@ 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