QyzxController.java 19.4 KB
Newer Older
yuquan.zhu committed
1 2 3 4 5
package cn.timer.api.controller.qyzx;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
邓实川 committed
6
import java.util.stream.Collectors;
yuquan.zhu committed
7 8 9 10 11
import java.util.stream.Stream;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.web.bind.annotation.DeleteMapping;
yuquan.zhu committed
13 14 15 16 17 18
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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;
邓实川 committed
19

yuquan.zhu committed
20 21 22
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
邓实川 committed
23 24
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
东州 翁 committed
25
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
yuquan.zhu committed
26 27 28

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
邓实川 committed
29
import cn.hutool.core.util.ObjectUtil;
tangzhaoqian committed
30 31
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
yuquan.zhu committed
32 33 34 35
import cn.timer.api.bean.qyzx.QyzxAttaFwjsb;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
36
import cn.timer.api.bean.qyzx.QyzxInvoiceUsual;
yuquan.zhu committed
37
import cn.timer.api.bean.qyzx.QyzxLogBuy;
tangzhaoqian committed
38
import cn.timer.api.bean.qyzx.QyzxOperLog;
yuquan.zhu committed
39
import cn.timer.api.bean.qyzx.QyzxPayServe;
40
import cn.timer.api.bean.qyzx.QyzxSuggestionFeeback;
yuquan.zhu committed
41 42 43 44 45
import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.CommonEnum;
46
import cn.timer.api.config.enums.SysRoleType;
yuquan.zhu committed
47 48 49
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.qyzx.QyzxEntInfoMMapper;
50
import cn.timer.api.dao.qyzx.QyzxInvoiceUsualMapper;
yuquan.zhu committed
51
import cn.timer.api.dao.qyzx.QyzxLogBuyMapper;
tangzhaoqian committed
52
import cn.timer.api.dao.qyzx.QyzxOperLogMapper;
53
import cn.timer.api.dao.qyzx.QyzxPayServeMapper;
yuquan.zhu committed
54 55 56 57
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.login.QysDto;
import cn.timer.api.dto.qyzx.AdminListDto;
import cn.timer.api.dto.qyzx.AttaFpglQueryDto;
58
import cn.timer.api.dto.qyzx.EntauthDto;
yuquan.zhu committed
59
import cn.timer.api.dto.qyzx.LogBuyDto;
tangzhaoqian committed
60
import cn.timer.api.dto.qyzx.QyzxOperLogQuaryDto;
yuquan.zhu committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@Api(tags = "4.0企业中心")
@RequestMapping(value = "/qyzx", produces = { "application/json" })
public class QyzxController {
	@Autowired
	private HttpSession session;

	@Autowired
	private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;

	@Autowired
	private QyzxEntInfoMMapper qyzxEntInfoMMapper;

	@Autowired
	private QyzxEmpLoginMapper qyzxEmpLoginMapper;

	@Autowired
	private QyzxLogBuyMapper qyzxLogBuyMapper;

