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

增加绩效数据初始化接口

parent a01f9f74
......@@ -16,6 +16,7 @@ import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -176,4 +177,49 @@ public class StaffPerformSummaryController extends BaseCRUDJsonBodyMappingContro
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
@PostMapping({"init"})
@UnAuth
public Rest<Object> init(@RequestBody StaffCheckSummaryQuery query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "执行绩效初始化";
int code = 1;
try {
if(query.getStaffId()!=null && query.getYear()!=null && query.getMonth()!=null) {
StaffEntity staffEntity = staffService.get(query.getStaffId());
StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery();
summaryQuery.setStaffId(query.getStaffId());
summaryQuery.setYear(query.getYear());
summaryQuery.setMonth(query.getMonth());
StaffPerformSummaryEntity temp = this.service.selectOne(summaryQuery);
if (temp == null) {
BigDecimal totalScore = new BigDecimal(100);
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
staffPerformSummaryEntity.initAttrValue();
staffPerformSummaryEntity.setStaffId(staffEntity.getId());
staffPerformSummaryEntity.setWorkNum(staffEntity.getWorkNum());
staffPerformSummaryEntity.setStaffName(staffEntity.getName());
staffPerformSummaryEntity.setDeptId(staffEntity.getDeptId());
staffPerformSummaryEntity.setDeptName(staffEntity.getDeptName());
staffPerformSummaryEntity.setSalaId(staffEntity.getSalaId());
staffPerformSummaryEntity.setSalaName(staffEntity.getSalaName());
staffPerformSummaryEntity.setYear(query.getYear());
staffPerformSummaryEntity.setMonth(query.getMonth());
staffPerformSummaryEntity.setTotalScore(totalScore);
staffPerformSummaryEntity.setCreateUserId(1l);
staffPerformSummaryEntity.setCreateTime(new Date());
this.service.save(staffPerformSummaryEntity);
}
}
model.put("message_info", "执行绩效初始化成功");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
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