Commit 8272cde1 authored by YangZhaoJun1's avatar YangZhaoJun1

Merge branch 'V2.0.3' of http://103.249.252.28:90/lcy/education into V2.0.3

parents 213c197d f261e85c
...@@ -54,6 +54,28 @@ public class BArrangeController extends PaginationController<BArrange> { ...@@ -54,6 +54,28 @@ public class BArrangeController extends PaginationController<BArrange> {
json); json);
} }
@ApiOperation(value="按id查询排课", notes="按id查询排课")
@ApiImplicitParam(name = "businessId", value = "排课Id", required = true, dataType = "varchar")
@GetMapping(value = "/findArrangeById")
public Result findArrangeById(String businessId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bArrangeServiceImpl.findArrange(businessId));
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "json", value = "json", required = true, dataType = "varchar"),})
@PostMapping("/update")
@PreAuthorize("hasRole('ROLE_1001')")
public Result update(String json) {
PersistModel data = bArrangeServiceImpl.merge(json);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
json);
}
@ApiOperation(value="查看 集合", notes="查看单 集合") @ApiOperation(value="查看 集合", notes="查看单 集合")
@ApiImplicitParam(name = "termCode", value = "学期编号", required = false, dataType = "varchar") @ApiImplicitParam(name = "termCode", value = "学期编号", required = false, dataType = "varchar")
@GetMapping(value = "/findAllByPagination") @GetMapping(value = "/findAllByPagination")
......
...@@ -100,6 +100,15 @@ public interface BArrangeRepository extends BaseMapper<BArrange> { ...@@ -100,6 +100,15 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
int insertBSubAgency(List<BSubAgency> list); int insertBSubAgency(List<BSubAgency> list);
//按id查
@Select("<script>select b_arrange.business_id,term_code,description,agency_code,b_arrange.status from b_arrange "
+ "LEFT JOIN b_subtask ON b_arrange.business_id = b_subtask.arrange_id "
+ "LEFT JOIN b_sub_agency ON b_subtask.business_id = b_sub_agency.subtask_id "
+ "where 1=1 and b_arrange.business_id = #{0} "
+ "GROUP BY b_arrange.business_id "
+ "</script>")
@ResultMap(value = "BaseResultMapByAgencyCode")
BArrange selectArrangeById(String businessId);
} }
package org.rcisoft.business.barrange.dao;
import org.rcisoft.business.barrange.entity.BSubAgency;
import org.rcisoft.core.base.BaseMapper;
public interface BSubAgencyRepository extends BaseMapper<BSubAgency> {
}
package org.rcisoft.business.barrange.dao;
import org.rcisoft.business.barrange.entity.BSubtask;
import org.rcisoft.core.base.BaseMapper;
public interface BSubtaskRepository extends BaseMapper<BSubtask> {
}
...@@ -20,7 +20,19 @@ public interface BArrangeService { ...@@ -20,7 +20,19 @@ public interface BArrangeService {
*/ */
PersistModel save(String json); PersistModel save(String json);
/**
* 根据id查询排课
* @param businessId
* @return
*/
BArrange findArrange(String businessId);
/**
* 修改
* @param json
* @return
*/
PersistModel merge(String json);
/** /**
* 分页查询 * 分页查询
......
...@@ -7,6 +7,8 @@ import net.sf.json.JSONArray; ...@@ -7,6 +7,8 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.barrange.dao.BArrangeRepository; import org.rcisoft.business.barrange.dao.BArrangeRepository;
import org.rcisoft.business.barrange.dao.BSubAgencyRepository;
import org.rcisoft.business.barrange.dao.BSubtaskRepository;
import org.rcisoft.business.barrange.entity.BArrange; import org.rcisoft.business.barrange.entity.BArrange;
import org.rcisoft.business.barrange.entity.BSubAgency; import org.rcisoft.business.barrange.entity.BSubAgency;
import org.rcisoft.business.barrange.entity.BSubtask; import org.rcisoft.business.barrange.entity.BSubtask;
...@@ -33,6 +35,7 @@ import org.rcisoft.sys.user.dao.SysUserMapper; ...@@ -33,6 +35,7 @@ import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.entity.SysUser; import org.rcisoft.sys.user.entity.SysUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -72,9 +75,11 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -72,9 +75,11 @@ public class BArrangeServiceImpl implements BArrangeService {
@Autowired @Autowired
private BRoomsRepository bRoomsRepository; private BRoomsRepository bRoomsRepository;
@Autowired
private BSubAgencyRepository bSubAgencyRepository;
@Autowired
private BSubtaskRepository bSubtaskRepository;
/** /**
* 保存 bArrange * 保存 bArrange
...@@ -120,6 +125,61 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -120,6 +125,61 @@ public class BArrangeServiceImpl implements BArrangeService {
return new PersistModel(line); return new PersistModel(line);
} }
/**
* 根据id查询 bArrange
* @param businessId
* @return
*/
@Override
public BArrange findArrange(String businessId){
return bArrangeRepository.selectArrangeById(businessId);
}
/**
* 修改排课
* @param json
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(String json){
System.out.println("json:"+json);
BArrange bArrange = new BArrange();
JSONObject jsonObject = JSONObject.fromObject(json);
JSONObject arrange = jsonObject.getJSONObject("arrange");
bArrange.setDescription(arrange.getString("desc"));
bArrange.setTermCode(arrange.getString("termCode"));
bArrange.setStatus("0");
System.out.println("arrangeId:"+arrange.getString("businessId"));
bArrange.setBusinessId(arrange.getString("businessId"));
int line = bArrangeRepository.updateByPrimaryKeySelective(bArrange);
JSONArray childList = arrange.getJSONArray("childList");
for(int i = 0; i < childList.size() ; i++){
JSONObject subtask = childList.getJSONObject(i);
BSubtask bSubtask = new BSubtask();
bSubtask.setName(subtask.getString("name"));
bSubtask.setArrangeId(bArrange.getBusinessId());
bSubtask.setStatus("0");
bSubtask.setBusinessId(subtask.getString("businessId"));
System.out.println("subtaskId:"+subtask.getString("businessId"));
bSubtaskRepository.updateByPrimaryKeySelective(bSubtask);
JSONArray childList2 = subtask.getJSONArray("childList");
for(int j = 0; j < childList2.size() ; j++){
JSONObject agency = childList2.getJSONObject(j);
BSubAgency bSubAgency = new BSubAgency();
bSubAgency.setAgencyCode(agency.getString("agencyCode"));
bSubAgency.setStatus("0");
bSubAgency.setSubtaskId(bSubtask.getBusinessId());
bSubAgency.setBusinessId(agency.getString("businessId"));
System.out.println("subAgency"+agency.getString("businessId"));
bSubAgencyRepository.updateByPrimaryKeySelective(bSubAgency);
}
}
return new PersistModel(line);
}
/** /**
* 分页查询 bArrange * 分页查询 bArrange
* @return * @return
......
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