	@Autowired
88
	private ZzglBmgwMMapper zzglBmgwMMapper;
89

90 91
	@Autowired
	private QyzxPayServeMapper qyzxPayServeMapper;
92

93
	@Autowired
94
	private QyzxInvoiceUsualMapper qyzxInvoiceUsualMapper;
95

yuquan.zhu committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109
	/**
	 * 获取企业信息
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ent")
	@ApiOperation(value = "获取企业信息", httpMethod = "GET", notes = "接口发布说明")
	public Result<QyzxEntInfoM> selectent(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();
		QyzxEntInfoM qyzxEntInfoM = new LambdaQueryChainWrapper<QyzxEntInfoM>(qyzxEntInfoMMapper)
				.eq(orgCode != null, QyzxEntInfoM::getId, orgCode).one();
		return ResultUtil.data(qyzxEntInfoM, "获取企业信息成功");
	}
110

111 112 113 114 115 116 117 118
	/**
	 * 添加/修改企业信息
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/ent")
	@ApiOperation(value = "添加/修改企业信息", httpMethod = "POST", notes = "接口发布说明")
tangzhaoqian committed
119
	@Log(title = "修改-企业信息", businessType = BusinessType.UPDATE)
120 121
	public Result<QyzxEntInfoM> addent(@CurrentUser UserBean userBean, @RequestBody QyzxEntInfoM qyzxEntInfoM) {
		qyzxEntInfoM.setId(userBean.getOrgCode());
邓实川 committed
122

123 124
		QyzxEntInfoM q = new LambdaQueryChainWrapper<QyzxEntInfoM>(qyzxEntInfoMMapper)
				.eq(QyzxEntInfoM::getId, userBean.getOrgCode()).one();
邓实川 committed
125

126 127
		qyzxEntInfoM.setRegisterTime(q.getRegisterTime());
		qyzxEntInfoM.insertOrUpdate();
128

129 130
		return ResultUtil.data(qyzxEntInfoM, "添加/修改企业");
	}
yuquan.zhu committed
131 132 133 134 135 136 137 138 139

	/**
	 * 企业认证-申请
	 * 
	 * @param qyzxEntAuth
	 * @return
	 */
	@PostMapping(value = "/entauth")
	@ApiOperation(value = "企业认证", httpMethod = "POST", notes = "接口发布说明")
tangzhaoqian committed
140
	@Log(title = "企业认证", businessType = BusinessType.INSERT)
141
	public Result<QyzxEntInfoM> entauth(@CurrentUser UserBean userBean, @RequestBody QyzxEntInfoM qyzxEntInfoM) {
yuquan.zhu committed
142
		// 设置审核状态
143 144 145
		qyzxEntInfoM.setAttestStatus(CommonEnum.AUTH_TYPE_UNDEREVIEW.getType());
		qyzxEntInfoM.setId(userBean.getOrgCode());
		qyzxEntInfoM.updateById();
yuquan.zhu committed
146
		// }
147
		return ResultUtil.data(qyzxEntInfoM, "申请企业认证中");
yuquan.zhu committed
148 149 150
	}

	/**
151 152 153 154 155
	 * 运营管理 企业认证-审核-通过/不通过(weng)
	 * 
	 * @param qyzxEntAuth
	 * @return
	 */
156 157
	@PostMapping(value = "/entauthpass")
	@ApiOperation(value = "企业认证-审核-通过", httpMethod = "POST", notes = "接口发布说明")
158 159 160 161 162 163 164 165
	public Result<String> entauthpass(@RequestBody EntauthDto entauthDto) {// 2未通过,3通过
		String msg = "企业未认证";
		Integer type = entauthDto.getAuthType();
		if (type == CommonEnum.AUTH_TYPE_SUCCESS.getType()) {
			msg = "企业认证成功";
		}
		if (type == CommonEnum.AUTH_TYPE_FAILURE.getType()) {
			msg = "企业认证失败";
166
		}
167 168 169 170
		boolean b = new LambdaUpdateChainWrapper<QyzxEntInfoM>(qyzxEntInfoMMapper)
				.eq(QyzxEntInfoM::getId, entauthDto.getOrgCode()).set(QyzxEntInfoM::getAttestStatus, type).update();
		if (b) {
			return ResultUtil.data(msg);
171
		}
172
		return ResultUtil.data("企业认证流程有误");
173
	}
174

175
	/**
176 177 178 179 180
	 * 新增/编辑常用企业开票资料
	 * 
	 * @param QyzxInvoiceUsual
	 * @return
	 */
181 182
	@PostMapping(value = "/invoiceusual")
	@ApiOperation(value = "新增/编辑常用企业开票资料", httpMethod = "POST", notes = "接口发布说明")
183 184
	public Result<QyzxInvoiceUsual> invoiceusual(@CurrentUser UserBean userBean,
			@RequestBody QyzxInvoiceUsual qyzxInvoiceUsual) {
185 186 187 188 189 190 191 192
		qyzxInvoiceUsual.setOrgCode(userBean.getOrgCode());
		qyzxInvoiceUsual.setModifyUser(userBean.getEmpNum());
		boolean tof = qyzxInvoiceUsual.insertOrUpdate();
		if (tof) {
			return ResultUtil.data(qyzxInvoiceUsual, "常用企业开票资料已修改");
		}
		return ResultUtil.error("开票资料修改无效");
	}
193

194
	/**
195 196 197 198 199
	 * 显示常用的企业开票资料
	 * 
	 * @param QyzxInvoiceUsual
	 * @return
	 */
200 201 202
	@GetMapping(value = "/invoiceusual")
	@ApiOperation(value = "显示常用的企业开票资料", httpMethod = "GET", notes = "接口发布说明")
	public Result<QyzxInvoiceUsual> invoiceusual(@CurrentUser UserBean userBean) {
邓实川 committed
203 204
		QyzxInvoiceUsual one = qyzxInvoiceUsualMapper.selectOne(
				new QueryWrapper<QyzxInvoiceUsual>().lambda().eq(QyzxInvoiceUsual::getOrgCode, userBean.getOrgCode()));
205 206 207 208 209 210 211
		if (one != null) {
			if (one.getShippingArea() == null) {
				one.setShippingArea("");
			}
			if (one.getShippingAddress() == null) {
				one.setShippingAddress("");
			}
212
		}
213
		return ResultUtil.data(one, "显示常用的企业开票资料");
214
	}
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231

