forked from luyan/epmet-cloud-lingshan
19 changed files with 1325 additions and 0 deletions
@ -0,0 +1,129 @@ |
|||
package com.epmet.opendata.dto.ca; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Data |
|||
public class CaBmCategoryDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 类别ID |
|||
*/ |
|||
private Long categoryId; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String categoryType; |
|||
|
|||
/** |
|||
* 名称值 |
|||
*/ |
|||
private String categoryValue; |
|||
|
|||
/** |
|||
* 父类别ID |
|||
*/ |
|||
private Long parentCategoryId; |
|||
|
|||
/** |
|||
* 展示顺序 |
|||
*/ |
|||
private Integer categorySort; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private Long createBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createDate; |
|||
|
|||
/** |
|||
* 最后修改人 |
|||
*/ |
|||
private Long updateBy; |
|||
|
|||
/** |
|||
* 最后修改时间 |
|||
*/ |
|||
private Date updateDate; |
|||
|
|||
/** |
|||
* 删除状态 |
|||
*/ |
|||
private String deleteFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer versions; |
|||
|
|||
/** |
|||
* 扩展字段1 |
|||
*/ |
|||
private String attribute1; |
|||
|
|||
/** |
|||
* 扩展字段2 |
|||
*/ |
|||
private String attribute2; |
|||
|
|||
/** |
|||
* 扩展字段3 |
|||
*/ |
|||
private String attribute3; |
|||
|
|||
/** |
|||
* 扩展字段4 |
|||
*/ |
|||
private String attribute4; |
|||
|
|||
/** |
|||
* 扩展字段5 |
|||
*/ |
|||
private String attribute5; |
|||
|
|||
/** |
|||
* 扩展字段6 |
|||
*/ |
|||
private Long attribute6; |
|||
|
|||
/** |
|||
* 扩展字段7 |
|||
*/ |
|||
private Long attribute7; |
|||
|
|||
/** |
|||
* 扩展字段8 |
|||
*/ |
|||
private Long attribute8; |
|||
|
|||
/** |
|||
* 扩展字段9 |
|||
*/ |
|||
private Date attribute9; |
|||
|
|||
/** |
|||
* 扩展字段10 |
|||
*/ |
|||
private Date attribute10; |
|||
|
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.epmet.opendata.dto.ca; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Data |
|||
public class CaSysDictDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 字典ID |
|||
*/ |
|||
private Long dictId; |
|||
|
|||
/** |
|||
* 字典值,例如:sex/F |
|||
*/ |
|||
private String dictValue; |
|||
|
|||
/** |
|||
* 1.字典组名称(性别)或者字典名称(女) |
|||
*/ |
|||
private String dictLabel; |
|||
|
|||
/** |
|||
* 字典值时存入字典的值,字典组时存null |
|||
*/ |
|||
private String dictType; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
private String dictDesc; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer dictSort; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private Long createBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createDate; |
|||
|
|||
/** |
|||
* 最后修改人 |
|||
*/ |
|||
private Long updateBy; |
|||
|
|||
/** |
|||
* 最后修改时间 |
|||
*/ |
|||
private Date updateDate; |
|||
|
|||
/** |
|||
* 字典值:normal正常,deleted正常 |
|||
*/ |
|||
private String deleteFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer versions; |
|||
|
|||
} |
@ -0,0 +1,96 @@ |
|||
package com.epmet.opendata.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
|
|||
import com.epmet.opendata.dto.ca.CaBmCategoryDTO; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.excel.CaBmCategoryExcel; |
|||
import com.epmet.opendata.service.CaBmCategoryService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("caBmCategory") |
|||
public class CaBmCategoryController { |
|||
|
|||
@Autowired |
|||
private CaBmCategoryService caBmCategoryService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<CaBmCategoryDTO>> page(@RequestParam Map<String, Object> params) { |
|||
PageData<CaBmCategoryDTO> page = caBmCategoryService.page(params); |
|||
return new Result<PageData<CaBmCategoryDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
|||
public Result<CaBmCategoryDTO> get(@PathVariable("id") String id) { |
|||
CaBmCategoryDTO data = caBmCategoryService.get(id); |
|||
return new Result<CaBmCategoryDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody CaBmCategoryDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
caBmCategoryService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody CaBmCategoryDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
caBmCategoryService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids) { |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
caBmCategoryService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<CaBmCategoryDTO> list = caBmCategoryService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, CaBmCategoryExcel.class); |
|||
} |
|||
|
|||
/** |
|||
* 调用ruoyi接口存储数据 |
|||
* |
|||
* @param dto |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @author LZN |
|||
* @date 2022/6/2 10:02 |
|||
*/ |
|||
@PostMapping("/preserBmCategoryVation") |
|||
public Result getPreserLouDongVation(@RequestBody PreserVationFormDTO dto) { |
|||
caBmCategoryService.preserBmCategoryVation(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,83 @@ |
|||
package com.epmet.opendata.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
|
|||
import com.epmet.opendata.dto.ca.CaSysDictDTO; |
|||
import com.epmet.opendata.excel.CaSysDictExcel; |
|||
import com.epmet.opendata.service.CaSysDictService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("caSysDict") |
|||
public class CaSysDictController { |
|||
|
|||
@Autowired |
|||
private CaSysDictService caSysDictService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<CaSysDictDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<CaSysDictDTO> page = caSysDictService.page(params); |
|||
return new Result<PageData<CaSysDictDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
public Result<CaSysDictDTO> get(@PathVariable("id") String id){ |
|||
CaSysDictDTO data = caSysDictService.get(id); |
|||
return new Result<CaSysDictDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody CaSysDictDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
caSysDictService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody CaSysDictDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
caSysDictService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
caSysDictService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<CaSysDictDTO> list = caSysDictService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, CaSysDictExcel.class); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.opendata.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
|
|||
import com.epmet.opendata.entity.CaBmCategoryEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Mapper |
|||
public interface CaBmCategoryDao extends BaseDao<CaBmCategoryEntity> { |
|||
|
|||
int deleteAll(); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.opendata.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
|
|||
import com.epmet.opendata.entity.CaSysDictEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Mapper |
|||
public interface CaSysDictDao extends BaseDao<CaSysDictEntity> { |
|||
|
|||
} |
@ -0,0 +1,134 @@ |
|||
package com.epmet.opendata.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ca_bm_category") |
|||
public class CaBmCategoryEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 类别ID |
|||
*/ |
|||
private Long categoryId; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String categoryType; |
|||
|
|||
/** |
|||
* 名称值 |
|||
*/ |
|||
private String categoryValue; |
|||
|
|||
/** |
|||
* 父类别ID |
|||
*/ |
|||
private Long parentCategoryId; |
|||
|
|||
/** |
|||
* 展示顺序 |
|||
*/ |
|||
private Integer categorySort; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private Long createBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createDate; |
|||
|
|||
/** |
|||
* 最后修改人 |
|||
*/ |
|||
private Long updateBy; |
|||
|
|||
/** |
|||
* 最后修改时间 |
|||
*/ |
|||
private Date updateDate; |
|||
|
|||
/** |
|||
* 删除状态 |
|||
*/ |
|||
private String deleteFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer versions; |
|||
|
|||
/** |
|||
* 扩展字段1 |
|||
*/ |
|||
private String attribute1; |
|||
|
|||
/** |
|||
* 扩展字段2 |
|||
*/ |
|||
private String attribute2; |
|||
|
|||
/** |
|||
* 扩展字段3 |
|||
*/ |
|||
private String attribute3; |
|||
|
|||
/** |
|||
* 扩展字段4 |
|||
*/ |
|||
private String attribute4; |
|||
|
|||
/** |
|||
* 扩展字段5 |
|||
*/ |
|||
private String attribute5; |
|||
|
|||
/** |
|||
* 扩展字段6 |
|||
*/ |
|||
private Long attribute6; |
|||
|
|||
/** |
|||
* 扩展字段7 |
|||
*/ |
|||
private Long attribute7; |
|||
|
|||
/** |
|||
* 扩展字段8 |
|||
*/ |
|||
private Long attribute8; |
|||
|
|||
/** |
|||
* 扩展字段9 |
|||
*/ |
|||
private Date attribute9; |
|||
|
|||
/** |
|||
* 扩展字段10 |
|||
*/ |
|||
private Date attribute10; |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
package com.epmet.opendata.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ca_sys_dict") |
|||
public class CaSysDictEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 字典ID |
|||
*/ |
|||
private Long dictId; |
|||
|
|||
/** |
|||
* 字典值,例如:sex/F |
|||
*/ |
|||
private String dictValue; |
|||
|
|||
/** |
|||
* 1.字典组名称(性别)或者字典名称(女) |
|||
*/ |
|||
private String dictLabel; |
|||
|
|||
/** |
|||
* 字典值时存入字典的值,字典组时存null |
|||
*/ |
|||
private String dictType; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
private String dictDesc; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer dictSort; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private Long createBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createDate; |
|||
|
|||
/** |
|||
* 最后修改人 |
|||
*/ |
|||
private Long updateBy; |
|||
|
|||
/** |
|||
* 最后修改时间 |
|||
*/ |
|||
private Date updateDate; |
|||
|
|||
/** |
|||
* 字典值:normal正常,deleted正常 |
|||
*/ |
|||
private String deleteFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer versions; |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
package com.epmet.opendata.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Data |
|||
public class CaBmCategoryExcel { |
|||
|
|||
@Excel(name = "类别ID") |
|||
private Long categoryId; |
|||
|
|||
@Excel(name = "名称") |
|||
private String categoryName; |
|||
|
|||
@Excel(name = "") |
|||
private String categoryType; |
|||
|
|||
@Excel(name = "名称值") |
|||
private String categoryValue; |
|||
|
|||
@Excel(name = "父类别ID") |
|||
private Long parentCategoryId; |
|||
|
|||
@Excel(name = "展示顺序") |
|||
private Integer categorySort; |
|||
|
|||
@Excel(name = "创建人") |
|||
private Long createBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createDate; |
|||
|
|||
@Excel(name = "最后修改人") |
|||
private Long updateBy; |
|||
|
|||
@Excel(name = "最后修改时间") |
|||
private Date updateDate; |
|||
|
|||
@Excel(name = "删除状态") |
|||
private String deleteFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer versions; |
|||
|
|||
@Excel(name = "扩展字段1") |
|||
private String attribute1; |
|||
|
|||
@Excel(name = "扩展字段2") |
|||
private String attribute2; |
|||
|
|||
@Excel(name = "扩展字段3") |
|||
private String attribute3; |
|||
|
|||
@Excel(name = "扩展字段4") |
|||
private String attribute4; |
|||
|
|||
@Excel(name = "扩展字段5") |
|||
private String attribute5; |
|||
|
|||
@Excel(name = "扩展字段6") |
|||
private Long attribute6; |
|||
|
|||
@Excel(name = "扩展字段7") |
|||
private Long attribute7; |
|||
|
|||
@Excel(name = "扩展字段8") |
|||
private Long attribute8; |
|||
|
|||
@Excel(name = "扩展字段9") |
|||
private Date attribute9; |
|||
|
|||
@Excel(name = "扩展字段10") |
|||
private Date attribute10; |
|||
|
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.epmet.opendata.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Data |
|||
public class CaSysDictExcel { |
|||
|
|||
@Excel(name = "字典ID") |
|||
private Long dictId; |
|||
|
|||
@Excel(name = "字典值,例如:sex/F") |
|||
private String dictValue; |
|||
|
|||
@Excel(name = "1.字典组名称(性别)或者字典名称(女)") |
|||
private String dictLabel; |
|||
|
|||
@Excel(name = "字典值时存入字典的值,字典组时存null") |
|||
private String dictType; |
|||
|
|||
@Excel(name = "描述") |
|||
private String dictDesc; |
|||
|
|||
@Excel(name = "排序") |
|||
private Integer dictSort; |
|||
|
|||
@Excel(name = "创建人") |
|||
private Long createBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createDate; |
|||
|
|||
@Excel(name = "最后修改人") |
|||
private Long updateBy; |
|||
|
|||
@Excel(name = "最后修改时间") |
|||
private Date updateDate; |
|||
|
|||
@Excel(name = "字典值:normal正常,deleted正常") |
|||
private String deleteFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer versions; |
|||
|
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.opendata.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Component |
|||
public class CaBmCategoryRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.opendata.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Component |
|||
public class CaSysDictRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,90 @@ |
|||
package com.epmet.opendata.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.opendata.dto.ca.CaBmCategoryDTO; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.entity.CaBmCategoryEntity; |
|||
|
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
public interface CaBmCategoryService extends BaseService<CaBmCategoryEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<CaBmCategoryDTO> |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
PageData<CaBmCategoryDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<CaBmCategoryDTO> |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
List<CaBmCategoryDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return CaBmCategoryDTO |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
CaBmCategoryDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
void save(CaBmCategoryDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
void update(CaBmCategoryDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 调用ruoyi接口存储数据 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author LZN |
|||
* @date 2022/6/16 16:38 |
|||
*/ |
|||
void preserBmCategoryVation(PreserVationFormDTO dto); |
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.epmet.opendata.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.opendata.dto.ca.CaSysDictDTO; |
|||
import com.epmet.opendata.entity.CaSysDictEntity; |
|||
|
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
public interface CaSysDictService extends BaseService<CaSysDictEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<CaSysDictDTO> |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
PageData<CaSysDictDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<CaSysDictDTO> |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
List<CaSysDictDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return CaSysDictDTO |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
CaSysDictDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
void save(CaSysDictDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
void update(CaSysDictDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-06-16 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,173 @@ |
|||
package com.epmet.opendata.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
|
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dao.CaBmCategoryDao; |
|||
import com.epmet.opendata.dto.ca.CaBmCategoryDTO; |
|||
import com.epmet.opendata.dto.constant.CaWghDataConstant; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.entity.CaBmCategoryEntity; |
|||
import com.epmet.opendata.entity.CaLoudongEntity; |
|||
import com.epmet.opendata.redis.CaBmCategoryRedis; |
|||
import com.epmet.opendata.service.CaBmCategoryService; |
|||
import com.epmet.opendata.util.AesUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 多级类型信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Service |
|||
public class CaBmCategoryServiceImpl extends BaseServiceImpl<CaBmCategoryDao, CaBmCategoryEntity> implements CaBmCategoryService { |
|||
|
|||
@Autowired |
|||
private CaBmCategoryRedis caBmCategoryRedis; |
|||
|
|||
@Override |
|||
public PageData<CaBmCategoryDTO> page(Map<String, Object> params) { |
|||
IPage<CaBmCategoryEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, CaBmCategoryDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<CaBmCategoryDTO> list(Map<String, Object> params) { |
|||
List<CaBmCategoryEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, CaBmCategoryDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<CaBmCategoryEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<CaBmCategoryEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public CaBmCategoryDTO get(String id) { |
|||
CaBmCategoryEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, CaBmCategoryDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(CaBmCategoryDTO dto) { |
|||
CaBmCategoryEntity entity = ConvertUtils.sourceToTarget(dto, CaBmCategoryEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(CaBmCategoryDTO dto) { |
|||
CaBmCategoryEntity entity = ConvertUtils.sourceToTarget(dto, CaBmCategoryEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 调用ruoyi接口存储数据 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author LZN |
|||
* @date 2022/6/16 16:38 |
|||
*/ |
|||
@Override |
|||
public void preserBmCategoryVation(PreserVationFormDTO dto) { |
|||
int i = baseDao.deleteAll(); |
|||
if (i >= 0) { |
|||
dto.setPageNo(NumConstant.ONE); |
|||
dto.setPageSize(CaWghDataConstant.PAGE_LIMIT); |
|||
dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_UNICOM); |
|||
dto.setTableName(CaWghDataConstant.UNICOM_BM_CATEGORY); |
|||
|
|||
dto.setWhereCase("delete_flag = 'normal'"); |
|||
dto.setOrderBy("category_id,parent_category_id,create_date,update_date"); |
|||
|
|||
int pageNo = 1; |
|||
|
|||
int total = 0; |
|||
|
|||
do { |
|||
try { |
|||
total = listCategory(dto); |
|||
pageNo++; |
|||
dto.setPageNo(pageNo); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} while (total > (pageNo * NumConstant.FIFTY)); |
|||
} |
|||
|
|||
} |
|||
|
|||
private int listCategory(PreserVationFormDTO dto) throws Exception { |
|||
String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), CaWghDataConstant.AESKEY); |
|||
JSONObject obj = new JSONObject(); |
|||
obj.put(CaWghDataConstant.UNICOM_CONDITION, aes); |
|||
String data = HttpClientManager.getInstance().sendPostByJSON(CaWghDataConstant.DATA_URL_UNICON, obj.toJSONString()).getData(); |
|||
JSONObject toResult = JSON.parseObject(data); |
|||
Result result = ConvertUtils.mapToEntity(toResult, Result.class); |
|||
if (!result.success()) { |
|||
return dto.getPageNo() + 1; |
|||
} |
|||
|
|||
ReturnDate returnDate = JSONObject.parseObject(JSONObject.toJSONString(result.getData()), ReturnDate.class); |
|||
this.insertBatch(returnDate.getList()); |
|||
return returnDate.getTotal(); |
|||
} |
|||
|
|||
static class ReturnDate { |
|||
|
|||
private int total; |
|||
private List<CaBmCategoryEntity> list; |
|||
|
|||
|
|||
public int getTotal() { |
|||
return total; |
|||
} |
|||
|
|||
public void setTotal(int total) { |
|||
this.total = total; |
|||
} |
|||
|
|||
public List<CaBmCategoryEntity> getList() { |
|||
return list; |
|||
} |
|||
|
|||
public void setList(List<CaBmCategoryEntity> list) { |
|||
this.list = list; |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,87 @@ |
|||
package com.epmet.opendata.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.opendata.dao.CaSysDictDao; |
|||
import com.epmet.opendata.dto.ca.CaSysDictDTO; |
|||
import com.epmet.opendata.entity.CaSysDictEntity; |
|||
import com.epmet.opendata.redis.CaSysDictRedis; |
|||
import com.epmet.opendata.service.CaSysDictService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 字典信息表,字典值和字典组均存入此表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-16 |
|||
*/ |
|||
@Service |
|||
public class CaSysDictServiceImpl extends BaseServiceImpl<CaSysDictDao, CaSysDictEntity> implements CaSysDictService { |
|||
|
|||
@Autowired |
|||
private CaSysDictRedis caSysDictRedis; |
|||
|
|||
@Override |
|||
public PageData<CaSysDictDTO> page(Map<String, Object> params) { |
|||
IPage<CaSysDictEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, CaSysDictDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<CaSysDictDTO> list(Map<String, Object> params) { |
|||
List<CaSysDictEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, CaSysDictDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<CaSysDictEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<CaSysDictEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public CaSysDictDTO get(String id) { |
|||
CaSysDictEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, CaSysDictDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(CaSysDictDTO dto) { |
|||
CaSysDictEntity entity = ConvertUtils.sourceToTarget(dto, CaSysDictEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(CaSysDictDTO dto) { |
|||
CaSysDictEntity entity = ConvertUtils.sourceToTarget(dto, CaSysDictEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
<?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.epmet.opendata.dao.CaBmCategoryDao"> |
|||
|
|||
<resultMap type="com.epmet.opendata.entity.CaBmCategoryEntity" id="caBmCategoryMap"> |
|||
<result property="categoryId" column="category_id"/> |
|||
<result property="categoryName" column="category_name"/> |
|||
<result property="categoryType" column="category_type"/> |
|||
<result property="categoryValue" column="category_value"/> |
|||
<result property="parentCategoryId" column="parent_category_id"/> |
|||
<result property="categorySort" column="category_sort"/> |
|||
<result property="createBy" column="create_by"/> |
|||
<result property="createDate" column="create_date"/> |
|||
<result property="updateBy" column="update_by"/> |
|||
<result property="updateDate" column="update_date"/> |
|||
<result property="deleteFlag" column="delete_flag"/> |
|||
<result property="versions" column="versions"/> |
|||
<result property="attribute1" column="attribute1"/> |
|||
<result property="attribute2" column="attribute2"/> |
|||
<result property="attribute3" column="attribute3"/> |
|||
<result property="attribute4" column="attribute4"/> |
|||
<result property="attribute5" column="attribute5"/> |
|||
<result property="attribute6" column="attribute6"/> |
|||
<result property="attribute7" column="attribute7"/> |
|||
<result property="attribute8" column="attribute8"/> |
|||
<result property="attribute9" column="attribute9"/> |
|||
<result property="attribute10" column="attribute10"/> |
|||
</resultMap> |
|||
<delete id="deleteAll"> |
|||
delete from ca_bm_category |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,22 @@ |
|||
<?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.epmet.opendata.dao.CaSysDictDao"> |
|||
|
|||
<resultMap type="com.epmet.opendata.entity.CaSysDictEntity" id="caSysDictMap"> |
|||
<result property="dictId" column="dict_id"/> |
|||
<result property="dictValue" column="dict_value"/> |
|||
<result property="dictLabel" column="dict_label"/> |
|||
<result property="dictType" column="dict_type"/> |
|||
<result property="dictDesc" column="dict_desc"/> |
|||
<result property="dictSort" column="dict_sort"/> |
|||
<result property="createBy" column="create_by"/> |
|||
<result property="createDate" column="create_date"/> |
|||
<result property="updateBy" column="update_by"/> |
|||
<result property="updateDate" column="update_date"/> |
|||
<result property="deleteFlag" column="delete_flag"/> |
|||
<result property="versions" column="versions"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue