Commit 3d450472 authored by suhuiguang's avatar suhuiguang

1.bug及交接班

parent 8dc99145
package com.yeejoin.amos.boot.module.common.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 值班人员日期关联关系表
*
* @author system_generator
* @date 2021-07-06
*/
* 值班人员日期关联关系表
*
* @author system_generator
* @date 2021-07-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="DutyPersonShiftDto", description="值班人员日期关联关系表")
public class DutyPersonShiftDto extends BaseDto {
@ApiModel(value = "DutyPersonShiftDto", description = "值班人员日期关联关系表")
public class DutyPersonShiftDto extends BaseDto {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "值班日期")
private Date dutyDate;
......@@ -33,10 +33,13 @@ public class DutyPersonShiftDto extends BaseDto {
@ApiModelProperty(value = "更新人员")
private String recUserName;
@ApiModelProperty(value = "班次名称")
private String shiftName;
@ApiModelProperty(value = "班次名称")
private String shiftName;
@ApiModelProperty(value = "应用标识(数据隔离使用)")
private String appKey;
@ApiModelProperty(value = "颜色")
private String color;
}
package com.yeejoin.amos.boot.module.jcs.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 警情表单
*
* @author system_generator
* @date 2021-07-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="ShiftChangeDto", description="警情表单")
public class ShiftChangeDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "基本信息id(来源动态表单)")
private Long instanceId;
@ApiModelProperty(value = "值班情况")
private String dutyJson;
@ApiModelProperty(value = "力量出动情况")
private String powerJson;
@ApiModelProperty(value = "交接事宜描述")
private String remark;
@ApiModelProperty(value = "操作人名称")
private String recUserName;
}
package com.yeejoin.amos.boot.module.jcs.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 警情表单
*
* @author system_generator
* @date 2021-07-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("jc_shift_change")
public class ShiftChange extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 基本信息id(来源动态表单)
*/
@TableField("instance_id")
private Long instanceId;
/**
* 值班情况
*/
@TableField("duty_json")
private String dutyJson;
/**
* 力量出动情况
*/
@TableField("power_json")
private String powerJson;
/**
* 交接事宜描述
*/
@TableField("remark")
private String remark;
/**
* 操作人名称
*/
@TableField("rec_user_name")
private String recUserName;
}
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.yeejoin.amos.boot.module.jcs.api.entity.ShiftChange;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 警情表单 Mapper 接口
*
* @author system_generator
* @date 2021-07-13
*/
public interface ShiftChangeMapper extends BaseMapper<ShiftChange> {
}
package com.yeejoin.amos.boot.module.jcs.api.service;
/**
* 警情表单接口类
*
* @author system_generator
* @date 2021-07-13
*/
public interface IShiftChangeService {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.ShiftChangeMapper">
</mapper>
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -28,6 +27,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -84,7 +84,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException {
String instanceId = m.get("instanceId").toString();
List<DutyShift> dutyShifts = dutyShiftService.list(new LambdaQueryWrapper<DutyShift>().eq(BaseEntity::getIsDelete, false).eq(DutyShift::getAppKey, RequestContext.getAppKey()));
Map<Long, String> keyNameMap = dutyShifts.stream().collect(Collectors.toMap(BaseEntity::getSequenceNbr, DutyShift::getName));
Map<Long, DutyShift> keyNameMap = dutyShifts.stream().collect(Collectors.toMap(BaseEntity::getSequenceNbr, Function.identity()));
List<DutyPersonShiftDto> personShiftList = dutyPersonShiftService.list(new LambdaQueryWrapper<DutyPersonShift>()
.eq(DutyPersonShift::getInstanceId, instanceId)
.ge(beginDate != null, DutyPersonShift::getDutyDate, beginDate)
......@@ -92,7 +92,9 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
DutyPersonShiftDto dto = new DutyPersonShiftDto();
Bean.copyExistPropertis(e, dto);
//没值班信息,默认休
dto.setShiftName(e.getShiftId() != null ? keyNameMap.get(e.getShiftId()) : "休");
DutyShift dutyShift = keyNameMap.get(e.getShiftId());
dto.setShiftName(dutyShift != null ? dutyShift.getName() : "休");
dto.setColor(dutyShift != null ? dutyShift.getColor() : "");
return dto;
}).collect(Collectors.toList());
m.put("dutyShift", personShiftList);
......@@ -234,8 +236,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
List<DutyPersonShiftDto> shiftDtos = (List<DutyPersonShiftDto>) d.get("dutyShift");
Long finalInstanceId = instanceId;
//按照业务唯一索引查询主键
List<DutyPersonShift> dutyPersonShiftsDb = dutyPersonShiftService.list(new LambdaQueryWrapper<DutyPersonShift>().eq(DutyPersonShift::getInstanceId,instanceId));
Map<Date,Long> dutyPersonShiftMap = dutyPersonShiftsDb.stream().collect(Collectors.toMap(DutyPersonShift::getDutyDate,DutyPersonShift::getSequenceNbr));
List<DutyPersonShift> dutyPersonShiftsDb = dutyPersonShiftService.list(new LambdaQueryWrapper<DutyPersonShift>().eq(DutyPersonShift::getInstanceId, instanceId));
Map<Date, Long> dutyPersonShiftMap = dutyPersonShiftsDb.stream().collect(Collectors.toMap(DutyPersonShift::getDutyDate, DutyPersonShift::getSequenceNbr));
//todo: 只更新当天及值班之后数据
Set<DutyPersonShift> needToDb = shiftDtos.stream().filter(s -> DateUtils.dateCompare(s.getDutyDate(), new Date()) >= 0).map(shiftDto -> {
DutyPersonShift dutyPersonShift = new DutyPersonShift();
......@@ -294,10 +296,10 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
public List<Map<String, Object>> dayDutyPersonList(String dutyDay, Long shiftId, String postType) {
String groupCode = this.getGroupCode();
Map<String, String> params = new HashMap<>();
params.put("postType",postType);
params.put("postType", postType);
List<DynamicFormColumn> columns = dynamicFormColumnService.list(new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, groupCode));
Map<String, Object> fieldCodes = Bean.listToMap(columns, "fieldCode", "queryStrategy", DynamicFormColumn.class);
return dynamicFormInstanceService.getBaseMapper().listOneDayDutyPerson(dutyDay, shiftId,fieldCodes,RequestContext.getAppKey(),groupCode, params);
return dynamicFormInstanceService.getBaseMapper().listOneDayDutyPerson(dutyDay, shiftId, fieldCodes, RequestContext.getAppKey(), groupCode, params);
}
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ShiftChangeServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.dto.ShiftChangeDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 警情表单
*
* @author system_generator
* @date 2021-07-13
*/
@RestController
@Api(tags = "警情表单Api")
@RequestMapping(value = "/jcs/shift-change")
public class ShiftChangeController extends BaseController {
@Autowired
ShiftChangeServiceImpl shiftChangeServiceImpl;
/**
* 新增警情表单
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增警情表单", notes = "新增警情表单")
public ResponseModel<ShiftChangeDto> save(@RequestBody ShiftChangeDto model)
{
model=shiftChangeServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新警情表单", notes = "根据sequenceNbr更新警情表单")
public ResponseModel<ShiftChangeDto> updateBySequenceNbrShiftChange(@RequestBody ShiftChangeDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(shiftChangeServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除警情表单", notes = "根据sequenceNbr删除警情表单")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(shiftChangeServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个警情表单", notes = "根据sequenceNbr查询单个警情表单")
public ResponseModel<ShiftChangeDto> seleteOne(@PathVariable Long sequenceNbr)
{
return ResponseHelper.buildResponse(shiftChangeServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*@param current 当前页
*@param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "警情表单分页查询", notes = "警情表单分页查询")
public ResponseModel<Page<ShiftChangeDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam(value = "size") int size)
{
Page<ShiftChangeDto> page=new Page<ShiftChangeDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(shiftChangeServiceImpl.queryForShiftChangePage(page));
}
/**
*列表全部数据查询
*@return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "警情表单列表全部数据查询", notes = "警情表单列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<ShiftChangeDto>> selectForList()
{
return ResponseHelper.buildResponse(shiftChangeServiceImpl.queryForShiftChangeList());
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.yeejoin.amos.boot.module.jcs.api.entity.ShiftChange;
import com.yeejoin.amos.boot.module.jcs.api.mapper.ShiftChangeMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IShiftChangeService;
import com.yeejoin.amos.boot.module.jcs.api.dto.ShiftChangeDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 警情表单服务实现类
*
* @author system_generator
* @date 2021-07-13
*/
@Service
public class ShiftChangeServiceImpl extends BaseService<ShiftChangeDto,ShiftChange,ShiftChangeMapper> implements IShiftChangeService {
/**
* 分页查询
*/
public Page<ShiftChangeDto> queryForShiftChangePage(Page<ShiftChangeDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<ShiftChangeDto> queryForShiftChangeList() {
return this.queryForList("" , false);
}
}
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