	/**
	 * 显示企业的超级管理员
	 * 
	 * @param qyzxEntAuth
	 * @return
	 */
	@GetMapping(value = "/smanagerphone")
	@ApiOperation(value = "显示超管头像和电话号码", httpMethod = "GET", notes = "接口发布说明")
	public Result<QyzxEmpLogin> smanagerphone(@CurrentUser UserBean userBean) {
		QyzxEmpEntAsso smanagerid = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
				.select(QyzxEmpEntAsso::getEmpNum).eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
				.eq(QyzxEmpEntAsso::getStatus, 0).one();
		QyzxEmpLogin smanagerphone = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
				.select(QyzxEmpLogin::getPhone, QyzxEmpLogin::getHeadUrl)
				.eq(QyzxEmpLogin::getId, smanagerid.getEmpNum()).one();
		return ResultUtil.data(smanagerphone, "企业超管头像和电话号码");
yuquan.zhu committed
232 233
	}

234 235 236 237 238 239 240 241 242 243 244 245 246 247
	/*	*//**
			 * 获取企业的到期时间和版本号
			 *//*
				 * @GetMapping(value = "/endtimeversion")
				 * 
				 * @ApiOperation(value = "获取企业的到期时间和版本号", httpMethod = "GET", notes = "接口发布说明")
				 * public Result<QyzxEntInfoM> endtimeversion(@CurrentUser UserBean userBean) {
				 * QyzxEntInfoM qyzxEntInfoM = new
				 * LambdaQueryChainWrapper<QyzxEntInfoM>(qyzxEntInfoMMapper)
				 * .select(QyzxEntInfoM::getEndTime,QyzxEntInfoM::getLevel).eq(QyzxEntInfoM::
				 * getId, userBean.getOrgCode()).one(); return ResultUtil.data(qyzxEntInfoM,
				 * "获取企业的到期时间和版本号成功"); }
				 */

yuquan.zhu committed
248 249 250 251 252 253 254
	/**
	 * 企业列表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/entlist")
255
	@ApiOperation(value = "企业列表", httpMethod = "GET", notes = "接口发布说明")
yuquan.zhu committed
256
	public Result<List<QyzxEntInfoM>> entlist1(@CurrentUser UserBean userBean) {
邓实川 committed
257

258
		List<Object> orgCodes = qyzxEmpEntAssoMapper.selectObjs(new QueryWrapper<QyzxEmpEntAsso>().lambda()
邓实川 committed
259
				.select(QyzxEmpEntAsso::getOrgCode).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
yuquan.zhu committed
260 261 262 263 264 265 266 267 268 269 270 271
		List<QyzxEntInfoM> qyzxEntInfoMs = new LambdaQueryChainWrapper<QyzxEntInfoM>(qyzxEntInfoMMapper)
				.in(CollUtil.isNotEmpty(orgCodes), QyzxEntInfoM::getId, orgCodes).list();
		return ResultUtil.data(qyzxEntInfoMs, "获取企业信息成功");
	}

	/**
	 * 切换企业
	 * 
	 * @param org_num
	 * @return
	 */
	@GetMapping(value = "/changeent/{orgCode}")
272
	@ApiOperation(value = "切换企业", httpMethod = "GET", notes = "接口发布说明")
yuquan.zhu committed
273 274 275
	public Result<List<String>> changeent(@CurrentUser UserBean userBean, @PathVariable Integer orgCode) {
		// 查询该员工加入的企业id列表
		QyzxEmpLogin emp = userBean.getQyzxEmpLogin();
276
		Stream<QysDto> s = emp.getQys().stream().filter(o -> orgCode.equals(o.getId()));
yuquan.zhu committed
277 278 279
		// 判断 切换目标企业id 是否包含在 企业id列表 内
		if (s != null) {
			List<String> menus = new ArrayList<>();
280 281 282 283
			QysDto ctrl = s.findFirst().orElse(null);
			if (ctrl == null) {
				return ResultUtil.data(menus, "你不是该企业的用户!");
			}
邓实川 committed
284

285 286
			if (SysRoleType.U_TYPE_ADMIN.getType().equals(ctrl.getUserType())
					|| SysRoleType.U_TYPE_C_ADMIN.getType().equals(ctrl.getUserType())) {
yuquan.zhu committed
287 288 289
			} else {
				// 获取权限
				ArrayList<Integer> list = new ArrayList<Integer>();
东州 翁 committed
290 291
//				List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
//						.eq(ZzglBmgwM::getOrgCode, ctrl.getId()).list();
邓实川 committed
292 293 294 295

				List<ZzglBmgwM> zzglBmgwMs = zzglBmgwMMapper
						.selectList(new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, ctrl.getId()));

yuquan.zhu committed
296 297 298 299 300 301 302
				// 传入的部门岗位是登录者的岗位id.获取的list中只有一个元素,不必要
				ZzglBmgwM.getupDepts(list, ctrl.getBmgwId(), zzglBmgwMs);
				if (list != null && list.size() > 0) {
					LambdaQueryWrapper<ZzglAuth> wp = new LambdaQueryWrapper<>();
					wp.select(ZzglAuth::getMenuId).eq(ZzglAuth::getOrgCode, ctrl.getId())
							.and(i -> i.in(ZzglAuth::getBmgwId, list.toArray()));
					List<ZzglAuth> zas = ZzglAuth.builder().build().selectList(wp);
303 304
					if (zas != null && zas.size() != 0)
						zas.stream().forEach(o -> menus.add(o.getMenuId()));
yuquan.zhu committed
305 306 307 308 309 310 311 312 313 314 315
				}
			}
			emp.setOrgId(orgCode);
			session.setAttribute("ui", emp);
			qyzxEmpLoginMapper.updateById(emp);
			return ResultUtil.data(menus, "切换企业成功");
		} else {
			return ResultUtil.error();
		}
	}

