Commit 9eccdb5b authored by 廖旭伟's avatar 廖旭伟

修改测试bug

parent e96a0623
......@@ -92,11 +92,12 @@ public class HomeController extends BaseJsonBodyController {
}
@PostMapping({"dept/list"})
@UnAuth
public Rest<Object> deptList(@RequestBody HomeQueryPdu queryPdu) {
IUser user = this.getCurUser();
if(user==null){
throw new AppException("用户未登录");
}
// IUser user = this.getCurUser();
// if(user==null){
// throw new AppException("用户未登录");
// }
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询站点部门列表" ;
......@@ -136,11 +137,12 @@ public class HomeController extends BaseJsonBodyController {
}
@PostMapping({"device/list"})
@UnAuth
public Rest<Object> deviceList(@RequestBody DevicePdu queryPdu) {
IUser user = this.getCurUser();
if(user==null){
throw new AppException("用户未登录");
}
// IUser user = this.getCurUser();
// if(user==null){
// throw new AppException("用户未登录");
// }
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询站点设备列表" ;
......
......@@ -29,6 +29,7 @@ import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
import com.mortals.xhx.common.utils.ExportDocUtil;
import com.mortals.xhx.common.utils.WordUtil;
import com.mortals.xhx.module.matter.model.MatterEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -58,6 +59,8 @@ import java.util.stream.Collectors;
@Service("matterDatumService")
public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumDao, MatterDatumEntity, Long> implements MatterDatumService {
private static int RECOMMEND_COUNT = 5;
@Value("${upload.path}")
private String filePath;
@Value("${upload.url:http://localhost:17215/fsm/file/commonupload?prePath=/file/uploadfile}")
......@@ -100,6 +103,26 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
super.saveBefore(entity, context);
}
@Override
protected void updateBefore(MatterDatumEntity entity, Context context) throws AppException {
entity.setIsRecommend(null);
this.validData(entity, context);
}
@Override
protected void removeBefore(Long[] ids, Context context) throws AppException {
List<MatterDatumEntity> queryList = this.get(ids,context);
if(CollectionUtils.isNotEmpty(queryList)){
int recommendCount = paramService.getParamIntValue(ParamKey.MATTER_DATUM_RECOMMEND_COUNT);
for(MatterDatumEntity matterEntity:queryList){
if(matterEntity.getIsRecommend()==1){
recommendCount--;
}
}
paramService.setValueByKey(ParamKey.MATTER_DATUM_RECOMMEND_COUNT,String.valueOf(recommendCount));
}
}
private void parseDocxToJson(MatterDatumEntity entity) {
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filepath = rootPath + entity.getTemplatePath();
......@@ -351,7 +374,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
Map<String,Object> condition = new HashMap<>();
condition.put("id",id);
if(matterDatumEntity.getIsRecommend()==0){
if(recommendCount==6){
if(recommendCount >= RECOMMEND_COUNT){
throw new AppException("超过推荐个数");
}
recommendCount++;
......
......@@ -28,6 +28,7 @@ import java.util.*;
@Service("matterService")
public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, MatterEntity, Long> implements MatterService {
private static int RECOMMEND_COUNT = 5;
@Autowired
private ParamService paramService;
@Autowired
......@@ -50,6 +51,26 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
this.validData(entity, context);
}
@Override
protected void updateBefore(MatterEntity entity, Context context) throws AppException {
entity.setIsRecommend(null);
this.validData(entity, context);
}
@Override
protected void removeBefore(Long[] ids, Context context) throws AppException {
List<MatterEntity> queryList = this.get(ids,context);
if(CollectionUtils.isNotEmpty(queryList)){
int recommendCount = paramService.getParamIntValue(ParamKey.MATTER_RECOMMEND_COUNT);
for(MatterEntity matterEntity:queryList){
if(matterEntity.getIsRecommend()==1){
recommendCount--;
}
}
paramService.setValueByKey(ParamKey.MATTER_RECOMMEND_COUNT,String.valueOf(recommendCount));
}
}
@Override
public void createMatterbBySheetMatter(Long[] sheetMatterIds) {
List<SheetMatterEntity> sheetMatterEntityList = sheetMatterDao.get(sheetMatterIds);
......@@ -97,9 +118,8 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
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){
if(recommendCount>=RECOMMEND_COUNT){
throw new AppException("超过推荐个数");
}
recommendCount++;
......
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