|
@@ -1,8 +1,84 @@
|
|
|
package com.sky.ioc.service.information.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.sky.ioc.entity.domain.information.StaffConfigurationStaff;
|
|
|
+import com.sky.ioc.mapper.information.StaffConfigurationStaffMapper;
|
|
|
import com.sky.ioc.service.information.StaffConfigurationStaffService;
|
|
|
+import com.sky.ioc.tool.ReturnMsg;
|
|
|
+import net.bytebuddy.asm.Advice;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.xml.crypto.Data;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@Service
|
|
|
public class StaffConfigurationStaffServiceImpl implements StaffConfigurationStaffService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ StaffConfigurationStaffMapper staffConfigurationStaffMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReturnMsg delById(Integer id) {
|
|
|
+ if(id==null){
|
|
|
+ return ReturnMsg.fail("id不能为空");
|
|
|
+ }else{
|
|
|
+ staffConfigurationStaffMapper.deleteById(id);
|
|
|
+ return ReturnMsg.ok();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReturnMsg addStaffConfigurationStaff(String id,String responsibility_range,String staff_list,String remark,String duty_time) {
|
|
|
+ if(StringUtils.isNotBlank(staff_list)){
|
|
|
+ JSONArray jsonArray = JSON.parseArray(staff_list);
|
|
|
+ if(jsonArray.size()>0){
|
|
|
+ for(int i=0;i<jsonArray.size();i++){
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ StaffConfigurationStaff staffConfigurationStaff = new StaffConfigurationStaff();
|
|
|
+ staffConfigurationStaff.setConfiguration_id(id);
|
|
|
+ staffConfigurationStaff.setStaff(jsonObject.getString("id"));
|
|
|
+ staffConfigurationStaff.setRemark(remark);
|
|
|
+ staffConfigurationStaff.setResponsibility_range(responsibility_range);
|
|
|
+ staffConfigurationStaff.setDuty_time(duty_time);
|
|
|
+ staffConfigurationStaff.setUpdate_time(new Date()+"");
|
|
|
+ staffConfigurationStaff.setStaff_details(jsonObject.getString("details"));
|
|
|
+ staffConfigurationStaffMapper.insert(staffConfigurationStaff);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return ReturnMsg.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReturnMsg getList(Integer configuration_id, Integer page, Integer page_size) {
|
|
|
+ if(configuration_id==null){
|
|
|
+ return ReturnMsg.fail("配置id不能为空");
|
|
|
+ }else{
|
|
|
+ PageHelper.startPage(page,page_size);
|
|
|
+ List<StaffConfigurationStaff> lists = staffConfigurationStaffMapper.getListByConfigurationId(configuration_id);
|
|
|
+ return ReturnMsg.ok(new PageInfo<>(lists));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReturnMsg getHistoryList(Integer configuration_id, Integer page, Integer page_size) {
|
|
|
+ if(configuration_id==null){
|
|
|
+ return ReturnMsg.fail("配置id不能为空");
|
|
|
+ }else{
|
|
|
+ PageHelper.startPage(page,page_size);
|
|
|
+ List<StaffConfigurationStaff> lists = staffConfigurationStaffMapper.getHistoryListByConfigurationId(configuration_id);
|
|
|
+ return ReturnMsg.ok(new PageInfo<>(lists));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|