东州 翁 committed
316
	/**
邓实川 committed
317
	 * 意见反馈
东州 翁 committed
318
	 */
319
	@PostMapping(value = "/feedback")
东州 翁 committed
320
	@ApiOperation(value = "意见反馈", httpMethod = "POST", notes = "接口发布说明")
邓实川 committed
321 322 323 324 325 326 327 328 329 330 331
	public Result<String> feedback(@CurrentUser UserBean userBean,
			@RequestBody QyzxSuggestionFeeback qyzxSuggestionFeeback) {

		if (!ObjectUtil.isAllNotEmpty(qyzxSuggestionFeeback.getOpinionText(), qyzxSuggestionFeeback.getUrl(),
				qyzxSuggestionFeeback.getPersonalContact()))
			return ResultUtil.error("请完善意见信息!");

		qyzxSuggestionFeeback.setCreateTime(new Date());
		qyzxSuggestionFeeback.setEmpNum(userBean.getEmpNum());
		qyzxSuggestionFeeback.setOrgCode(userBean.getOrgCode());
		if (qyzxSuggestionFeeback.insert()) {
东州 翁 committed
332
			return ResultUtil.data("意见反馈成功!");
333
		}
东州 翁 committed
334
		return ResultUtil.data("意见反馈失败!");
yuquan.zhu committed
335
	}
336

yuquan.zhu committed
337
	/**
338
	 * 查看服务列表
yuquan.zhu committed
339
	 */
340
	@GetMapping(value = "/servelist")
