Commit 3d21fb98 authored by “yiyousong”'s avatar “yiyousong”
parents 8d2fb69e d7b0b0f7
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -30,6 +30,7 @@
"qs": "^6.10.3",
"secure-ls": "^1.2.6",
"swiper": "5",
"three": "^0.155.0",
"v-viewer": "^1.6.4",
"vue": "^2.6.14",
"vue-highlightjs": "^1.3.3",
......
<template>
<div class="actuary w-full h-auto">
<Start class="start"/>
<div class="act_cont">
<div class="act_tit">
<h1>智慧政务数据精算</h1>
......@@ -7,29 +8,19 @@
运用以人工智能为代表的新技术,驱动政务服务模式创新,为人民提供更加智慧化、人性化的政务服务,实现互联网与政务服务深度融合,大幅提升政务服务智慧化水平,让政府服务更聪明,让企业和市民办事更方便、更快捷、更有效率。
</p>
</div>
<div class="act_mod">
<div
class="mod_max"
v-for="item of menuPermission"
<div class="over_act_mod">
<div class="act_mod" ref="mode">
<div class="act_mod_item" v-for="(item,index) of menuPermission"
:key="item.id"
@click="handleJump(item.url)"
>
<div class="flip">
<div class="mod_min">
<img
:src="
item.imgPath
? api + item.imgPath
: require('../../assets/images/qyhx.png')
"
alt
/>
<div class="mod_cont">
<p class="name">{{ item.name }}</p>
<p class="remark">
{{ item.remark }}
</p>
@mouseover="hoverItem(index)"
@mouseleave="hoverleave(index)"
:style="{background: `url(${require('@/assets/images/dataActuary/'+(index+1)+'.png')}) no-repeat`}">
<div class="actitem_tit">
{{item.name}}
</div>
<div class="actitem_p">
{{item.hover?item.remark:'Business data analysis'}}
</div>
</div>
</div>
......@@ -41,6 +32,7 @@
<script>
import menu from "@/mixins/menu";
import Storage from "@/utils/js/Storage";
import Start from "./demo2"
export default {
mixins: [menu],
data() {
......@@ -49,6 +41,9 @@ export default {
menuPermission: [],
};
},
components:{
Start
},
created() {
this.getMenuList(true);
......@@ -57,6 +52,23 @@ export default {
},
methods: {
hoverItem(index){
this.menuPermission[index].hover = true
this.$refs.mode.style.transition="all 1s ease 0s";
// 如果大于6就要往前移动
if(index>5){
let num = index-5
this.$refs.mode.style.transform="translateX(-"+num*190+"px)";
this.$forceUpdate()
}
},
hoverleave(index){
this.$refs.mode.style.transform="translate(0, 0)";
this.$refs.mode.style.transition="all .5s ease 0s";
this.menuPermission[index].hover = false
this.$forceUpdate()
},
// 跳转
handleJump(url) {
this.$router.push(url);
......@@ -66,7 +78,7 @@ export default {
let { menuList } = Storage.get(2, "userInfo");
let actuary = menuList.filter((v) => v.name === "数据精算");
if (actuary.length) {
this.menuPermission = actuary
let arr = actuary
.map((v) => {
if (v.childList.length) {
return v.childList;
......@@ -75,6 +87,10 @@ export default {
}
})
.flat();
arr.forEach(item=>{
item.hover = false
})
this.menuPermission = arr
}
},
},
......@@ -83,85 +99,144 @@ export default {
<style lang="less" scoped>
@headerH: 4.5rem;
@keyframes startopen{
0% {
width: 170px;
}
100% {
width: 551px;
}
}
@keyframes leaveopen{
0% {
width: 551px;
background-size: 100% 100%;
}
100% {
background-size: 100% 100%;
width: 170px;
}
}
.start{
position: absolute;
bottom: 0;
z-index: 0;
overflow: hidden;
}
.actuary {
background: url("~@/assets/images/jinsuanbg.png") center no-repeat;
background: url("~@/assets/images/dataActuary/bg.png") center no-repeat;
background-size: cover;
padding-top: @headerH;
.act_cont {
margin: 120px auto;
position: relative;
z-index: 3;
.act_tit {
text-align: center;
margin: auto;
max-width: 800px;
max-width: 1300px;
h1 {
font-weight: 700;
font-size: 44px;
color: #ffffff;
font-size: 53px;
font-family: FZZhengHeiS-EB-GB;
color: #FFFFFF;
line-height: 64px;
letter-spacing: 6px;
background: linear-gradient(0deg, #D2F8FF 0%, #FFFFFF 88.37890625%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
p {
font-weight: 400;
font-size: 14px;
color: #ffffff;
line-height: 20px;
padding-top: 20px;
text-align: left;
font-size: 22px;
font-family: Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
line-height: 34px;
}
}
.over_act_mod{
width: 1520px;
overflow: hidden;
margin: 50px auto 0;
}
.act_mod {
margin: 30px 100px 0;
display: flex;
flex-wrap: wrap;
.mod_max {
width: 344px;
height: 200px;
padding: 18px;
justify-content: space-between;
transition: all 1s ease 0s;
cursor: pointer;
&:hover > .flip {
transform: translateY(-10px);
.act_mod_item:hover{
// animation: startopen 1s normal 1 forwards;
transition: all 1s ease 0s;
overflow: hidden;
flex-shrink: 0;
width: 551px;
height: 450px;
background: url('~@/assets/images/dataActuary/bg-open.png') center no-repeat !important;
background-size: 100% 100%;
border-radius: 12px;
box-sizing: border-box;
padding: 90px 50px;
.actitem_tit{
width: 350px;
font-size: 31px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #FFFFFF;
line-height: 59px;
margin-bottom: 20px;
}
.flip {
width: 100%;
height: 100%;
border-radius: 8px;
background-color: #ffffff;
transition: all linear 200ms;
.actitem_tit::before{
content: none;
}
.mod_min {
width: 285px;
height: 100%;
margin: auto;
display: flex;
align-items: center;
img {
width: 85px;
height: 72px;
.actitem_p{
width: 350px;
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
line-height: 28px;
}
.mod_cont {
width: 100%;
.name {
font-size: 18px;
font-weight: bold;
padding-bottom: 10px;
text-align: center;
}
.remark {
font-size: 14px;
line-height: 18px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
overflow: hidden;
.act_mod_item{
// animation: leaveopen .5s normal 1 forwards;
transition: all .5s ease 0s;
flex-shrink: 0;
width: 170px;
height: 450px;
border-radius: 12px;
margin:0 10px;
.actitem_p{
padding: 0 10px;
font-size: 12px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #0857E8;
line-height: 38px;
opacity: 0.7;
}
.actitem_tit{
font-size: 20px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #0857E8;
line-height: 38px;
padding:40px 10px 8px;
position: relative;
}
.actitem_tit::before{
content: "";
position: absolute;
left: 10px;
bottom: 0;
width: 30px;
height: 2px;
background: linear-gradient(to bottom right, #0857E8, #fff);
}
}
}
......
<template>
<div id="indexLizi" class="demo"></div>
</template>
<script>
import * as THREE from "three";
export default {
name: "Pointwave",
props: {
amountX: {
type: Number,
default: 50,
},
amountY: {
type: Number,
default: 50,
},
color: {
type: String,
default: "#10cbff",
},
top: {
type: Number,
default: 350,
},
},
data() {
return {
count: 0,
// 用来跟踪鼠标水平位置
mouseX: 0,
windowHalfX: null,
// 相机
camera: null,
// 场景
scene: null,
// 批量管理粒子
particles: null,
// 渲染器
renderer: null,
};
},
mounted() {
this.init();
this.animate();
},
methods: {
init() {
const SEPARATION = 100;
const SCREEN_WIDTH = window.innerWidth;
const SCREEN_HEIGHT = window.innerHeight;
const container = document.createElement("div");
this.windowHalfX = window.innerWidth / 2;
container.style.position = "relative";
container.style.top = `${this.top}px`;
container.style.height = `${SCREEN_HEIGHT - this.top}px`;
document.getElementById("indexLizi").appendChild(container);
this.camera = new THREE.PerspectiveCamera(
75,
SCREEN_WIDTH / SCREEN_HEIGHT,
1,
10000
);
this.camera.position.z = 1000;
this.scene = new THREE.Scene();
const numParticles = this.amountX * this.amountY;
const positions = new Float32Array(numParticles * 3);
const scales = new Float32Array(numParticles);
// 初始化粒子位置和大小
let i = 0;
let j = 0;
for (let ix = 0; ix < this.amountX; ix++) {
for (let iy = 0; iy < this.amountY; iy++) {
positions[i] = ix * SEPARATION - (this.amountX * SEPARATION) / 2;
positions[i + 1] = 0;
positions[i + 2] = iy * SEPARATION - (this.amountY * SEPARATION) / 2;
scales[j] = 1;
i += 3;
j++;
}
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.BufferAttribute(positions, 3)
);
geometry.setAttribute("scale", new THREE.BufferAttribute(scales, 1));
// 初始化粒子材质
const material = new THREE.ShaderMaterial({
uniforms: {
color: { value: new THREE.Color(this.color) },
},
vertexShader: `
attribute float scale;
void main() {
vec4 mvPosition = modelViewMatrix * vec4( position, 2.0 );
gl_PointSize = scale * ( 300.0 / - mvPosition.z );
gl_Position = projectionMatrix * mvPosition;
}
`,
fragmentShader: `
uniform vec3 color;
void main() {
if ( length( gl_PointCoord - vec2( 0.5, 0.5 ) ) > 0.475 ) discard;
gl_FragColor = vec4( color, 1.0 );
}
`,
});
this.particles = new THREE.Points(geometry, material);
this.scene.add(this.particles);
this.renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
this.renderer.setSize(container.clientWidth, container.clientHeight);
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.setClearAlpha(0);
container.appendChild(this.renderer.domElement);
window.addEventListener("resize", this.onWindowResize, {
passive: false,
});
document.addEventListener("mousemove", this.onDocumentMouseMove, {
passive: false,
});
document.addEventListener("touchstart", this.onDocumentTouchStart, {
passive: false,
});
document.addEventListener("touchmove", this.onDocumentTouchMove, {
passive: false,
});
},
render() {
this.camera.position.x += (this.mouseX - this.camera.position.x) * 0.05;
this.camera.position.y = 400;
this.camera.lookAt(this.scene.position);
const positions = this.particles.geometry.attributes.position.array;
const scales = this.particles.geometry.attributes.scale.array;
// 计算粒子位置及大小
let i = 0;
let j = 0;
for (let ix = 0; ix < this.amountX; ix++) {
for (let iy = 0; iy < this.amountY; iy++) {
positions[i + 1] =
Math.sin((ix + this.count) * 0.3) * 100 +
Math.sin((iy + this.count) * 0.5) * 100;
scales[j] =
(Math.sin((ix + this.count) * 0.3) + 1) * 8 +
(Math.sin((iy + this.count) * 0.5) + 1) * 8;
i += 3;
j++;
}
}
// 重新渲染粒子
this.particles.geometry.attributes.position.needsUpdate = true;
this.particles.geometry.attributes.scale.needsUpdate = true;
this.renderer.render(this.scene, this.camera);
this.count += 0.1;
},
animate() {
requestAnimationFrame(this.animate);
this.render();
// setInterval(() => {
// }, 50);
},
onDocumentMouseMove(event) {
this.mouseX = event.clientX - this.windowHalfX;
},
onDocumentTouchStart(event) {
if (event.touches.length === 1) {
this.mouseX = event.touches[0].pageX - this.windowHalfX;
}
},
onDocumentTouchMove(event) {
if (event.touches.length === 1) {
event.preventDefault();
this.mouseX = event.touches[0].pageX - this.windowHalfX;
}
},
onWindowResize() {
this.windowHalfX = window.innerWidth / 2;
this.camera.aspect = window.innerWidth / window.innerHeight;
this.camera.updateProjectionMatrix();
this.renderer.setSize(window.innerWidth, window.innerHeight);
},
},
};
</script>
<style lang="less" scoped>
.demo {
width: 100%;
height: 100%;
// background: url("@/assets/img/demo/bg.png") no-repeat center;
}
</style>
\ No newline at end of file
This diff is collapsed.
......@@ -41,3 +41,16 @@ CREATE TABLE `mortals_xhx_user_pwd_record` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户密码修改记录';
UPDATE mortals_xhx_user SET lastUpdatePwdTime=NOW();
-- ----------------------------
2023-08-29
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_user_model_collect`;
CREATE TABLE `mortals_xhx_user_model_collect` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,自增长',
`userId` bigint(20) DEFAULT NULL COMMENT '用户ID,主键,自增长',
`realName` varchar(64) DEFAULT NULL COMMENT '登录名',
`modelIds` varchar(128) DEFAULT NULL COMMENT '收藏模块',
`createTime` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户模块收藏';
\ No newline at end of file
......@@ -5,9 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.code.ModelTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.ModelPdu;
import com.mortals.xhx.feign.model.IApiModelFeign;
......@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -113,6 +114,73 @@ public class ModelController extends BaseJsonBodyController {
return ret;
}
/**
* 根据站点id查询模块列表
* @param query
* @return
*/
@PostMapping({"list/group"})
public Rest<Object> getListGroup(@RequestBody ModelVO query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询站点编排" ;
int code=1;
try {
if(this.getCurUser()==null){
throw new AppException("未登录或者登录过期");
}
ModelPdu modelPdu = new ModelPdu();
modelPdu.setSiteId(query.getSiteId());
if(this.getCurUser().getId()==1 && StringUtils.isEmpty(this.getCurUser().getSiteIds())){
modelPdu.setIsAdmin(1);
}else {
modelPdu.setIsAdmin(0);
}
//ApiResp<List<ModelFeignVO>> apiResp = apiModelFeign.getModelBySiteId(modelPdu);
String resp = apiModelFeign.getModelBySiteId(modelPdu);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取站点列表信息失败:" + apiResp.getMsg());
}
Map<Long,Long> map = roleModelService.getModelIdsUserId(this.getCurUser().getId());
List<ModelFeignVO> modelFeignVOList = JSONObject.parseArray(apiResp.getData().get("data").toString(),ModelFeignVO.class);
List<ModelFeignVO> list = modelFeignVOList.stream().filter(item->map.containsKey(item.getId())).collect(Collectors.toList());
if(this.getCurUser().getId()==1){
model.put("data", doGroup(modelFeignVOList));
}else {
model.put("data", doGroup(list));
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
private List<Map<String,Object>> doGroup(List<ModelFeignVO> result){
Map<Integer,List<ModelFeignVO>> groupMap = result.stream().collect(Collectors.groupingBy(t -> t.getType()));
List<Map<String,Object>> mapList = new ArrayList<>();
Map<String,Object> jcMap = new HashMap<>();
jcMap.put("type",ModelTypeEnum.JC.getDesc());
jcMap.put("list",groupMap.get(ModelTypeEnum.JC.getValue()));
mapList.add(jcMap);
Map<String,Object> g2gMap = new HashMap<>();
jcMap.put("type",ModelTypeEnum.G2G.getDesc());
jcMap.put("list",groupMap.get(ModelTypeEnum.G2G.getValue()));
mapList.add(g2gMap);
Map<String,Object> g2cMap = new HashMap<>();
jcMap.put("type",ModelTypeEnum.G2C.getDesc());
jcMap.put("list",groupMap.get(ModelTypeEnum.G2C.getValue()));
mapList.add(g2cMap);
return mapList;
}
/**
* 根据站点id查询数据管理列表
* @param query
......
......@@ -13,5 +13,5 @@ import java.util.List;
public interface PageInfoDao extends ICRUDDao<PageInfoEntity,Long>{
List<PageInfoEntity> getProductList();
}
package com.mortals.xhx.module.page.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.page.dao.PageInfoDao;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 产品页面配置DaoImpl DAO接口
......@@ -17,5 +17,8 @@ import java.util.List;
public class PageInfoDaoImpl extends BaseCRUDDaoMybatis<PageInfoEntity,Long> implements PageInfoDao {
@Override
public List<PageInfoEntity> getProductList() {
return this.getSqlSession().selectList(this.getSqlId("getProductList"));
}
}
package com.mortals.xhx.module.page.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 产品页面配置视图对象
*
......@@ -11,4 +8,13 @@ import java.util.List;
*/
public class PageInfoVo extends BaseEntityLong {
private Long platformId;
public Long getPlatformId() {
return platformId;
}
public void setPlatformId(Long platformId) {
this.platformId = platformId;
}
}
\ No newline at end of file
......@@ -3,6 +3,9 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import java.util.List;
/**
* PageInfoService
*
......@@ -21,4 +24,6 @@ public interface PageInfoService extends ICRUDService<PageInfoEntity,Long>{
* @throws AppException
*/
PageInfoEntity saveScreen(PageInfoEntity entity, Context context) throws AppException;
List<PageInfoEntity> getProductList() throws AppException;
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import com.mortals.xhx.module.page.model.PageInfoEntity;
import com.mortals.xhx.module.page.service.PageInfoService;
import java.util.Date;
import java.util.List;
/**
* PageInfoService
......@@ -82,6 +83,11 @@ public class PageInfoServiceImpl extends AbstractCRUDServiceImpl<PageInfoDao, Pa
}
}
@Override
public List<PageInfoEntity> getProductList() throws AppException {
return dao.getProductList();
}
private void doSaveImageBase64(PageInfoEntity entity,String oldName){
String base64 = String.valueOf(entity.getScreenUrl());
base64 = base64.replaceAll("data:image/png;base64,","");
......
......@@ -6,7 +6,6 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.product.ProductPdu;
import com.mortals.xhx.feign.product.IProductFeign;
import com.mortals.xhx.module.page.model.PageInfoEntity;
......@@ -57,18 +56,14 @@ public class PageInfoController extends BaseCRUDJsonBodyMappingController<PageIn
Context context = this.getContext();
String busiDesc = "查询产品列表";
int code;
int code=1;
try {
Rest<RespData<List<ProductPdu>>> result = productFeign.list(query);
code = result.getCode();
if(code > 0) {
model.put("data", result.getData().getData());
model.put("pageInfo", result.getData().getPageInfo());
model.put("dict", result.getData().getDict());
model.put("message_info", busiDesc + "成功");
}else {
model.put("message_info", result.getMsg());
List<PageInfoEntity> result = service.getProductList();
for(PageInfoEntity item:result){
item.setPlatformId(item.getProductId());
}
model.put("data", result);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
......
package com.mortals.xhx.module.user.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import java.util.List;
/**
* 用户模块收藏Dao
* 用户模块收藏 DAO接口
*
* @author zxfei
* @date 2023-08-29
*/
public interface UserModelCollectDao extends ICRUDDao<UserModelCollectEntity,Long>{
}
package com.mortals.xhx.module.user.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.user.dao.UserModelCollectDao;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import org.springframework.stereotype.Repository;
/**
* 用户模块收藏DaoImpl DAO接口
*
* @author zxfei
* @date 2023-08-29
*/
@Repository("userModelCollectDao")
public class UserModelCollectDaoImpl extends BaseCRUDDaoMybatis<UserModelCollectEntity,Long> implements UserModelCollectDao {
}
package com.mortals.xhx.module.user.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.user.model.vo.UserModelCollectVo;
import lombok.Data;
/**
* 用户模块收藏实体对象
*
* @author zxfei
* @date 2023-08-29
*/
@Data
public class UserModelCollectEntity extends UserModelCollectVo {
private static final long serialVersionUID = 1L;
/**
* 用户ID,主键,自增长
*/
private Long userId;
/**
* 登录名
*/
private String realName;
/**
* 收藏模块
*/
private String modelIds;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof UserModelCollectEntity) {
UserModelCollectEntity tmp = (UserModelCollectEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.userId = -1L;
this.realName = "";
this.modelIds = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.user.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户模块收藏视图对象
*
* @author zxfei
* @date 2023-08-29
*/
@Data
public class UserModelCollectVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.user.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import com.mortals.xhx.module.user.dao.UserModelCollectDao;
/**
* UserModelCollectService
*
* 用户模块收藏 service接口
*
* @author zxfei
* @date 2023-08-29
*/
public interface UserModelCollectService extends ICRUDService<UserModelCollectEntity,Long>{
UserModelCollectDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.user.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.user.dao.UserModelCollectDao;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import com.mortals.xhx.module.user.service.UserModelCollectService;
import lombok.extern.slf4j.Slf4j;
/**
* UserModelCollectService
* 用户模块收藏 service实现
*
* @author zxfei
* @date 2023-08-29
*/
@Service("userModelCollectService")
@Slf4j
public class UserModelCollectServiceImpl extends AbstractCRUDServiceImpl<UserModelCollectDao, UserModelCollectEntity, Long> implements UserModelCollectService {
}
\ No newline at end of file
package com.mortals.xhx.module.user.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.utils.BeanUtil;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.ModelPdu;
import com.mortals.xhx.feign.model.IApiModelFeign;
import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import com.mortals.xhx.module.user.service.UserModelCollectService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
/**
*
* 用户模块收藏
*
* @author zxfei
* @date 2023-08-29
*/
@RestController
@RequestMapping("user/model/collect")
public class UserModelCollectController extends BaseCRUDJsonBodyMappingController<UserModelCollectService,UserModelCollectEntity,Long> {
@Autowired
private IApiModelFeign apiModelFeign;
public UserModelCollectController(){
super.setModuleDesc( "用户模块收藏");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
@PostMapping({"get"})
public String getCollect() {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "查看" + this.getModuleDesc();
Context context = this.getContext();
model.put("data", Collections.emptyList());
try {
UserModelCollectEntity query = new UserModelCollectEntity();
query.setUserId(this.getCurUser().getId());
UserModelCollectEntity entity = this.service.selectOne(query);
if (entity == null) {
entity = new UserModelCollectEntity();
entity.setUserId(this.getCurUser().getId());
entity.setRealName(this.getCurUser().getRealName());
entity.setModelIds("");
}else {
if(StringUtils.isNotEmpty(entity.getModelIds())){
List<Long> idList = new ArrayList();
for(String id:entity.getModelIds().split(",")){
Long idL = DataUtil.converStr2Long(id,0l);
idList.add(idL);
}
ModelPdu pdu = new ModelPdu();
pdu.setIdList(idList);
String resp = apiModelFeign.getModelByQuery(pdu);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取站点列表信息失败:" + apiResp.getMsg());
}
model.put("data", apiResp.getData().get("data"));
}
}
model.put("message_info", busiDesc + "成功");
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
ret.put("data", model.get("data"));
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
@Override
@PostMapping({"save"})
@RepeatSubmit
public String save(@RequestBody UserModelCollectEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
int code = 1;
String busiDesc = "保存" + this.getModuleDesc();
if(StringUtils.isEmpty(entity.getModelIds())){
return this.createFailJsonResp("请选择要收藏的模块");
}
try {
UserModelCollectEntity query = new UserModelCollectEntity();
query.setUserId(this.getCurUser().getId());
UserModelCollectEntity temp = this.service.selectOne(query);
if (temp == null) {
Class<UserModelCollectEntity> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
UserModelCollectEntity initEntity = (UserModelCollectEntity)tClass.newInstance();
initEntity.initAttrValue();
BeanUtils.copyProperties(entity, initEntity, BeanUtil.getNullPropertyNames(entity));
entity = initEntity;
busiDesc = "新增" + this.getModuleDesc();
initEntity.setCreateTime(new Date());
IUser user = this.getCurUser();
if (user != null) {
initEntity.setUserId(user.getId());
initEntity.setRealName(user.getRealName());
}
this.service.save(initEntity, context);
} else {
busiDesc = "修改" + this.getModuleDesc();
entity.setId(temp.getId());
this.service.update(entity, context);
}
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var9);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.page.dao.ibatis.PageInfoDaoImpl">
<select id="getProductList" resultMap="PageInfoEntity-Map">
SELECT DISTINCT t.productId,t.productName FROM mortals_xhx_page_info t ORDER BY t.productId;
</select>
</mapper>
\ No newline at end of file
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