CompanyServiceImpl.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. package com.dk.oauth.service.impl;
  2. import com.alibaba.fastjson.JSON;
  3. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4. import com.dk.common.exception.BaseBusinessException;
  5. import com.dk.common.infrastructure.constant.Constant;
  6. import com.dk.common.infrastructure.enums.ErrorCodeEnum;
  7. import com.dk.common.model.response.mst.OrgResponse;
  8. import com.dk.common.model.response.mst.StaffResponse;
  9. import com.dk.common.model.vo.mst.OrgVO;
  10. import com.dk.common.model.vo.mst.StaffVO;
  11. import com.dk.common.response.ResponseCodeEnum;
  12. import com.dk.common.response.ResponseResultUtil;
  13. import com.dk.common.response.ResponseResultVO;
  14. import com.dk.common.util.AESUtil;
  15. import com.dk.oauth.convert.CompanyConvert;
  16. import com.dk.oauth.entity.*;
  17. import com.dk.oauth.feign.service.OrgFeign;
  18. import com.dk.oauth.feign.service.StaffFeign;
  19. import com.dk.oauth.mapper.*;
  20. import com.dk.oauth.query.*;
  21. import com.dk.oauth.response.*;
  22. import com.dk.oauth.service.ICompanyService;
  23. import org.springframework.beans.factory.annotation.Autowired;
  24. import org.springframework.stereotype.Service;
  25. import org.springframework.transaction.annotation.Transactional;
  26. import org.springframework.web.context.request.RequestContextHolder;
  27. import org.springframework.web.context.request.ServletRequestAttributes;
  28. import javax.annotation.Resource;
  29. import javax.servlet.http.HttpServletRequest;
  30. import java.time.LocalDate;
  31. import java.util.ArrayList;
  32. import java.util.HashMap;
  33. import java.util.List;
  34. import java.util.Map;
  35. /**
  36. * 公司实现类
  37. *
  38. * @author admin
  39. * @since 2023-07-01 09:41:05
  40. */
  41. @Service("companyService")
  42. public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {
  43. @Resource
  44. CompanyMapper companyMapper;
  45. @Resource
  46. UserMapper userMapper;
  47. @Resource
  48. StaffFeign staffFeign;
  49. @Resource
  50. OrgFeign orgFeign;
  51. @Resource
  52. DictionaryDataMapper dictionaryDataMapper;
  53. @Resource
  54. GoodsCategoryMapper goodsCategoryMapper;
  55. @Resource
  56. RoleMapper roleMapper;
  57. @Resource
  58. UnitMapper unitMapper;
  59. @Resource
  60. SaleChannelMapper saleChannelMapper;
  61. @Resource
  62. WarehouseMapper warehouseMapper;
  63. @Resource
  64. MoneyAccountMapper moneyAccountMapper;
  65. @Resource
  66. PrintLayoutMapper printLayoutMapper;
  67. @Autowired
  68. private CompanyConvert companyConvert;
  69. @Autowired
  70. private TradeMapper tradeMapper;
  71. /**
  72. * @desc : 通过ID查询
  73. * @author : admin
  74. * @date : 2023/2/3 13:32
  75. */
  76. @Override
  77. public ResponseResultVO selectById(Integer id) {
  78. return ResponseResultUtil.success(companyMapper.selectById(id));
  79. }
  80. /**
  81. * @desc : 可以绑定微信的员工人数 人数上限
  82. * @author : admin
  83. * @date : 2023/2/3 13:32
  84. */
  85. @Override
  86. public ResponseResultVO getCompanyMaxStaffNum(Integer id) {
  87. Company company = companyMapper.selectById(id);
  88. Map<String,Object> mp = new HashMap<>();
  89. // 解析license信息
  90. String licenseStr = AESUtil.desEncrypt(company.getLicense());
  91. if(licenseStr != null ){
  92. Map<String,Object> licenseMap = JSON.parseObject(licenseStr,Map.class);
  93. mp.put("web_max_num",Integer.parseInt(licenseMap.get("web_max_num").toString()));
  94. mp.put("wx_max_num",Integer.parseInt(licenseMap.get("wx_max_num").toString()));
  95. }else{
  96. mp.put("web_max_num",1);
  97. mp.put("wx_max_num",1);
  98. }
  99. return ResponseResultUtil.success(mp);
  100. }
  101. /**
  102. * @desc : 通过ID查询
  103. * @author : admin
  104. * @date : 2023/2/3 13:32
  105. */
  106. @Override
  107. public ResponseResultVO selectByOpenId(String openid) {
  108. return ResponseResultUtil.success(companyMapper.selectByOpenId(openid));
  109. }
  110. /**
  111. * @desc : 更新微信用的公司
  112. * @author : admin
  113. * @date : 2023/2/3 13:32
  114. */
  115. @Override
  116. @Transactional(rollbackFor = Exception.class)
  117. public ResponseResultVO updateWxUserCompany(Map<String, Object> map) {
  118. String userId = map.get("userId") + "";
  119. Integer cpId = Integer.valueOf(map.get("cpId") + "");
  120. List<Integer> cpIds = new ArrayList<>();
  121. cpIds.add(cpId);
  122. int i = userMapper.updateCpid(userId, cpId, cpIds);
  123. return ResponseResultUtil.success(true);
  124. }
  125. /**
  126. * @desc : 更新微信用的公司
  127. * @author : admin
  128. * @date : 2023/2/3 13:32
  129. */
  130. @Override
  131. @Transactional(rollbackFor = Exception.class)
  132. public ResponseResultVO updateCompanyCurStaffNum(Map<String, Object> map) {
  133. Integer curStaffNum = Integer.valueOf(map.get("curStaffNum") + "");
  134. Integer cpId = Integer.valueOf(map.get("cpId") + "");
  135. companyMapper.updateCompanyCurStaffNum(cpId, curStaffNum);
  136. return ResponseResultUtil.success(true);
  137. }
  138. /**
  139. * @desc : 选择公司更新微信用户的所在当前的公司
  140. * @author : admin
  141. * @date : 2023/2/3 13:32
  142. */
  143. @Override
  144. @Transactional(rollbackFor = Exception.class)
  145. public ResponseResultVO updateCurrentCpByWxid(Map<String, Object> map) {
  146. String userWxid = map.get("openid") + "";
  147. Integer cpId = null;
  148. if (map.get("cpId") != null) {
  149. cpId = Integer.valueOf(map.get("cpId") + "");
  150. }
  151. int i = userMapper.updateCurrentCpByWxid(userWxid, cpId);
  152. return ResponseResultUtil.success(true);
  153. }
  154. /**
  155. * @desc : 注册-商户
  156. * @author : 姜永辉
  157. * @date : 2024-02-20 13:55
  158. */
  159. @Override
  160. @Transactional(rollbackFor = Exception.class)
  161. public ResponseResultVO registerCompany(CompanyVO companyVO) {
  162. // 转实体
  163. Company company = companyConvert.convertToPo(companyVO);
  164. Company c = new Company();
  165. c.setFlgValid(true);
  166. c.setCpName(company.getCpName());
  167. Long aLong = companyMapper.countByCond(c);
  168. if (aLong > 0) {
  169. return ResponseResultUtil.error(ErrorCodeEnum.COMPANY_CODE_EXISTS.getCode(),
  170. ErrorCodeEnum.COMPANY_CODE_EXISTS.getMessage());
  171. }
  172. // company.setMaxStaffNum(1); // todo
  173. // company.setCurStaffNum(1);
  174. // 标准版默认2099年,1PC授权,1WX授权
  175. if(Constant.GradeCode.STD.getName().equals(company.getGradeCode())){
  176. company.setEndDate(LocalDate.parse("2099-12-31"));
  177. companyVO.setWebMaxNum(0);
  178. companyVO.setWxMaxNum(1);
  179. }
  180. company.setCpStatus("公司状态-通过");
  181. //获取具体服务的地址
  182. company.setSvcCode(companyMapper.selectServiceAllot(company.getGradeCode()));
  183. // 生成临时license授权
  184. Map<String,Object> licenseMap = new HashMap<>();
  185. licenseMap.put("grade_code",company.getGradeCode());
  186. licenseMap.put("end_date",company.getEndDate());
  187. licenseMap.put("web_max_num",companyVO.getWebMaxNum());
  188. licenseMap.put("wx_max_num",companyVO.getWxMaxNum());
  189. // 标准版
  190. if(Constant.GradeCode.STD.getName().equals(company.getGradeCode())){
  191. company.setLicense(AESUtil.aesEncrypt(JSON.toJSONString(licenseMap)) );
  192. }else{
  193. company.setLicenseSocial(AESUtil.aesEncrypt(JSON.toJSONString(licenseMap)) );
  194. }
  195. companyMapper.insert(company);
  196. // 动态设置服务的地址
  197. ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
  198. .getRequestAttributes();
  199. HttpServletRequest request;
  200. if (attributes != null) {
  201. request = attributes.getRequest();
  202. request.setAttribute("svcCode", company.getSvcCode().replace("_", "-"));
  203. }
  204. Trade trade = new Trade();
  205. // 专业版才插入交易记录
  206. if(Constant.GradeCode.PRO.getName().equals(company.getGradeCode())) {
  207. // 生成交易记录
  208. trade.setTradeNo(companyVO.getTradeNo());
  209. trade.setCpId(company.getCpId());
  210. trade.setWxUserId(companyVO.getWxUserId());
  211. trade.setTradeAmount(companyVO.getTradeAmount());
  212. trade.setTradeType(Constant.TradeType.REGISTER.getName());
  213. trade.setBuyLong(companyVO.getBuyLong());
  214. trade.setBuyBeginDate(companyVO.getBuyBeginDate());
  215. trade.setBuyEndDate(companyVO.getBuyEndDate());
  216. trade.setExtendDays(companyVO.getExtendDays());
  217. trade.setBuyGradeCode(companyVO.getGradeCode());
  218. trade.setTradeStatus(Constant.TradeStatus.INEFFECTIVE.getName());
  219. tradeMapper.insert(trade);
  220. }
  221. // 组织机构 -顶级 和公司的名称一样
  222. // 二级 名称叫做 运营中心 返回的业务部门的id是运营中新的id
  223. OrgVO orgVO = new OrgVO();
  224. orgVO.setCpId(company.getCpId());
  225. orgVO.setOrgName(company.getCpName());
  226. // 二级 名称叫做 运营中心 返回的业务部门的id是运营中新的id
  227. ResponseResultVO<OrgResponse> orgResponseResponseResultVO = orgFeign.insertFeignOrg(orgVO);
  228. OrgResponse orgResponse = new OrgResponse();
  229. // 如果没有成功返回,状态设置为待审
  230. if (orgResponseResponseResultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
  231. // 无用户
  232. throw new BaseBusinessException(ErrorCodeEnum.COMPANY_REGISTER_ERROR.getCode(),
  233. ErrorCodeEnum.COMPANY_REGISTER_ERROR.getMessage());
  234. } else {
  235. orgResponse = orgResponseResponseResultVO.getData();
  236. }
  237. // 生成员工
  238. UserLogin userLogin = userMapper.selectById(company.getOwner());
  239. StaffVO staffVO = new StaffVO();
  240. staffVO.setWxUserId(userLogin.getUserId());
  241. staffVO.setCpId(company.getCpId());
  242. staffVO.setStaffName(userLogin.getUserPhone());
  243. staffVO.setStaffPhone(userLogin.getUserPhone());
  244. staffVO.setOrgId(orgResponse.getOrgId());
  245. // 240521 追加公司的版本 创建用户的时候用
  246. staffVO.setGradeCode(company.getGradeCode());
  247. // 生成默认的角色数组--// 更新用户的角色ids--在插入基础数据的时候更新了。
  248. // staffVO.setRoleIds();
  249. // 注册商户时候插入员工
  250. ResponseResultVO<StaffResponse> staffResponseResponseResultVO = staffFeign.insertFeignStaff(staffVO);
  251. StaffResponse staffResponse = new StaffResponse();
  252. // 如果没有成功返回,状态设置为待审
  253. if (staffResponseResponseResultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
  254. // 无用户
  255. throw new BaseBusinessException(staffResponseResponseResultVO.getCode(), staffResponseResponseResultVO.getMessage());
  256. } else {
  257. staffResponse = staffResponseResponseResultVO.getData();
  258. }
  259. // 更新 创建商户用户的公司id
  260. Integer cpId = company.getCpId();
  261. List<Integer> cpIds = new ArrayList<>();
  262. cpIds.add(cpId);
  263. // 当天的userid可能 存在加入公司
  264. if (userLogin.getJoinedCps()!=null && userLogin.getJoinedCps().size() > 0){
  265. cpIds.addAll(userLogin.getJoinedCps()) ;
  266. }
  267. userMapper.updateCpid(userLogin.getUserId(), cpId, cpIds);
  268. // 生成员工 角色 基础资料(仓库 渠道 收入 支出 入库 出库 账户 来源 盈亏原因) 计量单位 种类 打印票据 等等。
  269. String staffId = staffResponse.getStaffId();
  270. Map<String, List<Map<String, Object>>> map = new HashMap<>();
  271. List<Map<String, Object>> listCom = new ArrayList<>();
  272. Map<String, Object> m = new HashMap<>();
  273. m.put("gradeCode",company.getGradeCode());
  274. m.put("cpId",cpId);
  275. m.put("staffId",staffId);
  276. listCom.add(m);
  277. map.put("company",listCom);
  278. // 角色及权限
  279. List<RoleResponse> roleResponses = roleMapper.selectByCond(new RoleQuery());
  280. List<Map<String, Object>> listRoles = new ArrayList<>();
  281. for (int i = 0; i < roleResponses.size(); i++) {
  282. m = new HashMap<>();
  283. m.put("roleCode",roleResponses.get(i).getRoleCode());
  284. m.put("roleName",roleResponses.get(i).getRoleName());
  285. m.put("displayNo",roleResponses.get(i).getDisplayNo());
  286. listRoles.add(m);
  287. }
  288. map.put("roles",listRoles);
  289. // 基础资料(仓库 渠道 )
  290. List<WarehouseResponse> warehouseResponses = warehouseMapper.selectByCond(new WarehouseQuery());
  291. List<Map<String, Object>> listWarehouses = new ArrayList<>();
  292. for (int i = 0; i < warehouseResponses.size(); i++) {
  293. m = new HashMap<>();
  294. m.put("whCode",warehouseResponses.get(i).getWhCode());
  295. m.put("whName",warehouseResponses.get(i).getWhName());
  296. m.put("displayNo",warehouseResponses.get(i).getDisplayNo());
  297. m.put("flgDefault",warehouseResponses.get(i).getFlgDefault());
  298. listWarehouses.add(m);
  299. }
  300. map.put("warehouses",listWarehouses);
  301. // 基础资料(仓库 渠道 )
  302. List<SaleChannelResponse> saleChannelResponses = saleChannelMapper.selectByCond(new SaleChannelQuery());
  303. List<Map<String, Object>> listSaleChannels = new ArrayList<>();
  304. for (int i = 0; i < saleChannelResponses.size(); i++) {
  305. m = new HashMap<>();
  306. m.put("channelCode",saleChannelResponses.get(i).getChannelCode());
  307. m.put("channelName",saleChannelResponses.get(i).getChannelName());
  308. m.put("displayNo",saleChannelResponses.get(i).getDisplayNo());
  309. m.put("flgDefault",saleChannelResponses.get(i).getFlgDefault());
  310. listSaleChannels.add(m);
  311. }
  312. map.put("saleChannels",listSaleChannels);
  313. // 基础资料(仓库 渠道 收入 支出 入库 出库 账户 来源 盈亏原因)
  314. List<DictionaryDataResponse> dictionaryDataResponses = dictionaryDataMapper.selectByCond(new DictionaryDataQuery());
  315. List<Map<String, Object>> listDictionaryDatas = new ArrayList<>();
  316. for (int i = 0; i < dictionaryDataResponses.size(); i++) {
  317. m = new HashMap<>();
  318. m.put("dictCode",dictionaryDataResponses.get(i).getDictCode());
  319. m.put("dataCode",dictionaryDataResponses.get(i).getDataCode());
  320. m.put("dataValue",dictionaryDataResponses.get(i).getDataValue());
  321. m.put("displayNo",dictionaryDataResponses.get(i).getDisplayNo());
  322. m.put("flgDefault",dictionaryDataResponses.get(i).getFlgDefault());
  323. listDictionaryDatas.add(m);
  324. }
  325. map.put("dictionaryDatas",listDictionaryDatas);
  326. // 资金账户
  327. List<MoneyAccountResponse> moneyAccountResponses = moneyAccountMapper.selectByCond(new MoneyAccountQuery());
  328. List<Map<String, Object>> listMoneyAccounts = new ArrayList<>();
  329. for (int i = 0; i < moneyAccountResponses.size(); i++) {
  330. m = new HashMap<>();
  331. m.put("macCode",moneyAccountResponses.get(i).getMacCode());
  332. m.put("macName",moneyAccountResponses.get(i).getMacName());
  333. m.put("macType",moneyAccountResponses.get(i).getMacType());
  334. m.put("balance",moneyAccountResponses.get(i).getBalance());
  335. m.put("accDate",moneyAccountResponses.get(i).getAccDate());
  336. m.put("displayNo",moneyAccountResponses.get(i).getDisplayNo());
  337. m.put("flgDefault",moneyAccountResponses.get(i).getFlgDefault());
  338. m.put("flgNegative",moneyAccountResponses.get(i).getFlgNegative());
  339. listMoneyAccounts.add(m);
  340. }
  341. map.put("moneyAccounts",listMoneyAccounts);
  342. // 计量单位
  343. List<UnitResponse> unitResponses = unitMapper.selectByCond(new UnitQuery());
  344. List<Map<String, Object>> listUnits = new ArrayList<>();
  345. for (int i = 0; i < unitResponses.size(); i++) {
  346. m = new HashMap<>();
  347. m.put("unitCode",unitResponses.get(i).getUnitCode());
  348. m.put("unitName",unitResponses.get(i).getUnitName());
  349. m.put("decimalPlaces",unitResponses.get(i).getDecimalPlaces());
  350. m.put("displayNo",unitResponses.get(i).getDisplayNo());
  351. listUnits.add(m);
  352. }
  353. map.put("units",listUnits);
  354. // 种类
  355. List<GoodsCategoryResponse> goodsCategoryResponses = goodsCategoryMapper.selectByCond(new GoodsCategoryQuery());
  356. List<Map<String, Object>> listGoodsCategorys = new ArrayList<>();
  357. for (int i = 0; i < goodsCategoryResponses.size(); i++) {
  358. m = new HashMap<>();
  359. m.put("catId",goodsCategoryResponses.get(i).getCatId());
  360. m.put("catCode",goodsCategoryResponses.get(i).getCatCode());
  361. m.put("catName",goodsCategoryResponses.get(i).getCatName());
  362. m.put("parentId",goodsCategoryResponses.get(i).getParentId());
  363. m.put("topId",goodsCategoryResponses.get(i).getTopId());
  364. m.put("levelUpper",goodsCategoryResponses.get(i).getLevelUpper());
  365. m.put("levelLower",goodsCategoryResponses.get(i).getLevelLower());
  366. m.put("levelLeaf",goodsCategoryResponses.get(i).getLevelLeaf());
  367. m.put("levelNo",goodsCategoryResponses.get(i).getLevelNo());
  368. m.put("levelCode",goodsCategoryResponses.get(i).getLevelCode());
  369. m.put("levelName",goodsCategoryResponses.get(i).getLevelName());
  370. m.put("displayNo",goodsCategoryResponses.get(i).getDisplayNo());
  371. listGoodsCategorys.add(m);
  372. }
  373. map.put("goodsCategorys",listGoodsCategorys);
  374. // 打印票据
  375. List<PrintLayout> printLayoutResponses = printLayoutMapper.selectByCond(new PrintLayout());
  376. List<Map<String, Object>> listPrintLayout = new ArrayList<>();
  377. for (int i = 0; i < printLayoutResponses.size(); i++) {
  378. m = new HashMap<>();
  379. m.put("layoutName",printLayoutResponses.get(i).getLayoutName());
  380. m.put("layoutData",printLayoutResponses.get(i).getLayoutData());
  381. m.put("displayNo",printLayoutResponses.get(i).getDisplayNo());
  382. m.put("docName",printLayoutResponses.get(i).getDocName());
  383. m.put("cpId",cpId);
  384. m.put("opCreateUserId",staffId);
  385. listPrintLayout.add(m);
  386. }
  387. map.put("printLayout",listPrintLayout);
  388. ResponseResultVO listResponseResultVO = staffFeign.insertFeignCompanyData(map);
  389. // 如果没有成功返回
  390. if (listResponseResultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
  391. // 无用户
  392. throw new BaseBusinessException(listResponseResultVO.getCode(), listResponseResultVO.getMessage());
  393. } else {
  394. // 更新用户的角色ids--在插入基础数据的时候更新了。
  395. // String rid = listResponseResultVO.getData();
  396. // roleids.add(rid);
  397. }
  398. companyVO.setCpId(company.getCpId()).setTradeAmount(trade.getTradeAmount()).setTradeNo(trade.getTradeNo());
  399. return ResponseResultUtil.success(companyVO);
  400. }
  401. /**
  402. * @desc : 续费
  403. * @author : 周兴
  404. * @date : 2024-05-17 13:55
  405. */
  406. @Transactional(rollbackFor = Exception.class)
  407. public ResponseResultVO reNewCompany(CompanyVO companyVO){
  408. // 转实体
  409. Company company = companyConvert.convertToPo(companyVO);
  410. // 生成临时license授权
  411. Map<String,Object> licenseMap = new HashMap<>();
  412. licenseMap.put("grade_code",company.getGradeCode());
  413. licenseMap.put("end_date",company.getEndDate());
  414. licenseMap.put("user_end_date",companyVO.getUserEndDate());
  415. licenseMap.put("web_max_num",companyVO.getWebMaxNum());
  416. licenseMap.put("wx_max_num",companyVO.getWxMaxNum());
  417. licenseMap.put("vip",companyVO.getVip());
  418. company.setLicenseSocial(AESUtil.aesEncrypt(JSON.toJSONString(licenseMap)) );
  419. companyMapper.updateById(company);
  420. // 生成交易记录
  421. Trade trade = new Trade();
  422. trade.setTradeNo(companyVO.getTradeNo());
  423. trade.setCpId(companyVO.getCpId());
  424. trade.setWxUserId(companyVO.getWxUserId());
  425. trade.setTradeAmount(companyVO.getTradeAmount());
  426. trade.setTradeType(Constant.TradeType.UPGRADE.getName());
  427. trade.setBuyLong(companyVO.getBuyLong());
  428. trade.setBuyBeginDate(companyVO.getBuyBeginDate());
  429. trade.setBuyEndDate(companyVO.getBuyEndDate());
  430. trade.setExtendDays(companyVO.getExtendDays());
  431. trade.setBuyGradeCode(companyVO.getGradeCode());
  432. trade.setTradeStatus(Constant.TradeStatus.INEFFECTIVE.getName());
  433. tradeMapper.insert(trade);
  434. return ResponseResultUtil.success(trade);
  435. }
  436. /**
  437. * @desc : 保存用户功能频率表
  438. * @author : 周兴
  439. * @date : 2024/3/28 9:39
  440. */
  441. @Transactional(
  442. rollbackFor = {Exception.class}
  443. )
  444. public ResponseResultVO<?> saveMenuFrequency(MenuFrequency menuFrequency) {
  445. MenuFrequency mf = companyMapper.selectMenuByUuid(menuFrequency);
  446. if(mf == null ){
  447. menuFrequency.setQty(1);
  448. }else{
  449. menuFrequency.setQty(mf.getQty() + 1);
  450. }
  451. // 保存用户功能频率表
  452. companyMapper.saveMenuFrequency(menuFrequency);
  453. return ResponseResultUtil.success();
  454. }
  455. }