341 342 343 344 345 346 347
	@ApiOperation(value = "查看服务列表", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<QyzxPayServe>> servelist() {
		List<QyzxPayServe> list = new LambdaQueryChainWrapper<QyzxPayServe>(qyzxPayServeMapper)
				.select(QyzxPayServe::getName, QyzxPayServe::getNum, QyzxPayServe::getSpecialPrice,
						QyzxPayServe::getOriginalPrice, QyzxPayServe::getSort, QyzxPayServe::getUnit,
						QyzxPayServe::getRemark)
				.orderByAsc(QyzxPayServe::getId).list();
348
		return ResultUtil.data(list, "查看服务列表成功");
yuquan.zhu committed
349
	}
350

yuquan.zhu committed
351 352 353 354 355 356
	/**
	 * 购买服务(添加服务计算,添加购买记录)
	 * 
	 * @param
	 * @return
	 */
357 358 359
	@PostMapping(value = "/buyserve")
	@ApiOperation(value = "购买服务(添加服务计算,添加购买记录)", httpMethod = "POST", notes = "接口发布说明")
	public Result<QyzxLogBuy> buyserve(@CurrentUser UserBean userBean, @RequestBody QyzxLogBuy qyzxLogBuy) {
yuquan.zhu committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
		Integer payServeId = qyzxLogBuy.getPayServeId();// 套餐的付费服务的id
		Integer num = qyzxLogBuy.getNum();// 套餐的购买次数
		QyzxPayServe qyzxPayServe = QyzxPayServe.builder().id(payServeId).build().selectById();
		Integer code = qyzxPayServe.getCode();// 获取套餐的付费服务代码

		Double o = qyzxPayServe.getOriginalPrice();
		Double s = qyzxPayServe.getSpecialPrice();
		Double price = (s != null && s > 0d ? s : o);
		Double money = NumberUtil.round(NumberUtil.mul(price, num), 4).doubleValue();
		log.info("money:" + money);
		Date date = new Date();
		log.info("date:" + date);
		// 添加购买记录表
		QyzxLogBuy.builder().empNum(userBean.getEmpNum()).payServeId(payServeId).money(money).num(num).createTime(date)
				.build().insertOrUpdate();
		// 添加或修改服务计算表
		Integer number = qyzxPayServe.getNum();
377 378
		LambdaQueryWrapper<QyzxAttaFwjsb> queryWrapper = new QueryWrapper<QyzxAttaFwjsb>().lambda();
		queryWrapper.eq(QyzxAttaFwjsb::getEmpNum, userBean.getEmpNum()).eq(QyzxAttaFwjsb::getCode, code);
yuquan.zhu committed
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
		Integer result = QyzxAttaFwjsb.builder().build().selectCount(queryWrapper);
		if (result != null && result > 0) {
			QyzxAttaFwjsb fwjb = QyzxAttaFwjsb.builder().build().selectOne(queryWrapper);
			// 续费
			QyzxAttaFwjsb.builder().id(fwjb.getId()).empNum(userBean.getEmpNum()).code(code)
					.hasNum(fwjb.getHasNum() + num * number).createTime(date).build().insertOrUpdate();
		} else {
			// 新增
			QyzxAttaFwjsb.builder().empNum(userBean.getEmpNum()).code(code).hasNum(num * number).createTime(date)
					.build().insertOrUpdate();
		}
		return ResultUtil.data(qyzxLogBuy, "添加/修改发票资料成功");
	}

	// 使用系统购买服务
	/**
	 * 获取服务计算
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/fwjs")
	@ApiOperation(value = "查看服务计算", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<QyzxAttaFwjsb>> fwjs(@CurrentUser UserBean userBean) {
邓实川 committed
403 404
		List<QyzxAttaFwjsb> qyzxAttaFpgl = QyzxAttaFwjsb.builder().build().selectList(
				new QueryWrapper<QyzxAttaFwjsb>().lambda().eq(QyzxAttaFwjsb::getEmpNum, userBean.getEmpNum()));
yuquan.zhu committed
405 406 407 408 409 410 411 412 413 414 415 416 417
		return ResultUtil.data(qyzxAttaFpgl, "获取服务计算成功");
	}

	/**
	 * 获取购买记录
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/gmjl")
	@ApiOperation(value = "获取购买记录", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<QyzxLogBuy>> selectgmjl(@CurrentUser UserBean userBean) {
		List<QyzxLogBuy> qyzxLogBuy = QyzxLogBuy.builder().build()
418
				.selectList(new QueryWrapper<QyzxLogBuy>().lambda().eq(QyzxLogBuy::getEmpNum, userBean.getEmpNum()));
yuquan.zhu committed
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
		return ResultUtil.data(qyzxLogBuy, "获取购买记录成功");
	}

	/**
	 * 查询购买记录
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/gmjlquery")
	@ApiOperation(value = "查询购买记录", httpMethod = "POST", notes = "接口发布说明")
	public Result<Object> querygmjl(@CurrentUser UserBean userBean, @RequestBody AttaFpglQueryDto attaFpglQueryDto) {

		Integer empNum = userBean.getEmpNum();
		attaFpglQueryDto.setEmpNum(empNum);

		IPage<LogBuyDto> page = new Page<LogBuyDto>(
				attaFpglQueryDto.getCurrentPage() == null ? 1 : attaFpglQueryDto.getCurrentPage(),
				attaFpglQueryDto.getTotalPage() == null ? 10 : attaFpglQueryDto.getTotalPage());

		List<LogBuyDto> logBuyDto = qyzxLogBuyMapper.selectByName(page, attaFpglQueryDto);

		return ResultUtil.data(page, logBuyDto, "查询成功");
	}

	/**
445
	 * 账号管理 获取账号
yuquan.zhu committed
446 447 448 449 450 451
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/adminlist/{page}/{limit}")
	@ApiOperation(value = "获取账号", httpMethod = "GET", notes = "接口发布说明")
452 453 454 455
	public Result<Object> adminlist(@CurrentUser UserBean userBean, @PathVariable("page") Integer page,
			@PathVariable("limit") Integer limit) {
		IPage<AdminListDto> page1 = new Page<AdminListDto>(page, limit);
		return ResultUtil.data(page1, qyzxEmpEntAssoMapper.adminlist(page1, userBean.getOrgCode()), "获取账号");
yuquan.zhu committed
456
	}
邓实川 committed
457

tangzhaoqian committed
458 459
	@Autowired
	private QyzxOperLogMapper qyzxOperLogMapper;
邓实川 committed
460

tangzhaoqian committed
461 462 463 464 465 466 467 468
	/**
	 * 查询-操作日志
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/select_oper_log")
	@ApiOperation(value = "查询-操作日志", httpMethod = "POST", notes = "查询-操作日志")
邓实川 committed
469 470
	public Result<Object> selectOperLog(@CurrentUser UserBean userBean,
			@RequestBody QyzxOperLogQuaryDto qyzxOperLogQuaryDto) {
tangzhaoqian committed
471 472
		IPage<QyzxOperLog> page = new Page<QyzxOperLog>(
				qyzxOperLogQuaryDto.getCurrentPage() == null ? 1 : qyzxOperLogQuaryDto.getCurrentPage(),
邓实川 committed
473 474
				qyzxOperLogQuaryDto.getTotalPage() == null ? 10 : qyzxOperLogQuaryDto.getTotalPage());

tangzhaoqian committed
475
		qyzxOperLogQuaryDto.setOrgCode(userBean.getOrgCode());
邓实川 committed
476 477 478
//		IPage<QyzxOperLog> pages = qyzxOperLogMapper.selectPageByQuery(page, qyzxOperLogQuaryDto);

		if (qyzxOperLogQuaryDto.getEmpNums() == null) {
479 480 481 482 483 484 485 486 487 488 489

			List<Integer> roles = new ArrayList<Integer>();
			roles.add(SysRoleType.U_TYPE_ADMIN.getType());
			roles.add(SysRoleType.U_TYPE_C_ADMIN.getType());

			List<QyzxEmpEntAsso> list = QyzxEmpEntAsso.builder().build()
					.selectList(new LambdaQueryWrapper<QyzxEmpEntAsso>()
							.eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
							.in(QyzxEmpEntAsso::getUserType, roles).select(QyzxEmpEntAsso::getEmpNum));

			List<Integer> empNums = list.stream().map(QyzxEmpEntAsso::getEmpNum).collect(Collectors.toList());
邓实川 committed
490 491 492
			qyzxOperLogQuaryDto.setEmpNums(empNums);
		}
		IPage<QyzxOperLog> pages = qyzxOperLogMapper.selectPageByQuery2(page, qyzxOperLogQuaryDto);
tangzhaoqian committed
493
		List<QyzxOperLog> listOl = pages.getRecords();
邓实川 committed
494

tangzhaoqian committed
495 496
		return ResultUtil.data(pages, listOl, "操作成功!");
	}
邓实川 committed
497

498 499 500 501 502 503 504 505
	/**
	 * 删除-操作日志
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/delete_oper_log")
	@ApiOperation(value = "删除-操作日志", httpMethod = "DELETE", notes = "查询-操作日志")
邓实川 committed
506 507
	public Result<Object> deleteOperLog(@CurrentUser UserBean userBean, @RequestBody Integer[] ids) {

508 509
		ArrayList<Integer> list = CollUtil.toList(ids);
		int delCount = qyzxOperLogMapper.deleteBatchIds(list);
邓实川 committed
510

511 512
		return ResultUtil.data(delCount, "操作成功!");
	}
yuquan.zhu committed
513 514

}