新兴行业清单导入

This commit is contained in:
mythxb 2023-12-26 15:12:40 +08:00
parent 9e84e0b1d4
commit 8df2f8b949
8 changed files with 101 additions and 22 deletions

View File

@ -0,0 +1,35 @@
package com.rzyc.bean.user.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author dong
* @date 2023-12-26 14:01
* @Version V1.0
*/
@ApiModel("职责清单")
public class ListSafeDto {
@ApiModelProperty(value = "岗位id",required = true)
private String listperformId;
@ApiModelProperty("关键字")
private String condition;
public String getListperformId() {
return listperformId;
}
public void setListperformId(String listperformId) {
this.listperformId = listperformId;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
}

View File

@ -39,7 +39,8 @@ public interface ListSafeMapper {
int updateByPrimaryKey(ListSafe record);
/*用户职责*/
List<ListSafeWithBLOBs> userListSafe(@Param("listPerformId") String listPerformId);
List<ListSafeWithBLOBs> userListSafe(@Param("listPerformId") String listPerformId,
@Param("condition") String condition);
/*查询部门局长的职责*/
List<ListSafe> othListSafe(@Param("supClassId") String supClassId);

View File

@ -1,5 +1,6 @@
package com.rzyc.model.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -32,10 +33,12 @@ public class ListSafe implements Serializable {
private Date applydate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdon;
private String createdby;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifiedon;
private String modifiedby;

View File

@ -417,7 +417,11 @@
<!--用户职责-->
<select id="userListSafe" resultMap="ResultMapWithBLOBs">
SELECT * FROM `ListSafe` ls WHERE ls.`ListPerformId` = #{listPerformId}
SELECT * FROM `ListSafe` ls
WHERE ls.`ListPerformId` = #{listPerformId}
<if test="null != condition and '' != condition">
and ls.SafeDuty like #{condition}
</if>
ORDER BY ls.SortId ASC,ls.CreatedOn ASC
</select>

View File

@ -70,7 +70,7 @@ public class ImportController extends com.rzyc.controller.BaseController {
@ApiOperation(value = "导入新兴行业职责", notes = "导入新兴行业职责")
@RequestMapping(value = "/risingData", method = RequestMethod.POST)
@ResponseBody
public SingleResult<String> risingData(@RequestBody MultipartFile multipartFile)throws Exception{
public SingleResult<String> risingData(@RequestBody MultipartFile multipartFile,Integer cellNum)throws Exception{
SingleResult<String> result = new SingleResult<>();
Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream());
Sheet sheet = wookbook.getSheetAt(0);
@ -99,7 +99,7 @@ public class ImportController extends com.rzyc.controller.BaseController {
Cell cell = row.getCell((short)1);
for (int j = 1;j<=13;j++){
for (int j = 1;j<=cellNum;j++){
cell = row.getCell((short)j);
String str = dataFormatter.formatCellValue(cell);
str = StringUtils.replaceBlank(str);
@ -125,7 +125,7 @@ public class ImportController extends com.rzyc.controller.BaseController {
System.out.println("unitName ----> "+unitName);
ListPerform perform = listPerformMapper.findByName(unitName,"5bd164aa-dd43-45e3-a5a2-649bb2fd9fb9");
if(null != perform){
for (int k = 1;k<=13;k++){
for (int k = 1;k<=cellNum;k++){
cell = row.getCell((short)k);
String listStr = dataFormatter.formatCellValue(cell);
listStr = StringUtils.replaceBlank(listStr);

View File

@ -502,7 +502,7 @@ public class PcPersonalController extends com.rzyc.controller.BaseController {
MultiResult<ListSafeWithBLOBs> result = new MultiResult<>();
SysUser sysUser = sysUserMapper.selectByPrimaryKey(userId);
if(null != sysUser && StringUtils.isNotBlank(sysUser.getSystitle())){
List<ListSafeWithBLOBs> listSafes = listSafeMapper.userListSafe(sysUser.getSystitle());
List<ListSafeWithBLOBs> listSafes = listSafeMapper.userListSafe(sysUser.getSystitle(),"");
if(null != listSafes && listSafes.size() > 0){
result.setData(listSafes);
}else{
@ -2094,7 +2094,7 @@ public class PcPersonalController extends com.rzyc.controller.BaseController {
@ResponseBody
public MultiResult<ListSafeWithBLOBs> performSafe(String listperformId)throws Exception{
MultiResult<ListSafeWithBLOBs> result = new MultiResult<>();
List<ListSafeWithBLOBs> listSafes = listSafeMapper.userListSafe(listperformId);
List<ListSafeWithBLOBs> listSafes = listSafeMapper.userListSafe(listperformId,"");
if(listSafes.size() > 0){
Integer sortId = 1;
for (ListSafeWithBLOBs listSafe : listSafes){
@ -2111,6 +2111,27 @@ public class PcPersonalController extends com.rzyc.controller.BaseController {
return result;
}
/**
* 岗位安全生产职责清单分页
* @version v1.0
* @author dong
* @date 2023/12/26 14:11
*/
@LoginAuth
@ApiOperation(value = "岗位安全生产职责清单分页", notes = "岗位安全生产职责清单分页")
@GetMapping(value = "performSafePage")
@ResponseBody
public SingleResult<Pager<ListSafeWithBLOBs>> performSafePage(@Valid ListSafeDto listSafeDto,@Valid PageDto pageDto)throws Exception{
SingleResult<Pager<ListSafeWithBLOBs>> result = new SingleResult<>();
String condition = TypeConversion.getConditionV1(listSafeDto.getCondition());
PageHelper.startPage(pageDto.getPage(), pageDto.getPageSize());
Page<ListSafeWithBLOBs> page = (Page<ListSafeWithBLOBs>)listSafeMapper.userListSafe(listSafeDto.getListperformId(),condition);
Pager<ListSafeWithBLOBs> pager = new Pager<>();
getDatePage(pager,page);
result.setData(pager);
return result;
}
/**
* 修改新增安全生产职责清单

View File

@ -595,7 +595,7 @@ public class WxContorller extends com.rzyc.controller.BaseController {
MultiResult<ListSafeWithBLOBs> result = new MultiResult<>();
SysUser sysUser = sysUserMapper.selectByPrimaryKey(userId);
if(null != sysUser && StringUtils.isNotBlank(sysUser.getSystitle())){
List<ListSafeWithBLOBs> userListSafe = listSafeMapper.userListSafe(sysUser.getSystitle());
List<ListSafeWithBLOBs> userListSafe = listSafeMapper.userListSafe(sysUser.getSystitle(),"");
result.setData(userListSafe);
}
return result;

View File

@ -20,7 +20,7 @@ import java.text.SimpleDateFormat;
*
*/
public class TypeConversion {
/**
* String 类型 装换成 Long 类型
* @param v1
@ -33,7 +33,7 @@ public class TypeConversion {
}
return result;
}
/**
* String 类型 装换成 Integer 类型
* @param v1
@ -46,7 +46,7 @@ public class TypeConversion {
}
return result;
}
/**
* String 类型 装换成 Double 类型
* @param v1
@ -59,7 +59,7 @@ public class TypeConversion {
}
return result;
}
/**
* Timestamp String
* @param t1
@ -67,10 +67,10 @@ public class TypeConversion {
* @return
*/
public static String timestampToString(Timestamp t1,String patten){
DateFormat sdf = new SimpleDateFormat(patten);
return sdf.format(t1);
DateFormat sdf = new SimpleDateFormat(patten);
return sdf.format(t1);
}
/**
* InputStream byte []数组
* @param in
@ -86,7 +86,7 @@ public class TypeConversion {
}
return output.toByteArray();
}
/**
* Url InputStream
* @param fileUrl
@ -94,16 +94,16 @@ public class TypeConversion {
* @throws Exception
*/
public static InputStream urlToInputStream(String fileUrl,InputStream is)throws Exception{
URL url = new URL(fileUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();//利用HttpURLConnection对象,我们可以从网络中获取网页数据.
URL url = new URL(fileUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();//利用HttpURLConnection对象,我们可以从网络中获取网页数据.
System.out.println(conn.getContentLength());;
conn.connect();
is = conn.getInputStream(); //得到网络返回的输入流
conn.connect();
is = conn.getInputStream(); //得到网络返回的输入流
return is;
}
/**
* 格式化小数
* 格式化小数
* @param decimal 要格式化的小数
* @param num 保留到小数点后多少位
* @return
@ -132,6 +132,21 @@ public class TypeConversion {
return condition;
}
/**
* 处理字符串 在字符串前面和后面加 %
* @param condition
* @return
* @throws Exception
*/
public static String getConditionV1(String condition) {
if (StringUtils.isNotBlank(condition)) {
condition = condition.replace(" ","");
condition = condition.replace("\t","");
condition = "%" + condition + "%";
}
return condition;
}
/**
- listToTree