package com.product.admin.service; import com.product.admin.config.CmnConst; import com.product.admin.config.SystemCode; import com.product.admin.service.idel.IPasswordSecurityService; import com.product.core.config.Global; import com.product.core.entity.DataTableEntity; import com.product.core.transfer.Transactional; import com.product.email.service.SendEmailService; import com.product.text.message.util.HttpSmsSendUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.product.core.dao.BaseDao; import com.product.core.entity.FieldSetEntity; import com.product.core.exception.BaseException; import com.product.core.service.support.AbstractBaseService; import java.io.IOException; import java.util.Date; /** * Copyright LX-BASE * @Title: PasswordSecurityService * @Project: LX-BASE-SERVER * @Date: 2020-05-30 17:29 * @Author: ZhouJie * @Description: 密码安全设置 */ @Component public class PasswordSecurityService extends AbstractBaseService implements IPasswordSecurityService { @Autowired public BaseDao baseDao; @Autowired public SendEmailService sendEmailService; /** * @Date: 2020-05-30 13:53 * @Author: ZhouJie * @Description: 查询密码强度信息 */ public FieldSetEntity findPwdSecurityInfo(String org_level_uuid) throws BaseException { FieldSetEntity fs = null; baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_PASSWORD_SECURITY,CmnConst.ORG_LEVEL_UUID+" = ? ",new Object[]{ org_level_uuid },true); // if(fs == null){ // fs = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_PASSWORD_SECURITY,CmnConst.UUID+" = ? ",new Object[]{ "security_uuid_01" },true); // if(fs == null) { // throw new BaseException(SystemCode.SYSTEM_PASSWORD_SECURITY_SET.getValue(), SystemCode.SYSTEM_PASSWORD_SECURITY_SET.getText(), this.getClass(),"checkNewPwd"); // } // } DataTableEntity t = baseDao.listTable(CmnConst.PRODUCT_SYS_PASSWORD_SECURITY, CmnConst.ORG_LEVEL_UUID + " = ? or "+CmnConst.ORG_LEVEL_UUID+" is null or "+CmnConst.ORG_LEVEL_UUID+"='' ", new Object[]{org_level_uuid}, CmnConst.ORG_LEVEL_UUID+" desc "); if(t!=null && t.getRows()>0) { fs=t.getFieldSetEntity(0); } if (fs == null) { fs = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_PASSWORD_SECURITY, "security_uuid_01", false); } if(fs == null) { throw new BaseException(SystemCode.SYSTEM_PASSWORD_SECURITY_NOT_FIND.getValue(), SystemCode.SYSTEM_PASSWORD_SECURITY_NOT_FIND.getText()); } return fs; } /** * @Date: 2020-10-09 13:53 * @Author: ZhouJie * @Description: 新增密码强度信息 */ @Transactional public String addSecurity(FieldSetEntity fse) throws BaseException { FieldSetEntity fsorg = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_ORG_LEVELS,fse.getString("org_level_uuid"),false); DataTableEntity dt = fse.getSubDataTable(CmnConst.PRODUCT_SYS_PASSWORD_SECURITY_ETAILS); if(dt != null && dt.getRows()>0){ for(int i= 0 ; i