From 420fc1907c12ff7418f93be9159e2a7d1915d3ec Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Wed, 17 Dec 2025 17:24:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E5=AF=BC=E4=BA=BA=E5=91=98=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/userinfo/beans/CustInfoQuery.java | 38 +++++++++ .../controller/platCustInfoController.java | 59 +++++++++++++ .../userinfo/mapper/platCustInfoMapper.java | 16 ++++ .../userinfo/service/ICustInfoService.java | 15 ++++ .../service/impl/ICustinfoServiceimpl.java | 84 +++++++++++++++++++ .../mapper/userinfo/platUserInfoMapper.xml | 63 ++++++++++++++ 6 files changed, 275 insertions(+) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/beans/CustInfoQuery.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/controller/platCustInfoController.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/mapper/platCustInfoMapper.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/ICustInfoService.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/impl/ICustinfoServiceimpl.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/resources/mapper/userinfo/platUserInfoMapper.xml diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/beans/CustInfoQuery.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/beans/CustInfoQuery.java new file mode 100644 index 00000000..8a1bb9b2 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/beans/CustInfoQuery.java @@ -0,0 +1,38 @@ +package com.bonus.canteen.core.userinfo.beans; + + +import lombok.Data; + +@Data +public class CustInfoQuery { + + // 查询条件 + private String custName; + private String phone; + private String custNum; + private String functionStatus; + private String configCode; + private Long orgId; + private Integer custState; + + // 分页参数 + private Integer pageNum; + private Integer pageSize; + + // 查询结果字段 + private Long custId; + private String custNumResult; + private String custNameResult; + private String phoneResult; + private String operator; + private Long orgIdResult; + private String orgName; + private String orgFullName; + private String idCard; + private Integer sex; + private String birthday; + private String crtime; + // 功能状态(true=有配置=开启,false=无配置=关闭) + private Boolean hasFunction; + private String[] selectedOrg; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/controller/platCustInfoController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/controller/platCustInfoController.java new file mode 100644 index 00000000..c2691c70 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/controller/platCustInfoController.java @@ -0,0 +1,59 @@ +package com.bonus.canteen.core.userinfo.controller; + +import com.bonus.canteen.core.userinfo.beans.CustInfoQuery; +import com.bonus.canteen.core.userinfo.service.ICustInfoService; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +@RestController +@RequestMapping("/custInfo") +public class platCustInfoController extends BaseController { + + + @Autowired + private ICustInfoService custInfoService; + + @GetMapping("/list") + public TableDataInfo list(CustInfoQuery query) { + startPage(); + List peoplelist = custInfoService.selectCustInfoList(query); + return getDataTable(peoplelist); + } + + @PostMapping("/toggleFunction") + public AjaxResult toggleFunction(@RequestBody CustInfoQuery query) { + try { + // 获取当前登录用户 + String operator = SecurityUtils.getUsername();; + query.setOperator(operator); + int result = custInfoService.toggleFunction(query); + + if (result > 0) { + return success("操作成功"); + } else { + return success("状态未变化"); + } + } catch (Exception e) { + return error("操作失败:" + e.getMessage()); + } + } + + /** + * 给app提供的接口 是否存在领导配置 + * @param query + * @return + */ + @PostMapping("/ifLeader") + public Boolean ifLeader(@RequestBody CustInfoQuery query) { + boolean result = custInfoService.ifLeader(query); + return result; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/mapper/platCustInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/mapper/platCustInfoMapper.java new file mode 100644 index 00000000..0830fa76 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/mapper/platCustInfoMapper.java @@ -0,0 +1,16 @@ +package com.bonus.canteen.core.userinfo.mapper; + +import com.bonus.canteen.core.userinfo.beans.CustInfoQuery; + +import java.util.List; + +public interface platCustInfoMapper { + + List selectCustInfoList(CustInfoQuery query); + + int checkConfigExists(Long custId); + + int insertConfig(CustInfoQuery query); + + int deleteConfig(CustInfoQuery query); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/ICustInfoService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/ICustInfoService.java new file mode 100644 index 00000000..81b850a4 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/ICustInfoService.java @@ -0,0 +1,15 @@ +package com.bonus.canteen.core.userinfo.service; + +import com.bonus.canteen.core.userinfo.beans.CustInfoQuery; +import com.bonus.common.core.web.page.TableDataInfo; + +import java.util.List; + +public interface ICustInfoService { + List selectCustInfoList(CustInfoQuery query); + + int toggleFunction(CustInfoQuery quer); + + boolean ifLeader(CustInfoQuery query); +} + diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/impl/ICustinfoServiceimpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/impl/ICustinfoServiceimpl.java new file mode 100644 index 00000000..4515025a --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/userinfo/service/impl/ICustinfoServiceimpl.java @@ -0,0 +1,84 @@ +package com.bonus.canteen.core.userinfo.service.impl; + +import com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo; +import com.bonus.canteen.core.userinfo.beans.CustInfoQuery; +import com.bonus.canteen.core.userinfo.mapper.platCustInfoMapper; +import com.bonus.canteen.core.userinfo.service.ICustInfoService; +import com.bonus.common.core.utils.PageUtils; +import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.common.houqin.utils.SM4EncryptUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; + +@Service +public class ICustinfoServiceimpl implements ICustInfoService { + + @Autowired + private platCustInfoMapper custInfoMapper; + + @Override + public List selectCustInfoList(CustInfoQuery query) { + if(query.getCustName() != null){ + // 解密 + try { + query.setCustName(SM4EncryptUtils.sm4Encrypt(query.getCustName())); + }catch (Exception e){ + e.printStackTrace(); + } + } + + List list = custInfoMapper.selectCustInfoList(query); + for (CustInfoQuery c : list) { + try { + // 姓名解密 + if (c.getCustNameResult() != null && !c.getCustNameResult().isEmpty()) { + c.setCustNameResult(SM4EncryptUtils.sm4Decrypt(c.getCustNameResult())); + } + + // 手机解密 + 脱敏 + if (c.getPhoneResult() != null && !c.getPhoneResult().isEmpty()) { + String phone = SM4EncryptUtils.sm4Decrypt(c.getPhoneResult()); + if (phone.length() == 11) { + c.setPhoneResult(phone.substring(0, 3) + "****" + phone.substring(7)); + } else { + c.setPhoneResult(phone); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return list; + } + + @Override + public int toggleFunction(CustInfoQuery query) { + int exists = custInfoMapper.checkConfigExists(query.getCustId()); + if (query.getHasFunction()) { + // 开启功能:插入配置记录 + if (exists == 0) { + return custInfoMapper.insertConfig(query); + } + // 已存在,不做操作 + return 0; + } else { + // 关闭功能:删除配置记录 + if (exists > 0) { + return custInfoMapper.deleteConfig(query); + } + // 已删除,不做操作 + return 0; + } +} + + @Override + public boolean ifLeader(CustInfoQuery query) { + int exists = custInfoMapper.checkConfigExists(query.getCustId()); + return exists > 0; + } + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/userinfo/platUserInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/userinfo/platUserInfoMapper.xml new file mode 100644 index 00000000..6a09b7cc --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/userinfo/platUserInfoMapper.xml @@ -0,0 +1,63 @@ + + + + + INSERT INTO sys_cust_config(cust_id, config_code, operator) + VALUES(#{custId}, #{configCode}, #{operator}) + + + DELETE FROM sys_cust_config + WHERE cust_id = #{custId} + + + + +