main
杜函宇 2 months ago
parent 760906e0a9
commit bf40277f7f

@ -21,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.List;
@ -73,6 +74,7 @@ public class AssetCurrentController extends BaseController {
return success(assetCurrentService.page(page, as));
}
/**
* ()
*
@ -114,7 +116,7 @@ public class AssetCurrentController extends BaseController {
@PostMapping
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@Transactional(rollbackFor = Exception.class)
public AjaxResult insert(@RequestBody AssetCurrent assetCurrent) {
public AjaxResult insert(@RequestBody @Valid AssetCurrent assetCurrent) {
StringBuilder a = new StringBuilder();
if (!assetCurrent.getGlymList().isEmpty()) {
assetCurrent.getGlymList().forEach(x -> {
@ -170,7 +172,7 @@ public class AssetCurrentController extends BaseController {
@ApiOperation(value = "修改数据")
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@PutMapping
public AjaxResult update(@RequestBody AssetCurrent assetCurrent) {
public AjaxResult update(@RequestBody @Valid AssetCurrent assetCurrent) {
StringBuilder a = new StringBuilder();
if (!assetCurrent.getGlymList().isEmpty()) {
assetCurrent.getGlymList().forEach(x -> {
@ -266,7 +268,7 @@ public class AssetCurrentController extends BaseController {
} catch (Exception e) {
throw new ServiceException("获取用户信息异常");
}
List<AssetExport> list = assetCurrentService.page(as);
List<AssetExport> list = assetCurrentService.page1(as);
ExcelUtil<AssetExport> util = new ExcelUtil<>(AssetExport.class);
util.exportExcel(response, list, "现有资产记录");
}

@ -24,7 +24,9 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* (unit)
@ -34,7 +36,7 @@ import java.util.List;
*/
@Api(tags = "单位表控制层")
@RestController
//@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@RequestMapping("/tc/unit")
public class UnitController {
@ -62,6 +64,15 @@ public class UnitController {
return AjaxResult.success(unitService.page(page, unit));
}
/**
*
*/
@ApiOperation(value = "获取所有单位列表", response = Unit.class)
@GetMapping("/allList")
public AjaxResult allList(UnitRequest unit) {
return AjaxResult.success(unitService.selectUnitList( unit));
}
/**
*
*/
@ -85,11 +96,13 @@ public class UnitController {
ExcelUtil<Unit> util = new ExcelUtil<>(Unit.class);
List<Unit> list = util.importExcel(file.getInputStream());
unitService.saveBatch(list);
Map<String,String> a1 = new HashMap<>();
for (Unit x : list) {
//查询用户表是否存在该用户
unitService.validUser(x);
String s = unitService.validUser(x);
a1.put(x.getUserName(),s);
}
return AjaxResult.success();
return AjaxResult.success(a1);
}
@PostMapping("/importTemplate")
@ -115,7 +128,7 @@ public class UnitController {
@Log(title = "新增单位", businessType = BusinessType.INSERT)
@PostMapping
@Transactional(rollbackFor = Exception.class)
public AjaxResult add( @RequestBody Unit unit) {
public AjaxResult add(@Valid @RequestBody Unit unit) {
if (!unitService.lambdaQuery().eq(Unit::getUserName, unit.getUserName()).eq(Unit::getDelFlag, "0").list().isEmpty()) {
throw new ServiceException(unit.getUserName() + "'已存在单位!");
}
@ -135,9 +148,8 @@ public class UnitController {
});
examineInfoService.saveBatch(unit.getJcxxList());
}
//查询用户表是否存在该用户
unitService.validUser(unit);
return AjaxResult.success();
String s = unitService.validUser(unit);
return AjaxResult.success(s);
}
/**
@ -147,9 +159,11 @@ public class UnitController {
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
@Transactional(rollbackFor = Exception.class)
public AjaxResult edit(@RequestBody Unit x) {
//查询用户表是否存在该用户
unitService.validUser(x);
public AjaxResult edit(@Valid @RequestBody Unit x) {
Unit byId = unitService.getById(x.getId());
if(!byId.getUserName().equals(x.getUserName()) || !byId.getNickName().equals(x.getNickName())){
throw new ServiceException("单位名称和社会信用代码不允许修改!");
}
unitService.updateById(x);
//先删除
unitOtherConcatService.deleteByUnitIds(x.getId());

@ -38,14 +38,22 @@ public class AssetCurrent extends BaseClass implements Serializable {
@NotBlank
@Size(max= 100,message="系统名称长度不能超过100")
@ApiModelProperty("系统名称")
@Excel(name = "*系统名称",sort = 2,width = 40,required = true)
private String xtmc;
// /**
// * 资产类型
// */
// @ApiModelProperty("资产类型")
// private String zclx;
/**
*
*/
@NotBlank
@Size(max= 50,message="单位名称长度不能超过50")
@ApiModelProperty("单位名称")
@Excel(name = "*单位名称",sort = 1,width = 40)
@Excel(name = "*单位名称",sort = 1,width = 40,required = true)
private String dwmc;
/**
*
@ -69,7 +77,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* IPport-IP
*/
@NotBlank
//@NotBlank
@Size(max= 50,message="IPport-IP地址长度不能超过50")
@ApiModelProperty("IPport-IP地址")
@Excel(name = "*ipv4",sort = 4)
@ -77,7 +85,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* IPport-
*/
@NotBlank
//@NotBlank
@Excel(name = "*端口",sort = 5)
@Size(max= 50,message="IPport-端口不能超过50")
@ApiModelProperty("IPport-端口")
@ -129,7 +137,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*系统类型",dictType="zc_xtlx",comboReadDict = true,sort =8)
@NotNull
//@NotNull
@ApiModelProperty("系统类型(字典)")
private String xtlx;
/**
@ -141,7 +149,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
*
*/
@NotNull
//@NotNull
// @Excel(name = "是否关基系统",dictType = "is_no",comboReadDict = true,sort = 10)
@Excel(name = "*是否关基系统",dictType = "is_no",comboReadDict = true,sort = 10)
@ApiModelProperty("是否关基系统(字典)")
@ -156,7 +164,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
*
*/
@NotBlank
//@NotBlank
@Excel(name = "*机房信息",sort = 58)
@Size(max= 500,message="机房信息长度不能超过500")
@ApiModelProperty("机房信息")
@ -164,7 +172,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* 使
*/
@NotBlank
//@NotBlank
@Size(max= 50,message="使用时间长度不能超过50")
@ApiModelProperty("使用时间")
@Excel(name = "使用时间",sort = 116)
@ -172,7 +180,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
*
*/
@NotNull
//@NotNull
@Excel(name = "*是否是互联网系统",dictType = "is_no",comboReadDict = true,sort = 117 )
@ApiModelProperty("是否是互联网系统(字典)")
private String hlwxt;
@ -188,7 +196,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*/
// @Excel(name = "系统状态",dictType = "zc_xtzt",comboReadDict = true,sort = 36)
@Excel(name = "*系统状态",dictType = "zc_xtzt",comboReadDict = true,sort = 36)
@NotNull
//@NotNull
@ApiModelProperty("系统状态(字典)")
private String xtzt;
/**
@ -254,13 +262,13 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*用户规模",dictType ="zc_yhgm",comboReadDict = true,sort = 53)
@NotNull
//@NotNull
@ApiModelProperty("用户规模")
private String yhgm;
/**
*
*/
@NotBlank
//@NotBlank
@Excel(name = "*互联网接入运营商",sort = 54)
@Size(max= 50,message="互联网接入运营商长度不能超过50")
@ApiModelProperty("互联网接入运营商")
@ -275,14 +283,14 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*资产物理接入地址",sort = 118,width = 28)
@NotBlank
//@NotBlank
@Size(max= 50,message="资产物理接入地址长度不能超过50")
@ApiModelProperty("资产物理接入地址")
private String zcwljrdz;
/**
*
*/
@NotNull
//@NotNull
@Excel(name = "*是否部署云平台",sort = 56,dictType = "is_no",comboReadDict = true)
@ApiModelProperty("是否部署云平台(字典)")
private String bsypt;
@ -304,7 +312,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*系统部署方式",dictType = "zc_xtbsfs",comboReadDict = true,sort = 59)
@NotNull
//@NotNull
@ApiModelProperty("系统部署方式")
private String xtbsfs;
/**
@ -325,13 +333,13 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*是否对公众开放",dictType = "is_no",comboReadDict = true,sort = 62,width = 22)
@NotNull
//@NotNull
@ApiModelProperty("是否对公众开放(字典)")
private String dgzkf;
/**
*
*/
@NotNull
//@NotNull
@Excel(name = "*互联网开放用途",dictType = "zc_hlwkfyt",comboReadDict = true,sort = 63,width = 22)
@ApiModelProperty("互联网开放用途(字典)")
private String hlwkfyt;
@ -388,7 +396,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotNull
//@NotNull
@Size(max= 500,message="相关业务-业务描述长度不能超过255")
@ApiModelProperty("相关业务-业务描述")
private String xgywYwms;
@ -401,7 +409,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*分管负责人",sort = 15)
@NotBlank
//@NotBlank
@Size(max= 50,message="分管负责人姓名长度不能超过50")
@ApiModelProperty("分管负责人姓名")
private String fgfzrxm;
@ -409,7 +417,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*分管负责人电话",sort = 16,width = 24)
@NotBlank
//@NotBlank
@Size(max= 50,message="分管负责人联系方式长度不能超过50")
@ApiModelProperty("分管负责人联系方式")
private String fgfzrlxfs;
@ -424,7 +432,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*部门负责人",sort = 18)
@NotBlank
//@NotBlank
@Size(max= 50,message="部门负责人姓名长度不能超过50")
@ApiModelProperty("部门负责人姓名")
private String bmfzrxm;
@ -432,7 +440,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*部门负责人电话",sort = 19,width = 24)
@NotBlank
//@NotBlank
@Size(max= 50,message="部门负责人联系方式长度不能超过50")
@ApiModelProperty("部门负责人联系方式")
private String bmfzrlxfs;
@ -447,14 +455,14 @@ public class AssetCurrent extends BaseClass implements Serializable {
*
*/
@Excel(name = "*第一联系人",sort = 21)
@NotBlank
//@NotBlank
@Size(max= 50,message="第一联系人姓名长度不能超过50")
@ApiModelProperty("第一联系人姓名")
private String dylxrxm;
/**
*
*/
@NotBlank
//@NotBlank
@Excel(name = "*第一联系人电话",sort = 22,width = 24)
@Size(max= 50,message="第一联系人联系方式长度不能超过50")
@ApiModelProperty("第一联系人联系方式")
@ -475,7 +483,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* ICP-
*/
@Excel(name = "*ICP备案状态",dictType = "is_no",comboReadDict = true,sort = 24)
@NotNull
//@NotNull
@ApiModelProperty("ICP备案信息-是否备案")
private String ipcSfba;
/**
@ -500,7 +508,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*/
// @Excel(name = "ICP备案编号",sort = 25,width = 46)
@Excel(name = "ICP备案编号ICP备案状态选择为是则必填",sort = 25,width = 46)
@NotBlank
//@NotBlank
@Size(max= 50,message="ICP备案信息-ICP备案编号长度不能超过50")
@ApiModelProperty("ICP备案信息-ICP备案编号")
private String ipcIpcbabh;
@ -508,7 +516,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* ICP-
*/
@Excel(name = "*备案域名",sort = 26)
@NotBlank
//@NotBlank
@Size(max= 50,message="ICP备案信息-备案域名长度不能超过50")
@ApiModelProperty("ICP备案信息-备案域名")
private String ipcBaym;
@ -544,7 +552,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*公安机关备案状态",dictType = "is_no",comboReadDict = true,sort = 27,width = 24)
@ApiModelProperty("公安机关备案信息-是否备案")
private String gajgSfba;
@ -560,7 +568,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
@Excel(name = "*公安机关备案号",sort = 28,width = 22)
@Size(max= 50,message="公安机关备案信息-公安机关备案号长度不能超过50")
@ApiModelProperty("公安机关备案信息-公安机关备案号")
@NotBlank
//@NotBlank
private String gajgBah;
/**
* -
@ -571,7 +579,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotBlank
//@NotBlank
@Excel(name = "*开发商",sort = 29)
@Size(max= 50,message="系统架构-开发商长度不能超过50")
@ApiModelProperty("系统架构-开发商")
@ -580,7 +588,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*系统版本",sort = 30)
@NotBlank
//@NotBlank
@Size(max= 50,message="系统架构-系统版本长度不能超过50")
@ApiModelProperty("系统架构-系统版本")
private String xtjgXtbb;
@ -588,7 +596,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*技术架构",sort = 31)
@NotBlank
//@NotBlank
@Size(max= 50,message="系统架构-技术架构长度不能超过50")
@ApiModelProperty("系统架构-技术架构")
private String xtjgJsjg;
@ -596,7 +604,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*服务组件",sort = 32)
@NotBlank
//@NotBlank
@Size(max= 50,message="系统架构-服务组件长度不能超过50")
@ApiModelProperty("系统架构-服务组件")
private String xtjgFwzj;
@ -604,7 +612,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -web
*/
@Excel(name = "*Web容器版本",sort = 33)
@NotBlank
//@NotBlank
@Size(max= 50,message="系统架构-web容器名称长度不能超过50")
@ApiModelProperty("系统架构-web容器名称")
private String xtjgWebMc;
@ -612,7 +620,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -web
*/
@Excel(name = "*Web容器名称",sort = 34)
@NotBlank
//@NotBlank
@Size(max= 50,message="系统架构-web容器版本长度不能超过50")
@ApiModelProperty("系统架构-web容器版本")
private String xtjgWebBb;
@ -620,14 +628,14 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*是否国产化系统",dictType = "is_no",comboReadDict = true,sort = 35,width = 22)
@NotNull
//@NotNull
@ApiModelProperty("系统架构-是否国产化系统")
private String xtjgGcxt;
/**
* -
*/
@Excel(name = "*是否有国产设备",dictType = "is_no",comboReadDict = true,sort = 35,width = 22)
@NotNull
//@NotNull
@ApiModelProperty("系统架构-是否有国产设备")
private String xtjgGcsb;
/**
@ -640,13 +648,13 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*是否是等保系统",dictType = "is_no",comboReadDict = true,sort = 42)
@NotNull
//@NotNull
@ApiModelProperty("等保信息-是否等保系统")
private String dbxxSfdbxt;
/**
* -
*/
@NotBlank
//@NotBlank
@Excel(name = "*等保测评备案号",sort = 43,width = 22)
@Size(max= 50,message="等保信息-等保测评备案号长度不能超过50")
@ApiModelProperty("等保信息-等保测评备案号")
@ -654,7 +662,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*等保等级",dictType = "dbxx_dbdj",comboReadDict = true,sort = 44)
@ApiModelProperty("等保信息-等保等级")
private String dbxxDbdj;
@ -677,7 +685,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotBlank
//@NotBlank
@Excel(name = "定级时间是否是等保系统是则必填样式如2024-11-02",sort = 119,width = 40)
@Size(max= 50,message="等保信息-定级时间长度不能超过50")
@ApiModelProperty("等保信息-定级时间")
@ -687,7 +695,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
*/
// @Excel(name = "是否有第三方测评",width = 45,dictType = "is_no",comboReadDict = true,sort = 45)
@ApiModelProperty("等保信息-是否有第三方测评")
@NotNull
//@NotNull
@Excel(name = "是否有第三方测评(是否是等保系统选择是则必填)",width = 45,dictType = "is_no",comboReadDict = true,sort = 45)
private String dbxxSfydsfcp;
@ -705,7 +713,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotBlank
//@NotBlank
@Excel(name = "*测评得分",sort = 49)
@Size(max= 50,message="等保信息-测评得分长度不能超过50")
@ApiModelProperty("等保信息-测评得分")
@ -901,7 +909,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotBlank
//@NotBlank
@Excel(name = "*数据库类型",sort = 99)
@Size(max= 50,message="数据资产-数据库类型长度不能超过50")
@ApiModelProperty("数据资产-数据库类型")
@ -910,7 +918,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*数据库端口",sort = 100)
@NotBlank
//@NotBlank
@Size(max= 50,message="数据资产-端口长度不能超过50")
@ApiModelProperty("数据资产-端口")
private String sjzcDk;
@ -918,7 +926,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*数据库版本",sort = 101)
@NotBlank
//@NotBlank
@Size(max= 50,message="数据资产-数据库版本长度不能超过255")
@ApiModelProperty("数据资产-数据库版本")
private String sjzcSjkbb;
@ -932,7 +940,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*共享属性",dictType = "sjzc_gxsx",comboReadDict = true,sort = 103)
@ApiModelProperty("数据资产-共享属性")
private String sjzcGxsx;
@ -940,27 +948,27 @@ public class AssetCurrent extends BaseClass implements Serializable {
* -
*/
@Excel(name = "*开放属性",dictType = "sjzc_kfsx",comboReadDict = true,sort = 104)
@NotNull
//@NotNull
@ApiModelProperty("数据资产-开放属性")
private String sjzcKfsx;
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*数据领域",dictType = "sjzc_sjly",comboReadDict = true,sort = 105)
@ApiModelProperty("数据资产-数据领域")
private String sjzcSjly;
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*更新周期",dictType = "sjzc_gxzq",comboReadDict = true,sort = 106)
@ApiModelProperty("数据资产-更新周期")
private String sjzcGxzq;
/**
* -
*/
@NotBlank
//@NotBlank
@Excel(name = "*数据类型",sort = 107)
@Size(max= 255,message="数据资产-数据类型长度不能超过255")
@ApiModelProperty("数据资产-数据类型")
@ -968,7 +976,7 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotBlank
//@NotBlank
@Excel(name = "*数据量",sort = 108)
@Size(max= 255,message="数据资产-数据量长度不能超过255")
@ApiModelProperty("数据资产-数据量")
@ -981,28 +989,28 @@ public class AssetCurrent extends BaseClass implements Serializable {
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*是否为涉密数据",dictType = "is_no",comboReadDict = true,sort = 110)
@ApiModelProperty("数据资产-是否为涉密数据")
private String sjzcSmsj;
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*数据是否出境",dictType = "is_no",comboReadDict = true,sort = 111)
@ApiModelProperty("数据资产-数据是否出境")
private String sjzcCj;
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "*数据分级分类",dictType = "sjzc_sjfjfl",comboReadDict = true,sort = 112)
@ApiModelProperty("数据资产-数据分级分类")
private String sjzcSjfjfl;
/**
* -
*/
@NotNull
//@NotNull
@Excel(name = "数据重要程度",dictType = "zc_xtzyx",comboReadDict = true,sort = 113)
@ApiModelProperty("数据资产-数据重要程度")
private String sjzcSjzycd;

@ -10,6 +10,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ -28,6 +29,7 @@ public class Unit implements Serializable {
@TableId(type = IdType.AUTO,value = "id")
private Long id;
@NotBlank
@ApiModelProperty("单位名称/用户昵称")
@Excel(name = "单位名称*",required = true)
private String nickName;
@ -75,6 +77,7 @@ public class Unit implements Serializable {
@Excel(name = "单位角色",dictType="dwjs",comboReadDict = true)
private String dwjs;
@NotBlank
@ApiModelProperty("统一社会信用代码/用户账号")
@Excel(name = "统一社会信用代码",required = true)
private String userName;

@ -15,6 +15,12 @@ import java.util.Date;
@Data
public class AssetCurrentPageRequest {
// /**
// * 资产类型
// */
// @ApiModelProperty("资产类型")
// private String zclx;
/**
*
*/

@ -26,6 +26,18 @@ public interface AssetCurrentMapper extends BaseMapper<AssetCurrent> {
*/
Page<AssetCurrent> page(Page<AssetCurrent> page,@Param("req") AssetCurrentPageRequest as);
/**
*
*
* @param as
* @return
*/
List<AssetCurrent> page(@Param("req") AssetCurrentPageRequest as);
/**
*
*/
List<AssetExport> page1(@Param("req") AssetCurrentPageRequest as);

@ -27,12 +27,12 @@ public interface AssetCurrentService extends IService<AssetCurrent> {
Page<AssetCurrent> page(Page<AssetCurrent> page, AssetCurrentPageRequest as);
/**
*
*
*
* @param as
* @return
*/
List<AssetExport> page(AssetCurrentPageRequest as);
List<AssetExport> page1(AssetCurrentPageRequest as);
/**
*

@ -40,7 +40,7 @@ public interface UnitService extends IService<Unit> {
/**
*
*/
void validUser(Unit unit);
String validUser(Unit unit);
/**
* id

@ -48,13 +48,13 @@ public class AssetCurrentServiceImpl extends ServiceImpl<AssetCurrentMapper, Ass
}
/**
*
*
*
* @param as
* @return
*/
@Override
public List<AssetExport> page(AssetCurrentPageRequest as) {
public List<AssetExport> page1(AssetCurrentPageRequest as) {
return baseMapper.page1(as);
}

@ -3,8 +3,8 @@ package com.ruoyi.tc.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PasswordGenerator;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysUserService;
@ -19,6 +19,7 @@ import java.util.List;
/**
* unit_info
*
* @author du
* @since 2024/11/13 15:02
*/
@ -27,6 +28,7 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
@Resource
private ISysUserService userService;
/**
*
*
@ -35,7 +37,7 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
*/
@Override
public Page<Unit> page(Page<Unit> page, UnitRequest unit) {
return baseMapper.selectUnitList(page,unit);
return baseMapper.selectUnitList(page, unit);
}
/**
@ -62,21 +64,22 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
*
*/
@Override
public void validUser(Unit x) {
if(x.getUserName()!=null && x.getUserName().length()>6){
public String validUser(Unit x) {
if (x.getUserName() != null) {
String password = PasswordGenerator.password();
SysUser user = new SysUser();
user.setUserName(x.getUserName());
user.setPassword(SecurityUtils.encryptPassword(x.getUserName().substring(x.getUserName().length() - 6)));
user.setPassword(SecurityUtils.encryptPassword(password));
user.setNickName(x.getNickName());
SysUser u = userService.selectUserByUserName(x.getUserName());
if (StringUtils.isNull(u)) {
userService.insertUser(user);
Long[] roles = new Long[]{100L};
userService.insertUserAuth(user.getUserId(), roles);
}else {
//只修改用户账号,密码,单位名称
userService.updateUserProfile(user);
}
return password;
} else {
throw new ServiceException("统一社会信用代码/用户账号不能为空");
}
}
@ -87,6 +90,7 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
public List<String> selectByIds(Long id) {
return baseMapper.selectByIds(id);
}
/**
*
*/
@ -105,7 +109,7 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
@Override
public Page<Unit> dwList(Page<Unit> page, UnitRequest unit) {
return baseMapper.dwList(page,unit);
return baseMapper.dwList(page, unit);
}
}

@ -0,0 +1,26 @@
package com.ruoyi.common.utils;
import java.security.SecureRandom;
/**
* @author du
* @since 2024/11/26 10:04
*/
public class PasswordGenerator {
public static String password() {
//定义字符池
String upperCase = "ABCDEFGHIJKLMNOPORSTUVWXYZ";
String lowercase = "abcdefghijklmnopqrstuvwxyz";
String numbers = "0123456789";
String specialcharacters = "!@#$%^&*";
String allcharacters = upperCase + lowercase + numbers + specialcharacters;
//创建随机数生成器
SecureRandom random = new SecureRandom();// 使用 SecureRandom 以增加安全性
StringBuilder password = new StringBuilder(16);// 使用 stringBuilder 来构建字符串
for (int i = 0; i < 16; i++) {
int index = random.nextInt(allcharacters.length());// 随机选择字符下标
password.append(allcharacters.charAt(index));//将字符添加到密码中
}
return password.toString();
}
}
Loading…
Cancel
Save