Commit 1cac5c58 by caiyt

极光推送逻辑修改,上传文件名逻辑修改

parent 423995a5
...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.soss.common.core.domain.AjaxResult; import com.soss.common.core.domain.AjaxResult;
import com.soss.common.exception.ServiceException; import com.soss.common.exception.ServiceException;
import com.soss.common.utils.StringUtils; import com.soss.common.utils.StringUtils;
import com.soss.common.utils.uuid.UUID;
import com.soss.system.domain.Machine; import com.soss.system.domain.Machine;
import com.soss.system.domain.Shop; import com.soss.system.domain.Shop;
import com.soss.system.jiguang.impl.JiGuangPushServiceImpl; import com.soss.system.jiguang.impl.JiGuangPushServiceImpl;
...@@ -17,10 +16,7 @@ import com.soss.system.utils.DistanceUtil; ...@@ -17,10 +16,7 @@ import com.soss.system.utils.DistanceUtil;
import io.jsonwebtoken.lang.Assert; import io.jsonwebtoken.lang.Assert;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -42,10 +38,15 @@ public class ApplicationController { ...@@ -42,10 +38,15 @@ public class ApplicationController {
@Autowired @Autowired
private ICustomerService customerService; private ICustomerService customerService;
@RequestMapping("/saveData") @PostMapping("/saveData")
public AjaxResult saveApplicationData(@RequestParam("machineCode") String machineCode, @RequestBody String body) { public AjaxResult saveApplicationData(@RequestBody String body) {
String id = UUID.randomUUID().toString(); JSONObject bodyJson = JSONObject.parseObject(body);
String key = machineCode;//+"_"+id; String machineCode = bodyJson.getString("machineCode");
Integer screenNo = bodyJson.getInteger("screenNo");
if (screenNo == null) {
screenNo = 1;
}
String key = machineCode + "_" + screenNo;
stringRedisTemplate.opsForValue().set(key, body); stringRedisTemplate.opsForValue().set(key, body);
stringRedisTemplate.expire(key, 60, TimeUnit.SECONDS); stringRedisTemplate.expire(key, 60, TimeUnit.SECONDS);
return AjaxResult.success("处理成功", key); return AjaxResult.success("处理成功", key);
...@@ -53,48 +54,58 @@ public class ApplicationController { ...@@ -53,48 +54,58 @@ public class ApplicationController {
@RequestMapping("/getData") @RequestMapping("/getData")
public AjaxResult getApplicationData(@RequestBody String body) { public AjaxResult getApplicationData(@RequestBody String body) {
JSONObject jj = JSONObject.parseObject(body); JSONObject bodyJson = JSONObject.parseObject(body);
String key = jj.getString("key"); String redisKey = bodyJson.getString("key");
JSONObject location = jj.getJSONObject("location"); JSONObject location = bodyJson.getJSONObject("location");
String s = stringRedisTemplate.opsForValue().get(key); String redisVal = stringRedisTemplate.opsForValue().get(redisKey);
if (StringUtils.isEmpty(s)) { if (StringUtils.isEmpty(redisVal)) {
throw new ServiceException("该二维码已经过期"); throw new ServiceException("该二维码已经过期");
} }
String openId = jj.getString("openId"); String openId = bodyJson.getString("openId");
String faceInfoId = jj.getString("faceInfoId"); String faceInfoId = bodyJson.getString("faceInfoId");
if (StringUtils.isNotEmpty(openId)) { if (StringUtils.isNotEmpty(openId)) {
Assert.isTrue(StringUtils.isNotEmpty(faceInfoId), "faceInfoId还未传递"); Assert.isTrue(StringUtils.isNotEmpty(faceInfoId), "faceInfoId还未传递");
customerService.insertCustFaceInfo(openId, faceInfoId); customerService.insertCustFaceInfo(openId, faceInfoId);
} }
JSONObject info = JSONObject.parseObject(s); JSONObject redisJson = JSONObject.parseObject(redisVal);
String machineCode = info.getString("machineCode"); String machineCode = redisJson.getString("machineCode");
Integer screenNo = redisJson.getInteger("screenNo");
Machine machine = machineService.selectMachineByCode(machineCode); Machine machine = machineService.selectMachineByCode(machineCode);
Shop shop = shopService.selectShopById(machine.getShopId()); Shop shop = shopService.selectShopById(machine.getShopId());
shop.setDistance(DistanceUtil.getDistanceDesc(Double.parseDouble(shop.getLng()), Double.parseDouble(shop.getLat()), Double.parseDouble(location.getString("lng")), Double.parseDouble(location.getString("lat")))); shop.setDistance(DistanceUtil.getDistanceDesc(Double.parseDouble(shop.getLng()), Double.parseDouble(shop.getLat()), Double.parseDouble(location.getString("lng")), Double.parseDouble(location.getString("lat"))));
info.put("shop", shop); redisJson.put("shop", shop);
String[] keys = key.split("_");
//推送数据给安卓 //推送数据给安卓
JSONObject jsonObject = new JSONObject(); JSONObject jgBody = new JSONObject();
jsonObject.put("action", "QRCODE_VISITED"); jgBody.put("action", "QRCODE_VISITED");
jsonObject.put("timestamp", String.valueOf(System.currentTimeMillis())); jgBody.put("timestamp", String.valueOf(System.currentTimeMillis()));
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("seqNo", key); data.put("seqNo", redisKey);
jsonObject.put("data", data); jgBody.put("data", data);
jiGuangPushService.push(keys[0], jsonObject); jiGuangPushService.push(Integer.parseInt(machine.getId()), screenNo, jgBody);
// stringRedisTemplate.delete(key); // stringRedisTemplate.delete(redisKey);
return AjaxResult.success("处理成功", info.toJSONString()); return AjaxResult.success("处理成功", redisJson.toJSONString());
} }
@RequestMapping("/jgRegister") @RequestMapping("/jgRegister")
public AjaxResult jgRegister(@RequestParam String machineCode,@RequestParam String registerId){ public AjaxResult jgRegister(@RequestParam String machineCode, @RequestParam(required = false) Integer screenNo, @RequestParam String registerId) {
Machine machine = machineService.selectMachineByCode(machineCode); Machine machine = machineService.selectMachineByCode(machineCode);
if(machine==null ){ if (machine == null || machine.getShopId() == null) {
throw new ServiceException("该机器未绑定店铺,请先绑定店铺"); throw new ServiceException("该机器未绑定店铺,请先绑定店铺");
} }
machine.setRegister(registerId); if (screenNo == null) {
return AjaxResult.success(machineService.updateMachine(machine)); screenNo = 1;
}
Assert.isTrue(StringUtils.isNotEmpty(machineCode), "machineCode不能为空");
Assert.isTrue(StringUtils.isNotEmpty(registerId), "registerId不能为空");
// machine.setRegister(registerId);
// machineService.updateMachine(machine);
machineService.saveMachineScreenRef(Integer.parseInt(machine.getId()), screenNo, registerId);
return AjaxResult.success();
} }
@RequestMapping("/getOrderTaking") @RequestMapping("/getOrderTaking")
public AjaxResult getOrderTaking(String machineCode){ public AjaxResult getOrderTaking(String machineCode){
......
...@@ -9,6 +9,7 @@ import com.soss.system.domain.Machine; ...@@ -9,6 +9,7 @@ import com.soss.system.domain.Machine;
import com.soss.system.service.IMachineService; import com.soss.system.service.IMachineService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -73,10 +74,13 @@ public class MachineController extends BaseController ...@@ -73,10 +74,13 @@ public class MachineController extends BaseController
*/ */
@Log(title = "机器", businessType = BusinessType.UPDATE) @Log(title = "机器", businessType = BusinessType.UPDATE)
@GetMapping("/unbound") @GetMapping("/unbound")
public AjaxResult unbound(String id) public AjaxResult unbound(String id) {
{
return toAjax(machineService.unbound(id)); return toAjax(machineService.unbound(id));
} }
@GetMapping("/bind/check/{shopId}")
public AjaxResult isShopBindMachine(@PathVariable Long shopId) {
List<Machine> machines = machineService.getMachines(shopId);
return AjaxResult.success(!CollectionUtils.isEmpty(machines));
}
} }
...@@ -91,6 +91,7 @@ weixin: ...@@ -91,6 +91,7 @@ weixin:
templateId: Fu_CPIXa0cnJ4EDdVKqFQ4T3qTxBqv8vXMU7-sQgerg templateId: Fu_CPIXa0cnJ4EDdVKqFQ4T3qTxBqv8vXMU7-sQgerg
pagePath: orderSubPackage/pages/orderInfo/index?orderId= pagePath: orderSubPackage/pages/orderInfo/index?orderId=
program: trial program: trial
qr-size: 455*455
# refund-no-prefix: RD # refund-no-prefix: RD
# program: formal # program: formal
#mqtt: #mqtt:
......
package com.soss.framework.config; package com.soss.framework.config;
import com.soss.framework.interceptor.GlobalExceptionHandlerFilter; import com.soss.framework.interceptor.GlobalExceptionHandlerFilter;
import com.soss.framework.security.filter.JwtAuthenticationTokenFilter;
import com.soss.framework.security.handle.AuthenticationEntryPointImpl;
import com.soss.framework.security.handle.LogoutSuccessHandlerImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
...@@ -8,6 +11,7 @@ import org.springframework.security.authentication.AuthenticationManager; ...@@ -8,6 +11,7 @@ import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
...@@ -15,10 +19,8 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; ...@@ -15,10 +19,8 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.access.channel.ChannelProcessingFilter; import org.springframework.security.web.access.channel.ChannelProcessingFilter;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.logout.LogoutFilter; import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.security.web.firewall.StrictHttpFirewall;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
import com.soss.framework.security.filter.JwtAuthenticationTokenFilter;
import com.soss.framework.security.handle.AuthenticationEntryPointImpl;
import com.soss.framework.security.handle.LogoutSuccessHandlerImpl;
/** /**
* spring security配置 * spring security配置
...@@ -142,8 +144,20 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -142,8 +144,20 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* 身份认证接口 * 身份认证接口
*/ */
@Override @Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception protected void configure(AuthenticationManagerBuilder auth) throws Exception {
{
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
} }
@Override
public void configure(WebSecurity web) throws Exception {
super.configure(web);
StrictHttpFirewall firewall = new StrictHttpFirewall();
firewall.setAllowSemicolon(true);
firewall.setAllowUrlEncodedSlash(true);
firewall.setAllowUrlEncodedPeriod(true);
firewall.setAllowUrlEncodedPercent(true);
//设置允许双 //
firewall.setAllowUrlEncodedDoubleSlash(true);
web.httpFirewall(firewall);
}
} }
package com.soss.framework.security.filter; package com.soss.framework.security.filter;
import java.io.IOException; import com.soss.common.core.domain.model.LoginUser;
import javax.servlet.FilterChain; import com.soss.common.utils.SecurityUtils;
import javax.servlet.ServletException; import com.soss.common.utils.StringUtils;
import javax.servlet.http.HttpServletRequest; import com.soss.framework.web.service.TokenService;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
import com.soss.common.core.domain.model.LoginUser;
import com.soss.common.utils.SecurityUtils; import javax.servlet.FilterChain;
import com.soss.common.utils.StringUtils; import javax.servlet.ServletException;
import com.soss.framework.web.service.TokenService; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/** /**
* token过滤器 验证token有效性 * token过滤器 验证token有效性
...@@ -29,11 +30,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter ...@@ -29,11 +30,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
@Override @Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException throws ServletException, IOException {
{
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
{
tokenService.verifyToken(loginUser); tokenService.verifyToken(loginUser);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities()); UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
......
...@@ -4,6 +4,7 @@ import com.aliyun.oss.OSS; ...@@ -4,6 +4,7 @@ import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder; import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException; import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.CannedAccessControlList; import com.aliyun.oss.model.CannedAccessControlList;
import com.soss.common.utils.sign.Md5Utils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,6 +15,7 @@ import java.io.IOException; ...@@ -14,6 +15,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.UUID;
@Service @Service
@Slf4j @Slf4j
...@@ -62,7 +64,7 @@ public class OssFileServiceImpl { ...@@ -62,7 +64,7 @@ public class OssFileServiceImpl {
//构建日期目录 //构建日期目录
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String datePath = dateFormat.format(new Date()); String datePath = dateFormat.format(new Date());
String fileUrl = dir + "/" + datePath + "/" + originName; String fileUrl = dir + "/" + datePath + "/" + getSaveName(originName);
//文件上传到云服务器 //文件上传到云服务器
ossClient.putObject(bucketName, fileUrl, inputStream); ossClient.putObject(bucketName, fileUrl, inputStream);
return "https://" + bucketName + "." + endpoint + "/" + fileUrl; return "https://" + bucketName + "." + endpoint + "/" + fileUrl;
...@@ -76,4 +78,12 @@ public class OssFileServiceImpl { ...@@ -76,4 +78,12 @@ public class OssFileServiceImpl {
} }
return null; return null;
} }
//文件存储路径
private static String getSaveName(String fileName) {
int lasIdx = fileName.lastIndexOf(".");
String fileNameSuf = fileName.substring(lasIdx);
String nameKey = Md5Utils.hash(fileName + UUID.randomUUID().toString() + System.currentTimeMillis());
return nameKey + fileNameSuf;
}
} }
...@@ -117,6 +117,8 @@ public class WeixinServiceImpl { ...@@ -117,6 +117,8 @@ public class WeixinServiceImpl {
private String queryUrl; private String queryUrl;
@Value("${weixin.refund-url}") @Value("${weixin.refund-url}")
private String refundUrl; private String refundUrl;
@Value("${weixin.qr-size}")
private String qrSize;
private String areaData; private String areaData;
public String getSessionKeyOrOpenId(String code) { public String getSessionKeyOrOpenId(String code) {
...@@ -730,7 +732,12 @@ public class WeixinServiceImpl { ...@@ -730,7 +732,12 @@ public class WeixinServiceImpl {
hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
String fileName = System.currentTimeMillis() + ".png"; String fileName = System.currentTimeMillis() + ".png";
try { try {
BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, 350, 350, hints); String[] qrSizeArr = qrSize.split("\\*");
int width = Integer.parseInt(qrSizeArr[0]);
int height = Integer.parseInt(qrSizeArr[1]);
log.info("qr with: {} height: {}", width, height);
BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints);
bitMatrix = deleteWhite(bitMatrix);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", byteArrayOutputStream); MatrixToImageWriter.writeToStream(bitMatrix, "PNG", byteArrayOutputStream);
return ossFileService.uploadFile(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), fileName); return ossFileService.uploadFile(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), fileName);
...@@ -739,4 +746,23 @@ public class WeixinServiceImpl { ...@@ -739,4 +746,23 @@ public class WeixinServiceImpl {
} }
return null; return null;
} }
/**
* 删除白边
*/
private BitMatrix deleteWhite(BitMatrix matrix) {
int[] rec = matrix.getEnclosingRectangle();
int resWidth = rec[2] + 1;
int resHeight = rec[3] + 1;
BitMatrix resMatrix = new BitMatrix(resWidth, resHeight);
resMatrix.clear();
for (int i = 0; i < resWidth; i++) {
for (int j = 0; j < resHeight; j++) {
if (matrix.get(i + rec[0], j + rec[1])) {
resMatrix.set(i, j);
}
}
}
return resMatrix;
}
} }
...@@ -54,7 +54,7 @@ public class Machine extends BaseEntity ...@@ -54,7 +54,7 @@ public class Machine extends BaseEntity
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
private String register; // private String register;
@Override @Override
public String toString() { public String toString() {
......
package com.soss.system.jiguang.impl; package com.soss.system.jiguang.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.soss.common.utils.StringUtils;
import com.soss.system.domain.Machine;
import com.soss.system.domain.Order;
import com.soss.system.domain.vo.PushBean; import com.soss.system.domain.vo.PushBean;
import com.soss.system.jiguang.JiGuangPushService; import com.soss.system.jiguang.JiGuangPushService;
import com.soss.system.jiguang.MyJiGuangPushService; import com.soss.system.jiguang.MyJiGuangPushService;
...@@ -14,7 +11,6 @@ import org.springframework.stereotype.Service; ...@@ -14,7 +11,6 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 推送服务 * 推送服务
...@@ -87,29 +83,31 @@ public class JiGuangPushServiceImpl implements JiGuangPushService { ...@@ -87,29 +83,31 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
public String[] checkRegistids(String[] registids) { public String[] checkRegistids(String[] registids) {
List<String> regList = new ArrayList<String>(registids.length); List<String> regList = new ArrayList<String>(registids.length);
for (String registid : registids) { for (String registid : registids) {
if (registid!=null && !"".equals(registid.trim())) { if (registid != null && !"".equals(registid.trim())) {
regList.add(registid); regList.add(registid);
} }
} }
return regList.toArray(new String[0]); return regList.toArray(new String[0]);
} }
public void push(String key, JSONObject jsonObject) { public void push(Integer machineId, Integer screenNo, JSONObject jsonObject) {
String s = machineMapper.selectRegister(key); // String s = machineMapper.selectRegister(key);
if(StringUtils.isNotEmpty(s)){ String[] registerIds = machineMapper.selectRegister(machineId, screenNo);
if (registerIds != null && registerIds.length > 0) {
PushBean pushBean = new PushBean(); PushBean pushBean = new PushBean();
pushBean.setMessageCount(jsonObject); pushBean.setMessageCount(jsonObject);
pushAndroid(pushBean,s); pushAndroid(pushBean, registerIds);
} }
} }
public void pushMachine(String machineId, Map<String, String> map) {
/*public void pushMachine(String machineId, Map<String, String> map) {
Machine machine = machineMapper.selectMachineById(machineId); Machine machine = machineMapper.selectMachineById(machineId);
if(StringUtils.isNotEmpty(machine.getRegister())){ if (StringUtils.isNotEmpty(machine.getRegister())) {
PushBean pushBean = new PushBean(); PushBean pushBean = new PushBean();
pushBean.setExtras(map); pushBean.setExtras(map);
pushBean.setAlert("新消息"); pushBean.setAlert("新消息");
pushAndroid(pushBean,machine.getRegister()); pushAndroid(pushBean, machine.getRegister());
} }
} }
...@@ -130,5 +128,5 @@ public class JiGuangPushServiceImpl implements JiGuangPushService { ...@@ -130,5 +128,5 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
pushBean.setMessageCount(jsonObject); pushBean.setMessageCount(jsonObject);
pushAndroid(pushBean,machine.getRegister()); pushAndroid(pushBean,machine.getRegister());
} }
} }*/
} }
...@@ -3,6 +3,7 @@ package com.soss.system.mapper; ...@@ -3,6 +3,7 @@ package com.soss.system.mapper;
import com.soss.system.domain.GoodsSku; import com.soss.system.domain.GoodsSku;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
...@@ -72,4 +73,6 @@ public interface GoodsSkuMapper ...@@ -72,4 +73,6 @@ public interface GoodsSkuMapper
void deleteGoodsSkuByGoodsId(@Param("goodsId") String id); void deleteGoodsSkuByGoodsId(@Param("goodsId") String id);
List<GoodsSku> selectSpec(String query); List<GoodsSku> selectSpec(String query);
void updateSkuPrice(@Param("goodsId") long id, @Param("discountDiff") BigDecimal discountDiff, @Param("priceDiff") BigDecimal priceDiff);
} }
package com.soss.system.mapper; package com.soss.system.mapper;
import com.soss.system.domain.Machine; import com.soss.system.domain.Machine;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -65,5 +66,10 @@ public interface MachineMapper ...@@ -65,5 +66,10 @@ public interface MachineMapper
public int deleteMachineByIds(String[] ids); public int deleteMachineByIds(String[] ids);
int unbound(String id); int unbound(String id);
String selectRegister(String id);
// String selectRegister(String id);
void saveMachineScreenRef(@Param("machineId") Integer machineId, @Param("screenNo") Integer screenNo, @Param("registerId") String registerId);
String[] selectRegister(@Param("machineId") Integer machineId, @Param("screenNo") Integer screenNo);
} }
...@@ -59,7 +59,11 @@ public interface IMachineService ...@@ -59,7 +59,11 @@ public interface IMachineService
*/ */
public int deleteMachineById(String id); public int deleteMachineById(String id);
List<Machine> getMachines(Long shopId);
String bindMachine(String code, Long shopId); String bindMachine(String code, Long shopId);
int unbound(String id); int unbound(String id);
void saveMachineScreenRef(Integer machineId, Integer screenNo, String registerId);
} }
...@@ -299,7 +299,13 @@ public class GoodsServiceImpl implements IGoodsService { ...@@ -299,7 +299,13 @@ public class GoodsServiceImpl implements IGoodsService {
goodsTagMapper.deleteGoodsTagByGoodsId(String.valueOf(goods.getId())); goodsTagMapper.deleteGoodsTagByGoodsId(String.valueOf(goods.getId()));
insertGoodsTags(goods); insertGoodsTags(goods);
if (StringUtils.isEmpty(goods.getSpec()) || Objects.equals(goodsOri.getSpec(), goods.getSpec())) {
if ((StringUtils.isEmpty(goods.getSpec()) || Objects.equals(goodsOri.getSpec(), goods.getSpec()))) {
BigDecimal discountDiff = goods.getDiscount().subtract(goodsOri.getDiscount());
BigDecimal priceDiff = goods.getPrice().subtract(goodsOri.getPrice());
if (discountDiff.compareTo(BigDecimal.ZERO) != 0 || priceDiff.compareTo(BigDecimal.ZERO) != 0) {
goodsSkuMapper.updateSkuPrice(goods.getId(), discountDiff, priceDiff);
}
return i; return i;
} }
/*if(StringUtils.isNotEmpty(goods.getSpec())){ /*if(StringUtils.isNotEmpty(goods.getSpec())){
...@@ -329,9 +335,7 @@ public class GoodsServiceImpl implements IGoodsService { ...@@ -329,9 +335,7 @@ public class GoodsServiceImpl implements IGoodsService {
*/ */
@Override @Override
public int deleteGoodsById(String id) { public int deleteGoodsById(String id) {
return 1; return 1;
} }
@Override @Override
...@@ -398,10 +402,9 @@ public class GoodsServiceImpl implements IGoodsService { ...@@ -398,10 +402,9 @@ public class GoodsServiceImpl implements IGoodsService {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("action", "GOODS_CHANGED"); jsonObject.put("action", "GOODS_CHANGED");
jsonObject.put("timestamp", System.currentTimeMillis()); jsonObject.put("timestamp", System.currentTimeMillis());
jiGuangPushService.push(machines.get(0).getCode(), jsonObject); int machineId = Integer.parseInt(machines.get(0).getId());
jiGuangPushService.push(machineId, null, jsonObject);
} }
} }
@Override @Override
......
...@@ -10,7 +10,6 @@ import com.soss.system.domain.*; ...@@ -10,7 +10,6 @@ import com.soss.system.domain.*;
import com.soss.system.domain.vo.ResultVo; import com.soss.system.domain.vo.ResultVo;
import com.soss.system.jiguang.impl.JiGuangPushServiceImpl; import com.soss.system.jiguang.impl.JiGuangPushServiceImpl;
import com.soss.system.mapper.*; import com.soss.system.mapper.*;
import com.soss.system.weixin.util.SendMessageUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -49,12 +48,6 @@ public class MachineApiServiceImpl { ...@@ -49,12 +48,6 @@ public class MachineApiServiceImpl {
@Autowired @Autowired
private JiGuangPushServiceImpl jiGuangPushService; private JiGuangPushServiceImpl jiGuangPushService;
@Autowired @Autowired
private GoodsCategoryMapper goodsCategoryMapper;
@Autowired
private WechatMessageServiceImpl wechatMessageService;
@Autowired
private SendMessageUtils sendMessageUtils;
@Autowired
private OrderOperationLogServiceImpl operationLogService; private OrderOperationLogServiceImpl operationLogService;
public String shopGoodsUpdate(JSONObject jsonObject) { public String shopGoodsUpdate(JSONObject jsonObject) {
...@@ -90,9 +83,8 @@ public class MachineApiServiceImpl { ...@@ -90,9 +83,8 @@ public class MachineApiServiceImpl {
int i = shopGoodsSkuMapper.updateSkuStatus(skuIds, robotID, shopID, status); int i = shopGoodsSkuMapper.updateSkuStatus(skuIds, robotID, shopID, status);
//推送给极光 //推送给极光
Machine machine = machineMapper.selectMachineById(robotID); Machine machine = machineMapper.selectMachineById(robotID);
String code = machine.getCode();
this.push(code,status,map); this.push(machine, status, map);
return ""+i; return ""+i;
} }
...@@ -111,24 +103,25 @@ public class MachineApiServiceImpl { ...@@ -111,24 +103,25 @@ public class MachineApiServiceImpl {
* "state": 2 * "state": 2
* } * }
* } * }
* @param code * @param machine
* @param status * @param status
* @param map * @param map
*/ */
private void push( String code, String status, Map<Long, List<Long>> map){ private void push(Machine machine, String status, Map<Long, List<Long>> map) {
for (Long aLong : map.keySet()) { for (Long aLong : map.keySet()) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("action","SKU_STATE_CHANGED"); jsonObject.put("action", "SKU_STATE_CHANGED");
jsonObject.put("timestamp",System.currentTimeMillis()); jsonObject.put("timestamp", System.currentTimeMillis());
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
jsonObject.put("data",data); jsonObject.put("data", data);
data.put("machineCode",code); data.put("machineCode", machine.getCode());
data.put("goodsId",aLong); data.put("goodsId", aLong);
data.put("skuIds",map.get(aLong)); data.put("skuIds", map.get(aLong));
data.put("state",status); data.put("state", status);
jiGuangPushService.push(code,jsonObject); int machineId = Integer.parseInt(machine.getId());
jiGuangPushService.push(machineId, null, jsonObject);
} }
} }
......
...@@ -94,17 +94,22 @@ public class MachineServiceImpl implements IMachineService { ...@@ -94,17 +94,22 @@ public class MachineServiceImpl implements IMachineService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteMachineById(String id) public int deleteMachineById(String id) {
{
return machineMapper.deleteMachineById(id); return machineMapper.deleteMachineById(id);
} }
@Override @Override
@Transactional public List<Machine> getMachines(Long shopId) {
public String bindMachine(String code, Long shopId) {
Machine machine = new Machine(); Machine machine = new Machine();
machine.setShopId(shopId); machine.setShopId(shopId);
List<Machine> machines = machineMapper.selectMachineList(machine); List<Machine> machines = machineMapper.selectMachineList(machine);
return machines;
}
@Override
@Transactional
public String bindMachine(String code, Long shopId) {
List<Machine> machines = getMachines(shopId);
if (!machines.isEmpty()) { if (!machines.isEmpty()) {
throw new ServiceException("目前只允许一个店铺绑定一台机器"); throw new ServiceException("目前只允许一个店铺绑定一台机器");
} }
...@@ -134,4 +139,9 @@ public class MachineServiceImpl implements IMachineService { ...@@ -134,4 +139,9 @@ public class MachineServiceImpl implements IMachineService {
public Machine selectMachineByCode(String machineCode) { public Machine selectMachineByCode(String machineCode) {
return machineMapper.selectMachineByCode(machineCode); return machineMapper.selectMachineByCode(machineCode);
} }
@Override
public void saveMachineScreenRef(Integer machineId, Integer screenNo, String registerId) {
machineMapper.saveMachineScreenRef(machineId, screenNo, registerId);
}
} }
...@@ -260,7 +260,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -260,7 +260,7 @@ public class OrderServiceImpl implements IOrderService {
} }
private void timeoutState(Order order) { private void timeoutState(Order order) {
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
if (BooleanUtils.isTrue(order.getSendMsgFlag2())) { if (BooleanUtils.isTrue(order.getSendMsgFlag2())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
} }
...@@ -272,7 +272,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -272,7 +272,7 @@ public class OrderServiceImpl implements IOrderService {
* @param order * @param order
*/ */
private void partialRefundState(Order order) { private void partialRefundState(Order order) {
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
machineApiService.updateOrder(order); machineApiService.updateOrder(order);
} }
...@@ -286,7 +286,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -286,7 +286,7 @@ public class OrderServiceImpl implements IOrderService {
private void completedState(Order order) { private void completedState(Order order) {
order.setFinishTime(new Date()); order.setFinishTime(new Date());
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
if (BooleanUtils.isTrue(order.getSendMsgFlag3())) { if (BooleanUtils.isTrue(order.getSendMsgFlag3())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
} }
...@@ -300,7 +300,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -300,7 +300,7 @@ public class OrderServiceImpl implements IOrderService {
* @param order * @param order
*/ */
private void refundingState(Order order) { private void refundingState(Order order) {
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
machineApiService.updateOrder(order); machineApiService.updateOrder(order);
} }
...@@ -315,7 +315,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -315,7 +315,7 @@ public class OrderServiceImpl implements IOrderService {
private void unpaidCancelState(Order order) { private void unpaidCancelState(Order order) {
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
machineApiService.updateOrder(order); machineApiService.updateOrder(order);
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
} }
...@@ -327,7 +327,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -327,7 +327,7 @@ public class OrderServiceImpl implements IOrderService {
*/ */
private void takingState(Order order) { private void takingState(Order order) {
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
} }
/** /**
...@@ -341,7 +341,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -341,7 +341,7 @@ public class OrderServiceImpl implements IOrderService {
*/ */
private void productionCompletedState(Order order) { private void productionCompletedState(Order order) {
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "制作完成,您的订单已经制作完成,现在可以去取餐啦!"); wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "制作完成,您的订单已经制作完成,现在可以去取餐啦!");
if (BooleanUtils.isTrue(order.getSendMsgFlag2())) { if (BooleanUtils.isTrue(order.getSendMsgFlag2())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
...@@ -360,7 +360,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -360,7 +360,7 @@ public class OrderServiceImpl implements IOrderService {
*/ */
private void productionState(Order order) { private void productionState(Order order) {
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "制作提醒,您的订单已经开始制作,马上就能享受美味了!"); wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "制作提醒,您的订单已经开始制作,马上就能享受美味了!");
if (BooleanUtils.isTrue(order.getSendMsgFlag2())) { if (BooleanUtils.isTrue(order.getSendMsgFlag2())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
...@@ -381,7 +381,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -381,7 +381,7 @@ public class OrderServiceImpl implements IOrderService {
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
machineApiService.updateOrder(order); machineApiService.updateOrder(order);
//极光推送 //极光推送
jiGuangPushService.pushOrderState(order); // jiGuangPushService.pushOrderState(order);
wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "下单成功,您已经下单成功了~"); wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "下单成功,您已经下单成功了~");
if (BooleanUtils.isTrue(order.getSendMsgFlag1())) { if (BooleanUtils.isTrue(order.getSendMsgFlag1())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
......
...@@ -92,13 +92,13 @@ public class ShopRecommendServiceImpl implements IShopRecommendService ...@@ -92,13 +92,13 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
List<Machine> machines = machineMapper.selectMachineList(machine); List<Machine> machines = machineMapper.selectMachineList(machine);
if(!machines.isEmpty()){ if(!machines.isEmpty()){
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("action","GOODS_CHANGED"); jsonObject.put("action", "GOODS_CHANGED");
jsonObject.put("timestamp",System.currentTimeMillis()); jsonObject.put("timestamp", System.currentTimeMillis());
jiGuangPushService.push(machines.get(0).getCode(),jsonObject); int machineId = Integer.parseInt(machines.get(0).getId());
jiGuangPushService.push(machineId, null, jsonObject);
} }
} }
/** /**
* 修改推荐和今日特惠 * 修改推荐和今日特惠
* *
......
...@@ -46,21 +46,17 @@ public class ShopServiceImpl implements IShopService ...@@ -46,21 +46,17 @@ public class ShopServiceImpl implements IShopService
private ShopGoodsSkuMapper shopGoodsSkuMapper; private ShopGoodsSkuMapper shopGoodsSkuMapper;
@Autowired @Autowired
private GoodsCategoryMapper goodsCategoryMapper; private GoodsCategoryMapper goodsCategoryMapper;
@Autowired @Autowired
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Autowired @Autowired
private GoodsMapper goodsMapper; private GoodsMapper goodsMapper;
@Autowired @Autowired
private ShopRecommendMapper shopRecommendMapper; private ShopRecommendMapper shopRecommendMapper;
@Autowired @Autowired
private JiGuangPushServiceImpl jiGuangPushService; private JiGuangPushServiceImpl jiGuangPushService;
@Autowired @Autowired
private GoodsTagMapper goodsTagMapper; private GoodsTagMapper goodsTagMapper;
/** /**
* 查询店铺 * 查询店铺
* *
...@@ -195,6 +191,7 @@ public class ShopServiceImpl implements IShopService ...@@ -195,6 +191,7 @@ public class ShopServiceImpl implements IShopService
} }
@Override @Override
@Transactional
public String addGoods(long shopId, String goodsIds) { public String addGoods(long shopId, String goodsIds) {
String[] goodsIdString = goodsIds.split(","); String[] goodsIdString = goodsIds.split(",");
for (String s : goodsIdString) { for (String s : goodsIdString) {
...@@ -204,6 +201,7 @@ public class ShopServiceImpl implements IShopService ...@@ -204,6 +201,7 @@ public class ShopServiceImpl implements IShopService
} }
return null; return null;
} }
@Transactional @Transactional
public String addGoods(long shopId, Long goodsId) { public String addGoods(long shopId, Long goodsId) {
ShopGoods shopGoods = new ShopGoods(); ShopGoods shopGoods = new ShopGoods();
...@@ -236,16 +234,18 @@ public class ShopServiceImpl implements IShopService ...@@ -236,16 +234,18 @@ public class ShopServiceImpl implements IShopService
shopGoodsSku.setUpdatedAt(new Date()); shopGoodsSku.setUpdatedAt(new Date());
shopGoodsSkuMapper.insertShopGoodsSku(shopGoodsSku); shopGoodsSkuMapper.insertShopGoodsSku(shopGoodsSku);
} }
updateApplication(machine1.getCode()); updateApplication(Integer.parseInt(machine1.getId()));
} }
return null; return null;
} }
public void updateApplication(String code){
public void updateApplication(Integer machineId) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("action","GOODS_CHANGED"); jsonObject.put("action", "GOODS_CHANGED");
jsonObject.put("timestamp",System.currentTimeMillis()); jsonObject.put("timestamp", System.currentTimeMillis());
jiGuangPushService.push(code,jsonObject); jiGuangPushService.push(machineId, null, jsonObject);
} }
@Override @Override
public List<GoodsCategory> getCategoryGoods(long shopId) { public List<GoodsCategory> getCategoryGoods(long shopId) {
List<String> categoryIdStrList = goodsCategoryMapper.selectCategoryIdByShopId(shopId); List<String> categoryIdStrList = goodsCategoryMapper.selectCategoryIdByShopId(shopId);
...@@ -359,7 +359,7 @@ public class ShopServiceImpl implements IShopService ...@@ -359,7 +359,7 @@ public class ShopServiceImpl implements IShopService
List<Machine> machines = machineMapper.selectMachineList(machine); List<Machine> machines = machineMapper.selectMachineList(machine);
if(!machines.isEmpty()){ if(!machines.isEmpty()){
Machine machine1 =machines .get(0); Machine machine1 =machines .get(0);
updateApplication(machine1.getCode()); updateApplication(Integer.parseInt(machine1.getId()));
} }
return null; return null;
} }
...@@ -393,7 +393,7 @@ public class ShopServiceImpl implements IShopService ...@@ -393,7 +393,7 @@ public class ShopServiceImpl implements IShopService
List<Machine> machines = machineMapper.selectMachineList(machine); List<Machine> machines = machineMapper.selectMachineList(machine);
if (!machines.isEmpty()) { if (!machines.isEmpty()) {
Machine machine1 = machines.get(0); Machine machine1 = machines.get(0);
updateApplication(machine1.getCode()); updateApplication(Integer.parseInt(machine1.getId()));
} }
return null; return null;
} }
......
...@@ -97,4 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -97,4 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectGoodsSkuVo"/> <include refid="selectGoodsSkuVo"/>
where is_deleted in (0, 2) and rule_list like concat('%',#{query},'%') where is_deleted in (0, 2) and rule_list like concat('%',#{query},'%')
</select> </select>
<update id="updateSkuPrice">
UPDATE goods_sku set price= price + #{priceDiff}, discount = discount + #{discountDiff} where goods_id = #{goodsId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="bindTime" column="bind_time" /> <result property="bindTime" column="bind_time" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" /> <result property="updatedAt" column="updated_at" />
<result property="register" column="register"></result> <!--<result property="register" column="register"></result>-->
</resultMap> </resultMap>
<sql id="selectMachineVo"> <sql id="selectMachineVo">
...@@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="state != null and state != ''">state = #{state},</if> <if test="state != null and state != ''">state = #{state},</if>
<if test="bindTime != null">bind_time = #{bindTime},</if> <if test="bindTime != null">bind_time = #{bindTime},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="register != null">register = #{register},</if> <!--<if test="register != null">register = #{register},</if>-->
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
...@@ -99,7 +99,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -99,7 +99,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update machine set shopId =null where code =#{id} update machine set shopId =null where code =#{id}
</update> </update>
<select id="selectRegister" resultType="string"> <!--<select id="selectRegister" resultType="string">
select register from machine where code =#{id} select register from machine where code =#{id}
</select>-->
<insert id="saveMachineScreenRef">
insert into machine_screen_ref values (#{machineId}, #{screenNo}, #{registerId})
on duplicate key update register_id = #{registerId}
</insert>
<select id="selectRegister" resultType="java.lang.String">
select register_id from machine_screen_ref where machine_id = #{machineId}
<if test="screenNo != null">
and screen_no = #{screenNo}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment