Commit e2970c5d authored by chenzhao's avatar chenzhao

修改巡检bug

parent 8ed928b0
......@@ -1020,14 +1020,18 @@ public class ExcelServiceImpl {
//组装参数
Long group=null;
user.setCompanySeqs(companySeqs);
String[] split = orgUsrExcelDto.getDeptSeqs().split("@");
user.setDeptSeqs(split[1]);
if (!StringUtils.isEmpty(orgUsrExcelDto.getDeptSeqs())){
String[] split = orgUsrExcelDto.getDeptSeqs().split("@");
user.setDeptSeqs(split[1]);
}
user.setEmail(orgUsrExcelDto.getEmail());
user.setLockStatus("UNLOCK");
for (UserVO userVO : listUser) {
if(userVO.getType().equals(orgUsrExcelDto.getUserType())){
Map<String,List<String>> orgRoleSeqs=new HashMap<>();
orgRoleSeqs.put(split[1],userVO.getRoleSeqs());
if (!StringUtils.isEmpty(orgUsrExcelDto.getDeptSeqs())) {
orgRoleSeqs.put(orgUsrExcelDto.getDeptSeqs().split("@")[1],userVO.getRoleSeqs());
}
user.setOrgRoleSeqs(orgRoleSeqs);
user.setAppCodes(userVO.getAppCodes());
user.setRoleSeqs(userVO.getRoleSeqs());
......@@ -1035,7 +1039,7 @@ public class ExcelServiceImpl {
}
}
//密码效验加密,不能为空,并且必须相等
if(!orgUsrExcelDto.getPassword().isEmpty()){
if(!StringUtils.isEmpty(orgUsrExcelDto.getPassword())){
user.setPassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz"));
user.setRePassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz"));
}else{
......
......@@ -329,13 +329,14 @@ public class InputItemController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入检查项", notes = "导入检查项")
@PostMapping(value = "/importData", produces = "application/json;charset=UTF-8")
public void importData(@RequestPart("file") MultipartFile multipartFile) {
public CommonResponse importData(@RequestPart("file") MultipartFile multipartFile) {
try {
List<InputItemExcelDto> inputItemExcelDtos = ExcelUtil.readFirstSheetExcel(multipartFile, InputItemExcelDto.class, 1);
for (InputItemExcelDto inputItemExcelDto : inputItemExcelDtos) {
if (StringUtils.isEmpty(inputItemExcelDto.getItemNo()) || StringUtils.isEmpty(inputItemExcelDto.getName()) || StringUtils.isEmpty(inputItemExcelDto.getInputClassify())){
throw new BadRequest("编号、名称、检查类型不能为空");
}
InputItemParam inputItemParam = new InputItemParam();
//组装参数 因部分字段数据数据库中用json统一保存 按类型组装为所需数据结构
if (inputItemExcelDto.getItemType().equals("选择") && StringUtil.isNotEmpty(inputItemExcelDto.getDataJson())){
List<InputItemDataDto> itemDataDtos = new ArrayList<>();
......@@ -358,12 +359,41 @@ public class InputItemController extends AbstractBaseController {
BeanUtils.copyProperties(inputItemExcelDto,inputItemDataJsonlDto);
inputItemExcelDto.setDataJson(JSON.toJSONString(inputItemExcelDto));
}
List<Map<String, String> > itemDataDtos = new ArrayList<>();
if (inputItemExcelDto.getPictureJson() != null){
if (inputItemExcelDto.getPictureJson().contains("|")) {
String[] datas = inputItemExcelDto.getPictureJson().split("\\|");
List<String> list = Arrays.asList(datas);
list.forEach(e->{
String[] data = e.split(",");
Map<String, String> map = new HashMap<>();
map.put("name",data[0]);
map.put("isMust",data[1]);
itemDataDtos.add(map);
});
}else {
String[] data = inputItemExcelDto.getPictureJson().split(",");
Map<String, String> map = new HashMap<>();
map.put("name",data[0]);
map.put("isMust",data[1]);
itemDataDtos.add(map);
}
}
//转化为新增接口所需参数
InputItemParam inputItemParam = new InputItemParam();
BeanUtils.copyProperties(inputItemExcelDto,inputItemParam);
if (inputItemParam.getDataJson() != null){
inputItemParam.setDataJson(JSON.parseArray(inputItemParam.getDataJson().toString(),Map.class));
}
if (inputItemParam.getPictureJson()!=null){
inputItemParam.setPictureJson(itemDataDtos);
}
//新增接口
this.addNewItemNew(inputItemParam);
}
return CommonResponseUtil.success();
} catch (Exception e) {
throw new BadRequest(e.getMessage());
}
......@@ -372,8 +402,13 @@ public class InputItemController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出检查项", notes = "导出检查项")
@RequestMapping(value = "/exportData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public void exportData(HttpServletResponse response) {
public void exportData(HttpServletResponse response,String ids) {
InputItemPageParam criterias = new InputItemPageParam();
ReginParams params = getSelectedOrgInfo();
if (!StringUtils.isEmpty(ids)){
criterias.setIds(ids);
}
criterias.setBizOrgCode(params.getPersonIdentity().getCompanyBizOrgCode());
List<InputItemExcelVo> content = inputItemMapper.getInputItemInfoExcelNew(criterias);
//此处对数据做统一处理 拼接为易读内容
for (InputItemExcelVo inputItemExcelDto : content) {
......@@ -391,7 +426,7 @@ public class InputItemController extends AbstractBaseController {
}
}
}
if (ITEMTYPE.contains(inputItemExcelDto.getItemType()) && !inputItemExcelDto.getPictureJson().equals("[]")&& !inputItemExcelDto.getPictureJson().equals("")) {
if (!inputItemExcelDto.getPictureJson().equals("[]")&& !inputItemExcelDto.getPictureJson().equals("")) {
List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getPictureJson(), Map.class);
text = "";
for (int i = 0; i< maps.size(); i++) {
......
......@@ -41,6 +41,7 @@ public class InputItemExcelDto extends BaseDto {
@ExcelProperty(value = "评分项(选择)", index = 5)
@ApiModelProperty(value = "评分项")
private String dataJson;
@ExcelProperty(value = "消防装备类型", index = 6)
@ApiModelProperty(value = "消防装备类型")
private String equipmentType;
......@@ -64,9 +65,9 @@ public class InputItemExcelDto extends BaseDto {
@ApiModelProperty(value = "检查类型")
private String inputClassify;
@ExcelProperty(value = "拍照项(文本/选择)", index = 14)
@ExcelProperty(value = "拍照项", index = 14)
@ApiModelProperty(value = "拍照项")
private Object pictureJson;
private String pictureJson;
@ExplicitConstraint(indexNum=11,source = {"是","否"})
@ExcelProperty(value = "是否必填", index = 11)
......@@ -451,11 +452,11 @@ public class InputItemExcelDto extends BaseDto {
this.orgCode = orgCode;
}
public Object getPictureJson() {
public String getPictureJson() {
return pictureJson;
}
public void setPictureJson(Object pictureJson) {
public void setPictureJson(String pictureJson) {
this.pictureJson = pictureJson;
}
......
......@@ -64,7 +64,7 @@ public class InputItemExcelVo extends BaseDto {
@ApiModelProperty(value = "检查类型")
private String inputClassify;
@ExcelProperty(value = "拍照项(文本/选择)", index = 14)
@ExcelProperty(value = "拍照项", index = 14)
@ApiModelProperty(value = "拍照项")
private String pictureJson;
......@@ -158,6 +158,17 @@ public class InputItemExcelVo extends BaseDto {
@ExcelIgnore
private String riskDesc;
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
@ExcelIgnore
private String ids;
/**
* 新加字段
*/
......
......@@ -27,6 +27,16 @@ public class InputItemPageParam extends CommonPageable{
private String subCode;
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
private String ids;
public Integer getInhierarchy() {
return inhierarchy;
}
......
......@@ -322,7 +322,7 @@ public class PointServiceImpl implements IPointService {
pointInputItem.setClassifyIds(Long.valueOf(newPointClassify.getId()).toString());
pointInputItem.setId(0);
pointInputItem.setOrderNo(pItemVo.getpOrderNo());
PointInputItem pointInputItemResult = iPointInputItemDao.save(pointInputItem);
PointInputItem pointInputItemResult = iPointInputItemDao.saveAndFlush(pointInputItem);
//更新巡检路线
if (routePointList.size() > 0) {
Long classifyId = newPointClassify.getId();
......
......@@ -1067,15 +1067,15 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
}
if(dlData.length<5){ //255以内的下拉
//255以内的下拉,参数分别是:作用的sheet、下拉内容数组、起始行、终止行、起始列、终止列
sheet1.addValidationData(setDataValidation(sheet1, dlData, 1, 30000, rownum ,rownum)); //超过255个报错
sheet1.addValidationData(setDataValidation(sheet1, dlData, 1, dlData.length, rownum ,rownum)); //超过255个报错
} else { //255以上的下拉,即下拉列表元素很多的情况
//1、设置有效性
//String strFormula = "Sheet2!$A$1:$A$5000" ; //Sheet2第A1到A5000作为下拉列表来源数据
String strFormula = "Sheet2!$"+arr[index]+"$1:$"+arr[index]+"$5000"; //Sheet2第A1到A5000作为下拉列表来源数据
String strFormula = "Sheet2!$"+arr[index]+"$1:$"+arr[index]+"$"+dlData.length; //Sheet2第A1到A5000作为下拉列表来源数据
sheet2.setColumnWidth(r, 4000); //设置每列的列宽
//设置数据有效性加载在哪个单元格上,参数分别是:从sheet2获取A1到A5000作为一个下拉的数据、起始行、终止行、起始列、终止列
sheet1.addValidationData(SetDataValidation(strFormula, 1, 30000, rownum, rownum)); //下拉列表元素很多的情况
sheet1.addValidationData(SetDataValidation(strFormula, 1, dlData.length, rownum, rownum)); //下拉列表元素很多的情况
//2、生成sheet2内容
for(int j=0;j<dlData.length;j++){
......
......@@ -1878,7 +1878,7 @@
WHERE
(
0 <![CDATA[<>]]> find_in_set(`fs`.`id`, `s`.`system_id`)
)
) limt 1
) AS `chargePersonName`
FROM
`wl_equipment_specific_index` `si`
......
......@@ -434,6 +434,9 @@
<if test="treeId != null and treeId != '' and treeId == '-4'">
and a.key_parts_type is not null
</if>
<if test="ids != null and ids != ''">
and a.id in (${ids})
</if>
<if test="treeId != null and treeId != '' and treeId == '-5'">
and a.custom_type is not null
</if>
......@@ -442,6 +445,7 @@
treeId != '-2' and treeId != '-4' and treeId != '-5' and treeId.contains('@'.toString())">
and LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}
</if>
<if test="subCode!=null and subCode!='' and subCode!=' ' and
treeId != null and treeId != '' and treeId != '-3' and treeId != '-1' and
treeId != '-2' and treeId != '-4' and treeId != '-5' and !treeId.contains('@'.toString())">
......
......@@ -745,7 +745,7 @@
</select>
<select id="queryPointPie" resultType="Map">
<select id="queryPointPie" resultType="java.util.HashMap">
SELECT
sum(a.QUALIFIED) qualified,
sum(a.UNPLAN) unplan,
......@@ -791,7 +791,7 @@
) a
</select>
<select id="queryPointHistogram" resultType="Map">
<select id="queryPointHistogram" resultType="java.util.HashMap">
SELECT
case when a.department_name = ''|| a.department_name is null then '其他' else a.department_name end departmentName,
sum(a.QUALIFIED) qualified,
......
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