Commit 76d53e82 by zhangkb

给规则管理各模块加操作日志记录

parent b1ffbd58
...@@ -9,10 +9,12 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -9,10 +9,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.indicators.DriveIndCatalog; import com.keymobile.indicators.model.entity.indicators.DriveIndCatalog;
import com.keymobile.indicators.model.entity.indicators.IndCatalog; import com.keymobile.indicators.model.entity.indicators.IndCatalog;
import com.keymobile.indicators.service.hytobacco.DriveIndCatalogService; import com.keymobile.indicators.service.hytobacco.DriveIndCatalogService;
import com.keymobile.indicators.service.hytobacco.IndCatalogService; import com.keymobile.indicators.service.hytobacco.IndCatalogService;
import com.keymobile.indicators.utils.LogManager;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -29,14 +31,27 @@ public class IndCatalogCtrl { ...@@ -29,14 +31,27 @@ public class IndCatalogCtrl {
@ApiOperation(value = "新建基础指标目录", notes = "新建基础指标目录") @ApiOperation(value = "新建基础指标目录", notes = "新建基础指标目录")
@PostMapping(value = "/createBaseIndCatalog") @PostMapping(value = "/createBaseIndCatalog")
public Integer createBaseIndCatalog(@RequestBody IndCatalog indCatalog) throws Exception{ public Integer createBaseIndCatalog(@RequestBody IndCatalog indCatalog) throws Exception{
String message = null;
if(indCatalog.getId()==null) {
message = "新增基础项目录:{}";
}else {
message = "修改基础项目录:{}";
}
indCatalog = indCatalogService.saveOrUpdate(indCatalog); indCatalog = indCatalogService.saveOrUpdate(indCatalog);
LogManager.logInfo(Constants.LOG_INDICATOR_BASE_INDI_API,message,indCatalog.getCatalogName());
return indCatalog.getId(); return indCatalog.getId();
} }
@ApiOperation(value = "批量级联删除基础指标目录", notes = "批量级联删除基础指标目录") @ApiOperation(value = "批量级联删除基础指标目录", notes = "批量级联删除基础指标目录")
@PostMapping(value = "/deleteBaseIndCatalog") @PostMapping(value = "/deleteBaseIndCatalog")
public void deleteBaseIndCatalog(@RequestParam List<Integer> ids) throws Exception{ public void deleteBaseIndCatalog(@RequestParam List<Integer> ids) throws Exception{
StringBuilder message = new StringBuilder("");
List<IndCatalog> indCatalogs = indCatalogService.getByCatalogIdList(ids);
for(IndCatalog indCatalog : indCatalogs) {
message.append(indCatalog.getCatalogName()).append(";");
}
indCatalogService.recursionDelete(ids); indCatalogService.recursionDelete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_BASE_INDI_API,"删除基础项目录:{}",message.toString());
} }
@ApiOperation(value = "获取基础指标目录", notes = "获取基础指标目录") @ApiOperation(value = "获取基础指标目录", notes = "获取基础指标目录")
...@@ -70,14 +85,27 @@ public class IndCatalogCtrl { ...@@ -70,14 +85,27 @@ public class IndCatalogCtrl {
@ApiOperation(value = "新建考核指标目录", notes = "新建考核指标目录") @ApiOperation(value = "新建考核指标目录", notes = "新建考核指标目录")
@PostMapping(value = "/createDriveIndCatalog") @PostMapping(value = "/createDriveIndCatalog")
public Integer createDriveIndCatalog(@RequestBody DriveIndCatalog driveIndCatalog) throws Exception{ public Integer createDriveIndCatalog(@RequestBody DriveIndCatalog driveIndCatalog) throws Exception{
String message = null;
if(driveIndCatalog.getId()==null) {
message = "新增考核指标目录:{}";
}else {
message = "修改考核指标目录:{}";
}
driveIndCatalog = driveIndCatalogService.saveOrUpdate(driveIndCatalog); driveIndCatalog = driveIndCatalogService.saveOrUpdate(driveIndCatalog);
LogManager.logInfo(Constants.LOG_INDICATOR_DRIVE_INDI_API,message,driveIndCatalog.getCatalogName());
return driveIndCatalog.getId(); return driveIndCatalog.getId();
} }
@ApiOperation(value = "批量级联删除考核指标目录", notes = "批量级联删除考核指标目录") @ApiOperation(value = "批量级联删除考核指标目录", notes = "批量级联删除考核指标目录")
@PostMapping(value = "/deleteDriveIndCatalog") @PostMapping(value = "/deleteDriveIndCatalog")
public void deleteDriveIndCatalog(@RequestParam List<Integer> ids) throws Exception{ public void deleteDriveIndCatalog(@RequestParam List<Integer> ids) throws Exception{
StringBuilder message = new StringBuilder("");
List<DriveIndCatalog> driveIndCatalogs = driveIndCatalogService.getByCatalogIdList(ids);
for(DriveIndCatalog driveIndCatalog : driveIndCatalogs) {
message.append(driveIndCatalog.getCatalogName()).append(";");
}
driveIndCatalogService.recursionDelete(ids); driveIndCatalogService.recursionDelete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_DRIVE_INDI_API,"删除考核指标目录:{}",message.toString());
} }
@ApiOperation(value = "获取考核指标目录", notes = "获取考核指标目录") @ApiOperation(value = "获取考核指标目录", notes = "获取考核指标目录")
......
...@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.scorecard.IndScorecard; import com.keymobile.indicators.model.entity.scorecard.IndScorecard;
import com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog; import com.keymobile.indicators.model.entity.scorecard.ScorecardCatalog;
import com.keymobile.indicators.service.hytobacco.IndScorecardService; import com.keymobile.indicators.service.hytobacco.IndScorecardService;
import com.keymobile.indicators.service.hytobacco.ScorecardCatalogService; import com.keymobile.indicators.service.hytobacco.ScorecardCatalogService;
import com.keymobile.indicators.utils.LogManager;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -32,14 +34,27 @@ public class IndScorecardCtrl { ...@@ -32,14 +34,27 @@ public class IndScorecardCtrl {
@ApiOperation(value = "新增/修改评分卡目录", notes = "新增/修改评分卡目录") @ApiOperation(value = "新增/修改评分卡目录", notes = "新增/修改评分卡目录")
@PostMapping(value = "/saveOrUpdateCatalog") @PostMapping(value = "/saveOrUpdateCatalog")
public Integer saveOrUpdateCatalog(@RequestBody ScorecardCatalog scorecardCatalog)throws Exception{ public Integer saveOrUpdateCatalog(@RequestBody ScorecardCatalog scorecardCatalog)throws Exception{
String message = null;
if(scorecardCatalog.getId()==null) {
message = "新增指标计分规则目录:{}";
}else {
message = "修改指标计分规则目录:{}";
}
scorecardCatalog = scorecardCatalogService.saveOrUpdate(scorecardCatalog); scorecardCatalog = scorecardCatalogService.saveOrUpdate(scorecardCatalog);
LogManager.logInfo(Constants.LOG_INDICATOR_SCORECARD_API,message,scorecardCatalog.getCatalogName());
return scorecardCatalog.getId(); return scorecardCatalog.getId();
} }
@ApiOperation(value = "批量级联删除评分卡目录", notes = "批量级联删除评分卡目录") @ApiOperation(value = "批量级联删除评分卡目录", notes = "批量级联删除评分卡目录")
@PostMapping(value = "/deleteCatalog") @PostMapping(value = "/deleteCatalog")
public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{ public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{
StringBuilder message = new StringBuilder("");
List<ScorecardCatalog> scorecardCatalogs = scorecardCatalogService.getByCatalogIdList(ids);
for(ScorecardCatalog scorecardCatalog : scorecardCatalogs) {
message.append(scorecardCatalog.getCatalogName()).append(";");
}
scorecardCatalogService.recursionDelete(ids); scorecardCatalogService.recursionDelete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_SCORECARD_API,"删除指标计分规则目录:{}",message.toString());
} }
@ApiOperation(value = "获取评分卡目录", notes = "获取评分卡目录") @ApiOperation(value = "获取评分卡目录", notes = "获取评分卡目录")
...@@ -69,12 +84,25 @@ public class IndScorecardCtrl { ...@@ -69,12 +84,25 @@ public class IndScorecardCtrl {
@PostMapping(value = "/saveOrUpdate") @PostMapping(value = "/saveOrUpdate")
public Integer saveOrUpdate(@RequestBody IndScorecard indScorecard,@RequestParam String code,@RequestParam Integer catalogId, public Integer saveOrUpdate(@RequestBody IndScorecard indScorecard,@RequestParam String code,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) { @RequestParam String catalogIdPath,@RequestParam String user) {
String message = null;
if(indScorecard.getId()==null) {
message = "新建指标计分规则:{}";
}else {
message = "修改指标计分规则:{}";
}
LogManager.logInfo(Constants.LOG_INDICATOR_SCORECARD_API,message,indScorecard.getCardName());
return indScorecardService.saveOrUpdate(indScorecard,code,catalogId,catalogIdPath,user); return indScorecardService.saveOrUpdate(indScorecard,code,catalogId,catalogIdPath,user);
} }
@ApiOperation(value = "删除", notes = "删除") @ApiOperation(value = "删除", notes = "删除")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public String delete(@RequestParam List<Integer> ids) { public String delete(@RequestParam List<Integer> ids) throws Exception{
StringBuilder message = new StringBuilder("");
List<IndScorecard> scorecards = indScorecardService.findByIdList(ids);
for(IndScorecard scorecard : scorecards) {
message.append(scorecard.getCardName()).append(";");
}
LogManager.logInfo(Constants.LOG_INDICATOR_SCORECARD_API,"删除指标计分规则:{}",message.toString());
return indScorecardService.delete(ids); return indScorecardService.delete(ids);
} }
......
...@@ -70,6 +70,12 @@ public class IndicatorsDefCtrl { ...@@ -70,6 +70,12 @@ public class IndicatorsDefCtrl {
@ApiOperation(value = "删除基础指标", notes = "删除基础指标") @ApiOperation(value = "删除基础指标", notes = "删除基础指标")
@PostMapping(value = "/deleteBaseInd") @PostMapping(value = "/deleteBaseInd")
public String deleteBaseInd(@RequestParam List<String> indIds) throws Exception{ public String deleteBaseInd(@RequestParam List<String> indIds) throws Exception{
StringBuilder message = new StringBuilder("");
List<BaseIndDef> baseIndDefs = baseIndDefService.getByIdList(indIds);
for(BaseIndDef baseIndDef : baseIndDefs) {
message.append(baseIndDef.getIndName()).append(";");
}
LogManager.logInfo(Constants.LOG_INDICATOR_BASE_INDI_API,"删除基础项:{}",message.toString());
return baseIndDefService.delete(indIds); return baseIndDefService.delete(indIds);
} }
...@@ -114,13 +120,24 @@ public class IndicatorsDefCtrl { ...@@ -114,13 +120,24 @@ public class IndicatorsDefCtrl {
public String createDriveInd(@RequestBody DriveIndDef driveIndDef,@RequestParam String code,@RequestParam Integer catalogId, public String createDriveInd(@RequestBody DriveIndDef driveIndDef,@RequestParam String code,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user,@RequestParam String isUpdate, @RequestParam String catalogIdPath,@RequestParam String user,@RequestParam String isUpdate,
@RequestParam(required=false) String shortboardIds) throws Exception{ @RequestParam(required=false) String shortboardIds) throws Exception{
if("0".equals(isUpdate)) {
LogManager.logInfo(Constants.LOG_INDICATOR_DRIVE_INDI_API,"新增考核指标:{}",driveIndDef.getIndName());
}else {
LogManager.logInfo(Constants.LOG_INDICATOR_DRIVE_INDI_API,"新增考核指标:{}",driveIndDef.getIndName());
}
return driveIndDefService.saveOrUpdate(driveIndDef, code, catalogId, catalogIdPath, user, isUpdate, shortboardIds); return driveIndDefService.saveOrUpdate(driveIndDef, code, catalogId, catalogIdPath, user, isUpdate, shortboardIds);
} }
@ApiOperation(value = "删除考核指标", notes = "删除考核指标") @ApiOperation(value = "删除考核指标", notes = "删除考核指标")
@PostMapping(value = "/deleteDriveInd") @PostMapping(value = "/deleteDriveInd")
public void deleteDriveInd(@RequestParam List<String> indIds) throws Exception{ public void deleteDriveInd(@RequestParam List<String> indIds) throws Exception{
StringBuilder message = new StringBuilder("");
List<DriveIndDef> driveInds = driveIndDefService.getByIdList(indIds);
for(DriveIndDef driveIndDef : driveInds) {
message.append(driveIndDef.getIndName()).append(";");
}
driveIndDefService.delete(indIds); driveIndDefService.delete(indIds);
LogManager.logInfo(Constants.LOG_INDICATOR_DRIVE_INDI_API,"删除考核指标:{}",message.toString());
} }
@ApiOperation(value = "根据考核指标id获取指标详情", notes = "根据考核指标id获取指标详情") @ApiOperation(value = "根据考核指标id获取指标详情", notes = "根据考核指标id获取指标详情")
......
...@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.objscorerule.ScoreRule; import com.keymobile.indicators.model.entity.objscorerule.ScoreRule;
import com.keymobile.indicators.model.entity.objscorerule.ScoreRuleCatalog; import com.keymobile.indicators.model.entity.objscorerule.ScoreRuleCatalog;
import com.keymobile.indicators.service.hytobacco.ScoreRuleCatalogService; import com.keymobile.indicators.service.hytobacco.ScoreRuleCatalogService;
import com.keymobile.indicators.service.hytobacco.ScoreRuleService; import com.keymobile.indicators.service.hytobacco.ScoreRuleService;
import com.keymobile.indicators.utils.LogManager;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -32,14 +34,27 @@ public class ObjScoreRuleCtrl { ...@@ -32,14 +34,27 @@ public class ObjScoreRuleCtrl {
@ApiOperation(value = "新增/修改单位规则目录", notes = "新增/修改单位规则目录") @ApiOperation(value = "新增/修改单位规则目录", notes = "新增/修改单位规则目录")
@PostMapping(value = "/saveOrUpdateCatalog") @PostMapping(value = "/saveOrUpdateCatalog")
public Integer saveOrUpdateCatalog(@RequestBody ScoreRuleCatalog scoreRuleCatalog)throws Exception{ public Integer saveOrUpdateCatalog(@RequestBody ScoreRuleCatalog scoreRuleCatalog)throws Exception{
String message = null;
if(scoreRuleCatalog.getId()==null) {
message = "新增单位得分规则目录:{}";
}else {
message = "修改单位得分规则目录:{}";
}
scoreRuleCatalog = scoreRuleCatalogService.saveOrUpdate(scoreRuleCatalog); scoreRuleCatalog = scoreRuleCatalogService.saveOrUpdate(scoreRuleCatalog);
LogManager.logInfo(Constants.LOG_INDICATOR_OBJ_SCORERULE_API,message,scoreRuleCatalog.getCatalogName());
return scoreRuleCatalog.getId(); return scoreRuleCatalog.getId();
} }
@ApiOperation(value = "批量级联删除单位规则目录", notes = "批量级联删除单位规则目录") @ApiOperation(value = "批量级联删除单位规则目录", notes = "批量级联删除单位规则目录")
@PostMapping(value = "/deleteCatalog") @PostMapping(value = "/deleteCatalog")
public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{ public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{
StringBuilder message = new StringBuilder("");
List<ScoreRuleCatalog> scoreRuleCatalogs = scoreRuleCatalogService.getByCatalogIdList(ids);
for(ScoreRuleCatalog scoreRuleCatalog : scoreRuleCatalogs) {
message.append(scoreRuleCatalog.getCatalogName()).append(";");
}
scoreRuleCatalogService.recursionDelete(ids); scoreRuleCatalogService.recursionDelete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_OBJ_SCORERULE_API,"删除单位得分规则目录:{}",message.toString());
} }
@ApiOperation(value = "获取单位规则目录", notes = "获取单位规则目录") @ApiOperation(value = "获取单位规则目录", notes = "获取单位规则目录")
...@@ -69,13 +84,26 @@ public class ObjScoreRuleCtrl { ...@@ -69,13 +84,26 @@ public class ObjScoreRuleCtrl {
@PostMapping(value = "/saveOrUpdate") @PostMapping(value = "/saveOrUpdate")
public Integer saveOrUpdate(@RequestBody ScoreRule scoreRule,@RequestParam String code,@RequestParam Integer catalogId, public Integer saveOrUpdate(@RequestBody ScoreRule scoreRule,@RequestParam String code,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) { @RequestParam String catalogIdPath,@RequestParam String user) {
String message = null;
if(scoreRule.getId()==null) {
message = "新增单位得分规则:{}";
}else {
message = "修改单位得分规则:{}";
}
LogManager.logInfo(Constants.LOG_INDICATOR_OBJ_SCORERULE_API,message,scoreRule.getRuleName());
return scoreRuleService.saveOrUpdate(scoreRule,code,catalogId,catalogIdPath,user); return scoreRuleService.saveOrUpdate(scoreRule,code,catalogId,catalogIdPath,user);
} }
@ApiOperation(value = "删除", notes = "删除") @ApiOperation(value = "删除", notes = "删除")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public void delete(@RequestParam List<Integer> ids) { public void delete(@RequestParam List<Integer> ids) {
StringBuilder message = new StringBuilder("");
List<ScoreRule> scorerules = scoreRuleService.getByIdList(ids);
for(ScoreRule scorerule : scorerules) {
message.append(scorerule.getRuleName()).append(";");
}
scoreRuleService.delete(ids); scoreRuleService.delete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_OBJ_SCORERULE_API,"删除单位得分规则:{}",message.toString());
} }
@ApiOperation(value = "根据单位评分规则目录获取单位评分规则", notes = "根据单位评分规则目录获取单位评分规则") @ApiOperation(value = "根据单位评分规则目录获取单位评分规则", notes = "根据单位评分规则目录获取单位评分规则")
......
...@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.shortboard.ShortboardCatalog; import com.keymobile.indicators.model.entity.shortboard.ShortboardCatalog;
import com.keymobile.indicators.model.entity.shortboard.ShortboardRule; import com.keymobile.indicators.model.entity.shortboard.ShortboardRule;
import com.keymobile.indicators.service.hytobacco.ShortboardCatalogService; import com.keymobile.indicators.service.hytobacco.ShortboardCatalogService;
import com.keymobile.indicators.service.hytobacco.ShortboardRuleService; import com.keymobile.indicators.service.hytobacco.ShortboardRuleService;
import com.keymobile.indicators.utils.LogManager;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -32,14 +34,27 @@ public class ShortboardRuleCtrl { ...@@ -32,14 +34,27 @@ public class ShortboardRuleCtrl {
@ApiOperation(value = "新增/修改短板筛选规则目录", notes = "新增/修改短板筛选规则目录") @ApiOperation(value = "新增/修改短板筛选规则目录", notes = "新增/修改短板筛选规则目录")
@PostMapping(value = "/saveOrUpdateCatalog") @PostMapping(value = "/saveOrUpdateCatalog")
public Integer saveOrUpdateCatalog(@RequestBody ShortboardCatalog shortboardCatalog)throws Exception{ public Integer saveOrUpdateCatalog(@RequestBody ShortboardCatalog shortboardCatalog)throws Exception{
String message = null;
if(shortboardCatalog.getId()==null) {
message = "新增短板筛选规则目录:{}";
}else {
message = "修改短板筛选规则目录:{}";
}
shortboardCatalog = shortboardCatalogService.saveOrUpdate(shortboardCatalog); shortboardCatalog = shortboardCatalogService.saveOrUpdate(shortboardCatalog);
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_RULE_API,message,shortboardCatalog.getCatalogName());
return shortboardCatalog.getId(); return shortboardCatalog.getId();
} }
@ApiOperation(value = "批量级联删除短板筛选规则目录", notes = "批量级联删除短板筛选规则目录") @ApiOperation(value = "批量级联删除短板筛选规则目录", notes = "批量级联删除短板筛选规则目录")
@PostMapping(value = "/deleteCatalog") @PostMapping(value = "/deleteCatalog")
public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{ public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{
StringBuilder message = new StringBuilder("");
List<ShortboardCatalog> shortboardCatalogs = shortboardCatalogService.getByCatalogIdList(ids);
for(ShortboardCatalog shortboardCatalog : shortboardCatalogs) {
message.append(shortboardCatalog.getCatalogName()).append(";");
}
shortboardCatalogService.recursionDelete(ids); shortboardCatalogService.recursionDelete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_RULE_API,"删除短板筛选规则目录:{}",message.toString());
} }
@ApiOperation(value = "获取短板筛选规则目录", notes = "获取短板筛选规则目录") @ApiOperation(value = "获取短板筛选规则目录", notes = "获取短板筛选规则目录")
...@@ -69,13 +84,26 @@ public class ShortboardRuleCtrl { ...@@ -69,13 +84,26 @@ public class ShortboardRuleCtrl {
@PostMapping(value = "/saveOrUpdate") @PostMapping(value = "/saveOrUpdate")
public Integer saveOrUpdate(@RequestBody ShortboardRule shortboardRule,@RequestParam String code,@RequestParam Integer catalogId, public Integer saveOrUpdate(@RequestBody ShortboardRule shortboardRule,@RequestParam String code,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) { @RequestParam String catalogIdPath,@RequestParam String user) {
String message = null;
if(shortboardRule.getId()==null) {
message = "新增短板筛选规则:{}";
}else {
message = "修改短板筛选规则:{}";
}
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_RULE_API,message,shortboardRule.getRuleName());
return shortboardRuleService.saveOrUpdate(shortboardRule,code,catalogId,catalogIdPath,user); return shortboardRuleService.saveOrUpdate(shortboardRule,code,catalogId,catalogIdPath,user);
} }
@ApiOperation(value = "删除", notes = "删除") @ApiOperation(value = "删除", notes = "删除")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public void delete(@RequestParam List<Integer> ids) { public void delete(@RequestParam List<Integer> ids) {
StringBuilder message = new StringBuilder("");
List<ShortboardRule> shortboardRules = shortboardRuleService.getByIdList(ids);
for(ShortboardRule shortboardRule : shortboardRules) {
message.append(shortboardRule.getRuleName()).append(";");
}
shortboardRuleService.delete(ids); shortboardRuleService.delete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_RULE_API,"删除短板筛选规则:{}",message.toString());
} }
@ApiOperation(value = "根据短板筛选规则目录获取短板筛选规则", notes = "根据短板筛选规则目录获取短板筛选规则") @ApiOperation(value = "根据短板筛选规则目录获取短板筛选规则", notes = "根据短板筛选规则目录获取短板筛选规则")
......
...@@ -12,17 +12,19 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -12,17 +12,19 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.shortboard.ShortboardRecord; import com.keymobile.indicators.model.entity.shortboard.ShortboardRecord;
import com.keymobile.indicators.model.entity.shortboard.ShortboardUnit; import com.keymobile.indicators.model.entity.shortboard.ShortboardUnit;
import com.keymobile.indicators.model.entity.shortboard.ShortboardUnitCatalog; import com.keymobile.indicators.model.entity.shortboard.ShortboardUnitCatalog;
import com.keymobile.indicators.service.hytobacco.ShortboardRuleService; import com.keymobile.indicators.service.hytobacco.ShortboardRuleService;
import com.keymobile.indicators.service.hytobacco.ShortboardUnitCatalogService; import com.keymobile.indicators.service.hytobacco.ShortboardUnitCatalogService;
import com.keymobile.indicators.service.hytobacco.ShortboardUnitService; import com.keymobile.indicators.service.hytobacco.ShortboardUnitService;
import com.keymobile.indicators.utils.LogManager;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@Api(tags={"规则管理-短板筛选单元CRUD"}) @Api(tags={"短板管理-短板筛选单元CRUD"})
@RestController @RestController
@RequestMapping(value = "/shortboardUnit") @RequestMapping(value = "/shortboardUnit")
public class ShortboardUnitCtrl { public class ShortboardUnitCtrl {
...@@ -36,14 +38,27 @@ public class ShortboardUnitCtrl { ...@@ -36,14 +38,27 @@ public class ShortboardUnitCtrl {
@ApiOperation(value = "新增/修改短板筛选单元目录", notes = "新增/修改短板筛选单元目录") @ApiOperation(value = "新增/修改短板筛选单元目录", notes = "新增/修改短板筛选单元目录")
@PostMapping(value = "/saveOrUpdateCatalog") @PostMapping(value = "/saveOrUpdateCatalog")
public Integer saveOrUpdateCatalog(@RequestBody ShortboardUnitCatalog shortboardUnitCatalog)throws Exception{ public Integer saveOrUpdateCatalog(@RequestBody ShortboardUnitCatalog shortboardUnitCatalog)throws Exception{
String message = null;
if(shortboardUnitCatalog.getId()==null) {
message = "新增短板规则目录:{}";
}else {
message = "修改短板规则目录:{}";
}
shortboardUnitCatalog = shortboardUnitCatalogService.saveOrUpdate(shortboardUnitCatalog); shortboardUnitCatalog = shortboardUnitCatalogService.saveOrUpdate(shortboardUnitCatalog);
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_UNIT_API,message,shortboardUnitCatalog.getCatalogName());
return shortboardUnitCatalog.getId(); return shortboardUnitCatalog.getId();
} }
@ApiOperation(value = "批量级联删除短板筛选单元目录", notes = "批量级联删除短板筛选规则目录") @ApiOperation(value = "批量级联删除短板筛选单元目录", notes = "批量级联删除短板筛选规则目录")
@PostMapping(value = "/deleteCatalog") @PostMapping(value = "/deleteCatalog")
public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{ public void deleteCatalog(@RequestParam List<Integer> ids) throws Exception{
StringBuilder message = new StringBuilder("");
List<ShortboardUnitCatalog> shortboardUnitCatalogs = shortboardUnitCatalogService.getByCatalogIdList(ids);
for(ShortboardUnitCatalog shortboardUnit : shortboardUnitCatalogs) {
message.append(shortboardUnit.getCatalogName()).append(";");
}
shortboardUnitCatalogService.recursionDelete(ids); shortboardUnitCatalogService.recursionDelete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_UNIT_API,"删除短板规则目录:{}",message.toString());
} }
@ApiOperation(value = "获取短板筛选规则目录", notes = "获取短板筛选规则目录") @ApiOperation(value = "获取短板筛选规则目录", notes = "获取短板筛选规则目录")
...@@ -73,13 +88,26 @@ public class ShortboardUnitCtrl { ...@@ -73,13 +88,26 @@ public class ShortboardUnitCtrl {
@PostMapping(value = "/saveOrUpdate") @PostMapping(value = "/saveOrUpdate")
public Integer saveOrUpdate(@RequestBody ShortboardUnit shortboardUnit,@RequestParam String code,@RequestParam Integer catalogId, public Integer saveOrUpdate(@RequestBody ShortboardUnit shortboardUnit,@RequestParam String code,@RequestParam Integer catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) { @RequestParam String catalogIdPath,@RequestParam String user) {
String message = null;
if(shortboardUnit.getId()==null) {
message = "新增短板规则:{}";
}else {
message = "修改短板规则:{}";
}
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_UNIT_API,message,shortboardUnit.getUnitName());
return shortboardUnitService.saveOrUpdate(shortboardUnit,code,catalogId,catalogIdPath,user); return shortboardUnitService.saveOrUpdate(shortboardUnit,code,catalogId,catalogIdPath,user);
} }
@ApiOperation(value = "删除", notes = "删除") @ApiOperation(value = "删除", notes = "删除")
@PostMapping(value = "/delete") @PostMapping(value = "/deleteByIdList")
public void delete(@RequestParam Integer id) { public void delete(@RequestParam List<Integer> ids) {
shortboardUnitService.delete(id); StringBuilder message = new StringBuilder("");
List<ShortboardUnit> shortboardUnits = shortboardUnitService.getByIdList(ids);
for(ShortboardUnit shortboardUnit : shortboardUnits) {
message.append(shortboardUnit.getUnitName()).append(";");
}
shortboardUnitService.delete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_UNIT_API,"删除短板规则:{}",message.toString());
} }
@ApiOperation(value = "根据短板筛选单元目录获取短板筛选单元", notes = "根据短板筛选单元目录获取短板筛选单元") @ApiOperation(value = "根据短板筛选单元目录获取短板筛选单元", notes = "根据短板筛选单元目录获取短板筛选单元")
......
...@@ -13,6 +13,16 @@ public class Constants { ...@@ -13,6 +13,16 @@ public class Constants {
public static final String LOG_INDICATOR_UNIT_CAL_API = "indicator.unit.cal"; public static final String LOG_INDICATOR_UNIT_CAL_API = "indicator.unit.cal";
public static final String LOG_INDICATOR_BASE_INDI_API = "indicator.base.indi"; public static final String LOG_INDICATOR_BASE_INDI_API = "indicator.base.indi";
public static final String LOG_INDICATOR_DRIVE_INDI_API = "indicator.drive.indi";
public static final String LOG_INDICATOR_SCORECARD_API = "indicator.scorecard";
public static final String LOG_INDICATOR_OBJ_SCORERULE_API = "indicator.obj.scorerule";
public static final String LOG_INDICATOR_SHORTBOARD_RULE_API = "indicator.shortboardrule";
public static final String LOG_INDICATOR_SHORTBOARD_UNIT_API = "indicator.shortboardunit";
/** collection Name */ /** collection Name */
......
...@@ -18,4 +18,6 @@ public interface ShortboardRuleMapper extends BaseMapper<ShortboardRule>{ ...@@ -18,4 +18,6 @@ public interface ShortboardRuleMapper extends BaseMapper<ShortboardRule>{
public int countByCatalogId(@Param("catalogId")Integer catalogId,@Param("keyword")String keyword); public int countByCatalogId(@Param("catalogId")Integer catalogId,@Param("keyword")String keyword);
public void deleteByIdIn(@Param("ids")List<Integer> ids); public void deleteByIdIn(@Param("ids")List<Integer> ids);
public List<ShortboardRule> findByIdList(@Param("ids")List<Integer> ids);
} }
...@@ -16,4 +16,8 @@ public interface ShortboardUnitMapper extends BaseMapper<ShortboardUnit>{ ...@@ -16,4 +16,8 @@ public interface ShortboardUnitMapper extends BaseMapper<ShortboardUnit>{
@Param("keyword")String keyword,@Param("start") int start,@Param("end") int end); @Param("keyword")String keyword,@Param("start") int start,@Param("end") int end);
public int countByCatalogId(@Param("catalogId")Integer catalogId,@Param("keyword")String keyword); public int countByCatalogId(@Param("catalogId")Integer catalogId,@Param("keyword")String keyword);
public List<ShortboardUnit> findByIdList(@Param("ids")List<Integer> ids);
public void deleteByIdIn(@Param("ids")List<Integer> ids);
} }
...@@ -90,6 +90,10 @@ public class ShortboardRuleService { ...@@ -90,6 +90,10 @@ public class ShortboardRuleService {
return null; return null;
} }
public List<ShortboardRule> getByIdList(List<Integer> ids){
return shortboardRuleMapper.findByIdList(ids);
}
//根据给定的短板规则筛选短板单位 //根据给定的短板规则筛选短板单位
public List<ShortboardRecord> getObjFromShortboardRule(Integer date, public List<ShortboardRecord> getObjFromShortboardRule(Integer date,
List<String> compareObjs,List<String> driveIds, List<String> compareObjs,List<String> driveIds,
......
...@@ -49,8 +49,8 @@ public class ShortboardUnitService { ...@@ -49,8 +49,8 @@ public class ShortboardUnitService {
return shortboardUnit.getId(); return shortboardUnit.getId();
} }
public void delete(Integer id) { public void delete(List<Integer> ids) {
shortboardUnitMapper.deleteByPrimaryKey(id); shortboardUnitMapper.deleteByIdIn(ids);
} }
public Map<String,Object> getByCatalogId(Integer catalogId,String keyword,int page,int rows){ public Map<String,Object> getByCatalogId(Integer catalogId,String keyword,int page,int rows){
...@@ -78,6 +78,10 @@ public class ShortboardUnitService { ...@@ -78,6 +78,10 @@ public class ShortboardUnitService {
return null; return null;
} }
public List<ShortboardUnit> getByIdList(List<Integer> ids){
return shortboardUnitMapper.findByIdList(ids);
}
//保存预览数据生成短板预警池数据 //保存预览数据生成短板预警池数据
public String getShortboardObjFromUnit(Integer id,String user) throws Exception{ public String getShortboardObjFromUnit(Integer id,String user) throws Exception{
List<ShortboardRecord> result = new ArrayList<>(); List<ShortboardRecord> result = new ArrayList<>();
......
...@@ -3,7 +3,12 @@ package com.keymobile.indicators.utils; ...@@ -3,7 +3,12 @@ package com.keymobile.indicators.utils;
public enum ModelPathEnum { public enum ModelPathEnum {
LOG_CONTEXT_API("indicator.operate","数据填报/数据填报"), LOG_CONTEXT_API("indicator.operate","数据填报/数据填报"),
LOG_INDICATOR_UNIT_CAL_API("indicator.unit.cal","数据填报/数据运算"), LOG_INDICATOR_UNIT_CAL_API("indicator.unit.cal","数据填报/数据运算"),
LOG_INDICATOR_BASE_INDI_API("indicator.base.indi","规则管理/数据项管理"); LOG_INDICATOR_BASE_INDI_API("indicator.base.indi","规则管理/数据项管理"),
LOG_INDICATOR_DRIVE_INDI_API("indicator.drive.indi","规则管理/对标指标管理"),
LOG_INDICATOR_SCORECARD_API("indicator.scorecard","规则管理/指标计分规则管理"),
LOG_INDICATOR_OBJ_SCORERULE_API("indicator.obj.scorerule","规则管理/单位得分规则管理"),
LOG_INDICATOR_SHORTBOARD_RULE_API("indicator.shortboardrule","规则管理/短板筛选规则管理"),
LOG_INDICATOR_SHORTBOARD_UNIT_API("indicator.shortboardunit","短板管理/短板规则");
private String modelName; private String modelName;
private String modelPath; private String modelPath;
......
...@@ -27,6 +27,21 @@ ...@@ -27,6 +27,21 @@
<logger name="indicator.base.indi"> <logger name="indicator.base.indi">
<appender-ref ref="db" /> <appender-ref ref="db" />
</logger> </logger>
<logger name="indicator.drive.indi">
<appender-ref ref="db" />
</logger>
<logger name="indicator.scorecard">
<appender-ref ref="db" />
</logger>
<logger name="indicator.obj.scorerule">
<appender-ref ref="db" />
</logger>
<logger name="indicator.shortboardrule">
<appender-ref ref="db" />
</logger>
<logger name="indicator.shortboardunit">
<appender-ref ref="db" />
</logger>
<root level="INFO"> <root level="INFO">
<appender-ref ref="stdout" /> <appender-ref ref="stdout" />
</root> </root>
......
...@@ -37,4 +37,13 @@ ...@@ -37,4 +37,13 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="findByIdList" resultType="com.keymobile.indicators.model.entity.shortboard.ShortboardRule" >
select *
from short_board_rule
where id in
<foreach item="id" collection="ids" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -28,4 +28,22 @@ ...@@ -28,4 +28,22 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="findByIdList" resultType="com.keymobile.indicators.model.entity.shortboard.ShortboardUnit" >
select *
from short_board_unit
where id in
<foreach item="id" collection="ids" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<delete id="deleteByIdIn" parameterType="java.util.List">
delete
from short_board_unit
where id in
<foreach item="id" collection="ids" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
</mapper> </mapper>
\ 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