|
@@ -25,12 +25,16 @@ public class CheckDataServiceImpl implements CheckDataService {
|
|
|
PtCheckdataCQuery checkdataCQuery;
|
|
|
@Autowired
|
|
|
PtCheckdataMapper CheckdataMapper;
|
|
|
+ @Autowired
|
|
|
+ PtCheckscoreMapper checkscoreMapper;
|
|
|
+ @Autowired
|
|
|
+ PtCheckquestionMapper checkquestionMapper;
|
|
|
|
|
|
@Override
|
|
|
- public PageInfo<HashMap<String, Object>> getCheckNameList(int pageIndex, int pageSize, Integer year, Integer quarter, String dzzdm, String checkUserName, String partyCode,Integer recordStatus) {
|
|
|
+ public PageInfo<HashMap<String, Object>> getCheckNameList(int pageIndex, int pageSize, Integer year, Integer quarter, String dzzdm, String checkUserName, String partyCode, Integer recordStatus) {
|
|
|
|
|
|
PageHelper.startPage(pageIndex, pageSize);
|
|
|
- List<HashMap<String, Object>> list = checkdataCQuery.selectCheckNameList(year, quarter, dzzdm, checkUserName, partyCode,recordStatus);
|
|
|
+ List<HashMap<String, Object>> list = checkdataCQuery.selectCheckNameList(year, quarter, dzzdm, checkUserName, partyCode, recordStatus);
|
|
|
|
|
|
PageInfo<HashMap<String, Object>> result = new PageInfo(list);
|
|
|
|
|
@@ -39,58 +43,95 @@ public class CheckDataServiceImpl implements CheckDataService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
- public int saveCheckNameList(PtChecknamelist item , List<PtCheckparty> checkPartyList){
|
|
|
+ public int saveCheckNameList(PtChecknamelist item, List<PtCheckparty> checkPartyList) {
|
|
|
|
|
|
PtChecknamelist dbItem = checknamelistMapper.selectByPrimaryKey(item.getNameid());
|
|
|
- if(dbItem==null) {
|
|
|
+ if (dbItem == null) {
|
|
|
item.setCreatetime(new Date());
|
|
|
item.setRecordstatus(1);
|
|
|
item.setNameid(UUID.randomUUID().toString());
|
|
|
checknamelistMapper.insertSelective(item);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
checknamelistMapper.updateByPrimaryKey(item);
|
|
|
}
|
|
|
- PtCheckpartyExample example=new PtCheckpartyExample();
|
|
|
+ PtCheckpartyExample example = new PtCheckpartyExample();
|
|
|
example.or().andNameidEqualTo(item.getNameid());
|
|
|
checkpartyMapper.deleteByExample(example);
|
|
|
- checkPartyList.forEach(it->{
|
|
|
+ checkPartyList.forEach(it -> {
|
|
|
it.setNameid(item.getNameid());
|
|
|
it.setPartyid(UUID.randomUUID().toString());
|
|
|
checkpartyMapper.insertSelective(it);
|
|
|
});
|
|
|
+ assetrCheckScore(item.getYear(),item.getQuarter(),item.getCheckuserid(),item.getCheckusername(),checkPartyList);
|
|
|
return 1;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成考核评分
|
|
|
+ * @param year
|
|
|
+ * @param quarter
|
|
|
+ * @param checkUserId
|
|
|
+ * @param checkUserName
|
|
|
+ * @param checkPartyList
|
|
|
+ */
|
|
|
+ private void assetrCheckScore(Integer year, Integer quarter,String checkUserId,String checkUserName, List<PtCheckparty> checkPartyList) {
|
|
|
+ List<String> partyCodes = checkPartyList.stream().map(x -> x.getPartycode()).collect(Collectors.toList());
|
|
|
+ checkPartyList.forEach(party -> {
|
|
|
+ PtCheckscoreExample example = new PtCheckscoreExample();
|
|
|
+ example.or().andYearEqualTo(year).andQuarterEqualTo(quarter).andDzzdmEqualTo(party.getPartycode());
|
|
|
+ PtCheckscore partyScore = checkscoreMapper.selectByExample(example).stream().findFirst().orElse(null);
|
|
|
+ if (partyScore==null) {
|
|
|
+ partyScore =new PtCheckscore();
|
|
|
+ partyScore.setScoreid(UUID.randomUUID().toString());
|
|
|
+ partyScore.setYear(year);
|
|
|
+ partyScore.setQuarter(quarter);
|
|
|
+ partyScore.setCheckuserid(checkUserId);
|
|
|
+ partyScore.setDzzdm(party.getPartycode());
|
|
|
+ partyScore.setCheckusername(checkUserName);
|
|
|
+ partyScore.setRecordstatus(0);
|
|
|
+ checkscoreMapper.insert(partyScore);
|
|
|
+ }else{
|
|
|
+ partyScore.setCheckuserid(UUID.randomUUID().toString());
|
|
|
+ partyScore.setCheckuserid(checkUserId);
|
|
|
+ checkscoreMapper.updateByPrimaryKeySelective(partyScore);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
- public Integer deleteCheckNameList(List<String> nameIdList){
|
|
|
- PtCheckpartyExample example=new PtCheckpartyExample();
|
|
|
+ public Integer deleteCheckNameList(List<String> nameIdList) {
|
|
|
+ PtCheckpartyExample example = new PtCheckpartyExample();
|
|
|
example.or().andNameidIn(nameIdList);
|
|
|
checkpartyMapper.deleteByExample(example);
|
|
|
|
|
|
- PtChecknamelistExample ckExp=new PtChecknamelistExample();
|
|
|
+ PtChecknamelistExample ckExp = new PtChecknamelistExample();
|
|
|
ckExp.or().andNameidIn(nameIdList);
|
|
|
checknamelistMapper.deleteByExample(ckExp);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public Integer changeCheckNameListStatus(List<String> nameIdList,Integer recordStatus){
|
|
|
- PtChecknamelist record=new PtChecknamelist();
|
|
|
+ public Integer changeCheckNameListStatus(List<String> nameIdList, Integer recordStatus) {
|
|
|
+ PtChecknamelist record = new PtChecknamelist();
|
|
|
record.setRecordstatus(recordStatus);
|
|
|
- PtChecknamelistExample ckExp=new PtChecknamelistExample();
|
|
|
+ PtChecknamelistExample ckExp = new PtChecknamelistExample();
|
|
|
ckExp.or().andNameidIn(nameIdList);
|
|
|
- checknamelistMapper.updateByExampleSelective(record,ckExp);
|
|
|
- return 1;
|
|
|
+ checknamelistMapper.updateByExampleSelective(record, ckExp);
|
|
|
+ return 1;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public HashMap<String, Object> getCheckName(String id) {
|
|
|
|
|
|
- List<HashMap<String, Object>> list = checkdataCQuery.selectCheckNameList(null, null, null, null, null,null);
|
|
|
+ List<HashMap<String, Object>> list = checkdataCQuery.selectCheckNameList(null, null, null, null, null, null);
|
|
|
|
|
|
- HashMap<String, Object> item= list.stream().filter(x->x.get("nameid").toString().equals(id)).findFirst().orElse(null);
|
|
|
+ HashMap<String, Object> item = list.stream().filter(x -> x.get("nameid").toString().equals(id)).findFirst().orElse(null);
|
|
|
|
|
|
return item;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public PageInfo<HashMap<String, Object>> getCheckDataList(int pageIndex, int pageSize, Integer year, String dzzdm, String remark) {
|
|
|
|
|
@@ -101,6 +142,7 @@ public class CheckDataServiceImpl implements CheckDataService {
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public List<HashMap<String, Object>> getCheckDataFleList(String year) {
|
|
|
|
|
@@ -108,10 +150,11 @@ public class CheckDataServiceImpl implements CheckDataService {
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public int saveCheckdata(PtCheckdata item,String userid,String username){
|
|
|
+ public int saveCheckdata(PtCheckdata item, String userid, String username) {
|
|
|
PtCheckdata dbItem = CheckdataMapper.selectByPrimaryKey(item.getDataid());
|
|
|
- if(dbItem==null){
|
|
|
+ if (dbItem == null) {
|
|
|
item.setCheckdatauserid(userid);
|
|
|
item.setCheckdatausername(username);
|
|
|
item.setRecordstatus(1);
|
|
@@ -126,8 +169,50 @@ public class CheckDataServiceImpl implements CheckDataService {
|
|
|
return CheckdataMapper.updateByPrimaryKeySelective(item);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public PtCheckdata getCheckdata(String id) {
|
|
|
return CheckdataMapper.selectByPrimaryKey(id);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfo<HashMap<String, Object>> getCheckScoreList(int pageIndex, int pageSize, Integer year, Integer quarter, String dzzdm, String checkUserName, Float minScore,Float maxScore,Integer recordStatus) {
|
|
|
+
|
|
|
+ PageHelper.startPage(pageIndex, pageSize);
|
|
|
+ List<HashMap<String, Object>> list = checkdataCQuery.selectCheckScoreList( year, quarter, dzzdm, checkUserName, minScore, maxScore, recordStatus);
|
|
|
+
|
|
|
+ PageInfo<HashMap<String, Object>> result = new PageInfo(list);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
+ public int saveCheckScore(PtCheckscore item ,List<PtCheckquestion> questionList) {
|
|
|
+ PtCheckscore dbItem = checkscoreMapper.selectByPrimaryKey(item.getScoreid());
|
|
|
+ dbItem.setScore(item.getScore());
|
|
|
+ dbItem.setUpdatetime(new Date());
|
|
|
+ dbItem.setUpdateuserid(item.getUpdateuserid());
|
|
|
+ dbItem.setUpdateusername(item.getUpdateusername());
|
|
|
+ dbItem.setRecordstatus(1);
|
|
|
+ checkscoreMapper.updateByPrimaryKeySelective(dbItem);
|
|
|
+
|
|
|
+ PtCheckquestionExample example=new PtCheckquestionExample();
|
|
|
+ example.or().andScoreidEqualTo(item.getScoreid());
|
|
|
+ checkquestionMapper.deleteByExample(example);
|
|
|
+
|
|
|
+ questionList.forEach(x->{
|
|
|
+ x.setQuestionid(UUID.randomUUID().toString());
|
|
|
+ x.setScoreid(item.getScoreid());
|
|
|
+ checkquestionMapper.insert(x);
|
|
|
+ });
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public List<PtCheckquestion> getCheckquestionList(String scoreId) {
|
|
|
+
|
|
|
+ PtCheckquestionExample example=new PtCheckquestionExample();
|
|
|
+ example.or().andScoreidEqualTo(scoreId);
|
|
|
+ return checkquestionMapper.selectByExample(example);
|
|
|
+ }
|
|
|
}
|