This commit is contained in:
zhouzy062 2024-04-07 09:39:35 +08:00
commit 943c8b60f5
19 changed files with 436 additions and 132 deletions

View File

@ -203,6 +203,12 @@ public class MaType extends BaseEntity {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<MaType> children = new ArrayList<>();
/**
* 厂家规格型号
*/
@ApiModelProperty(value = "厂家规格型号")
private String facModel;
public Long getTypeId() {
@ -550,4 +556,12 @@ public class MaType extends BaseEntity {
public void setFinalPrice(String finalPrice) {
this.finalPrice = finalPrice;
}
public String getFacModel() {
return facModel;
}
public void setFacModel(String facModel) {
this.facModel = facModel;
}
}

View File

@ -13,6 +13,7 @@ import java.util.List;
/**
* 退料接收-app
*
* @author bns_han
*/
@RestController
@ -32,8 +33,14 @@ public class BackReceiveController extends BaseController {
@GetMapping("getbackReceiveList")
public AjaxResult getbackReceiveList(BackApplyInfo record) {
try {
List<BackApplyInfo> list = backReceiveService.getbackReceiveList(record);
return success(list);
if (record.getFlag() == 0) {
List<BackApplyInfo> list = backReceiveService.getbackReceiveList(record);
return success(list);
} else {
startPage();
List<BackApplyInfo> list = backReceiveService.getbackReceiveList(record);
return success(getDataTable(list));
}
} catch (Exception e) {
throw new RuntimeException(e);
}

View File

@ -51,6 +51,10 @@ public class BackApplyInfo {
* 类型名称
*/
private String typeName;
/**
* 协议号
*/
private String agreementCode;
/**
* 规格编号
*/
@ -159,4 +163,7 @@ public class BackApplyInfo {
* 退料数量
*/
private String preNum;
private String startTime;
private String endTime;
private Integer flag;
}

View File

@ -583,35 +583,69 @@
SELECT
bai.id,
bai.`code`,
bai.task_id as taskId,
bai.back_person as backPerson,
bai.task_id AS taskId,
bai.back_person AS backPerson,
bai.phone,
bpl.lot_id,
bpl.lot_name as lotName,
bui.unit_id as unitId,
bui.unit_name as unitName,
bai.back_time as backTime,
tt.task_status as taskStatus,
tta.agreement_id as agreementId,
GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
GROUP_CONCAT(mt2.type_name, '') AS typeName
bpl.lot_name AS lotName,
bui.unit_id AS unitId,
bui.unit_name AS unitName,
bai.back_time AS backTime,
bagi.agreement_code AS agreementCode,
tt.task_status AS taskStatus,
sd.`name` AS taskName,
tta.agreement_id AS agreementId,
GROUP_CONCAT( DISTINCT bad.type_id ) AS typeId,
GROUP_CONCAT( mt2.type_name, '' ) AS typeName
FROM
back_apply_info bai
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id=tta.agreement_id
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bagi.project_id
LEFT JOIN bm_unit_info bui on bui.unit_id=bagi.unit_id
LEFT JOIN sys_user us on us.user_id=bai.create_by
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id=mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id=mt3.parent_id
LEFT JOIN back_apply_details bad ON bad.parent_id = bai.id
LEFT JOIN tm_task tt ON tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bagi.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bagi.unit_id
LEFT JOIN sys_user us ON us.user_id = bai.create_by
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN sys_dic sd ON sd.id = tt.task_status
WHERE
tt.task_status in (38,39,40)
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
ORDER BY tt.task_status asc ,bai.create_time desc
tt.task_status IN ( 37, 38, 39, 40 )
<if test="keyWord != null and keyWord != ''">
and (bai.code like concat('%', #{keyWord}, '%') or
bagi.agreement_code like concat('%', #{keyWord}, '%'))
</if>
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}
</if>
<if test="lotId != null and lotId != ''">
and bpl.lot_id = #{lotId}
</if>
<if test="agreementCode != null and agreementCode != ''">
and bagi.agreement_code like concat('%', #{agreementCode}, '%')
</if>
<if test="taskStatus != null and taskStatus != ''">
and tt.task_status = #{taskStatus}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND bai.back_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
GROUP BY
bai.id,
us.user_name,
bai.phone,
bpl.lot_name,
bui.unit_name,
bagi.plan_start_time
<if test="typeId != null and typeId != ''">
HAVING
FIND_IN_SET(#{typeId}, GROUP_CONCAT(DISTINCT bad.type_id))
</if>
ORDER BY
tt.task_status ASC,
bai.create_time DESC
</select>
<select id="receiveView" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
@ -620,7 +654,8 @@
bai.task_id as taskId,
tta.agreement_id as agreementId,
mt.type_id as typeId,
mt.type_name typeCode,
mt.type_name as typeCode,
mt.unit_name as unitName,
mt2.type_name AS typeName,
IFNULL(bad.audit_num,0)-(IFNULL(aa.back_num,0)) as num,
mt.manage_type as manageType,
@ -644,6 +679,9 @@
) aa on aa.typeId=bad.type_id
WHERE
bai.id=#{id}
<if test="code != null and code != ''">
and CONCAT('NSJJ',mt.`code`,mt.model_code) like concat ('%',#{code},'%')
</if>
</select>
<select id="selectTaskNumByMonthWx" resultType="java.lang.Integer">

View File

@ -69,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isPlan != null">is_plan,</if>
<if test="isAncuo != null">is_ancuo,</if>
<if test="remark != null">remark,</if>
<if test="facModel != null">fac_model,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeName != null and typeName != ''">#{typeName},</if>
@ -98,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isPlan != null">#{isPlan},</if>
<if test="isAncuo != null">#{isAncuo},</if>
<if test="remark != null">#{remark},</if>
<if test="facModel != null">#{facModel},</if>
</trim>
</insert>
@ -154,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isAncuo != null">is_ancuo = #{isAncuo},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="facModel != null">fac_model = #{facModel},</if>
</trim>
where type_id = #{typeId}
</update>
@ -273,13 +276,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<select id="selectMaTypeByTypeId" resultMap="MaTypeResult">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type,
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id,m.unit_name, m.manage_type,
m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,
su.nick_name keeperUserName, mtr.user_id repairUserId, su1.nick_name repairUserName, mpi.prop_name,
su.nick_name keeperUserName, mtr.user_id repairUserId, su1.nick_name repairUserName,mpi.prop_id as propId, mpi.prop_name as propName,
m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id
m.remark, m.company_id,m.fac_model as facModel
from ma_type m
left join ma_prop_set mps on m.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
@ -334,7 +337,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,
su.nick_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id
m.remark, m.company_id,m.fac_model as facModel
from ma_type m
left join ma_prop_set mps on m.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id

View File

@ -84,11 +84,17 @@ public class BackApplyController extends BaseController {
*/
@ApiOperation(value = "退料申请(查看)")
@GetMapping("/getViewByApply")
public TableDataInfo getViewByApply(BackApplyInfo bean) {
startPage();
bean.setFlag(0);
List<BackApplyInfo> list = backApplyService.getViewByApply(bean);
return getDataTable(list);
public AjaxResult getViewByApply(BackApplyInfo bean) {
if (bean.getViewWeb() == 1) {
bean.setFlag(0);
List<BackApplyInfo> list = backApplyService.getViewByApply(bean);
return AjaxResult.success(list);
} else {
startPage();
bean.setFlag(0);
List<BackApplyInfo> list = backApplyService.getViewByApply(bean);
return AjaxResult.success(getDataTable(list));
}
}
/**

View File

@ -245,4 +245,6 @@ public class BackApplyInfo extends BaseEntity {
/** 前端条件查询所传退料时间 */
private String time;
private int viewWeb;
}

View File

@ -112,6 +112,17 @@ public class PurchaseMacodeInfo extends BaseEntity
/** 到货日期 */
@ApiModelProperty(value = "到货日期")
private String arrivalTime;
/** 单位名称 */
@ApiModelProperty(value = "单位名称")
private String unitName;
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
@ApiModelProperty(value = "0,正常 1, 重复数据")
private int statusFlag;

View File

@ -60,13 +60,11 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
}
}
}
int res = 0;
int res;
try {
//1. 判断是数量还是编号入库保存到不同表
//1.1 如果是编号入库
if (dto.getIsCode()) {
/*插入ma_machinema_machine_label和ma_label_bind以及
ma_type_put_in_storage_info表和ma_type_put_in_storage_details表*/
res = insertMaMachineInfo(dto, codeList);
if (res == 0) {
log.error("insertMaMachineInfo方法插入异常");
@ -87,11 +85,9 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
}
}
} catch (Exception e) {
log.error(e.getMessage());
// 添加事务回滚逻辑
log.error("保存入库盘点异常:{}",e.getMessage());
// 添加事务回滚逻辑保证入库全部成功或者全部失败
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
if (res == 0) {
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
}
return AjaxResult.success(res);
@ -113,7 +109,7 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
* @return
*/
private int insertMaMachineInfo(SavePutInfoDto dto, List<String> codeList) {
int num = 0;
int res = 0;
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
String code = codeList.get(i);
@ -125,21 +121,22 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
machIneDto.setPutInType(dto.getPutInType());
machIneDto.setNum(dto.getNum());
machIneDto.setCheckMan(dto.getCheckMan());
num = inventoryAndWarehousingMapper.insertMachine(machIneDto);
if (num == 0) {
throw new RuntimeException("新增到ma_machine表失败");
}
num = inventoryAndWarehousingMapper.insertMachineLabel(machIneDto);
if (num == 0) {
throw new RuntimeException("新增到ma_machine_label表失败");
}
num = inventoryAndWarehousingMapper.insertLabelBind(machIneDto);
if (num == 0) {
throw new RuntimeException("新增到ma_label_bind表失败");
}
num = getAnInt(machIneDto);
res += insertMachineInfo(machIneDto);
}
return num;
return res;
}
/**
* 方法抽取保持到ma_machinema_machine_label和ma_label_bind
* @param machIneDto
* @return
*/
private int insertMachineInfo(MachIneDto machIneDto) {
int res = inventoryAndWarehousingMapper.insertMachine(machIneDto);
res += inventoryAndWarehousingMapper.insertMachineLabel(machIneDto);
res += inventoryAndWarehousingMapper.insertLabelBind(machIneDto);
res += insertTypePutInStorageInfo(machIneDto);
return res;
}
/**
@ -147,19 +144,12 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
* @param machIneDto
* @return
*/
private int getAnInt(MachIneDto machIneDto) {
int num;
private int insertTypePutInStorageInfo(MachIneDto machIneDto) {
//插入ma_type_put_in_storage_info表,返回主键id
num = inventoryAndWarehousingMapper.saveInfo(machIneDto);
if (num == 0) {
throw new RuntimeException("新增到ma_type_put_in_storage_info表失败");
}
int res = inventoryAndWarehousingMapper.saveInfo(machIneDto);
//ma_type_put_in_storage_details表
num = inventoryAndWarehousingMapper.saveDetails(machIneDto);
if (num == 0) {
throw new RuntimeException("新增到ma_type_put_in_storage_details表失败");
}
return num;
res += inventoryAndWarehousingMapper.saveDetails(machIneDto);
return res;
}
@ -180,16 +170,16 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
* @return
*/
private int insertPutInfo(SavePutInfoDto dto) {
int num = 0;
int res = 0;
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
machIneDto.setCreator(dto.getCreator());
machIneDto.setPutInType(dto.getPutInType());
machIneDto.setRemarks(dto.getRemarks());
getAnInt(machIneDto);
res += insertTypePutInStorageInfo(machIneDto);
//根据类型追加ma_type表里面的num
num = updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
}
return num;
return res;
}
}

View File

@ -409,6 +409,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pcd.type_id typeId,
pcd.task_id taskId,
mt.CODE specsCode,
mt.unit_name unitName,
mt1.CODE typeCode,
CASE

View File

@ -85,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY mt.type_id) AS subquery4 ON subquery4.type_id = mt.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
WHERE mt.`level` = 4
and mt.del_flag = '0'
<if test="typeName != null and typeName != ''">
and mt2.type_name like concat('%',#{typeName},'%')
</if>

View File

@ -105,6 +105,11 @@
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<version>3.1.423</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,41 @@
package com.bonus.sgzb.system.config;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.List;
/**
*
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "tencent.sms")
public class TencentSmsConfig{
//api秘钥标识
private String accessKeyId;
//api秘钥
private String accessKeySecret;
//请求域名
private String endpoint;
//所属区域
private String region;
//腾讯云申请应用id
private String sdkAppId;
//签名
private String smsSign;
//云平台模板id
private List<String> templateId;
}

View File

@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
/**
* Description: 短信控制器
@ -26,6 +27,11 @@ public class SysSmsController extends BaseController {
@Resource
private ISysSmsService smsService;
/**
* 登录短信验证码
* @param phone
* @return
*/
@PostMapping("codeLogin")
public AjaxResult codeLogin(@RequestParam(value = "phone") String phone){
try {
@ -35,6 +41,12 @@ public class SysSmsController extends BaseController {
}
}
/**
* 短信验证码校验
* @param phone
* @param code
* @return
*/
@PostMapping("checkCode")
public AjaxResult codeLogin(@RequestParam(value = "phone") String phone, @RequestParam(value = "code") String code){
try {
@ -44,6 +56,12 @@ public class SysSmsController extends BaseController {
}
}
/**
* 验收通知短信
* @param phone
* @param msg
* @return
*/
@PostMapping("send")
public AjaxResult send(@RequestParam(value = "phone") String phone, @RequestParam(value = "msg",required = false) String msg){
try {

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.common.core.utils.GlobalConstants;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.system.domain.AgreementVo;
@ -42,13 +43,14 @@ public class SelectServiceImpl implements SelectService {
@Override
public AjaxResult getProData(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getProData(dto);
List<SelectVo> list = mapper.getProData(dto);
list.removeIf(item -> item == null);
return AjaxResult.success(list);
} catch (Exception e) {
log.error("工程-查询失败", e);
}
return AjaxResult.success(list);
return AjaxResult.success();
}
@Override

View File

@ -1,16 +1,29 @@
package com.bonus.sgzb.system.service.impl;
import cn.hutool.http.HttpRequest;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.GlobalConstants;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.redis.service.RedisService;
import com.bonus.sgzb.system.config.TencentSmsConfig;
import com.bonus.sgzb.system.service.ISysSmsService;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.sms.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
@ -24,17 +37,27 @@ import static com.bonus.sgzb.common.core.web.domain.AjaxResult.success;
* @Version 1.0
*/
@Service
@Slf4j
public class SysSmsServiceImpl implements ISysSmsService {
@Resource
private RedisService redisService;
@Resource
private TencentSmsConfig tencentSmsConfig;
/**
* 短信URL
*/
private static final String URL = "http://api.ktsms.cn/sms_token?ddtkey=bonus&secretkey=KtyBns@Admin2023!";
/**
* 验收通知短信
* @param phone 手机号
* @param msg 内容
* @return
*/
@Override
public AjaxResult sendSms(String phone, String msg) {
if (phone == null || StringUtils.isEmpty(msg)) {
@ -43,13 +66,34 @@ public class SysSmsServiceImpl implements ISysSmsService {
if (phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号格式不正确");
}
return sendMsgByPhone(phone, msg);
try {
String[] args = msg.split(",");
String body = sendMessageNew(phone,tencentSmsConfig.getTemplateId().get(0),args);
return success("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body);
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}
/**
* 登录短信验证码
* @param phone 手机号
* @return
*/
@Override
public AjaxResult codeLogin(String phone) {
// 校验手机号码
return sendCodeByPhone(phone, null);
try {
//获取六位验证码
String code = getSixBitCode();
//调用发送短信的方法
String body = sendMessageNew(phone,tencentSmsConfig.getTemplateId().get(1),code);
// 存储验证码至Redis中键值为code_15588886157 , 有效期5时间颗粒度为MINUTES:分钟
redisService.setCacheObject("code_" + phone, code, 5L, TimeUnit.MINUTES);
return success("手机号:" + phone + ",用户登录验证码:" + code + ",返回结果:" + body);
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}
@ -58,7 +102,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
* @param phone 手机号码
* @return AjaxResult对象
*/
private AjaxResult sendMsgByPhone(String phone, String msg) {
/* private AjaxResult sendMsgByPhone(String phone, String msg) {
// 校验手机号码
if (phone == null || phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号码不正确");
@ -76,7 +120,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}
}*/
/**
@ -84,7 +128,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
* @param phone 手机号码
* @return AjaxResult对象
*/
private AjaxResult sendCodeByPhone(String phone, String msg) {
/* private AjaxResult sendCodeByPhone(String phone, String msg) {
// 校验手机号码
if (phone == null || phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号格式错误请输入11位数字号码");
@ -108,7 +152,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}
}*/
/**
@ -146,6 +190,65 @@ public class SysSmsServiceImpl implements ISysSmsService {
return String.valueOf(random.nextInt(900000) + 100000);
}
/**
* 腾讯sms短信
* @param mobilePhone
* @param templateId
* @param args
* @return
* @throws Exception
*/
public String sendMessageNew(String mobilePhone,String templateId, String... args) throws Exception {
try{
// 实例化一个认证对象入参需要传入腾讯云账户secretIdsecretKey,此处还需注意密钥对的保密
Credential cred = new Credential(tencentSmsConfig.getAccessKeyId(), tencentSmsConfig.getAccessKeySecret());
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint(tencentSmsConfig.getEndpoint());
// 实例化一个client选项可选的没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的 第二个参数是地域信息
SmsClient client = new SmsClient(cred, tencentSmsConfig.getRegion(), clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
SendSmsRequest req = new SendSmsRequest();
//设置固定的参数
req.setSmsSdkAppId(tencentSmsConfig.getSdkAppId());// 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId
req.setSignName(tencentSmsConfig.getSmsSign());//短信签名内容: 使用 UTF-8 编码必须填写已审核通过的签名
req.setTemplateId(templateId);//模板 ID: 必须填写已审核通过的模板 ID
//设置发送相关的参数
//发送对象最多200个
String[] phoneNumberSet1 = mobilePhone.split(",");
for (int i = 0; i < phoneNumberSet1.length; i++) {
phoneNumberSet1[i] = "+86" + phoneNumberSet1[i];
}
req.setPhoneNumberSet(phoneNumberSet1);//发送的手机号
if(null != args && args.length > 0 && Arrays.stream(args)
.noneMatch(s -> s == null || s.trim().isEmpty())) {
String[] templateParamSet1 = args;//模板的参数
req.setTemplateParamSet(templateParamSet1);//发送验证码
}
// 返回的resp是一个SendSmsResponse的实例与请求对象对应
log.info("腾讯云平台短信发送请求参数:{}", JSONObject.toJSONString(req));
SendSmsResponse resp = client.SendSms(req);
// 输出json格式的字符串回包
log.info("腾讯云平台短信发送响应结果:{}", JSONObject.toJSONString(resp));
SendStatus[] sendStatusSet = resp.getSendStatusSet();
List<SendStatus> sendStatuses = Arrays.asList(sendStatusSet);
if (CollectionUtils.isNotEmpty(sendStatuses)){
for (SendStatus sendStatus : sendStatuses) {
if (!"OK".equalsIgnoreCase(sendStatus.getCode())){
throw new ServiceException(sendStatus.getMessage(),Integer.valueOf(sendStatus.getCode()));
}
}
}
return resp.getRequestId();
} catch (TencentCloudSDKException e) {
e.printStackTrace();
log.error("短信发送失败:{}", e.getMessage());
throw new ServiceException(e.getMessage(),Integer.valueOf(e.getErrorCode()));
}
}
}

View File

@ -36,7 +36,23 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
#腾讯云sms
tencent:
sms:
#api秘钥标识
accessKeyId: AKIDrreCVaRKDtMcgfU5QW9iEfv67tMfldJn
#api秘钥
accessKeySecret: OXUgeMo0yhBRTGo6sVu3yiFX4rQtAzc3
#请求域名
endpoint: sms.tencentcloudapi.com
#所属区域
region: ap-guangzhou
#腾讯云申请应用id
sdkAppId: 1400494336
#签名
smsSign: 南方电网互联网
#云平台模板id 2116937-验收通知 2115503-登录验证
templateId: 2116937,2115503

View File

@ -182,7 +182,7 @@
<el-dialog :title="title" :visible.sync="noticeOpen" width="1000px" append-to-body>
<el-form ref="nform" :model="nform" :rules="nrules" label-width="100px">
<el-form-item label="通知内容:" prop="notice">
<el-input v-model="nform.notice" type="textarea" :autosize="{ minRows: 4, maxRows: 6}" placeholder="请输入通知内容" style="width: 80%;"/>
<el-input v-model="nform.notice" type="textarea" :autosize="{ minRows: 4, maxRows: 6}" placeholder="请输入通知内容" style="width: 80%;" disabled/>
</el-form-item>
</el-form>
@ -504,7 +504,8 @@ export default {
item.phone = item.telphone;
})
let param = {
message:this.nform.notice,
// message:this.nform.notice,
message:`${this.getNowTime()},${this.taskInfo.code}`,
taskId:this.taskInfo.taskId,
bmNoticeInfoList:this.configUserList,
}

View File

@ -187,7 +187,7 @@
placeholder="请选择物品类型"
:options="deviceTypeTree"
:props="deviceTypeTreeProps"
v-model="deviceType"
v-model="codeForm.typeId"
@change="deviceTypeChange"
ref="deviceTypeCascader"
style="width: 400px;"
@ -229,18 +229,18 @@
<el-input
v-model="codeForm.codeSuffixStart"
clearable
placeholder="请输入后缀范围"
placeholder="请输入后缀范围起始值"
style="width: 185px"
@input="changeInput(codeForm.codeSuffixStart)"
@change="changeSuffixStart(codeForm.codeSuffixStart)"
/>
</el-form-item>
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd" v-if="!isNumCheck">
<el-input
v-model="codeForm.codeSuffixEnd"
clearable
placeholder="请输入后缀范围"
placeholder="请输入后缀范围结束值"
style="width: 185px"
@input="changeInput(codeForm.codeSuffixEnd)"
@change="changeSuffixEnd"
/>
</el-form-item>
</el-col>
@ -278,9 +278,9 @@
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="检验时间" label-width="130px" prop="thisCheckFixTime" v-if="!isNumCheck">
<el-form-item label="检验时间" label-width="130px" prop="thisCheckTime" v-if="!isNumCheck">
<el-date-picker
v-model="codeForm.thisCheckFixTime"
v-model="codeForm.thisCheckTime"
type="date"
placeholder="请输入检验时间"
style="width: 400px"
@ -288,9 +288,9 @@
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="下次检验时间" label-width="130px" prop="nextCheckFixTime" v-if="!isNumCheck">
<el-form-item label="下次检验时间" label-width="130px" prop="nextCheckTime" v-if="!isNumCheck">
<el-date-picker
v-model="codeForm.nextCheckFixTime"
v-model="codeForm.nextCheckTime"
type="date"
placeholder="请输入检验时间"
style="width: 13vw;"
@ -383,20 +383,20 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="检验日期" align="center" prop="thisCheckFixTime" :show-overflow-tooltip="true">
<el-table-column label="检验日期" align="center" prop="thisCheckTime" :show-overflow-tooltip="true">
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-date-picker
v-model="row.thisCheckFixTime"
v-model="row.thisCheckTime"
type="date"
placeholder="请输入检验时间"
style="width: 170px"
></el-date-picker>
</template>
</el-table-column>
<el-table-column label="下次检验日期" align="center" prop="nextCheckFixTime" :show-overflow-tooltip="true">
<el-table-column label="下次检验日期" align="center" prop="nextCheckTime" :show-overflow-tooltip="true">
<template v-slot:default="{ row }" v-if="!isNumCheck">
<el-date-picker
v-model="row.nextCheckFixTime"
v-model="row.nextCheckTime"
type="date"
placeholder="请输入下次检验时间"
style="width: 170px"
@ -603,8 +603,8 @@ export default {
codeSuffixEnd: undefined,
buyPrice: undefined,
codeFactory: undefined,
thisCheckFixTime: undefined,
nextCheckFixTime: undefined,
thisCheckTime: undefined,
nextCheckTime: undefined,
pageNum: 1,
pageSize: 10,
},
@ -668,7 +668,6 @@ export default {
},
//
cancelCode() {
this.codeOpen = false;
this.cascaderDisabled = false
this.resetCodeForm();
this.deviceType = {}
@ -676,7 +675,8 @@ export default {
this.codeTableList = []
this.numTableList = []
this.$refs['codeForm'].clearValidate()
this.isNumCheck = false;
this.codeOpen = false;
this.getList()
},
//
reset() {
@ -693,17 +693,17 @@ export default {
resetCodeForm() {
this.codeForm = {
checkMan: undefined,
putInType: undefined,
putInType: null,
remarks: undefined,
typeId: undefined,
typeId: null,
num: undefined,
codePrefix: undefined,
codeSuffixStart: undefined,
codeSuffixEnd: undefined,
buyPrice: undefined,
codeFactory: undefined,
thisCheckFixTime: undefined,
nextCheckFixTime: undefined,
thisCheckTime: undefined,
nextCheckTime: undefined,
pageNum: 1,
pageSize: 10,
}
@ -734,7 +734,11 @@ export default {
// this.codeForm.num, this.codeTableListthis.codeForm
for (let i = 0; i < this.codeForm.num; i++) {
// :
let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
let suffix = parseInt(this.codeForm.codeSuffixStart) + i
if (suffix > parseInt(this.codeForm.codeSuffixEnd)) {
suffix = parseInt(this.codeForm.codeSuffixEnd)
}
suffix = suffix.toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
suffix = isNaN(suffix) ? '' : suffix
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
@ -742,20 +746,18 @@ export default {
const outFacCode = ''
//
const maVender = this.supplierList.find(item => item.supplierId == this.codeForm.codeFactory)?.supplier || ''
// : codeForm.thisCheckFixTime, yyyy-MM-dd
let thisCheckFixTime = new Date(this.codeForm.thisCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
if (thisCheckFixTime == 'Invalid Date') thisCheckFixTime = ''
// : codeForm.nextCheckFixTime
let nextCheckFixTime = new Date(this.codeForm.nextCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
if (nextCheckFixTime == 'Invalid Date') nextCheckFixTime = ''
// : codeForm.thisCheckTime
const thisCheckTime = this.codeForm.thisCheckTime
// : codeForm.nextCheckTime
const nextCheckTime = this.codeForm.nextCheckTime
// : codeForm.buyPrice
const buyPrice = this.codeForm.buyPrice || 0
this.codeTableList.push({
maCode,
outFacCode,
maVender,
thisCheckFixTime,
nextCheckFixTime,
thisCheckTime,
nextCheckTime,
buyPrice
})
}
@ -763,11 +765,28 @@ export default {
})
},
/** 输入框改变 */
changeInput(num) {
changeSuffixStart(num) {
if (isNaN(num)) {
this.$message.error('请输入数字类型')
this.$message.error('后缀范围请输入数字类型')
this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
}
if (!this.codeForm.codeSuffixStart) {
this.codeForm.codeSuffixEnd = ''
}
},
changeSuffixEnd() {
if (!this.codeForm.codeSuffixStart) {
this.$message.error('请输入后缀范围起始值')
this.codeForm.codeSuffixEnd = ''
} else if (isNaN(this.codeForm.codeSuffixEnd)) {
this.$message.error('后缀范围请输入数字类型')
this.codeForm.codeSuffixEnd = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
} else {
if (parseInt(this.codeForm.codeSuffixStart) > parseInt(this.codeForm.codeSuffixEnd)) {
this.$message.error('后缀结束值不能小于起始值')
this.codeForm.codeSuffixEnd = +this.codeForm.codeSuffixStart + 1
}
}
},
handleResetRow(row) {
@ -775,8 +794,8 @@ export default {
row.maCode = ''
row.outFacCode = ''
row.maVender = ''
row.thisCheckFixTime = ''
row.nextCheckFixTime = ''
row.thisCheckTime = ''
row.nextCheckTime = ''
row.buyPrice = 0
},
@ -792,6 +811,10 @@ export default {
this.reset();
this.codeOpen = true;
this.title = "数量盘点入库";
this.resetCodeForm()
this.$nextTick(() => {
this.$refs['codeForm'].clearValidate()
})
},
/** 新增编号盘点按钮操作 */
handleCodeAdd() {
@ -799,6 +822,10 @@ export default {
this.reset();
this.codeOpen = true;
this.title = "编码盘点入库";
this.resetCodeForm()
this.$nextTick(() => {
this.$refs['codeForm'].clearValidate()
})
},
//
handleSelectionChange(selection) {
@ -821,9 +848,9 @@ export default {
this.$refs['codeForm'].validate(valid => {
if (valid) {
let SavePutInfoDto = {}
console.log('🚀 ~ this.codeForm:', this.codeForm);
console.log('🚀 ~ this.codeTableList:', this.codeTableList);
console.log('🚀 ~ this.numTableList:', this.numTableList);
// console.log('🚀 ~ this.codeForm:', this.codeForm);
// console.log('🚀 ~ this.numTableList:', this.numTableList);
// console.log('🚀 ~ this.codeTableList:', this.codeTableList);
if (this.isNumCheck) {
//
SavePutInfoDto = {
@ -836,14 +863,26 @@ export default {
//
inputByCode(SavePutInfoDto).then(response => {
this.$message.success('入库成功')
this.codeOpen = false
this.getList()
this.resetCodeForm()
this.reset()
this.numTableList = []
this.deviceType = {}
this.codeOpen = false
this.reset()
this.getList()
})
} else {
// yyyy-MM-dd
this.codeTableList.forEach(item => {
if (item.thisCheckTime) {
item.thisCheckTime = new Date(item.thisCheckTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
} else {
item.thisCheckTime = ''
}
if (item.nextCheckTime) {
item.nextCheckTime = new Date(item.nextCheckTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
} else {
item.nextCheckTime = ''
}
})
//
SavePutInfoDto = {
isCode: true, //
@ -864,12 +903,11 @@ export default {
//
inputByCode(SavePutInfoDto).then(response => {
this.$message.success('入库成功')
this.codeOpen = false
this.getList()
this.resetCodeForm()
this.reset()
this.codeTableList = []
this.deviceType = {}
this.codeOpen = false
this.reset()
this.getList()
})
}
}